mcconnell 2003/11/17 00:20:35
Added: repository/test .cvsignore maven.xml project.xml
repository/test/src/test/org/apache/avalon/repository
ApplicationDirectiveTest.java
InitialRepositoryFactoryTest.java
Log:
Repository test system containing the bootstrap repository as the only dependency.
Revision Changes Path
1.1 avalon-sandbox/repository/test/.cvsignore
Index: .cvsignore
===================================================================
maven.log
velocity.log
build.properties
target
.classpath
.project
1.1 avalon-sandbox/repository/test/maven.xml
Index: maven.xml
===================================================================
<project default="merlin:build" xmlns:maven="jelly:maven" xmlns:j="jelly:core"
xmlns:util="jelly:util" xmlns:ant="jelly:ant">
<preGoal name="test:test">
<ant:mkdir dir="${maven.build.dir}/repository"/>
<copy todir="${maven.build.dir}/repository">
<fileset dir="${maven.repo.local}">
<include name="avalon-repository/**"/>
<include name="avalon-util/**"/>
</fileset>
</copy>
</preGoal>
</project>
1.1 avalon-sandbox/repository/test/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../project.xml</extend>
<groupId>avalon-repository</groupId>
<id>avalon-repository-test</id>
<name>Avalon Repository Test</name>
<currentVersion>1.2-dev</currentVersion>
<package>org.apache.avalon.repository</package>
<inceptionYear>2002</inceptionYear>
<shortDescription>Avalon Repository Test</shortDescription>
<dependencies>
<dependency>
<groupId>avalon-repository</groupId>
<artifactId>avalon-repository-main</artifactId>
<version>1.2-dev</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${basedir}/src/java/</sourceDirectory>
<unitTestSourceDirectory>${basedir}/src/test/</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.*</include>
<include>**/*TestCase.*</include>
</includes>
<excludes>
<exclude>**/Abstract*.*</exclude>
</excludes>
<resources>
<resource>
<directory>${basedir}/src/test</directory>
<includes>
<include>**/*.x*</include>
</includes>
</resource>
</resources>
</unitTest>
<resources>
<resource>
<directory>${basedir}/src/java</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>${basedir}/target/</directory>
<includes>
<include>**/*.app</include>
<include>*.meta</include>
</includes>
</resource>
</resources>
<jars></jars>
</build>
</project>
1.1
avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/ApplicationDirectiveTest.java
Index: ApplicationDirectiveTest.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.repository;
import java.util.Properties;
import junit.framework.TestCase;
/**
* @todo
* @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
* @author $Author: mcconnell $
* @version $Revision: 1.1 $
*/
public class ApplicationDirectiveTest extends TestCase
{
public static void main(String[] args)
{
junit.textui.TestRunner.run(ApplicationDirectiveTest.class);
}
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception
{
super.setUp();
}
/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
super.tearDown();
}
/**
* Constructor for ApplicationDirectiveTest.
* @param arg0
*/
public ApplicationDirectiveTest(String arg0)
{
super(arg0);
}
public void testNullConstructor() throws Exception
{
try
{
ApplicationDirective app = new ApplicationDirective( null, null );
fail( "No null pointer exception." );
}
catch( Throwable e )
{
assertTrue( true );
}
}
public void testReal() throws Exception
{
ArtifactReference ref =
new ArtifactReference( "avalon-repository", "avalon-repository-main" );
ApplicationDirective app = new ApplicationDirective( ref, getLocalRepo() );
JarDescriptor jar = app.getJarDescriptor();
assertTrue( "group", jar.getGroup().equals( "avalon-repository" ) );
assertTrue( "name", jar.getName().equals( "avalon-repository-impl" ) );
assertTrue( "type", jar.getType().equals( "jar" ) );
assertTrue( "version", jar.getVersion().equals( "1.2-dev" ) );
}
private static String[] getLocalRepo()
{
return new String[]{
"file:///" + System.getProperty( "basedir" ) + "/target/repository" };
}
}
1.1
avalon-sandbox/repository/test/src/test/org/apache/avalon/repository/InitialRepositoryFactoryTest.java
Index: InitialRepositoryFactoryTest.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.repository ;
import java.io.File;
import junit.framework.TestCase ;
/**
*
*
* @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
* @author $Author: mcconnell $
* @version $Revision: 1.1 $
*/
public class InitialRepositoryFactoryTest extends TestCase
{
public static void main(String[] args)
{
junit.textui.TestRunner.run(InitialRepositoryFactoryTest.class);
}
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception
{
super.setUp();
}
/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
super.tearDown();
}
/**
* Constructor for InitialRepositoryFactoryTest.
* @param arg0
*/
public InitialRepositoryFactoryTest(String arg0)
{
super(arg0);
}
public void testGetDefaultContext() throws Exception
{
RepositoryFactory l_factory = new InitialRepositoryFactory() ;
assertNotNull( l_factory ) ;
RepositoryContext l_context = l_factory.getDefaultContext() ;
assertNotNull( l_context ) ;
}
public void testRepositoryBootstrap() throws Exception
{
String [] l_urls = getRepositorySet();
RepositoryFactory l_factory = new InitialRepositoryFactory( l_urls ) ;
assertNotNull( l_factory ) ;
RepositoryContext l_config = l_factory.getDefaultContext() ;
assertNotNull( l_config ) ;
l_config.setCacheDir( System.getProperty( "user.home" )
+ File.separator + ".merlin" ) ;
l_config.setRemoteRepositoryUrls( l_urls ) ;
Repository l_repo = l_factory.create( l_config ) ;
assertNotNull( l_repo ) ;
l_repo.getArtifact("avalon-framework", "avalon-framework-api", "4.1.5",
"jar" ) ;
}
private static String[] getRepositorySet()
{
return new String[]{
"file:///" + System.getProperty( "basedir" ) + "/target/repository",
};
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]