svn commit: rev 22314 - avalon/trunk/runtime/merlin/unit/src/java/org/apache/avalon/merlin/unit

[email protected]
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
Author: mcconnell
Date: Wed Jun 30 03:11:16 2004
New Revision: 22314

Modified:
   avalon/trunk/runtime/merlin/unit/src/java/org/apache/avalon/merlin/unit/AbstractMerlinTestCase.java
Log:
Update to handle revision to the location of the test-classes directory.

Modified: avalon/trunk/runtime/merlin/unit/src/java/org/apache/avalon/merlin/unit/AbstractMerlinTestCase.java
==============================================================================
--- avalon/trunk/runtime/merlin/unit/src/java/org/apache/avalon/merlin/unit/AbstractMerlinTestCase.java	(original)
+++ avalon/trunk/runtime/merlin/unit/src/java/org/apache/avalon/merlin/unit/AbstractMerlinTestCase.java	Wed Jun 30 03:11:16 2004
@@ -55,7 +55,7 @@
     private static final String DEPLOYMENT_MODEL_CLASSNAME = 
       "org.apache.avalon.composition.model.DeploymentModel";
 
-    private static File getWorkDir()
+    private static File getWorkDirectory()
     {
         String path = System.getProperty( "project.dir" );
         if( null != path )
@@ -64,17 +64,23 @@
         }
         else
         {
-            path = System.getProperty( "basedir" );
-            if( null != path )
-            {
-                return new File( path );
-            }
-            else
-            {
-                return new File( System.getProperty( "user.dir" ) );
-            }
+            return getBaseDirectory();
         }
     }
+
+    private static File getBaseDirectory()
+    {
+        String path = System.getProperty( "basedir" );
+        if( null != path )
+        {
+            return new File( path );
+        }
+        else
+        {
+            return new File( System.getProperty( "user.dir" ) );
+        }
+    }
+
 
     //----------------------------------------------------------
     // immutable state
@@ -118,15 +124,15 @@
 
         try
         {
-            File basedir = getBaseDirectory();
+            File work = getWorkDirectory();
             File home = getHomeDirectory();
 
             Artifact artifact = DefaultBuilder.createImplementationArtifact( 
-              classloader, home, basedir, 
+              classloader, home, work, 
               MERLIN_PROPERTIES, IMPLEMENTATION_KEY );
 
             InitialContextFactory icFactory = 
-              new DefaultInitialContextFactory( "merlin", basedir );
+              new DefaultInitialContextFactory( "merlin", work );
             icFactory.setCacheDirectory( getCacheDirectory() );
 
             InitialContext context = icFactory.createInitialContext();
@@ -274,18 +280,25 @@
     private String buildDefaultTestPath()
     {
         File base = getBaseDirectory();
-        File classes = new File( base, "target/classes/BLOCK-INF/block.xml" );
-        if( classes.exists() )
+        File classes = new File( base, "target/classes/BLOCK-INF/block.xml" );
+        File tests = new File( base, "target/test-classes/BLOCK-INF/block.xml" );
+        if( classes.exists() && tests.exists() )
+        {
+            return "target/classes,target/test-classes";
+        }
+        else if( classes.exists() )
+        {
+            return "target/classes";
+        }
+        else if( tests.exists() )
+        {
+            return "target/test-classes";
+        }
+        else
         {
-            return "target/classes";
+            return null;
         }
-        return null;
     }
-
-    private File getBaseDirectory()
-    {
-        return getWorkDir();
-    }
 
     private File getHomeDirectory()
     {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.