synchronize and fix integration tests with the latest code base
git-svn-id: https://svn.apache.org/repos/asf/incubator/easyant/easyant4e/trunk@1087205 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.easyant4e.tests/META-INF/MANIFEST.MF b/org.apache.easyant4e.tests/META-INF/MANIFEST.MF
index 96add3d..387c2e3 100644
--- a/org.apache.easyant4e.tests/META-INF/MANIFEST.MF
+++ b/org.apache.easyant4e.tests/META-INF/MANIFEST.MF
@@ -17,4 +17,5 @@
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
diff --git a/org.apache.easyant4e.tests/datas/simplejavaproject/.classpath b/org.apache.easyant4e.tests/datas/simplejavaproject/.classpath
index 6e5da4e..43026d0 100644
--- a/org.apache.easyant4e.tests/datas/simplejavaproject/.classpath
+++ b/org.apache.easyant4e.tests/datas/simplejavaproject/.classpath
@@ -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&confs=*"/>
<classpathentry kind="output" path="target"/>
</classpath>
diff --git a/org.apache.easyant4e.tests/datas/simplejavaproject/.project b/org.apache.easyant4e.tests/datas/simplejavaproject/.project
index b152e18..dcee550 100644
--- a/org.apache.easyant4e.tests/datas/simplejavaproject/.project
+++ b/org.apache.easyant4e.tests/datas/simplejavaproject/.project
@@ -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>
diff --git a/org.apache.easyant4e.tests/datas/simplejavaproject/module.ivy b/org.apache.easyant4e.tests/datas/simplejavaproject/module.ivy
index c94b557..3672a8a 100644
--- a/org.apache.easyant4e.tests/datas/simplejavaproject/module.ivy
+++ b/org.apache.easyant4e.tests/datas/simplejavaproject/module.ivy
@@ -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>
diff --git a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/AbstractEasyAntTest.java b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/AbstractEasyAntTest.java
index a1c7aef..e02040d 100644
--- a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/AbstractEasyAntTest.java
+++ b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/AbstractEasyAntTest.java
@@ -28,14 +28,6 @@
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 @@
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;
diff --git a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantCoreServiceTest.java b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantCoreServiceTest.java
index 53a368b..45d1d61 100644
--- a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantCoreServiceTest.java
+++ b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantCoreServiceTest.java
@@ -31,19 +31,11 @@
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);
}
diff --git a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantProjectServiceTest.java b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantProjectServiceTest.java
index 3fa1b64..b0a6597 100644
--- a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantProjectServiceTest.java
+++ b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EasyantProjectServiceTest.java
@@ -24,6 +24,7 @@
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 @@
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());
+ }
+ }
}
diff --git a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EclipseProjectBuilder.java b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EclipseProjectBuilder.java
index 245fbb1..2819eeb 100644
--- a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EclipseProjectBuilder.java
+++ b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/EclipseProjectBuilder.java
@@ -113,7 +113,7 @@
+ "<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 @@
// 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
index d3e2c69..0000000
--- a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ExtensionRegistryTest.java
+++ /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();
-// }
-}
diff --git a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ImportProjectTest.java b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ImportProjectTest.java
index 9f5b398..abd4a05 100644
--- a/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ImportProjectTest.java
+++ b/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/ImportProjectTest.java
@@ -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.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.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.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 @@
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 @@
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){
diff --git a/org.apache.easyant4e/.project b/org.apache.easyant4e/.project
index 9aa2163..89f78f7 100644
--- a/org.apache.easyant4e/.project
+++ b/org.apache.easyant4e/.project
@@ -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>
@@ -37,20 +21,21 @@
</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>
diff --git a/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java b/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java
index 500e8c2..e7f5277 100644
--- a/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java
+++ b/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java
@@ -40,7 +40,7 @@
public EasyAntPlugin(Module... modules) {
injector = Guice.createInjector(modules);
- injectMembers(this);
+ injector.injectMembers(this);
}
public void injectMembers(Object instance) {
diff --git a/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java b/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java
index 56bb7e0..a314e1f 100644
--- a/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java
+++ b/org.apache.easyant4e/src/org/apache/easyant4e/natures/EasyAntNature.java
@@ -295,9 +295,8 @@
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++;
}
diff --git a/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java b/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java
index 5193b16..332b5ea 100644
--- a/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java
+++ b/org.apache.easyant4e/src/org/apache/easyant4e/natures/RemoveEasyAntNatureOperation.java
@@ -47,7 +47,7 @@
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]);
diff --git a/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectService.java b/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectService.java
index d707cca..b1f0f4c 100644
--- a/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectService.java
+++ b/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectService.java
@@ -34,10 +34,8 @@
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);
diff --git a/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectServiceImpl.java b/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectServiceImpl.java
index 015d890..b4cb635 100644
--- a/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectServiceImpl.java
+++ b/org.apache.easyant4e/src/org/apache/easyant4e/services/EasyantProjectServiceImpl.java
@@ -96,10 +96,8 @@
*/
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 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 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 @@
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 @@
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);
diff --git a/org.apache.easyant4e/src/org/apache/easyant4e/wizards/EasyAntImportWizardPage.java b/org.apache.easyant4e/src/org/apache/easyant4e/wizards/EasyAntImportWizardPage.java
index e7da584..cb3f2d4 100644
--- a/org.apache.easyant4e/src/org/apache/easyant4e/wizards/EasyAntImportWizardPage.java
+++ b/org.apache.easyant4e/src/org/apache/easyant4e/wizards/EasyAntImportWizardPage.java
@@ -576,7 +576,7 @@
*/
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);
}
/**