avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/repository/test/src/test/org/apache/avalon/repository InitialRepositoryFactoryTest.java TargetReferenceTest.java
Date Thu, 20 Nov 2003 04:21:17 GMT
mcconnell    2003/11/19 20:21:17

  Modified:    repository/test/src/test/org/apache/avalon/repository
                        InitialRepositoryFactoryTest.java
                        TargetReferenceTest.java
  Log:
  Removed setter operations on RepositoryContext and refactored content to use common unils
package.
  
  Revision  Changes    Path
  1.4       +23 -13    avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/InitialRepositoryFactoryTest.java
  
  Index: InitialRepositoryFactoryTest.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/InitialRepositoryFactoryTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InitialRepositoryFactoryTest.java	19 Nov 2003 17:28:37 -0000	1.3
  +++ InitialRepositoryFactoryTest.java	20 Nov 2003 04:21:17 -0000	1.4
  @@ -54,6 +54,8 @@
   
   import junit.framework.TestCase ;
   
  +import org.apache.avalon.repository.util.MavenArtifactFactory ;
  +import org.apache.avalon.repository.util.DefaultRepositoryContext ;
   
   /**
    * 
  @@ -84,13 +86,12 @@
           String[] bootstrap = getBootstrapRepositorySet();
           RepositoryFactory factory = new InitialRepositoryFactory( bootstrap );
           assertNotNull( factory );
  -        RepositoryContext context = factory.getDefaultContext();
  -        assertNotNull( context );
  -        
  -        context.setCacheDir( 
  -           System.getProperty( "user.home" ) 
  -           + File.separator + ".merlin" 
  -           + File.separator + "repository" ) ;
  +
  +        RepositoryContext defaults = factory.getDefaultContext();
  +        assertNotNull( defaults );
  +
  +        DefaultRepositoryContext context = new DefaultRepositoryContext( defaults );
  +        context.setCacheDir( getCacheDir() );
   
           String[] repositories = getWorkingRepositorySet();
           context.setRemoteRepositoryUrls( repositories ) ;
  @@ -116,11 +117,10 @@
           // our repository usage scenario
           //
   
  -        RepositoryContext context = factory.getDefaultContext();
  -        context.setCacheDir( 
  -           System.getProperty( "user.home" ) 
  -           + File.separator + ".merlin" 
  -           + File.separator + "repository" ) ;
  +        RepositoryContext defaults = factory.getDefaultContext();
  +        DefaultRepositoryContext context = new DefaultRepositoryContext( defaults );
  +        context.setCacheDir( getCacheDir() );
  +
           String[] repositories = getWorkingRepositorySet();
           context.setRemoteRepositoryUrls( repositories ) ;
   
  @@ -144,8 +144,11 @@
           // create a classloader based on the artifact
           //
   
  +        long time = System.currentTimeMillis();
           ClassLoader loader = 
             repository.getClassLoader( artifact );
  +        long time2 = System.currentTimeMillis();
  +        System.out.println("## elapsed: (" + (time2 - time) + " milliseconds)" );
   
           //
           // grab a class from the classloader just to show that 
  @@ -169,6 +172,13 @@
           return new String[]{ 
             "http://dpml.net/","http://www.ibiblio.org/maven/"
           };
  +    }
  +
  +    private String getCacheDir()
  +    {
  +        return System.getProperty( "user.dir" ) 
  +           + File.separator + ".cache" 
  +           + File.separator + "repository";
       }
   
   }
  
  
  
  1.2       +3 -2      avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/TargetReferenceTest.java
  
  Index: TargetReferenceTest.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/TargetReferenceTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TargetReferenceTest.java	18 Nov 2003 12:59:56 -0000	1.1
  +++ TargetReferenceTest.java	20 Nov 2003 04:21:17 -0000	1.2
  @@ -53,6 +53,7 @@
   
   import junit.framework.TestCase;
   
  +import org.apache.avalon.repository.util.MavenArtifactFactory ;
   
   /**
    * @todo
  
  
  

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


Mime
View raw message