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.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.rules.TestName;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractRepositoryLayerTestCase
|
* AbstractRepositoryLayerTestCase
|
||||||
|
@ -38,8 +39,9 @@ import java.io.File;
|
||||||
@RunWith( SpringJUnit4ClassRunner.class )
|
@RunWith( SpringJUnit4ClassRunner.class )
|
||||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
|
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
|
||||||
public abstract class AbstractRepositoryLayerTestCase
|
public abstract class AbstractRepositoryLayerTestCase
|
||||||
extends TestCase
|
|
||||||
{
|
{
|
||||||
|
@Rule
|
||||||
|
public TestName name = new TestName();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ApplicationContext applicationContext;
|
protected ApplicationContext applicationContext;
|
||||||
|
|
|
@ -25,6 +25,8 @@ import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
|
||||||
import org.apache.maven.archiva.repository.layout.LayoutException;
|
import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractDefaultRepositoryContentTestCase
|
* AbstractDefaultRepositoryContentTestCase
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,6 +24,8 @@ import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
|
||||||
import org.apache.maven.archiva.repository.layout.LayoutException;
|
import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractLegacyRepositoryContentTestCase
|
* AbstractLegacyRepositoryContentTestCase
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,6 +29,8 @@ import org.junit.Test;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArtifactExtensionMappingTest
|
* ArtifactExtensionMappingTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,6 +25,8 @@ import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
|
||||||
import org.apache.maven.archiva.repository.layout.LayoutException;
|
import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefaultPathParserTest
|
* DefaultPathParserTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,6 +31,8 @@ import org.junit.Test;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LegacyPathParserTest
|
* LegacyPathParserTest
|
||||||
*
|
*
|
||||||
|
@ -53,8 +55,6 @@ public class LegacyPathParserTest
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
|
||||||
|
|
||||||
parser = new LegacyPathParser( config );
|
parser = new LegacyPathParser( config );
|
||||||
LegacyArtifactPath jaxen = new LegacyArtifactPath();
|
LegacyArtifactPath jaxen = new LegacyArtifactPath();
|
||||||
jaxen.setPath( "jaxen/jars/jaxen-1.0-FCS-full.jar" );
|
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.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManagedDefaultRepositoryContentTest
|
* ManagedDefaultRepositoryContentTest
|
||||||
|
@ -63,8 +65,6 @@ public class ManagedDefaultRepositoryContentTest
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
|
||||||
|
|
||||||
File repoDir = new File( "src/test/repositories/default-repository" );
|
File repoDir = new File( "src/test/repositories/default-repository" );
|
||||||
|
|
||||||
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
|
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.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManagedLegacyRepositoryContentTest
|
* ManagedLegacyRepositoryContentTest
|
||||||
|
@ -53,8 +55,6 @@ public class ManagedLegacyRepositoryContentTest
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
|
||||||
|
|
||||||
File repoDir = new File( "src/test/repositories/legacy-repository" );
|
File repoDir = new File( "src/test/repositories/legacy-repository" );
|
||||||
|
|
||||||
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
|
ManagedRepositoryConfiguration repository = createRepository( "testRepo", "Unit Test Repo", repoDir );
|
||||||
|
|
|
@ -43,8 +43,6 @@ public class RemoteDefaultRepositoryContentTest
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
|
||||||
|
|
||||||
RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
|
RemoteRepositoryConfiguration repository = createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo",
|
||||||
"http://repo1.maven.org/maven2/" );
|
"http://repo1.maven.org/maven2/" );
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,6 @@ public class RemoteLegacyRepositoryContentTest
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
|
||||||
|
|
||||||
RemoteRepositoryConfiguration repository =
|
RemoteRepositoryConfiguration repository =
|
||||||
createRemoteRepository( "testRemoteLegacyRepo", "Unit Test Remote Legacy Repo",
|
createRemoteRepository( "testRemoteLegacyRepo", "Unit Test Remote Legacy Repo",
|
||||||
"http://repo1.maven.org/maven/" );
|
"http://repo1.maven.org/maven/" );
|
||||||
|
|
|
@ -30,9 +30,11 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import java.io.File;
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryRequestTest
|
* RepositoryRequestTest
|
||||||
|
@ -55,8 +57,6 @@ public class RepositoryRequestTest
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
|
||||||
|
|
||||||
LegacyPathParser legacyPathParser = new LegacyPathParser( archivaConfiguration );
|
LegacyPathParser legacyPathParser = new LegacyPathParser( archivaConfiguration );
|
||||||
repoRequest = new RepositoryRequest( legacyPathParser );
|
repoRequest = new RepositoryRequest( legacyPathParser );
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,15 +41,17 @@ import org.junit.Test;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.xml.sax.SAXException;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MetadataToolsTest
|
* MetadataToolsTest
|
||||||
|
@ -67,7 +69,6 @@ public class MetadataToolsTest
|
||||||
@Named( value = "archivaConfiguration#mock" )
|
@Named( value = "archivaConfiguration#mock" )
|
||||||
protected MockConfiguration config;
|
protected MockConfiguration config;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGatherSnapshotVersionsA()
|
public void testGatherSnapshotVersionsA()
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -355,7 +356,7 @@ public class MetadataToolsTest
|
||||||
reference.setVersion( version );
|
reference.setVersion( version );
|
||||||
|
|
||||||
ManagedRepositoryConfiguration repo =
|
ManagedRepositoryConfiguration repo =
|
||||||
createRepository( "test-repo", "Test Repository: " + getName(), repoRootDir );
|
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRootDir );
|
||||||
ManagedRepositoryContent repoContent =
|
ManagedRepositoryContent repoContent =
|
||||||
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
|
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
|
||||||
repoContent.setRepository( repo );
|
repoContent.setRepository( repo );
|
||||||
|
@ -574,7 +575,7 @@ public class MetadataToolsTest
|
||||||
private ManagedRepositoryContent createTestRepoContent()
|
private ManagedRepositoryContent createTestRepoContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File repoRoot = new File( "target/metadata-tests/" + getName() );
|
File repoRoot = new File( "target/metadata-tests/" + name.getMethodName() );
|
||||||
if ( repoRoot.exists() )
|
if ( repoRoot.exists() )
|
||||||
{
|
{
|
||||||
FileUtils.deleteDirectory( repoRoot );
|
FileUtils.deleteDirectory( repoRoot );
|
||||||
|
@ -583,7 +584,7 @@ public class MetadataToolsTest
|
||||||
repoRoot.mkdirs();
|
repoRoot.mkdirs();
|
||||||
|
|
||||||
ManagedRepositoryConfiguration repoConfig =
|
ManagedRepositoryConfiguration repoConfig =
|
||||||
createRepository( "test-repo", "Test Repository: " + getName(), repoRoot );
|
createRepository( "test-repo", "Test Repository: " + name.getMethodName(), repoRoot );
|
||||||
|
|
||||||
ManagedRepositoryContent repoContent =
|
ManagedRepositoryContent repoContent =
|
||||||
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
|
applicationContext.getBean( "managedRepositoryContent#default", ManagedRepositoryContent.class );
|
||||||
|
|
Loading…
Reference in New Issue