You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/10/15 20:44:18 UTC

svn commit: r1398503 - in /incubator/easyant/core/trunk/src/test: java/org/apache/easyant/core/ java/org/apache/easyant/core/services/ resources/ resources/org/apache/easyant/core/multimodule/

Author: jlboudart
Date: Mon Oct 15 20:44:17 2012
New Revision: 1398503

URL: http://svn.apache.org/viewvc?rev=1398503&view=rev
Log:
Refactor easyant's tests

Modified:
    incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntBaseTest.java
    incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/ModuleInheritanceTest.java
    incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/PropertiesAsAttributesTest.java
    incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/StandardJavaProjectTest.java
    incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java
    incubator/easyant/core/trunk/src/test/resources/ivysettings-test.xml
    incubator/easyant/core/trunk/src/test/resources/org/apache/easyant/core/multimodule/parent.ivy

Modified: incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntBaseTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntBaseTest.java?rev=1398503&r1=1398502&r2=1398503&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntBaseTest.java (original)
+++ incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/EasyAntBaseTest.java Mon Oct 15 20:44:17 2012
@@ -17,13 +17,17 @@
  */
 package org.apache.easyant.core;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.io.PrintStream;
 import java.net.URISyntaxException;
 import java.net.URL;
 
-import junit.framework.TestCase;
-
 import org.apache.easyant.core.factory.EasyantConfigurationFactory;
 import org.apache.tools.ant.BuildEvent;
 import org.apache.tools.ant.BuildException;
@@ -31,17 +35,17 @@ import org.apache.tools.ant.BuildListene
 import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.LogLevel;
+import org.junit.After;
 
 /**
- * A EasyAntBaseTest is a TestCase which executes targets from an easyant module
- * for testing.
+ * A EasyAntBaseTest is a TestCase which executes targets from an easyant module for testing.
  * 
- * This class provides a number of utility methods for particular build file
- * tests which extend this class.
+ * This class provides a number of utility methods for particular build file tests which extend this class.
  * 
  */
-public abstract class EasyAntBaseTest extends TestCase {
+public abstract class EasyAntBaseTest {
 
+    protected static final String EASYANT_CACHE_DIR = "easyant.default.cache.dir";
     protected Project project;
     protected EasyAntConfiguration conf;
 
@@ -52,37 +56,18 @@ public abstract class EasyAntBaseTest ex
     private BuildException buildException;
 
     /**
-     * Default constructor for the BuildFileTest object.
-     */
-    public EasyAntBaseTest() {
-        super();
-    }
-
-    /**
-     * Constructor for the BuildFileTest object.
-     * 
-     * @param name
-     *            string to pass up to TestCase constructor
-     */
-    public EasyAntBaseTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Automatically calls the target called "tearDown" from the build file
-     * tested if it exits.
+     * Automatically calls the target called "tearDown" from the build file tested if it exits.
      * 
-     * This allows to use Ant tasks directly in the build file to clean up after
-     * each test. Note that no "setUp" target is automatically called, since
-     * it's trivial to have a test target depend on it.
+     * This allows to use Ant tasks directly in the build file to clean up after each test. Note that no "setUp" target
+     * is automatically called, since it's trivial to have a test target depend on it.
      */
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         if (project == null) {
             /*
-             * Maybe the BuildFileTest was subclassed and there is no
-             * initialized project. So we could avoid getting a NPE. If there is
-             * an initialized project getTargets() does not return null as it is
-             * initialized by an empty HashSet.
+             * Maybe the EasyAntBaseTest was subclassed and there is no initialized project. So we could avoid getting a
+             * NPE. If there is an initialized project getTargets() does not return null as it is initialized by an
+             * empty HashSet.
              */
             return;
         }
@@ -92,6 +77,22 @@ public abstract class EasyAntBaseTest ex
         }
     }
 
