synchronize and fix integration tests with the latest code base trunk@1460149
authorJérôme Benois <jbenois@apache.org>
Thu, 31 Mar 2011 07:28:01 +0000 (07:28 +0000)
committerJérôme Benois <jbenois@apache.org>
Thu, 31 Mar 2011 07:28:01 +0000 (07:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/easyant/easyant4e/trunk@1087205 13f79535-47bb-0310-9956-ffa450edef68

17 files changed:
org.apache.easyant4e.tests/META-INF/MANIFEST.MF
org.apache.easyant4e.tests/datas/simplejavaproject/.classpath
org.apache.easyant4e.tests/datas/simplejavaproject/.project
org.apache.easyant4e.tests/datas/simplejavaproject/module.ivy
org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/AbstractEasyAntTest.java
org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantCoreServiceTest.java
org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantProjectServiceTest.java
org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EclipseProjectBuilder.java
org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ExtensionRegistryTest.java [deleted file]
org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ImportProjectTest.java
org.apache.easyant4e/.project
org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java
org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java
org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java
org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectService.java
org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectServiceImpl.java
org.apache.easyant4e/src/org/apache/easyant4e/wizards/EasyAntImportWizardPage.java

index 96add3d..387c2e3 100644 (file)
@@ -17,4 +17,5 @@ Require-Bundle: org.apache.easyant4e,
  org.eclipse.pde.core
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: org.apache.easyant.core.report
+Import-Package: org.apache.easyant.core.descriptor,
+ org.apache.easyant.core.report
index 6e5da4e..43026d0 100644 (file)
@@ -1,26 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
 <classpath>
        <classpathentry excluding="/simplejavaproject/target" kind="src" output="target" path="src/main/java"/>
        <classpathentry excluding="/simplejavaproject/target" kind="src" output="target" path="src/main/resources"/>
        <classpathentry excluding="/simplejavaproject/target" kind="src" output="target" path="src/test/java"/>
        <classpathentry excluding="/simplejavaproject/target" kind="src" output="target" path="src/test/resources"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-       <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/module.ivy/*"/>
+       <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=module.ivy&amp;confs=*"/>
        <classpathentry kind="output" path="target"/>
 </classpath>
index b152e18..dcee550 100644 (file)
@@ -1,20 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
 <projectDescription>
        <name>simplejavaproject</name>
        <comment>simplejavaproject description</comment>
@@ -35,5 +19,6 @@
        <natures>
                <nature>org.apache.easyant4e.EasyAntNature</nature>
                <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.apache.ivyde.eclipse.ivynature</nature>
        </natures>
 </projectDescription>
index c94b557..3672a8a 100644 (file)
@@ -16,7 +16,7 @@
 -->
 <ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
     <info organisation="org.apache.easyant" module="simplejavaproject" status="integration" >
-        <ea:build type="org.apache.easyant.buildtypes#build-std-java;0.2">
+        <ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2">
             <ea:property name="run.main.classname" value="org.apache.easyant.example.Example"/>
             <ea:plugin module="org.apache.easyant.plugins#run-java;0.1" as="run"/>
         </ea:build>
index a1c7aef..e02040d 100644 (file)
@@ -28,14 +28,6 @@ import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.ui.IPackagesViewPart;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
 import org.junit.After;
 import org.junit.Before;
 
@@ -72,11 +64,14 @@ public abstract class AbstractEasyAntTest {
         assertNotNull(testProject);
         IFile testJavaModuleDesc = EclipseProjectBuilder.createModuleDescriptorFile(testJavaProject.getProject(), "org.apache.easyant");
         assertNotNull(testJavaModuleDesc);
-        assertTrue(testJavaModuleDesc.exists());       
+        assertTrue(testJavaModuleDesc.exists());   
+        
+               //TODO register error log handler Activator.getEasyAntPlugin().log
     }
     
     @After
     public void tearDown() throws CoreException {
+               //TODO check assert empty error log Activator.getEasyAntPlugin().log
         if(this.testProject!=null){
             EclipseProjectBuilder.deleteProject(testProject);
             this.testProject = null;
index 53a368b..45d1d61 100644 (file)
@@ -31,19 +31,11 @@ import org.junit.Test;
 
 public class EasyantCoreServiceTest extends AbstractEasyAntTest {
 
-/*
-    @Test
-    public void testGetIvyInstance() {
-        Ivy ivy = coreService.getIvyInstance(testProject);
-        assertNotNull(ivy);
-    }
-*/
-
     @Test
     public void testGetPluginsRepositoryPath() {
         String pluginsRepositoryPath = coreService.getPluginsRepositoryPath();
         assertNotNull(pluginsRepositoryPath);
-        String pluginPath = System.getProperty("user.home") + "/.easyant/repository";
+        String pluginPath = System.getProperty("user.home") + "/.easyant/easyant-repository";
         assertEquals(pluginPath, pluginsRepositoryPath);
     }
 
index 3fa1b64..b0a6597 100644 (file)
@@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
 
 import java.util.List;
 
+import org.apache.easyant.core.descriptor.PropertyDescriptor;
 import org.apache.easyant.core.report.PhaseReport;
 import org.apache.easyant.core.report.TargetReport;
 import org.apache.easyant4e.EasyAntConstants;
@@ -33,84 +34,67 @@ import org.junit.Test;
 
 public class EasyantProjectServiceTest extends AbstractEasyAntTest {
 
-/*
-    @Test
-    public void testGetIvyInstance() {
-        Ivy ivy = projectService.getIvyInstance(testProject);
-        assertNotNull(ivy);
-    }
-*/
-    
-    // @Test
-    // public void testAddNature(){
-    // assertFalse(projectService.hasEasyAntNature(testProject));
-    // projectService.addNature(testProject);
-    // assertTrue(projectService.hasEasyAntNature(testProject));
-    // assertFalse(projectService.hasEasyAntBuilder(testProject));
-    // }
-    //  
-    // @Test
-    // public void testRemoveNature(){
-    // assertFalse(projectService.hasEasyAntNature(testProject));
-    // projectService.addNature(testProject);
-    // assertTrue(projectService.hasEasyAntNature(testProject));
-    // assertFalse(projectService.hasEasyAntBuilder(testProject));
-    // projectService.removeNature(testProject);
-    // assertFalse(projectService.hasEasyAntNature(testProject));
-    // assertFalse(projectService.hasEasyAntBuilder(testProject));
-    // }
+       @Test
+       public void testGetProjectProperty() {
+               IProject javaProject = testJavaProject.getProject();
+               assertNotNull(javaProject);
+               PropertyDescriptor srcMainJavaProp = projectService.getProperty(
+                               javaProject, "src.main.java");
+               assertNotNull(srcMainJavaProp);
+       }
 
-    @Test
-    public void testAddNatureOnJavaProject() {
-        IProject javaProject = testJavaProject.getProject();
-        assertFalse(projectService.hasEasyAntNature(javaProject));
-        assertFalse(projectService.hasEasyAntBuilder(javaProject));
-        projectService.addNature(javaProject);
-        assertTrue(projectService.hasEasyAntNature(javaProject));
-        assertTrue(projectService.hasEasyAntBuilder(javaProject));
-        // TODO check classpath and source folder
-    }
+       @Test
+       public void testAddNatureOnJavaProject() {
+               IProject javaProject = testJavaProject.getProject();
+               assertFalse(projectService.hasEasyAntNature(javaProject));
+               assertFalse(projectService.hasEasyAntBuilder(javaProject));
+               projectService.addNature(javaProject);
+               assertTrue(projectService.hasEasyAntNature(javaProject));
+               assertTrue(projectService.hasEasyAntBuilder(javaProject));
+               // TODO check classpath and source folder       
+       }
 
-    @Test
-    public void testRemoveNatureOnJavaProject() {
-        IProject javaProject = testJavaProject.getProject();
-        assertFalse(projectService.hasEasyAntNature(javaProject));
-        projectService.addNature(javaProject);
-        assertTrue(projectService.hasEasyAntNature(javaProject));
-        assertTrue(projectService.hasEasyAntBuilder(javaProject));
-        projectService.removeNature(javaProject);
-        assertFalse(projectService.hasEasyAntNature(javaProject));
-        assertFalse(projectService.hasEasyAntBuilder(javaProject));
-        // TODO check classpath and source folder
-    }
+       @Test
+       public void testRemoveNatureOnJavaProject() {
+               IProject javaProject = testJavaProject.getProject();
+               assertFalse(projectService.hasEasyAntNature(javaProject));
+               projectService.addNature(javaProject);
+               assertTrue(projectService.hasEasyAntNature(javaProject));
+               assertTrue(projectService.hasEasyAntBuilder(javaProject));
+               projectService.removeNature(javaProject);
+               assertFalse(projectService.hasEasyAntNature(javaProject));
+               assertFalse(projectService.hasEasyAntBuilder(javaProject));
+               // TODO check classpath and source folder
+       }
 
-    @Test
-    public void testGetPhases() {
-        IProject javaProject = testJavaProject.getProject();
-        IFile ivyFile = javaProject.getFile("module.ivy");
-        assertNotNull(ivyFile);
-        List<PhaseReport> phases = projectService.getPhases(ivyFile);
-        assertNotNull(phases);      
-        assertTrue("nb phases:" + phases.size(), phases.size() > 0);
-    }
+       @Test
+       public void testGetPhases() {
+               IProject javaProject = testJavaProject.getProject();
+               IFile ivyFile = javaProject.getFile("module.ivy");
+               assertNotNull(ivyFile);
+               List<PhaseReport> phases = projectService.getPhases(ivyFile);
+               assertNotNull(phases);
+               assertTrue("nb phases:" + phases.size(), phases.size() > 0);
+       }
 
-    @Test
-    public void testGetTargets() {
-        IProject javaProject = testJavaProject.getProject();
-        IFile ivyFile = javaProject.getFile("module.ivy");
-        assertNotNull(ivyFile);
-        List<TargetReport> targets = projectService.getTargets(ivyFile);
-        assertNotNull(targets);     
-        assertTrue("nb targets:" + targets.size(), targets.size() > 0);
-    }
+       @Test
+       public void testGetTargets() {
+               IProject javaProject = testJavaProject.getProject();
+               IFile ivyFile = javaProject.getFile("module.ivy");
+               assertNotNull(ivyFile);
+               List<TargetReport> targets = projectService.getTargets(ivyFile);
+               assertNotNull(targets);
+               assertTrue("nb targets:" + targets.size(), targets.size() > 0);
+       }
 
-    @Test
-    public void testRunBuild() {
-        try {
-            projectService.runBuild(testJavaProject.getProject(), "compile", EasyAntConstants.ANT_LOGLEVEL_DEBUG, null);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-    }
+       @Test
+       public void testRunBuild() {
+               try {
+                       projectService.runBuild(testJavaProject.getProject(), "compile",
+                                       EasyAntConstants.ANT_LOGLEVEL_DEBUG, null);
+               } catch (Exception e) {
+                       fail(e.getMessage());
+               }
+       }
 
 }
index 245fbb1..2819eeb 100644 (file)
@@ -113,7 +113,7 @@ public class EclipseProjectBuilder {
                 + "<ivy-module version=\"2.0\" xmlns:ea=\"http://www.easyant.org\">"
                 + "  <info organisation=\"" + org + "\" module=\"" + project.getName() + "\" status=\"integration\" >"
                 + "    <description>project description</description>" 
-                + "    <ea:build type=\"org.apache.easyant.buildtypes#build-std-java;0.2\" />"
+                + "    <ea:build organisation=\"org.apache.easyant.buildtypes\" module=\"build-std-java\" revision=\"0.2\"/>"
                 + "  </info>" 
                 + "</ivy-module>";
         InputStream in = new ByteArrayInputStream(content.getBytes());
@@ -159,9 +159,9 @@ public class EclipseProjectBuilder {
     // throws JavaModelException {
     // StringBuffer buf = new StringBuffer();
     // buf.append("package " + pack.getElementName() + ";
-");
+//");
     // buf.append("
-");
+//");
     // buf.append(source);
     // ICompilationUnit cu = pack.createCompilationUnit(cuName,
     // buf.toString(), false, null);
diff --git a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ExtensionRegistryTest.java b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ExtensionRegistryTest.java
deleted file mode 100644 (file)
index d3e2c69..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-package org.apache.easyant4e.tests;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.core.internal.registry.ExtensionRegistry;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IContributor;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.RegistryFactory;
-import org.eclipse.core.runtime.spi.IDynamicExtensionRegistry;
-import org.junit.Test;
-
-public class ExtensionRegistryTest {
-
-    @Test
-    public void testRemoveExtension() {
-        IExtensionRegistry reg = RegistryFactory.getRegistry();     
-        
-        //assertNull(reg.getExtension("org.apache.ivyde.eclipse.ui.actions.ResolveAction"));
-        //assertNull(reg.getExtension("org.eclipse.ui.popupMenus","org.apache.ivyde.eclipse.ui.actions.ResolveAction"));
-        //assertNull(reg.getExtension("org.eclipse.ui","popupMenus","org.apache.ivyde.eclipse.ui.actions.ResolveAction"));
-
-        IDynamicExtensionRegistry reg2 = (IDynamicExtensionRegistry)reg;
-        for(IContributor contributor : reg2.getAllContributors()){          
-            if("org.apache.ivyde.eclipse".equals(contributor.getName())){
-                System.out.println("--> contributor "+contributor);
-                reg2.removeContributor(contributor, ((ExtensionRegistry) reg2).getTemporaryUserToken());
-                System.out.println("--> remove all extensions ");
-            }
-        }       
-        
-//      IExtension[] extensions = reg.getExtensions("org.apache.ivyde.eclipse");
-//      assertNotNull(extensions);
-//      for(IExtension extension:extensions){
-//          if("org.eclipse.ui.popupMenus".equals(extension.getExtensionPointUniqueIdentifier())){
-//              reg.removeExtension(extension, ((ExtensionRegistry) reg).getTemporaryUserToken());
-//          }
-//          System.out.println(extension.getNamespaceIdentifier() +" - "+extension.getExtensionPointUniqueIdentifier());            
-//          final IConfigurationElement[] configElements = extension.getConfigurationElements();
-//          for (IConfigurationElement element:configElements) {
-//              System.out.println("\t--> "+element.getName()+" : "+element.getAttribute("id"));                    
-//          }               
-//      }
-        
-    
-    }
-
-//  private void removeExtension(String extensionPointId, String extensionId) {
-//      IExtensionRegistry reg = RegistryFactory.getRegistry();
-//      IExtension extension = reg.getExtension(extensionPointId, extensionId);
-//      if (extension != null) {
-//          reg.removeExtension(extension, getUserToken());
-//      }
-//  }
-//
-//  private Object getUserToken() {
-//      IExtensionRegistry registry = RegistryFactory.getRegistry();
-//      // return null; // require -Declipse.registry.nulltoken=true
-//      return ((ExtensionRegistry) registry).getTemporaryUserToken();
-//  }
-}
index 9f5b398..abd4a05 100644 (file)
@@ -18,7 +18,6 @@
 package org.apache.easyant4e.tests;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -27,6 +26,7 @@ import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 
 import org.apache.easyant4e.Activator;
@@ -34,11 +34,8 @@ import org.apache.easyant4e.EasyAntPlugin;
 import org.apache.easyant4e.services.EasyantProjectService;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.IClasspathEntry;
@@ -46,9 +43,6 @@ import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.pde.core.plugin.IPluginModelBase;
 import org.eclipse.pde.core.plugin.PluginRegistry;
-import org.eclipse.pde.internal.core.util.CoreUtility;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -87,10 +81,7 @@ public class ImportProjectTest{
         String[] newNatures= {};
         description.setNatureIds(newNatures);   
     
-        Thread.sleep(2000);
-        Shell messageShell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
-        assertNotNull(messageShell);
-        simpleJavaProject = projectService.importProject(description, messageShell, new NullProgressMonitor());
+        simpleJavaProject = projectService.importProject(description, new NullProgressMonitor());
         assertNotNull(simpleJavaProject);
         assertTrue(simpleJavaProject.exists());
         assertTrue(simpleJavaProject.isOpen());
@@ -101,41 +92,31 @@ public class ImportProjectTest{
             fail(e.getMessage());
         }
         assertTrue(projectService.hasEasyAntNature(simpleJavaProject));
-        
-        //Assert source folders
-        assertTrue(simpleJavaProject.hasNature(JavaCore.NATURE_ID));    
-        IJavaProject javaProject = (IJavaProject)simpleJavaProject.getNature(JavaCore.NATURE_ID);
+        assertSourceFolders(simpleJavaProject);
+        //TODO assert classpath
+        //org.eclipse.jdt.launching.JRE_CONTAINER
+        //org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/module.ivy/*
+    }
+    
+    private void assertSourceFolders(IProject project) throws Exception{
+       assertTrue(project.hasNature(JavaCore.NATURE_ID));    
+        IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
         assertNotNull(javaProject);
         List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
         entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
         assertTrue(entries.size()>0);
-        boolean srcMainJavaSourceFolderFound=false;
-        boolean srcTestJavaSourceFolderFound=false;
-        boolean srcMainResourcesSourceFolderFound=false;
-        boolean srcTestResourcesSourceFolderFound=false;
+        HashSet<String> sourceFolders = new HashSet<String>();
         for(IClasspathEntry entry:entries){
             if(IClasspathEntry.CPE_SOURCE==entry.getEntryKind()){
                 String path = entry.getPath().toOSString();
                 assertNotNull(path);
-                if("/simplejavaproject/src/main/java".equals(path)){
-                    srcMainJavaSourceFolderFound=true;
-                }else if("/simplejavaproject/src/test/java".equals(path)){
-                    srcTestJavaSourceFolderFound=true;
-                }else if("/simplejavaproject/src/main/resources".equals(path)){
-                    srcMainResourcesSourceFolderFound=true;
-                }else if("/simplejavaproject/src/test/resources".equals(path)){
-                    srcTestResourcesSourceFolderFound=true;
-                }
+                sourceFolders.add(path);
             }
         }
-        assertTrue(srcMainJavaSourceFolderFound);
-        assertTrue(srcTestJavaSourceFolderFound);
-        assertTrue(srcMainResourcesSourceFolderFound);
-        assertTrue(srcTestResourcesSourceFolderFound);
-        
-        //TODO assert classpath
-        //org.eclipse.jdt.launching.JRE_CONTAINER
-        //org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/module.ivy/*
+        assertTrue(sourceFolders.contains("/simplejavaproject/src/main/java"));
+        assertTrue(sourceFolders.contains("/simplejavaproject/src/test/java"));
+        assertTrue(sourceFolders.contains("/simplejavaproject/src/main/resources"));
+        assertTrue(sourceFolders.contains("/simplejavaproject/src/test/resources"));
     }
     
     private IPath getSimpleJavaProjectLocation(String projectPath){
index 9aa2163..89f78f7 100644 (file)
@@ -1,20 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
 <projectDescription>
        <name>org.apache.easyant4e</name>
        <comment></comment>
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
+                       <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
+                       <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
        </buildSpec>
        <natures>
+               <nature>org.sonar.ide.eclipse.core.sonarNature</nature>
                <nature>org.eclipse.pde.PluginNature</nature>
                <nature>org.eclipse.jdt.core.javanature</nature>
-               <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
                <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
+               <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
        </natures>
 </projectDescription>
index 500e8c2..e7f5277 100644 (file)
@@ -40,7 +40,7 @@ public class EasyAntPlugin {
 
     public EasyAntPlugin(Module... modules) {
         injector = Guice.createInjector(modules);
-        injectMembers(this);
+        injector.injectMembers(this);
     }
 
     public void injectMembers(Object instance) {
index 56bb7e0..a314e1f 100644 (file)
@@ -295,9 +295,8 @@ public class EasyAntNature implements IProjectNature {
             ICommand[] newCommands = new ICommand[commands.length - 1];
             int i = 0;
             for (ICommand command : commands) {
-                if (command.getBuilderName().equals(builderID)) {
+                if (!command.getBuilderName().equals(builderID)) {
                     // Remove the given builder
-                } else {
                     newCommands[i] = command;
                     i++;
                 }
index 5193b16..332b5ea 100644 (file)
@@ -47,7 +47,7 @@ public class RemoveEasyAntNatureOperation implements IRunnableWithProgress {
                     monitor.subTask("Remove the EasyAnt nature to the project " + project.getName());
                     IProjectDescription description = project.getDescription();
                     String[] oldNatures = description.getNatureIds();
-                    ArrayList newNatures = new ArrayList();
+                    ArrayList<String> newNatures = new ArrayList<String>();
                     for (int i = 0; i < oldNatures.length; i++) {
                         if (!oldNatures[i].equals(EasyAntNature.NATURE_ID)) {
                             newNatures.add(oldNatures[i]);
index d707cca..b1f0f4c 100644 (file)
@@ -34,10 +34,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.swt.widgets.Shell;
 
 public interface EasyantProjectService {
-
-    //Ivy getIvyInstance(IProject project);
     
-    IProject importProject(IProjectDescription projectDescription, Shell messageShell, IProgressMonitor monitor);
+    IProject importProject(IProjectDescription projectDescription/*, Shell messageShell*/, IProgressMonitor monitor);
     
     boolean hasEasyAntNature(IProject project);
     
index 015d890..b4cb635 100644 (file)
@@ -96,10 +96,8 @@ public class EasyantProjectServiceImpl implements EasyantProjectService{
 */
     public void runBuild(IProject project, String buildTaskName, int logLevel, IProgressMonitor monitor) {
         console.show();
-        console.info("
-");
-        console.info(project.getName() + "$ easyant " + buildTaskName+"
-");
+        console.info("");
+        console.info(project.getName() + "$ easyant " + buildTaskName+".");
         
         IFile ivyFile = project.getFile("module.ivy");
         String ivyFilePath = ivyFile.getLocation().toOSString();
@@ -210,14 +208,14 @@ public class EasyantProjectServiceImpl implements EasyantProjectService{
     
 
     public void addNature(IProject project) {
-        addNature(project, null, null); 
+        addNature(project, null); 
     }
     
-    private void addNature(IProject project, Shell shell, IProgressMonitor monitor) {
+    private void addNature(IProject project, IProgressMonitor monitor) {
 
         AddEasyAntNatureOperation addNature = new AddEasyAntNatureOperation(project);
         try {
-            if(shell==null && monitor==null){
+            if(monitor==null){
                 PlatformUI.getWorkbench().getProgressService().run(false, false, addNature);
             }else{
                 addNature.run(monitor);
@@ -246,7 +244,7 @@ public class EasyantProjectServiceImpl implements EasyantProjectService{
         
     }
 
-    public IProject importProject(IProjectDescription projectDescription,  Shell messageShell, IProgressMonitor monitor) {
+    public IProject importProject(IProjectDescription projectDescription/*,  Shell messageShell*/, IProgressMonitor monitor) {
         //String projectName = importProjectDescriptor.getProjectName();
         //IProjectDescription projectDescription = importProjectDescriptor.getDescription();
         String projectName = projectDescription.getName();
@@ -274,7 +272,7 @@ public class EasyantProjectServiceImpl implements EasyantProjectService{
             ImportOperation importOperation = new ImportOperation(rootWorkspace.getFullPath(),importSource,FileSystemStructureProvider.INSTANCE, new IOverwriteQuery(){
                     public String queryOverwrite(String pathString) { return ALL; }
             });
-            importOperation.setContext(messageShell);
+            //importOperation.setContext(messageShell);//FIXME is it required?
             try {
                 //PlatformUI.getWorkbench().getProgressService().run(false, false, importOperation);
                 importOperation.run(monitor);
@@ -291,7 +289,7 @@ public class EasyantProjectServiceImpl implements EasyantProjectService{
             project.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 70));
             // configure project, apply EasyAnt nature
 //          if (importProjectDescriptor.isFromIvyDescription()) {
-                addNature(project, messageShell, monitor);
+                addNature(project/*, messageShell*/, monitor);
 //          }
         } catch (CoreException e) {
             Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot configure imported project.", e);
index e7da584..cb3f2d4 100644 (file)
@@ -576,7 +576,7 @@ public class EasyAntImportWizardPage extends WizardPage {
      */
     private IProject createExistingProject(final ProjectRecord record, IProgressMonitor monitor)
             throws InvocationTargetException, InterruptedException {        
-        return easyantProjectService.importProject(record.getDescription(), getShell(), monitor);
+        return easyantProjectService.importProject(record.getDescription()/*, getShell()*/, monitor);
     }
 
     /**