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/main DefaultInitialContextTest.java
Date Wed, 03 Dec 2003 20:42:26 GMT
mcconnell    2003/12/03 12:42:26

  Modified:    repository/test/src/test/org/apache/avalon/repository/main
                        DefaultInitialContextTest.java
  Log:
  Simplify testcase setup.
  
  Revision  Changes    Path
  1.4       +22 -22    avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextTest.java
  
  Index: DefaultInitialContextTest.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/main/DefaultInitialContextTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultInitialContextTest.java	3 Dec 2003 15:01:10 -0000	1.3
  +++ DefaultInitialContextTest.java	3 Dec 2003 20:42:26 -0000	1.4
  @@ -92,41 +92,31 @@
   
       public void testRepositoryBootstrap() throws Exception
       {
  -        String[] bootstrap = getBootstrapRepositorySet();
  +        InitialContext context = 
  +          new DefaultInitialContext( 
  +            getMavenRepositoryDirectory(),
  +            getDefaultHosts() );
   
  -        InitialContext context = new DefaultInitialContext( bootstrap );
           Factory factory = context.getInitialFactory();
           assertNotNull( factory );
   
  -        Map criteria = factory.createDefaultCriteria();
  -        String[] repositories = getWorkingRepositorySet();
  -        criteria.put( "avalon.repository.remote.url", repositories );
  -
  -        Repository repository = (Repository ) factory.create( criteria ) ;
  +        Repository repository = (Repository ) factory.create() ;
           assertNotNull( repository ) ;
           
           Artifact artifact = Artifact.createArtifact( 
  -          "avalon-framework", "avalon-framework-api", "4.1.5", "jar" );
  +          "avalon-framework", "avalon-framework-api", "4.1.5" );
           URL url = repository.getResource( artifact );
           assertNotNull( "url", url );
       }
   
  -    private static String[] getBootstrapRepositorySet()
  +    private static File getMavenRepositoryDirectory()
       {
  -        return new String[]{ 
  -          getMavenRepositoryURI()
  -        };
  +        return new File( getMavenHomeDirectory(), "repository" );
       }
   
  -    private static String getMavenRepositoryURI()
  +    private static File getMavenHomeDirectory()
       {
  -        String home = getMavenHome();
  -        return "file:///" + getMavenHomeRepository();
  -    }
  -
  -    private static String getMavenHomeRepository()
  -    {
  -        return getMavenHome() + File.separator + "repository";
  +        return new File( getMavenHome() );
       }
   
       private static String getMavenHome()
  @@ -158,7 +148,17 @@
           }
       }
   
  -    private static String[] getWorkingRepositorySet()
  +    private File getBaseDirectory()
  +    {
  +        String base = System.getProperty( "basedir" );
  +        if( null != base )
  +        {
  +            return new File( base );
  +        }
  +        return new File( System.getProperty( "user.dir" ) );
  +    }
  +
  +    private static String[] getDefaultHosts()
       {
           return new String[]{ 
             "http://dpml.net/",
  
  
  

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


Mime
View raw message