+    public void cleanTargetDirectory() {
+        if (project == null) {
+            throw new IllegalStateException("Project is not configured !");
+        }
+        File targetDirectory = project.resolveFile(project.replaceProperties("${basedir}/target"));
+        targetDirectory.delete();
+    }
+
+    public void cleanCache() {
+        if (project == null) {
+            throw new IllegalStateException("Project is not configured !");
+        }
+        File cacheDirectory = project.resolveFile(project.replaceProperties(project.getProperty(EASYANT_CACHE_DIR)));
+        cacheDirectory.delete();
+    }
+
     /**
      * run a target, expect for any build exception
      * 
@@ -105,8 +106,7 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * Assert that only the given message has been logged with a priority <=
-     * INFO when running the given target.
+     * Assert that only the given message has been logged with a priority <= INFO when running the given target.
      */
     public void expectLog(String target, String log) {
         executeTarget(target);
@@ -119,8 +119,8 @@ public abstract class EasyAntBaseTest ex
      */
     public void assertLogContaining(String substring) {
         String realLog = getLog();
-        assertTrue("expecting log to contain \"" + substring + "\" log was \""
-                + realLog + "\"", realLog.indexOf(substring) >= 0);
+        assertTrue("expecting log to contain \"" + substring + "\" log was \"" + realLog + "\"",
+                realLog.indexOf(substring) >= 0);
     }
 
     /**
@@ -128,8 +128,7 @@ public abstract class EasyAntBaseTest ex
      */
     public void assertLogNotContaining(String substring) {
         String realLog = getLog();
-        assertFalse("didn't expect log to contain \"" + substring
-                + "\" log was \"" + realLog + "\"",
+        assertFalse("didn't expect log to contain \"" + substring + "\" log was \"" + realLog + "\"",
                 realLog.indexOf(substring) >= 0);
     }
 
@@ -146,15 +145,13 @@ public abstract class EasyAntBaseTest ex
      * Assert that the given substring is in the output messages.
      * 
      * @param message
-     *            Print this message if the test fails. Defaults to a meaningful
-     *            text if <tt>null</tt> is passed.
+     *            Print this message if the test fails. Defaults to a meaningful text if <tt>null</tt> is passed.
      * @since Ant1.7
      */
     public void assertOutputContaining(String message, String substring) {
         String realOutput = getOutput();
-        String realMessage = (message != null) ? message
-                : "expecting output to contain \"" + substring
-                        + "\" output was \"" + realOutput + "\"";
+        String realMessage = (message != null) ? message : "expecting output to contain \"" + substring
+                + "\" output was \"" + realOutput + "\"";
         assertTrue(realMessage, realOutput.indexOf(substring) >= 0);
     }
 
@@ -162,21 +159,18 @@ public abstract class EasyAntBaseTest ex
      * Assert that the given substring is not in the output messages.
      * 
      * @param message
-     *            Print this message if the test fails. Defaults to a meaningful
-     *            text if <tt>null</tt> is passed.
+     *            Print this message if the test fails. Defaults to a meaningful text if <tt>null</tt> is passed.
      * @since Ant1.7
      */
     public void assertOutputNotContaining(String message, String substring) {
         String realOutput = getOutput();
-        String realMessage = (message != null) ? message
-                : "expecting output to not contain \"" + substring
-                        + "\" output was \"" + realOutput + "\"";
+        String realMessage = (message != null) ? message : "expecting output to not contain \"" + substring
+                + "\" output was \"" + realOutput + "\"";
         assertFalse(realMessage, realOutput.indexOf(substring) >= 0);
     }
 
     /**
-     * Assert that the given message has been logged with a priority &lt;= INFO
-     * when running the given target.
+     * Assert that the given message has been logged with a priority &lt;= INFO when running the given target.
      */
     public void expectLogContaining(String target, String log) {
         executeTarget(target);
@@ -184,8 +178,7 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * Assert that the given message has not been logged with a priority &lt;=
-     * INFO when running the given target.
+     * Assert that the given message has not been logged with a priority &lt;= INFO when running the given target.
      */
     public void expectLogNotContaining(String target, String log) {
         executeTarget(target);
@@ -193,8 +186,7 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * Gets the log the BuildFileTest object. Only valid if configureProject()
-     * has been called.
+     * Gets the log the BuildFileTest object. Only valid if configureProject() has been called.
      * 
      * @pre logBuffer!=null
      * @return The log value
@@ -204,8 +196,7 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * Assert that the given message has been logged with a priority &gt;=
-     * VERBOSE when running the given target.
+     * Assert that the given message has been logged with a priority &gt;= VERBOSE when running the given target.
      */
     public void expectDebuglog(String target, String log) {
         executeTarget(target);
@@ -218,8 +209,7 @@ public abstract class EasyAntBaseTest ex
      */
     public void assertDebuglogContaining(String substring) {
         String realLog = getFullLog();
-        assertTrue("expecting debug log to contain \"" + substring
-                + "\" log was \"" + realLog + "\"",
+        assertTrue("expecting debug log to contain \"" + substring + "\" log was \"" + realLog + "\"",
                 realLog.indexOf(substring) >= 0);
     }
 
@@ -250,8 +240,7 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * Executes the target, verify output matches expectations and that we got
-     * the named error at the end
+     * Executes the target, verify output matches expectations and that we got the named error at the end
      * 
      * @param target
      *            target to execute
@@ -300,6 +289,33 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
+     * configure and init to run the named project
+     * 
+     * @param url
+     *            path to project file to run
+     * @param logLevel
+     *            a given {@link LogLevel}
+     * 
+     * @throws BuildException
+     */
+    public void configureAndInitProject(URL url, int logLevel) {
+        configureProject(url, logLevel);
+        initProject();
+    }
+
+    /**
+     * configure and init to run the named project
+     * 
+     * @param url
+     *            path to project file to run
+     * @throws BuildException
+     */
+    public void configureAndInitProject(URL url) {
+        configureProject(url);
+        initProject();
+    }
+
+    /**
      * Set up to run the named project
      * 
      * @param url
@@ -311,8 +327,7 @@ public abstract class EasyAntBaseTest ex
         try {
             f = new File(url.toURI());
         } catch (URISyntaxException e) {
-            throw new BuildException("Can't load project from url "
-                    + url.toString(), e);
+            throw new BuildException("Can't load project from url " + url.toString(), e);
         }
         configureProject(f.getAbsolutePath(), Project.MSG_DEBUG);
     }
@@ -332,8 +347,7 @@ public abstract class EasyAntBaseTest ex
         try {
             f = new File(url.toURI());
         } catch (URISyntaxException e) {
-            throw new BuildException("Can't load project from url "
-                    + url.toString(), e);
+            throw new BuildException("Can't load project from url " + url.toString(), e);
         }
         configureProject(f.getAbsolutePath(), logLevel);
     }
@@ -349,36 +363,32 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * Sets up to run the named project If you want to modify a few thing on the
-     * default configuration you should override this method
+     * Sets up to run the named project If you want to modify a few thing on the default configuration you should
+     * override this method
      * 
      * @param filename
      *            name of project file to run
      * @param logLevel
      *            a given {@link LogLevel}
      */
-    public void configureProject(String filename, int logLevel)
-            throws BuildException {
-        conf = EasyantConfigurationFactory.getInstance()
-                .createDefaultConfiguration();
+    public void configureProject(String filename, int logLevel) throws BuildException {
+        conf = EasyantConfigurationFactory.getInstance().createDefaultConfiguration();
         conf.setMsgOutputLevel(logLevel);
         conf.setBuildModule(new File(filename));
-        conf.getDefinedProps().put(
-                EasyAntMagicNames.SKIP_CORE_REVISION_CHECKER, "true");
+        conf.getDefinedProps().put(EasyAntMagicNames.SKIP_CORE_REVISION_CHECKER, "true");
         // to avoid side effects due to user settings we ignore this setting by
         // default for test
-        conf.getDefinedProps().put(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS,
-                "true");
+        conf.getDefinedProps().put(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS, "true");
+
+        // Configure easyant ivy instance
+        conf.setEasyantIvySettingsUrl(this.getClass().getResource("/ivysettings-test.xml"));
 
         // Configure the project basedir
         File projectModule = new File(filename);
         if (!projectModule.exists()) {
-            throw new BuildException("Project "
-                    + projectModule.getAbsolutePath() + " does not exists");
+            throw new BuildException("Project " + projectModule.getAbsolutePath() + " does not exists");
         }
-        conf.getDefinedProps().put(MagicNames.PROJECT_BASEDIR,
-                projectModule.getParent());
-
+        conf.getDefinedProps().put(MagicNames.PROJECT_BASEDIR, projectModule.getParent());
     }
 
     /**
@@ -388,8 +398,7 @@ public abstract class EasyAntBaseTest ex
      */
     public void initProject() {
         if (conf == null) {
-            throw new RuntimeException(
-                    "You must call the configureProject method before initProject()");
+            throw new RuntimeException("You must call the configureProject method before initProject()");
         }
         // Flush the buffer
         logBuffer = new StringBuffer();
@@ -457,18 +466,16 @@ public abstract class EasyAntBaseTest ex
      * @param cause
      *            information string to reader of report
      * @param msg
-     *            the message value of the build exception we are waiting for
-     *            set to null for any build exception to be valid
+     *            the message value of the build exception we are waiting for set to null for any build exception to be
+     *            valid
      */
-    public void expectSpecificBuildException(String target, String cause,
-            String msg) {
+    public void expectSpecificBuildException(String target, String cause, String msg) {
         try {
             executeTarget(target);
         } catch (org.apache.tools.ant.BuildException ex) {
             buildException = ex;
             if ((null != msg) && (!ex.getMessage().equals(msg))) {
-                fail("Should throw BuildException because '" + cause
-                        + "' with message '" + msg + "' (actual message '"
+                fail("Should throw BuildException because '" + cause + "' with message '" + msg + "' (actual message '"
                         + ex.getMessage() + "' instead)");
             }
             return;
@@ -477,8 +484,7 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * run a target, expect an exception string containing the substring we look
-     * for (case sensitive match)
+     * run a target, expect an exception string containing the substring we look for (case sensitive match)
      * 
      * @param target
      *            target to run
@@ -487,17 +493,14 @@ public abstract class EasyAntBaseTest ex
      * @param contains
      *            substring of the build exception to look for
      */
-    public void expectBuildExceptionContaining(String target, String cause,
-            String contains) {
+    public void expectBuildExceptionContaining(String target, String cause, String contains) {
         try {
             executeTarget(target);
         } catch (org.apache.tools.ant.BuildException ex) {
             buildException = ex;
             if ((null != contains) && (ex.getMessage().indexOf(contains) == -1)) {
-                fail("Should throw BuildException because '" + cause
-                        + "' with message containing '" + contains
-                        + "' (actual message '" + ex.getMessage()
-                        + "' instead)");
+                fail("Should throw BuildException because '" + cause + "' with message containing '" + contains
+                        + "' (actual message '" + ex.getMessage() + "' instead)");
             }
             return;
         }
@@ -577,9 +580,8 @@ public abstract class EasyAntBaseTest ex
     }
 
     /**
-     * Retrieve a resource from the caller classloader to avoid assuming a vm
-     * working directory. The resource path must be relative to the package name
-     * or absolute from the root path.
+     * Retrieve a resource from the caller classloader to avoid assuming a vm working directory. The resource path must
+     * be relative to the package name or absolute from the root path.
      * 
      * @param resource
      *            the resource to retrieve its url.
@@ -614,8 +616,7 @@ public abstract class EasyAntBaseTest ex
         private int logLevel;
 
         /**
-         * Constructs a test listener which will ignore log events above the
-         * given level.
+         * Constructs a test listener which will ignore log events above the given level.
          */
         public AntTestListener(int logLevel) {
             this.logLevel = logLevel;
@@ -628,8 +629,8 @@ public abstract class EasyAntBaseTest ex
         }
 
         /**
-         * Fired after the last target has finished. This event will still be
-         * thrown if an error occurred during the build.
+         * Fired after the last target has finished. This event will still be thrown if an error occurred during the
+         * build.
          * 
          * @see BuildEvent#getException()
          */
@@ -647,8 +648,7 @@ public abstract class EasyAntBaseTest ex
         }
 
         /**
-         * Fired when a target has finished. This event will still be thrown if
-         * an error occurred during the build.
+         * Fired when a target has finished. This event will still be thrown if an error occurred during the build.
          * 
          * @see BuildEvent#getException()
          */
@@ -668,8 +668,7 @@ public abstract class EasyAntBaseTest ex
         }
 
         /**
-         * Fired when a task has finished. This event will still be throw if an
-         * error occurred during the build.
+         * Fired when a task has finished. This event will still be throw if an error occurred during the build.
          * 
          * @see BuildEvent#getException()
          */
@@ -690,8 +689,7 @@ public abstract class EasyAntBaseTest ex
                 return;
             }
 
-            if (event.getPriority() == Project.MSG_INFO
-                    || event.getPriority() == Project.MSG_WARN
+            if (event.getPriority() == Project.MSG_INFO || event.getPriority() == Project.MSG_WARN
                     || event.getPriority() == Project.MSG_ERR) {
                 logBuffer.append(event.getMessage());
             }

Modified: incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/ModuleInheritanceTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/ModuleInheritanceTest.java?rev=1398503&r1=1398502&r2=1398503&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/ModuleInheritanceTest.java (original)
+++ incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/ModuleInheritanceTest.java Mon Oct 15 20:44:17 2012
@@ -18,31 +18,37 @@
 package org.apache.easyant.core;
 
 import org.apache.tools.ant.Project;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class ModuleInheritanceTest extends EasyAntBaseTest {
 
-    protected void setUp() throws Exception {
-        configureProject(this.getResource("multimodule/myapp-core/module.ivy"), Project.MSG_INFO);
-
-        // Configure easyant ivy instance
-        conf.setEasyantIvySettingsUrl(this.getClass().getResource("/ivysettings-test.xml"));
+    @Before
+    public void setUp() {
+        configureAndInitProject(this.getResource("multimodule/myapp-core/module.ivy"), Project.MSG_INFO);
+        cleanTargetDirectory();
+    }
 
-        // init project with easyant configuration
-        initProject();
+    @After
+    public void tearDown() {
+        cleanTargetDirectory();
     }
 
-    public void clean() throws Exception {
-        executeTarget("clean");
+    @Test
+    public void shouldInheritProperty() {
+        assertPropertyEquals("test.property", "myvalue");
     }
 
-    public void testInheritablePluginWithScopeChild() throws Exception {
-        clean();
+    @Test
+    public void shouldInheritPluginWithScopeChild() {
         executeTarget("source-jar:init");
     }
 
-    public void testNonInheritableElements() throws Exception {
-        clean();
-        expectBuildException("eadoc:init", "Target \"eadoc:init\" does not exist in the project \"myapp-core\"");
+    @Test
+    public void shouldNotInheritElements() {
+        expectBuildException("documentation:init",
+                "Target \"documentation:init\" does not exist in the project \"myapp-core\"");
         expectPropertyUnset("validate", "my.property");
     }
 

Modified: incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/PropertiesAsAttributesTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/PropertiesAsAttributesTest.java?rev=1398503&r1=1398502&r2=1398503&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/PropertiesAsAttributesTest.java (original)
+++ incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/PropertiesAsAttributesTest.java Mon Oct 15 20:44:17 2012
@@ -24,55 +24,35 @@ import org.junit.Test;
 public class PropertiesAsAttributesTest extends EasyAntBaseTest {
 
     @Before
-    public void setUp() throws Exception {
-
-        configureProject(this.getResource("propertiesAsAttributes.ivy"), Project.MSG_INFO);
-
-        // Configure easyant ivy instance
-        conf.setEasyantIvySettingsUrl(this.getClass().getResource("/ivysettings-test.xml"));
-
-        // init project with easyant configuration
-        initProject();
-    }
-
-    @Test
-    public void testClean() throws Exception {
-        executeTarget("clean");
+    public void setUp() {
+        configureAndInitProject(this.getResource("propertiesAsAttributes.ivy"), Project.MSG_INFO);
     }
 
     @Test
-    public void testPropertiesInBuildType() throws Exception {
-        expectPropertySet("validate", "my.property.inbuildtype", "true");
-
+    public void shouldHandlePropertiesInBuildType() {
+        assertPropertyEquals("my.property.inbuildtype", "true");
         // properties loaded by build configuration
-        expectPropertyUnset("validate", "my.property.inconf");
+        assertPropertyUnset("my.property.inconf");
     }
 
     @Test
-    public void testPropertiesInPlugin() throws Exception {
-        expectPropertySet("validate", "my.property.inplugin", "true");
+    public void shouldHandlePropertiesInPlugin() {
+        assertPropertyEquals("my.property.inplugin", "true");
 
         // properties loaded by build configuration
-        expectPropertyUnset("validate", "my.property.inconf");
+        assertPropertyUnset("my.property.inconf");
     }
 
     @Test
-    public void testPropertiesInBuildConfiguration() throws Exception {
+    public void shouldHandlePropertiesInBuildConfiguration() {
         conf.getActiveBuildConfigurations().add("myBuild");
 
         // re-init project with easyant configuration including build types
         initProject();
 
-        expectPropertySet("validate", "my.property.inplugin", "true");
+        assertPropertyEquals("my.property.inplugin", "true");
 
         // properties loaded by build configuration
-        expectPropertySet("validate", "my.property.inconf", "true");
-    }
-
-    @Test
-    public void testVerify() throws Exception {
-        testClean();
-        executeTarget("verify");
+        assertPropertyEquals("my.property.inconf", "true");
     }
-
 }

Modified: incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/StandardJavaProjectTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/StandardJavaProjectTest.java?rev=1398503&r1=1398502&r2=1398503&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/StandardJavaProjectTest.java (original)
+++ incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/StandardJavaProjectTest.java Mon Oct 15 20:44:17 2012
@@ -18,48 +18,59 @@
 package org.apache.easyant.core;
 
 import org.apache.tools.ant.Project;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class StandardJavaProjectTest extends EasyAntBaseTest {
 
-    protected void setUp() throws Exception {
-        configureProject(this.getResource("standardJavaProject.ivy"), Project.MSG_INFO);
-
-        // Configure easyant ivy instance
-        conf.setEasyantIvySettingsUrl(this.getClass().getResource("/ivysettings-test.xml"));
+    @Before
+    public void setUp() {
+        configureAndInitProject(this.getResource("standardJavaProject.ivy"), Project.MSG_INFO);
+        cleanTargetDirectory();
+    }
 
-        // init project with easyant configuration
-        initProject();
+    @After
+    public void tearDown() {
+        cleanTargetDirectory();
     }
 
-    public void testClean() throws Exception {
+    @Test
+    public void shouldInvokeClean() {
         executeTarget("clean");
     }
 
-    public void testValidate() throws Exception {
-        expectPropertySet("validate", "default.build.number", "10");
+    @Test
+    public void shouldInvokeCompile() {
+        executeTarget("compile");
     }
 
-    public void testPackage() throws Exception {
-        testClean();
+    @Test
+    public void shouldInvokePackage() {
         executeTarget("package");
     }
 
-    public void testImportWithoutAsAttribute() throws Exception {
-        testClean();
+    @Test
+    public void shouldInvokeVerify() {
+        executeTarget("verify");
+    }
+
+    @Test
+    public void shouldImportWithoutAsAttribute() {
         // <ea:plugin module="javadoc" revision="0.1"/>
         // no "as" attribute is specified, easyant should prefix all targets with "module" value by default
         executeTarget("javadoc:javadoc");
     }
 
-    public void testImportWithAsAttribute() throws Exception {
-        testClean();
+    @Test
+    public void shouldImportWithAsAttribute() {
         // <ea:plugin module="javadoc" revision="0.1" as="foobar"/>
         executeTarget("foobarjavadoc:javadoc");
     }
 
-    public void testVerify() throws Exception {
-        testClean();
-        executeTarget("verify");
+    @Test
+    public void shouldOverrideExistingProperty() {
+        assertPropertyEquals("default.build.number", "10");
     }
 
 }

Modified: incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java?rev=1398503&r1=1398502&r2=1398503&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java (original)
+++ incubator/easyant/core/trunk/src/test/java/org/apache/easyant/core/services/PluginServiceTest.java Mon Oct 15 20:44:17 2012
@@ -134,7 +134,7 @@ public class PluginServiceTest {
             }
         }
         Assert.assertNotNull(packageEP);
-        Assert.assertEquals("compile,abstract-package:package-finished,hello-world", packageEP.getDepends());
+        Assert.assertEquals("compile,abstract-package:package,hello-world", packageEP.getDepends());
 
         List<TargetReport> targets = packageEP.getTargetReports();
         Set<String> expectedTargets = new HashSet<String>(Arrays.asList("hello-world"));

Modified: incubator/easyant/core/trunk/src/test/resources/ivysettings-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/resources/ivysettings-test.xml?rev=1398503&r1=1398502&r2=1398503&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/resources/ivysettings-test.xml (original)
+++ incubator/easyant/core/trunk/src/test/resources/ivysettings-test.xml Mon Oct 15 20:44:17 2012
@@ -16,8 +16,10 @@
 -->
 <ivysettings>
     <property name="apache.easyant.public.url" value="http://repository.easyant.org/apache-easyant"/>
+    <property name="easyant.default.cache.dir" value="${basedir}/easyant-cache-test"/>
+
     <settings defaultResolver="easyant-test-chain"/>
-    <caches defaultCacheDir="${basedir}/target/easyant-cache-test" useOrigin="true" />
+    <caches defaultCacheDir="${easyant.default.cache.dir}" useOrigin="true" />
     
     <resolvers>
         <url name="apache-easyant-plugins">

Modified: incubator/easyant/core/trunk/src/test/resources/org/apache/easyant/core/multimodule/parent.ivy
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/test/resources/org/apache/easyant/core/multimodule/parent.ivy?rev=1398503&r1=1398502&r2=1398503&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/test/resources/org/apache/easyant/core/multimodule/parent.ivy (original)
+++ incubator/easyant/core/trunk/src/test/resources/org/apache/easyant/core/multimodule/parent.ivy Mon Oct 15 20:44:17 2012
@@ -16,7 +16,7 @@
 -->
 <ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
     <info organisation="org.apache.easyant" module="myapp-parent" revision="0.2" status="integration" >
-        <ea:property name="test" value="zz"/>
+        <ea:property name="test.property" value="myvalue"/>
         <ea:plugin module="source-jar" revision="0.9" inherit-scope="child" />
         <ea:plugin module="documentation" revision="0.9" inheritable="false" my.property="myvalue"/>
     </info>