use JUnit 4 API

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1136309 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2011-06-16 07:44:28 +00:00
parent 9b41c21838
commit ca05dcc62c
12 changed files with 34 additions and 27 deletions

View File

@ -19,16 +19,17 @@ package org.apache.maven.archiva.repository;
* under the License.
*/
import junit.framework.TestCase;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import javax.inject.Inject;
/**
* AbstractRepositoryLayerTestCase
@ -38,8 +39,9 @@ import java.io.File;
@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractRepositoryLayerTestCase
extends TestCase
{
@Rule
public TestName name = new TestName();
@Inject
protected ApplicationContext applicationContext;

View File

@ -25,6 +25,8 @@ import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
import org.apache.maven.archiva.repository.layout.LayoutException;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* AbstractDefaultRepositoryContentTestCase
*

View File

@ -24,6 +24,8 @@ import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
import org.apache.maven.archiva.repository.layout.LayoutException;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* AbstractLegacyRepositoryContentTestCase
*

View File

@ -29,6 +29,8 @@ import org.junit.Test;
import java.util.Collections;
import static org.junit.Assert.*;
/**
* ArtifactExtensionMappingTest
*

View File

@ -25,6 +25,8 @@ import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
import org.apache.maven.archiva.repository.layout.LayoutException;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* DefaultPathParserTest
*

View File

@ -31,6 +31,8 @@ import org.junit.Test;
import javax.inject.Inject;
import javax.inject.Named;
import static org.junit.Assert.*;
/**
* LegacyPathParserTest
*
@ -53,8 +55,6 @@ public class LegacyPathParserTest
public void setUp()
throws Exception
{
super.setUp();
parser = new LegacyPathParser( config );
LegacyArtifactPath jaxen = new LegacyArtifactPath();
jaxen.setPath( "jaxen/jars/jaxen-1.0-FCS-full.jar" );

View File

@ -32,14 +32,16 @@ import org.apache.maven.archiva.repository.layout.LayoutException;
import org.junit.Before;
import org.junit.Test;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import static org.junit.Assert.*;
/**
* ManagedDefaultRepositoryContentTest
@ -63,8 +65,6 @@ public class ManagedDefaultRepositoryContentTest
public void setUp()
throws Exception
{
super.setUp();
File repoDir = new File( "src/test/repositories/default-repository" );
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );

View File

@ -29,13 +29,15 @@ import org.apache.maven.archiva.repository.layout.LayoutException;
import org.junit.Before;
import org.junit.Test;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import static org.junit.Assert.*;
/**
* ManagedLegacyRepositoryContentTest
@ -53,8 +55,6 @@ public class ManagedLegacyRepositoryContentTest
public void setUp()
throws Exception
{
super.setUp();
File repoDir = new File( "src/test/repositories/legacy-repository" );
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );

View File

@ -43,8 +43,6 @@ public class RemoteDefaultRepositoryContentTest
public void setUp()
throws Exception
{
super.setUp();
RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
"http://repo1.maven.org/maven2/" );

View File

@ -44,8 +44,6 @@ public class RemoteLegacyRepositoryContentTest
public void setUp()
throws Exception
{
super.setUp();
RemoteRepositoryConfiguration repository =
createRemoteRepository( "testRemoteLegacyRepo", "Unit Test Remote Legacy Repo",
"http://repo1.maven.org/maven/" );

View File

@ -30,9 +30,11 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import java.io.File;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import static org.junit.Assert.*;
/**
* RepositoryRequestTest
@ -55,8 +57,6 @@ public class RepositoryRequestTest
public void setUp()
throws Exception
{
super.setUp();
LegacyPathParser legacyPathParser = new LegacyPathParser( archivaConfiguration );
repoRequest = new RepositoryRequest( legacyPathParser );
}

View File

@ -41,15 +41,17 @@ import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import org.xml.sax.SAXException;
import javax.inject.Inject;
import javax.inject.Named;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import javax.xml.parsers.ParserConfigurationException;
import static org.junit.Assert.*;
/**
* MetadataToolsTest
@ -67,7 +69,6 @@ public class MetadataToolsTest
@Named( value = "archivaConfiguration#mock" )
protected MockConfiguration config;
@Test
public void testGatherSnapshotVersionsA()
throws Exception
@ -355,7 +356,7 @@ public class MetadataToolsTest
reference.setVersion( version );
ManagedRepositoryConfiguration repo =
createRepository( "test-repo", "Test Repository: " + getName(), repoRootDir );
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRootDir );
ManagedRepositoryContent repoContent =
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
repoContent.setRepository( repo );
@ -574,7 +575,7 @@ public class MetadataToolsTest
private ManagedRepositoryContent createTestRepoContent()
throws Exception
{
File repoRoot = new File( "target/metadata-tests/" + getName() );
File repoRoot = new File( "target/metadata-tests/" + name.getMethodName() );
if ( repoRoot.exists() )
{
FileUtils.deleteDirectory( repoRoot );
@ -583,7 +584,7 @@ public class MetadataToolsTest
repoRoot.mkdirs();
ManagedRepositoryConfiguration repoConfig =
createRepository( "test-repo", "Test Repository: " + getName(), repoRoot );
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRoot );
ManagedRepositoryContent repoContent =
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );