mirror of https://github.com/apache/archiva.git
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:
parent
9b41c21838
commit
ca05dcc62c
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.junit.Test;
|
|||
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* ArtifactExtensionMappingTest
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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" );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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/" );
|
||||
|
||||
|
|
|
@ -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/" );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue