avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject svn commit: rev 46177 - in avalon/trunk/runtime: activation/impl/etc/test composition/api/src/java/org/apache/avalon/composition/data logging/test/etc/test merlin/cli/etc/test merlin/cli/src/test/org/apache/avalon/merlin/cli/test merlin/unit/etc/test repository/api/src/java/org/apache/avalon/repository repository/main/src/java/org/apache/avalon/repository/main repository/spi/src/test/org/apache/avalon/repository/meta repository/test repository/test/etc/test repository/test/src/test/org/apache/avalon/repository/main test/teste/src/main/org/apache/avalon/test/teste
Date Thu, 16 Sep 2004 13:33:19 GMT
Author: niclas
Date: Thu Sep 16 06:33:18 2004
New Revision: 46177

Added:
   avalon/trunk/runtime/activation/impl/etc/test/test.properties   (contents, props changed)
   avalon/trunk/runtime/logging/test/etc/test/avalon.properties   (contents, props changed)
   avalon/trunk/runtime/repository/test/etc/test/merlin.properties   (contents, props changed)
Modified:
   avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java
   avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties
   avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java
   avalon/trunk/runtime/merlin/unit/etc/test/merlin.properties
   avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
   avalon/trunk/runtime/repository/main/src/java/org/apache/avalon/repository/main/DefaultInitialContextFactory.java
   avalon/trunk/runtime/repository/spi/src/test/org/apache/avalon/repository/meta/MetaTest.java
   avalon/trunk/runtime/repository/test/build.xml
   avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextTest.java
   avalon/trunk/runtime/test/teste/src/main/org/apache/avalon/test/teste/TestE.java
Log:
Various clean-ups, fixes and tests...

Added: avalon/trunk/runtime/activation/impl/etc/test/test.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/activation/impl/etc/test/test.properties	Thu Sep 16 06:33:18 2004
@@ -0,0 +1 @@
+avalon.repository.online = false
\ No newline at end of file

Modified: avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java
==============================================================================
--- avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java
(original)
+++ avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/data/DeploymentProfile.java
Thu Sep 16 06:33:18 2004
@@ -18,6 +18,7 @@
 package org.apache.avalon.composition.data;
 
 import java.io.Serializable;
+import java.lang.Comparable;
 
 import org.apache.avalon.logging.data.CategoriesDirective;
 
@@ -27,14 +28,25 @@
  * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
  * @version $Id$
  */
-public abstract class DeploymentProfile implements Serializable
+public abstract class DeploymentProfile implements Serializable, Comparable
 {
     //--------------------------------------------------------------------------
     // static
     //--------------------------------------------------------------------------
 
+   /**
+    * System default activation policy.
+    */
     public static final int DEFAULT = -1;
+
+   /**
+    * Activation on startup enabled.
+    */
     public static final int ENABLED = 1;
+
+   /**
+    * Activation on startup disabled.
+    */
     public static final int DISABLED = 0;
 
     private static final CategoriesDirective EMPTY_CATEGORIES = 
@@ -145,5 +157,12 @@
     public String toString()
     {
         return "[" + getName() + "]";
+    }
+
+    public int compareTo( Object object )
+    {
+        String name = this.toString();
+        String other = object.toString();
+        return name.compareTo( other );
     }
 }

Added: avalon/trunk/runtime/logging/test/etc/test/avalon.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/logging/test/etc/test/avalon.properties	Thu Sep 16 06:33:18 2004
@@ -0,0 +1 @@
+avalon.repository.online = false
\ No newline at end of file

Modified: avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties
==============================================================================
--- avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties	(original)
+++ avalon/trunk/runtime/merlin/cli/etc/test/merlin.properties	Thu Sep 16 06:33:18 2004
@@ -1,3 +1,4 @@
+avalon.repository.online = false
 
 #
 # server mode

Modified: avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java
==============================================================================
--- avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java
(original)
+++ avalon/trunk/runtime/merlin/cli/src/test/org/apache/avalon/merlin/cli/test/MerlinCLITestCase.java
Thu Sep 16 06:33:18 2004
@@ -67,7 +67,8 @@
                 "-home",
                 basedir,
                 "-system",
-                system
+                system,
+                "-offline"
               };
             Main.main( args );
         }

Modified: avalon/trunk/runtime/merlin/unit/etc/test/merlin.properties
==============================================================================
--- avalon/trunk/runtime/merlin/unit/etc/test/merlin.properties	(original)
+++ avalon/trunk/runtime/merlin/unit/etc/test/merlin.properties	Thu Sep 16 06:33:18 2004
@@ -1,3 +1,4 @@
+avalon.repository.online = false
 
 #----------------------------------------------------------------------
 # static defaults for the merlin platform

Modified: avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
==============================================================================
--- avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
(original)
+++ avalon/trunk/runtime/repository/api/src/java/org/apache/avalon/repository/Artifact.java
Thu Sep 16 06:33:18 2004
@@ -21,6 +21,8 @@
 import java.io.Serializable;
 import java.io.IOException;
 import java.net.URL;
+import java.lang.Comparable;
+
 
 /**
  * Defintion of a artifact that maintains a relative url
@@ -30,7 +32,7 @@
  * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
  * @version $Id$
  */
-public class Artifact implements Serializable
+public class Artifact implements Serializable, Comparable
 {
     // ------------------------------------------------------------------------
     // static
@@ -392,6 +394,13 @@
         if( path.startsWith( SEP ) ) return getCleanPath( path.substring( 1, path.length()
) );
         if( path.endsWith( SEP ) ) return getCleanPath( path.substring( 0, path.length()
-1 ) );
         return path;
+    }
+
+    public int compareTo( Object object )
+    {
+        String name = this.toString();
+        String other = object.toString();
+        return name.compareTo( other );
     }
 
 }

Modified: avalon/trunk/runtime/repository/main/src/java/org/apache/avalon/repository/main/DefaultInitialContextFactory.java
==============================================================================
--- avalon/trunk/runtime/repository/main/src/java/org/apache/avalon/repository/main/DefaultInitialContextFactory.java
(original)
+++ avalon/trunk/runtime/repository/main/src/java/org/apache/avalon/repository/main/DefaultInitialContextFactory.java
Thu Sep 16 06:33:18 2004
@@ -181,6 +181,12 @@
             m_properties, 
             new Properties[]{ m_properties } );
 
+        String value = m_properties.getProperty( InitialContext.ONLINE_KEY );
+        if( null != value )
+        {  
+            m_online = value.equalsIgnoreCase( "true" );
+        }
+        
         //
         // retrieve the property defining the implementation
         // artifact for the initial repository

Modified: avalon/trunk/runtime/repository/spi/src/test/org/apache/avalon/repository/meta/MetaTest.java
==============================================================================
--- avalon/trunk/runtime/repository/spi/src/test/org/apache/avalon/repository/meta/MetaTest.java
(original)
+++ avalon/trunk/runtime/repository/spi/src/test/org/apache/avalon/repository/meta/MetaTest.java
Thu Sep 16 06:33:18 2004
@@ -27,6 +27,7 @@
 
 import org.apache.avalon.repository.Artifact;
 
+
 /**
  * 
  * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>

Modified: avalon/trunk/runtime/repository/test/build.xml
==============================================================================
--- avalon/trunk/runtime/repository/test/build.xml	(original)
+++ avalon/trunk/runtime/repository/test/build.xml	Thu Sep 16 06:33:18 2004
@@ -8,6 +8,7 @@
   <import file="${magic.templates}/standard.xml"/>
 
   <target name="init" depends="standard.init">
+    <x:filter key="avalon-repository-api" feature="uri" token="REPO_API_SPEC"/>
     <x:filter key="avalon-repository-impl" feature="uri" 
        token="REPOSITORY_IMPLEMENTATION"/>
   </target>

Added: avalon/trunk/runtime/repository/test/etc/test/merlin.properties
==============================================================================
--- (empty file)
+++ avalon/trunk/runtime/repository/test/etc/test/merlin.properties	Thu Sep 16 06:33:18 2004
@@ -0,0 +1 @@
+avalon.repository.online = false

Modified: avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextTest.java
==============================================================================
--- avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextTest.java
(original)
+++ avalon/trunk/runtime/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextTest.java
Thu Sep 16 06:33:18 2004
@@ -41,7 +41,7 @@
  */
 public class DefaultInitialContextTest extends TestCase
 {
-    private static final String KEY = "test";
+    private static final String KEY = "merlin";
 
     private static final File BASEDIR = getWorkDir();
 
@@ -54,9 +54,7 @@
         }
         else
         {
-            path = System.getProperty( "basedir" );
-            File root = new File( path );
-            return new File( root, "target/test-classes" );
+            throw new IllegalStateException( "Missing 'project.dir' property." );
         }
     }
 
@@ -73,7 +71,7 @@
     {
         DefaultInitialContextFactory factory = 
           new DefaultInitialContextFactory( KEY, BASEDIR );
-        factory.setCacheDirectory( getMavenRepositoryDirectory() );
+        factory.setCacheDirectory( getRepositoryDirectory() );
         factory.setHosts( getDefaultHosts() );
 
         InitialContext context = factory.createInitialContext();
@@ -81,7 +79,7 @@
         assertEquals( 
           "cache", 
           context.getInitialCacheDirectory(), 
-          getMavenRepositoryDirectory() );
+          getRepositoryDirectory() );
 
         String[] defaults = getDefaultHosts();
         String[] hosts = context.getInitialHosts();
@@ -100,50 +98,18 @@
         Repository repository = (Repository) context.getRepository() ;
         assertNotNull( repository ) ;
    
-        Artifact artifact = Artifact.createArtifact( 
-          "avalon-framework", "avalon-framework-api", "4.1.5" );
+        Artifact artifact = Artifact.createArtifact( "@REPO_API_SPEC@" );
         URL url = repository.getResource( artifact );
         assertNotNull( "url", url );
     }
 
-    private static File getMavenRepositoryDirectory()
+    private static File getRepositoryDirectory()
     {
-        return new File( getMavenHomeDirectory(), "repository" );
-    }
-
-    private static File getMavenHomeDirectory()
-    {
-        return new File( getMavenHome() );
-    }
-
-    private static String getMavenHome()
-    {
-        try
-        {
-            String local = 
-              System.getProperty( 
-                "maven.home.local", 
-                Env.getEnvVariable( "MAVEN_HOME_LOCAL" ) );
-            if( null != local ) return local;
-
-            return System.getProperty( "user.home" ) + File.separator + ".maven";
-
-        }
-        catch( Throwable e )
-        {
-            final String error = 
-              "Internal error while attempting to access environment.";
-            final String message = 
-              ExceptionHelper.packException( error, e, true );
-            throw new RuntimeException( message );
-        }
+        return new File( System.getProperty( "project.repository.cache.path" ) );
     }
 
     private static String[] getDefaultHosts()
     {
-        return new String[]{ 
-          "http://www.dpml.net/",
-          "http://www.ibiblio.org/maven/"
-        };
+        return new String[0];
     }
 }

Modified: avalon/trunk/runtime/test/teste/src/main/org/apache/avalon/test/teste/TestE.java
==============================================================================
--- avalon/trunk/runtime/test/teste/src/main/org/apache/avalon/test/teste/TestE.java	(original)
+++ avalon/trunk/runtime/test/teste/src/main/org/apache/avalon/test/teste/TestE.java	Thu Sep
16 06:33:18 2004
@@ -37,7 +37,7 @@
     }
 
    /**
-    * @avalon.dependency key= "a" type="org.apache.avalon.test.testa.A"
+    * @avalon.dependency key="a" type="org.apache.avalon.test.testa.A"
     */
     public void service( ServiceManager manager ) throws ServiceException
     {

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message