svn commit: rev 22322 - 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 06:16:20 2004
New Revision: 22322

Modified:
   avalon/trunk/runtime/merlin/unit/src/java/org/apache/avalon/merlin/unit/AbstractMerlinTestCase.java
Log:
Upgrade handling of block implicit references - was using relative paths which break on reactor builds.

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 06:16:20 2004
@@ -55,7 +55,7 @@
     private static final String DEPLOYMENT_MODEL_CLASSNAME = 
       "org.apache.avalon.composition.model.DeploymentModel";
 
-    private static File getWorkDirectory()
+    public static File getWorkDirectory()
     {
         String path = System.getProperty( "project.dir" );
         if( null != path )
@@ -68,7 +68,7 @@
         }
     }
 
-    private static File getBaseDirectory()
+    public static File getBaseDirectory()
     {
         String path = System.getProperty( "basedir" );
         if( null != path )
@@ -81,17 +81,28 @@
         }
     }
 
+    public static File getTargetDirectory()
+    {
+        return new File( getBaseDirectory(), "target" );
+    }
+
+    public static File getClassesDirectory()
+    {
+        return new File( getTargetDirectory(), "classes" );
+    }
+
+    private static File getTestClassesDirectory()
+    {
+        return new File( getTargetDirectory(), "test-classes" );
+    }
 
     //----------------------------------------------------------
     // immutable state
     //----------------------------------------------------------
 
     private Object m_kernel;
-
     private ClassLoader m_classloader;
-
     private Object m_root;
-
     private Method m_locate;
     private Method m_runtime;
     private Method m_resolve;
@@ -280,26 +291,27 @@
     private String buildDefaultTestPath()
     {
         File base = getBaseDirectory();
-        File classes = new File( base, "target/classes/BLOCK-INF/block.xml" );
-        File tests = new File( base, "target/test-classes/BLOCK-INF/block.xml" );
+        File classes = new File( getClassesDirectory(), "BLOCK-INF/block.xml" );
+        File tests = new File( getTestClassesDirectory(), "BLOCK-INF/block.xml" );
         if( classes.exists() && tests.exists() )
         {
-            return "target/classes,target/test-classes";
+            return getClassesDirectory().toString() 
+               + "," + getTestClassesDirectory().toString();
         }
         else if( classes.exists() )
         {
-            return "target/classes";
+            return getClassesDirectory().toString();
         }
         else if( tests.exists() )
         {
-            return "target/test-classes";
+            return getTestClassesDirectory().toString();
         }
         else
         {
             return null;
         }
-    }
-
+    }
+
     private File getHomeDirectory()
     {
         return getCacheDirectory().getParentFile();
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.