[MRM-1638] Improve unit test for archiva build

Based on patch provided by Eric Barboni.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1356091 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-02 07:36:23 +00:00
parent e3885c59da
commit 1484a3316a
146 changed files with 844 additions and 237 deletions

View File

@ -76,8 +76,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -36,7 +36,6 @@ import org.junit.Test;
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;
@ -47,13 +46,14 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* LegacyToDefaultConverterTest
*
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class LegacyToDefaultConverterTest
extends TestCase

View File

@ -38,10 +38,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>

View File

@ -19,16 +19,19 @@ package org.apache.archiva.checksum;
* under the License.
*/
import java.io.File;
import junit.framework.TestCase;
import org.apache.archiva.common.utils.FileUtil;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.runner.RunWith;
import java.io.File;
/**
* AbstractChecksumTestCase
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractChecksumTestCase
extends TestCase
{

View File

@ -22,27 +22,34 @@ package org.apache.archiva.checksum;
import java.io.File;
import junit.framework.TestCase;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* ChecksumAlgorithmTest
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ChecksumAlgorithmTest
extends TestCase
{
@Test
public void testGetHashByExtensionSha1()
{
assertEquals( ChecksumAlgorithm.SHA1, ChecksumAlgorithm.getByExtension( new File( "something.jar.sha1" ) ) );
assertEquals( ChecksumAlgorithm.SHA1, ChecksumAlgorithm.getByExtension( new File( "OTHER.JAR.SHA1" ) ) );
}
@Test
public void testGetHashByExtensionMd5()
{
assertEquals( ChecksumAlgorithm.MD5, ChecksumAlgorithm.getByExtension( new File( "something.jar.md5" ) ) );
assertEquals( ChecksumAlgorithm.MD5, ChecksumAlgorithm.getByExtension( new File( "OTHER.JAR.MD5" ) ) );
}
@Test
public void testGetHashByExtensionInvalid()
{
try

View File

@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
/**
* ChecksumTest
@ -34,6 +35,7 @@ public class ChecksumTest
{
private static final String UNSET_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
@Test
public void testConstructSha1()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
@ -41,6 +43,7 @@ public class ChecksumTest
.getAlgorithm() );
}
@Test
public void testConstructMd5()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.MD5 );
@ -48,6 +51,7 @@ public class ChecksumTest
.getAlgorithm() );
}
@Test
public void testUpdate()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
@ -57,6 +61,7 @@ public class ChecksumTest
assertEquals( "Checksum", "e396119ae0542e85a74759602fd2f81e5d36d762", checksum.getChecksum() );
}
@Test
public void testUpdateMany()
throws IOException
{
@ -76,6 +81,7 @@ public class ChecksumTest
assertEquals( "Checksum MD5", "21c2c5ca87ec018adacb2e2fb3432219", checksumMd5.getChecksum() );
}
@Test
public void testUpdateWholeUpdatePartial()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );

View File

@ -24,12 +24,14 @@ import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
/**
* ChecksummedFileTest
*
* @version $Id$
*/
public class ChecksummedFileTest
extends AbstractChecksumTestCase
{
@ -75,6 +77,7 @@ public class ChecksummedFileTest
return jarFile;
}
@Test
public void testCalculateChecksumMd5()
throws IOException
{
@ -85,6 +88,7 @@ public class ChecksummedFileTest
assertEquals( expectedChecksum, actualChecksum );
}
@Test
public void testCalculateChecksumSha1()
throws IOException
{
@ -95,6 +99,7 @@ public class ChecksummedFileTest
assertEquals( expectedChecksum, actualChecksum );
}
@Test
public void testCreateChecksum()
throws IOException
{
@ -108,6 +113,7 @@ public class ChecksummedFileTest
assertEquals( "2bb14b388973351b0a4dfe11d171965f59cc61a1 redback-authz-open.jar", hashContents );
}
@Test
public void testFixChecksum()
throws IOException
{
@ -126,12 +132,14 @@ public class ChecksummedFileTest
assertTrue( "ChecksummedFile.isValid(SHA1) == true", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) );
}
@Test
public void testGetChecksumFile()
{
ChecksummedFile checksummedFile = new ChecksummedFile( new File( "test.jar" ) );
assertEquals( "test.jar.sha1", checksummedFile.getChecksumFile( ChecksumAlgorithm.SHA1 ).getName() );
}
@Test
public void testIsValidChecksum()
throws IOException
{
@ -141,6 +149,7 @@ public class ChecksummedFileTest
assertTrue( "ChecksummedFile.isValid(SHA1)", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) );
}
@Test
public void testIsValidChecksumInvalidSha1Format()
throws IOException
{
@ -155,6 +164,7 @@ public class ChecksummedFileTest
}
@Test
public void testIsValidChecksumNoChecksumFiles()
throws IOException
{
@ -167,6 +177,7 @@ public class ChecksummedFileTest
}
@Test
public void testIsValidChecksumSha1AndMd5()
throws IOException
{
@ -178,6 +189,7 @@ public class ChecksummedFileTest
ChecksumAlgorithm.MD5 } ) );
}
@Test
public void testIsValidChecksumSha1NoMd5()
throws IOException
{
@ -190,6 +202,7 @@ public class ChecksummedFileTest
}
@Test
public void testParseChecksum()
throws IOException
{
@ -204,6 +217,7 @@ public class ChecksummedFileTest
}
@Test
public void testParseChecksumAltDash1()
throws IOException
{
@ -215,6 +229,7 @@ public class ChecksummedFileTest
assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
}
@Test
public void testParseChecksumAltDash2()
throws IOException
{
@ -226,6 +241,7 @@ public class ChecksummedFileTest
assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
}
@Test
public void testRemoteMetadataChecksumFilePathSha1()
throws IOException
{
@ -246,6 +262,7 @@ public class ChecksummedFileTest
}
}
@Test
public void testRemoteMetadataChecksumFilePathMd5()
throws IOException
{

View File

@ -103,20 +103,11 @@
<artifactId>archiva-policies</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -32,17 +32,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 java.util.List;
import java.util.Map;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* Test the configuration store.
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class ArchivaConfigurationTest
extends TestCase

View File

@ -22,16 +22,16 @@ package org.apache.archiva.configuration;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* Test the generated Configuration class from Modello. This is primarily to test the hand coded methods.
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ConfigurationTest
extends TestCase
{

View File

@ -23,11 +23,11 @@ import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class FileTypesTest
extends TestCase

View File

@ -20,16 +20,16 @@ package org.apache.archiva.configuration;
*/
import junit.framework.TestCase;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods.
*
* @since 1.1
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class LegacyArtifactPathTest
extends TestCase
{

View File

@ -30,10 +30,11 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class MavenProxyPropertyLoaderTest
extends TestCase
{

View File

@ -26,15 +26,20 @@ import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* ProxyConnectorConfigurationOrderComparatorTest
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ProxyConnectorConfigurationOrderComparatorTest
extends TestCase
{
@Test
public void testSortOfAllZeros()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();
@ -49,6 +54,7 @@ public class ProxyConnectorConfigurationOrderComparatorTest
assertProxyOrder( new String[]{ "corporate", "snapshots", "3rdparty", "sandbox" }, proxies );
}
@Test
public void testSortNormal()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();
@ -63,6 +69,7 @@ public class ProxyConnectorConfigurationOrderComparatorTest
assertProxyOrder( new String[]{ "snapshots", "3rdparty", "corporate", "sandbox" }, proxies );
}
@Test
public void testSortPartial()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();

View File

@ -24,13 +24,18 @@ import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import java.util.Comparator;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Test the repositry comparator.
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryConfigurationComparatorTest
extends TestCase
{
@Test
public void testComparator()
{
Comparator<AbstractRepositoryConfiguration> comparator = new RepositoryConfigurationComparator();

View File

@ -67,8 +67,9 @@
<!-- test dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -35,12 +35,12 @@ import org.junit.Test;
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 org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractArtifactConsumerTest
extends TestCase

View File

@ -21,10 +21,7 @@ package org.apache.archiva.consumers.core.repository;
import junit.framework.TestCase;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.repository.ManagedRepositoryContent;
@ -39,18 +36,17 @@ import org.junit.Before;
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 java.io.IOException;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractRepositoryPurgeTest
extends TestCase

View File

@ -74,8 +74,9 @@
<artifactId>archiva-repository-admin-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -36,7 +36,6 @@ import org.junit.Test;
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;
@ -46,11 +45,12 @@ import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* NexusIndexerConsumerTest
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class NexusIndexerConsumerTest
extends TestCase

View File

@ -68,10 +68,11 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -31,7 +31,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
@ -39,6 +38,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* Test the repository converter.
@ -48,7 +48,7 @@ import java.util.List;
* @todo should reject if dependencies are missing - rely on reporting?
* @todo group metadata
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath:/spring-context.xml"} )
public class RepositoryConverterTest
extends TestCase

View File

@ -113,8 +113,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -48,11 +48,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import java.util.List;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractNexusRepositorySearch
extends TestCase

View File

@ -22,14 +22,14 @@ import junit.framework.TestCase;
import org.apache.archiva.indexer.util.SearchUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Arrays;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class NexusRepositorySearchPaginateTest
extends TestCase
{

View File

@ -24,16 +24,16 @@ import org.apache.archiva.indexer.util.SearchUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class NexusRepositorySearchTest
extends AbstractNexusRepositorySearch

View File

@ -42,8 +42,9 @@
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -20,12 +20,16 @@ package org.apache.archiva.model;
*/
import junit.framework.TestCase;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* RepositoryURLTest
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryURLTest
extends TestCase
{
@ -49,43 +53,51 @@ public class RepositoryURLTest
assertEquals( "Password", expectedPassword, rurl.getPassword() );
}
@Test
public void testFileUrlNormal()
{
assertURL( "file:///home/joakim/code/test/this/", "file", NO_HOST, NO_PORT, "/home/joakim/code/test/this/",
NO_USER, NO_PASS );
}
@Test
public void testFileUrlShort()
{
assertURL( "file:/home/joakim/code/test/this/", "file", NO_HOST, NO_PORT, "/home/joakim/code/test/this/",
NO_USER, NO_PASS );
}
@Test
public void testHttpUrlPathless()
{
assertURL( "http://machine", "http", "machine", NO_PORT, "/", NO_USER, NO_PASS );
}
@Test
public void testHttpUrlWithPort()
{
assertURL( "http://machine:8080/", "http", "machine", "8080", "/", NO_USER, NO_PASS );
}
@Test
public void testHttpUrlWithUsernamePassword()
{
assertURL( "http://user:pass@machine/secured/", "http", "machine", NO_PORT, "/secured/", "user", "pass" );
}
@Test
public void testHttpUrlWithUsernameNoPassword()
{
assertURL( "http://user@machine/secured/", "http", "machine", NO_PORT, "/secured/", "user", NO_PASS );
}
@Test
public void testHttpUrlWithUsernamePasswordAndPort()
{
assertURL( "http://user:pass@machine:9090/secured/", "http", "machine", "9090", "/secured/", "user", "pass" );
}
@Test
public void testBogusWithPath()
{
// This should not fail. The intent of RepositoryURL is to have it support oddball protocols that

View File

@ -81,10 +81,11 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>

View File

@ -24,19 +24,19 @@ import org.apache.archiva.policies.urlcache.UrlFailureCache;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Properties;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* CachedFailuresPolicyTest
*
* @version $Id$
*/
@RunWith( value = SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class CachedFailuresPolicyTest
extends TestCase

View File

@ -26,7 +26,6 @@ import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.BufferedReader;
import java.io.File;
@ -34,6 +33,7 @@ import java.io.FileReader;
import java.util.Properties;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@ -42,7 +42,7 @@ import static org.junit.Assert.*;
*
* @version $Id$
*/
@RunWith( value = SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml"} )
public class ChecksumPolicyTest
{

View File

@ -25,19 +25,19 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Properties;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* ReleasePolicyTest
*
* @version $Id$
*/
@RunWith( value = SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class ReleasePolicyTest
extends TestCase

View File

@ -25,19 +25,19 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Properties;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* SnapshotsPolicyTest
*
* @version $Id$
*/
@RunWith( value = SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class SnapshotsPolicyTest
extends TestCase

View File

@ -62,10 +62,11 @@
<artifactId>commons-logging-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -24,15 +24,15 @@ import org.apache.maven.wagon.Wagon;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* Test the WagonFactory works through Spring to be bound into the RepositoryProxyConnectors implementation.
*
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class WagonFactoryTest
extends TestCase

View File

@ -129,10 +129,11 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-admin-default</artifactId>

View File

@ -63,6 +63,7 @@ import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Locale;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@ -71,7 +72,7 @@ import static org.junit.Assert.*;
*
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractProxyTestCase
{

View File

@ -45,7 +45,6 @@ import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.servlet.ServletException;
@ -53,6 +52,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@ -61,7 +61,7 @@ import static org.junit.Assert.*;
*
* @version $Id: ManagedDefaultTransferTest.java 677852 2008-07-18 08:16:24Z brett $
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class HttpProxyTransferTest
{

View File

@ -92,6 +92,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>

View File

@ -35,16 +35,16 @@ import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import java.util.List;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractRepositoryAdminTest
extends TestCase

View File

@ -67,10 +67,11 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-model</artifactId>

View File

@ -28,17 +28,17 @@ 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 java.io.File;
import javax.inject.Inject;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* AbstractRepositoryLayerTestCase
*
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractRepositoryLayerTestCase
{

View File

@ -25,12 +25,16 @@ import org.apache.archiva.model.RepositoryURL;
import java.net.MalformedURLException;
import junit.framework.TestCase;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* RepositoryURLTest
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryURLTest
extends TestCase
{
@ -46,7 +50,8 @@ public class RepositoryURLTest
assertEquals( port, url.getPort() );
assertEquals( path, url.getPath() );
}
@Test
public void testProtocolHttp()
throws MalformedURLException
{
@ -54,6 +59,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
@Test
public void testProtocolWagonWebdav()
throws MalformedURLException
{
@ -61,6 +67,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
@Test
public void testProtocolHttpWithPort()
throws MalformedURLException
{
@ -68,6 +75,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
@Test
public void testProtocolHttpWithUsername()
throws MalformedURLException
{
@ -75,6 +83,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
@Test
public void testProtocolHttpWithUsernamePassword()
throws MalformedURLException
{
@ -82,6 +91,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
@Test
public void testProtocolHttpWithUsernamePasswordPort()
throws MalformedURLException
{

View File

@ -20,16 +20,16 @@ package org.apache.archiva.repository.content;
*/
import junit.framework.TestCase;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* FilenameParserTest
*
* @version $Id$
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class FilenameParserTest
extends TestCase
{

View File

@ -25,16 +25,16 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.xml.XMLException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.File;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* RepositoryMetadataReaderTest
*
* @version $Id$
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryMetadataReaderTest
extends TestCase
{

View File

@ -25,17 +25,17 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.custommonkey.xmlunit.XMLAssert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.File;
import java.io.StringWriter;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* RepositoryMetadataWriterTest
*
* @version $Id$
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryMetadataWriterTest
extends TestCase
{

View File

@ -58,8 +58,9 @@
-->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -40,7 +40,6 @@ import org.springframework.context.NoSuchMessageException;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
@ -53,13 +52,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* RepositoryContentConsumersTest
*
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class RepositoryContentConsumersTest
extends TestCase

View File

@ -29,7 +29,6 @@ import org.junit.Test;
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;
@ -41,13 +40,14 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* RepositoryScannerTest
*
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class RepositoryScannerTest
extends TestCase

View File

@ -52,8 +52,9 @@
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -29,16 +29,22 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Before;
import org.junit.runner.RunWith;
/**
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractFileEventTest
extends TestCase
{
protected List<Digester> digesters;
@SuppressWarnings( "unchecked" )
@Before
@Override
public void setUp()
throws Exception
{

View File

@ -24,6 +24,9 @@ import org.apache.archiva.common.utils.FileUtil;
import java.io.File;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
*/
@ -40,6 +43,8 @@ public class CopyFileEventTest
private String source, oldChecksum;
@Override
@Before
public void setUp()
throws Exception
{
@ -67,7 +72,8 @@ public class CopyFileEventTest
oldChecksum = readFile( testDestChecksum );
}
@Test
public void testCopyCommitRollback()
throws Exception
{
@ -92,6 +98,7 @@ public class CopyFileEventTest
assertChecksumRollback( testDest );
}
@Test
public void testCopyCommitRollbackWithBackup()
throws Exception
{
@ -126,6 +133,7 @@ public class CopyFileEventTest
assertChecksumRollback( testDest );
}
@Test
public void testCreateRollbackCommit()
throws Exception
{
@ -148,7 +156,9 @@ public class CopyFileEventTest
assertTrue( "Test that the destination contents are copied correctly", source.equals( target ) );
}
protected void tearDown()
@After
@Override
public void tearDown()
throws Exception
{
super.tearDown();
@ -156,6 +166,7 @@ public class CopyFileEventTest
FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "target/transaction-tests" ) );
}
@Override
protected void assertChecksumCommit( File file )
throws IOException
{
@ -166,6 +177,7 @@ public class CopyFileEventTest
assertFalse( "Test that the destination checksum contents are created correctly", oldChecksum.equals( target ) );
}
@Override
protected void assertChecksumRollback( File file )
throws IOException
{

View File

@ -23,6 +23,8 @@ import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.archiva.common.utils.FileUtil;
import org.junit.After;
import org.junit.Test;
/**
*/
@ -31,6 +33,7 @@ public class CreateFileEventTest
{
private File testDir = new File( FileUtil.getBasedir(), "target/transaction-tests/create-file" );
@Test
public void testCreateCommitRollback()
throws Exception
{
@ -56,6 +59,7 @@ public class CreateFileEventTest
assertTrue( "target directory still exists", new File( FileUtil.getBasedir(), "target" ).exists() );
}
@Test
public void testCreateCommitRollbackWithBackup()
throws Exception
{
@ -90,6 +94,7 @@ public class CreateFileEventTest
assertChecksumRollback( testFile );
}
@Test
public void testCreateRollbackCommit()
throws Exception
{
@ -110,7 +115,9 @@ public class CreateFileEventTest
assertChecksumCommit( testFile );
}
protected void tearDown()
@Override
@After
public void tearDown()
throws Exception
{
super.tearDown();

View File

@ -53,6 +53,12 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -22,12 +22,15 @@ package org.apache.archiva.xml;
import java.io.File;
import junit.framework.TestCase;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.runner.RunWith;
/**
* AbstractArchivaXmlTestCase
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractArchivaXmlTestCase
extends TestCase
{

View File

@ -20,15 +20,20 @@ package org.apache.archiva.xml;
*/
import junit.framework.TestCase;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* LatinEntitiesTest
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class LatinEntitiesTest
extends TestCase
{
@Test
public void testResolveEntity()
{
// Good Entities.

View File

@ -32,6 +32,7 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.net.URL;
import org.junit.Test;
/**
* LatinEntityResolutionReaderTest
@ -139,7 +140,8 @@ public class LatinEntityResolutionReaderTest
fail( "IOException: " + e.getMessage() );
}
}
@Test
public void testReaderNormalBufsize()
throws IOException
{
@ -155,6 +157,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 4096 );
}
@Test
public void testReaderSmallBufsize()
throws IOException
{
@ -170,6 +173,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 1024 );
}
@Test
public void testReaderRediculouslyTinyBufsize()
throws IOException
{
@ -185,6 +189,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 32 );
}
@Test
public void testReaderHugeBufsize()
throws IOException
{
@ -200,7 +205,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 409600 );
}
@Test
public void testReaderLeftOver()
throws IOException
{
@ -225,7 +230,7 @@ public class LatinEntityResolutionReaderTest
}
}
@Test
public void testNoLatinEntitiesHugeLine()
{
assertProperRead( "commons-codec-1.2.pom", "commons-codec-1.2.pom", 4096 );

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import org.dom4j.Element;
import org.junit.Test;
/**
* XMLReaderTest
@ -49,7 +50,8 @@ public class XMLReaderTest
assertTrue( "Contains [" + expectedText + "]", texts.contains( expectedText ) );
}
}
@Test
public void testNoPrologBasicRead()
throws XMLException
{
@ -60,6 +62,7 @@ public class XMLReaderTest
assertElementTexts( fruits, new String[] { "apple", "cherry", "pear", "peach" } );
}
@Test
public void testNoPrologEntitiesRead()
throws XMLException
{
@ -70,6 +73,7 @@ public class XMLReaderTest
assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
}
@Test
public void testNoPrologUtf8Read()
throws XMLException
{
@ -80,6 +84,7 @@ public class XMLReaderTest
assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
}
@Test
public void testPrologUtf8Read()
throws XMLException
{
@ -91,6 +96,7 @@ public class XMLReaderTest
}
// MRM-1136
@Test
public void testProxiedMetadataRead()
throws XMLException
{

View File

@ -24,6 +24,7 @@ import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.io.StringWriter;
import org.junit.Test;
/**
* XMLWriterTest
@ -33,6 +34,7 @@ import java.io.StringWriter;
public class XMLWriterTest
extends AbstractArchivaXmlTestCase
{
@Test
public void testWrite()
throws Exception
{

View File

@ -91,7 +91,13 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-admin-default</artifactId>

View File

@ -42,7 +42,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.BufferedInputStream;
@ -55,11 +54,12 @@ import java.io.IOException;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* ArchivaIndexingTaskExecutorTest
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class ArchivaIndexingTaskExecutorTest
extends TestCase

View File

@ -43,18 +43,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class DownloadRemoteIndexTaskTest
extends TestCase

View File

@ -86,10 +86,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>

View File

@ -31,22 +31,22 @@ import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Calendar;
import java.util.List;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.mockito.Mockito.mock;
/**
* ArchivaRepositoryScanningTaskExecutorPhase1Test
*
* @version $Id: ArchivaRepositoryScanningTaskExecutorPhase1Test.java 1214303 2011-12-14 15:37:51Z olamy $
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
extends TestCase
@ -78,6 +78,7 @@ public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
protected MetadataRepository metadataRepository;
@Before
@Override
public void setUp()
throws Exception
{
@ -123,6 +124,7 @@ public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
}
@After
@Override
public void tearDown()
throws Exception
{

View File

@ -30,9 +30,8 @@ import java.util.Collection;
/**
* ArchivaRepositoryScanningTaskExecutorPhase1Test
*
* @version $Id: ArchivaRepositoryScanningTaskExecutorPhase1Test.java 1214303 2011-12-14 15:37:51Z olamy $
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class ArchivaRepositoryScanningTaskExecutorPhase1Test
extends ArchivaRepositoryScanningTaskExecutorAbstractTest

View File

@ -36,9 +36,9 @@ import java.util.Date;
/**
* ArchivaRepositoryScanningTaskExecutorPhase2Test
*
* @version $Id: ArchivaRepositoryScanningTaskExecutorTest.java 1214303 2011-12-14 15:37:51Z olamy $
* @version $Id$
*/
@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class ArchivaRepositoryScanningTaskExecutorPhase2Test
extends ArchivaRepositoryScanningTaskExecutorAbstractTest

View File

@ -225,7 +225,12 @@
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>

View File

@ -45,10 +45,13 @@ import javax.ws.rs.core.MediaType;
import java.io.File;
import java.util.Collections;
import java.util.Date;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.runner.RunWith;
/**
* @author Olivier Lamy
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractArchivaRestTest
extends AbstractRestServicesTest
{

View File

@ -56,6 +56,12 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>

View File

@ -26,17 +26,17 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* @version
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml"} )
public class RssFeedGeneratorTest
extends TestCase

View File

@ -34,7 +34,6 @@ import org.apache.archiva.rss.RssFeedGenerator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.ArrayList;
import java.util.Calendar;
@ -44,8 +43,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class NewArtifactsRssFeedProcessorTest
extends TestCase
{

View File

@ -29,7 +29,6 @@ import org.easymock.MockControl;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Arrays;
import java.util.Collections;
@ -37,8 +36,9 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class NewVersionsOfArtifactRssFeedProcessorTest
extends TestCase
{

View File

@ -146,6 +146,12 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>

View File

@ -38,18 +38,18 @@ import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* AbstractSecurityTest
*
* @version $Id: AbstractSecurityTest
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public abstract class AbstractSecurityTest
extends TestCase

View File

@ -24,16 +24,16 @@ import org.apache.archiva.redback.role.RoleManager;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* RoleProfilesTest
*
* @version $Id: RoleManagerTest.java 4330 2007-05-10 17:28:56Z jmcconnell $
*/
@RunWith( SpringJUnit4ClassRunner.class )
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class RoleManagerTest
extends TestCase

View File

@ -139,6 +139,12 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>

View File

@ -35,12 +35,12 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
@RunWith( BlockJUnit4ClassRunner.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RssFeedServletTest
extends TestCase
{

View File

@ -650,7 +650,12 @@
<artifactId>mail</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -29,10 +29,13 @@ import org.junit.Test;
import java.io.File;
import java.util.Collections;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.runner.RunWith;
/**
* @author Olivier Lamy
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RuntimeInfoServiceTest
extends AbstractRestServicesTest
{

View File

@ -875,7 +875,13 @@
<scope>test</scope>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>

View File

@ -49,10 +49,13 @@ import org.slf4j.LoggerFactory;
import org.springframework.web.context.ContextLoaderListener;
import java.util.Collections;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.runner.RunWith;
/**
* @author Olivier Lamy
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractDownloadTest
extends TestCase
{

View File

@ -34,7 +34,6 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -51,11 +50,12 @@ import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class DownloadArtifactsTest
extends AbstractDownloadTest
{

View File

@ -37,16 +37,16 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
@RunWith( JUnit4.class )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class DownloadMergedIndexTest
extends AbstractDownloadTest
{

View File

@ -43,7 +43,11 @@ import org.apache.struts2.StrutsSpringTestCase;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractActionTestCase
extends StrutsSpringTestCase
{
@ -207,7 +211,8 @@ public abstract class AbstractActionTestCase
}
@Override
protected void setUp( )
@Before
public void setUp( )
throws Exception
{
super.setUp( );
@ -223,7 +228,8 @@ public abstract class AbstractActionTestCase
}
@Override
protected void tearDown( )
@After
public void tearDown( )
throws Exception
{
super.tearDown( );

View File

@ -26,12 +26,14 @@ import org.apache.struts2.StrutsSpringTestCase;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.List;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.runner.RunWith;
/**
* AbstractWebworkTestCase
*
* @version $Id$
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractWebworkTestCase
extends StrutsSpringTestCase
{

View File

@ -30,6 +30,7 @@ import org.apache.archiva.scheduler.indexing.DefaultDownloadRemoteIndexScheduler
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -47,7 +48,8 @@ public class BrowseActionTest
private static final String OTHER_TEST_REPO = "other-repo";
protected void setUp()
@Override
public void setUp()
throws Exception
{
super.setUp();
@ -61,7 +63,8 @@ public class BrowseActionTest
factory.setRepositorySession( repositorySession );
}
protected void tearDown()
@Override
public void tearDown()
throws Exception
{
super.tearDown();
@ -69,11 +72,13 @@ public class BrowseActionTest
setObservableRepos( Lists.<String>newArrayList( "test-repo" ) );
}
@Test
public void testInstantiation()
{
assertFalse( action == getActionProxy( "/browse.action" ).getAction() );
}
@Test
public void testBrowse()
throws Exception
{
@ -92,6 +97,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseNoObservableRepos()
throws Exception
{
@ -103,6 +109,7 @@ public class BrowseActionTest
assertNoOutputVariables();
}
@Test
public void testBrowseGroupNoObservableRepos()
throws Exception
{
@ -122,6 +129,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseArtifactNoObservableRepos()
throws Exception
{
@ -143,6 +151,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseGroupNoGroupId()
throws Exception
{
@ -151,6 +160,7 @@ public class BrowseActionTest
assertNoOutputVariables();
}
@Test
public void testBrowseGroupNoArtifacts()
throws Exception
{
@ -172,6 +182,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseGroupWithArtifacts()
throws Exception
{
@ -195,6 +206,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseWithCollapsedGroupsAndArtifacts()
throws Exception
{
@ -217,6 +229,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseWithCollapsedGroupsAndArtifactsAcrossRepositories()
throws Exception
{
@ -241,6 +254,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseGroupWithCollapsedGroupsAndArtifacts()
throws Exception
{
@ -266,6 +280,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseArtifactNoGroupId()
throws Exception
{
@ -284,6 +299,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseArtifactNoArtifactId()
throws Exception
{
@ -302,6 +318,7 @@ public class BrowseActionTest
assertNull( action.getSharedModel() );
}
@Test
public void testBrowseArtifact()
throws Exception
@ -336,6 +353,7 @@ public class BrowseActionTest
assertDefaultModel( model, selectedGroupId, selectedArtifactId, null );
}
@Test
public void testBrowseArtifactWithSnapshots()
throws Exception

View File

@ -44,7 +44,12 @@ import java.util.ArrayList;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class DeleteArtifactActionTest
extends StrutsSpringTestCase
{
@ -79,7 +84,8 @@ public class DeleteArtifactActionTest
}
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -111,7 +117,8 @@ public class DeleteArtifactActionTest
}
@Override
protected void tearDown()
@After
public void tearDown()
throws Exception
{
action = null;
@ -120,6 +127,7 @@ public class DeleteArtifactActionTest
}
@Test
public void testNPEInDeleteArtifact()
throws Exception
{

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -72,7 +73,7 @@ public class SearchActionTest
private RepositorySession session;
@Override
protected void setUp()
public void setUp()
throws Exception
{
super.setUp();
@ -107,6 +108,7 @@ public class SearchActionTest
// quick search...
@Test
public void testQuickSearch()
throws Exception
{
@ -153,6 +155,7 @@ public class SearchActionTest
searchControl.verify();
}
@Test
public void testSearchWithinSearchResults()
throws Exception
{
@ -203,6 +206,7 @@ public class SearchActionTest
searchControl.verify();
}
@Test
public void testQuickSearchUserHasNoAccessToAnyRepository()
throws Exception
{
@ -223,6 +227,7 @@ public class SearchActionTest
userReposControl.verify();
}
@Test
public void testQuickSearchNoSearchHits()
throws Exception
{
@ -258,6 +263,7 @@ public class SearchActionTest
// advanced/filtered search...
@Test
public void testAdvancedSearchOneRepository()
throws Exception
{
@ -305,6 +311,7 @@ public class SearchActionTest
searchControl.verify();
}
@Test
public void testAdvancedSearchAllRepositories()
throws Exception
{
@ -356,6 +363,7 @@ public class SearchActionTest
userReposControl.verify();
}
@Test
public void testAdvancedSearchNoSearchHits()
throws Exception
{
@ -393,6 +401,7 @@ public class SearchActionTest
searchControl.verify();
}
@Test
public void testAdvancedSearchUserHasNoAccessToAnyRepository()
throws Exception
{
@ -406,6 +415,7 @@ public class SearchActionTest
assertEquals(GlobalResults.ACCESS_TO_NO_REPOS, result);
}
@Test
public void testAdvancedSearchNoSpecifiedCriteria()
throws Exception
{
@ -422,6 +432,7 @@ public class SearchActionTest
}
// find artifact..
@Test
public void testFindArtifactWithOneHit()
throws Exception
{
@ -450,6 +461,7 @@ public class SearchActionTest
userReposControl.verify();
}
@Test
public void testFindArtifactWithMultipleHits()
throws Exception
{
@ -478,6 +490,7 @@ public class SearchActionTest
userReposControl.verify();
}
@Test
public void testFindArtifactNoChecksumSpecified()
throws Exception
{
@ -488,6 +501,7 @@ public class SearchActionTest
assertEquals("Unable to search for a blank checksum", (String) action.getActionErrors().iterator().next());
}
@Test
public void testFindArtifactNoResults()
throws Exception
{

View File

@ -47,6 +47,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -77,7 +78,8 @@ public class ShowArtifactActionTest
private static final String TEST_TYPE = "jar";
protected void setUp()
@Override
public void setUp()
throws Exception
{
super.setUp();
@ -115,11 +117,13 @@ public class ShowArtifactActionTest
}
@Test
public void testInstantiation()
{
assertFalse( action == getActionProxy( "/showArtifact.action" ).getAction() );
}
@Test
public void testGetArtifactUniqueRelease()
{
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@ -143,6 +147,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testGetArtifactUniqueSnapshot()
{
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@ -173,6 +178,7 @@ public class ShowArtifactActionTest
assertNull( action.getMailingLists() );
}
@Test
public void testGetArtifactUniqueSnapshotTimestamped()
{
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@ -189,6 +195,7 @@ public class ShowArtifactActionTest
assertNoOutputFields();
}
@Test
public void testGetMissingProject()
{
setActionParameters();
@ -200,6 +207,7 @@ public class ShowArtifactActionTest
assertNoOutputFields();
}
@Test
public void testGetArtifactNoObservableRepos()
{
setObservableRepos( Collections.<String>emptyList() );
@ -214,6 +222,7 @@ public class ShowArtifactActionTest
assertNoOutputFields();
}
@Test
public void testGetArtifactNotInObservableRepos()
{
metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@ -228,6 +237,7 @@ public class ShowArtifactActionTest
assertNoOutputFields();
}
@Test
public void testGetArtifactOnlySeenInSecondObservableRepo()
{
setObservableRepos( Arrays.asList( OTHER_TEST_REPO, TEST_REPO ) );
@ -252,6 +262,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testGetArtifactSeenInBothObservableRepo()
{
setObservableRepos( Arrays.asList( TEST_REPO, OTHER_TEST_REPO ) );
@ -278,6 +289,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testGetArtifactCanOnlyObserveInOneOfTwoRepos()
{
setObservableRepos( Arrays.asList( TEST_REPO ) );
@ -304,6 +316,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testGetArtifactNoMavenFacet()
{
ProjectVersionMetadata versionMetadata = new ProjectVersionMetadata();
@ -335,6 +348,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testMetadataHasRepositoryFacetProblem()
{
String errMsg = "Error in resolving artifact's parent POM file: Sample Parent POM not found";
@ -360,6 +374,7 @@ public class ShowArtifactActionTest
assertEquals( "Artifact metadata is incomplete: " + errMsg, action.getActionErrors().toArray()[0].toString() );
}
@Test
public void testMetadataIncomplete()
{
ProjectVersionMetadata metaData = createProjectModel( TEST_SNAPSHOT_VERSION );
@ -385,6 +400,7 @@ public class ShowArtifactActionTest
assertEquals( "Artifact metadata is incomplete.", action.getActionErrors().toArray()[0].toString() );
}
@Test
public void testGetMailingLists()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
@ -413,6 +429,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testGetDependencies()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
@ -441,6 +458,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testGetDependees()
throws Exception
{
@ -471,6 +489,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testGetProjectMetadata()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
@ -498,6 +517,7 @@ public class ShowArtifactActionTest
assertTrue( action.getArtifacts().isEmpty() );
}
@Test
public void testAddAndDeleteMetadataProperty()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );

View File

@ -52,6 +52,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.junit.Test;
/**
* UploadActionTest
@ -78,6 +79,7 @@ public class UploadActionTest
private ManagedRepository managedRepository;
@Override
public void setUp()
throws Exception
{
@ -116,6 +118,7 @@ public class UploadActionTest
}
@Override
public void tearDown()
throws Exception
{
@ -286,6 +289,7 @@ public class UploadActionTest
return control;
}
@Test
public void testArtifactUploadWithPomSuccessful()
throws Exception
{
@ -327,6 +331,7 @@ public class UploadActionTest
verifyProjectMetadataChecksums( repoLocation );
}
@Test
public void testArtifactUploadWithClassifier()
throws Exception
{
@ -387,6 +392,7 @@ public class UploadActionTest
verifyProjectMetadataChecksums( repoLocation );
}
@Test
public void testArtifactUploadGeneratePomSuccessful()
throws Exception
{
@ -428,6 +434,7 @@ public class UploadActionTest
verifyProjectMetadataChecksums( repoLocation );
}
@Test
public void testArtifactUploadNoPomSuccessful()
throws Exception
{
@ -511,6 +518,7 @@ public class UploadActionTest
assertTrue( StringUtils.contains( contents, md5 ) );
}
@Test
public void testArtifactUploadFailedRepositoryNotFound()
throws Exception
{
@ -548,6 +556,7 @@ public class UploadActionTest
new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
}
@Test
public void testArtifactUploadSnapshots()
throws Exception
{
@ -680,6 +689,7 @@ public class UploadActionTest
assertEquals( "Incorrect build number in filename.", "2", buildnumber );
}
@Test
public void testChecksumIsCorrectWhenArtifactIsReUploaded()
throws Exception
{
@ -748,6 +758,7 @@ public class UploadActionTest
verifyProjectMetadataChecksums( repoLocation );
}
@Test
public void testUploadArtifactAlreadyExistingRedeploymentsBlocked()
throws Exception
{
@ -794,6 +805,7 @@ public class UploadActionTest
verifyProjectMetadataChecksums( repoLocation );
}
@Test
public void testUploadArtifactAlreadyExistingRedeploymentsAllowed()
throws Exception
{

View File

@ -24,6 +24,7 @@ import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.web.action.AbstractWebworkTestCase;
import org.easymock.MockControl;
import org.junit.Before;
/**
*/
@ -40,8 +41,9 @@ public abstract class AbstractOrganizationInfoActionTest
protected abstract AbstractAppearanceAction getAction();
@Before
@Override
protected void setUp()
public void setUp()
throws Exception
{
super.setUp();

View File

@ -28,6 +28,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
/**
*/
@ -54,6 +56,7 @@ public class EditOrganizationInfoActionTest
private ActionValidatorManager actionValidatorManager;
@Override
@Before
public void setUp()
throws Exception
{
@ -64,6 +67,7 @@ public class EditOrganizationInfoActionTest
actionValidatorManager = factory.createDefaultActionValidatorManager();
}
@Test
public void testOrganisationInfoSaves()
throws Exception
{
@ -96,6 +100,7 @@ public class EditOrganizationInfoActionTest
assertEquals( "URL1", orginfo.getUrl() );
}
@Test
public void testStruts2ValidationFrameworkWithNullInputs()
throws Exception
{
@ -122,6 +127,7 @@ public class EditOrganizationInfoActionTest
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
@Test
public void testStruts2ValidationFrameworkWithBlankInputs()
throws Exception
{
@ -148,6 +154,7 @@ public class EditOrganizationInfoActionTest
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
@Test
public void testStruts2ValidationFrameworkWithInvalidInputs()
throws Exception
{
@ -184,6 +191,7 @@ public class EditOrganizationInfoActionTest
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
@Test
public void testStruts2ValidationFrameworkWithValidInputs()
throws Exception
{

View File

@ -20,12 +20,14 @@ package org.apache.archiva.web.action.admin.appearance;
*/
import org.apache.archiva.configuration.OrganisationInformation;
import org.junit.Test;
/**
*/
public class OrganizationInfoActionTest
extends AbstractOrganizationInfoActionTest
{
@Test
public void testOrganisationInfoLoads()
throws Exception
{

View File

@ -42,6 +42,8 @@ import org.easymock.MockControl;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
/**
* AddProxyConnectorActionTest
@ -58,7 +60,8 @@ public class AddProxyConnectorActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -75,6 +78,7 @@ public class AddProxyConnectorActionTest
archivaConfiguration );
}
@Test
public void testAddBlackListPattern()
throws Exception
{
@ -106,6 +110,7 @@ public class AddProxyConnectorActionTest
assertEquals( 1, connector.getBlackListPatterns().size() );
}
@Test
public void testAddProperty()
throws Exception
{
@ -139,6 +144,7 @@ public class AddProxyConnectorActionTest
}
@SuppressWarnings( "unchecked" )
@Test
public void testAddProxyConnectorCommit()
throws Exception
{
@ -173,6 +179,7 @@ public class AddProxyConnectorActionTest
assertEquals( "gramov-a-bits", actualConnector.getProperties().get( "eat-a" ) );
}
@Test
public void testAddProxyConnectorInitialPage()
throws Exception
{
@ -194,6 +201,7 @@ public class AddProxyConnectorActionTest
assertEquals( Action.INPUT, status );
}
@Test
public void testAddWhiteListPattern()
throws Exception
{
@ -225,6 +233,7 @@ public class AddProxyConnectorActionTest
assertEquals( 1, connector.getWhiteListPatterns().size() );
}
@Test
public void testRemoveBlackListPattern()
throws Exception
{
@ -271,6 +280,7 @@ public class AddProxyConnectorActionTest
assertEquals( "Should have left 1 blacklist pattern", "**/*.war", connector.getBlackListPatterns().get( 0 ) );
}
@Test
public void testRemoveProperty()
throws Exception
{
@ -317,6 +327,7 @@ public class AddProxyConnectorActionTest
assertEquals( "Should have left 1 property", "general-tso", connector.getProperties().get( "username" ) );
}
@Test
public void testRemoveWhiteListPattern()
throws Exception
{
@ -363,6 +374,7 @@ public class AddProxyConnectorActionTest
assertEquals( "Should have left 1 whitelist pattern", "javax/**/*", connector.getWhiteListPatterns().get( 0 ) );
}
@Test
public void testSecureActionBundle()
throws Exception
{

View File

@ -32,7 +32,8 @@ import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.web.action.AbstractWebworkTestCase;
import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
import org.easymock.MockControl;
import org.junit.Before;
import org.junit.Test;
/**
* DeleteProxyConnectorActionTest
*
@ -52,7 +53,8 @@ public class DeleteProxyConnectorActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -68,7 +70,8 @@ public class DeleteProxyConnectorActionTest
( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration(
archivaConfiguration );
}
@Test
public void testConfirmDelete()
throws Exception
{
@ -84,6 +87,7 @@ public class DeleteProxyConnectorActionTest
assertNoErrors( action );
}
@Test
public void testConfirmDeleteBadSourceOrTarget()
throws Exception
{
@ -118,6 +122,7 @@ public class DeleteProxyConnectorActionTest
assertHasErrors( action );
}
@Test
public void testConfirmDeleteNoSourceOrTarget()
throws Exception
{
@ -152,6 +157,7 @@ public class DeleteProxyConnectorActionTest
assertHasErrors( action );
}
@Test
public void testDelete()
throws Exception
{
@ -177,6 +183,7 @@ public class DeleteProxyConnectorActionTest
assertEquals( 0, archivaConfiguration.getConfiguration().getProxyConnectors().size() );
}
@Test
public void testSecureActionBundle()
throws Exception
{

View File

@ -31,6 +31,8 @@ import org.apache.archiva.web.action.AbstractWebworkTestCase;
import org.apache.archiva.redback.components.registry.RegistryException;
import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
import org.easymock.MockControl;
import org.junit.Before;
import org.junit.Test;
public class DisableProxyConnectorActionTest
extends AbstractWebworkTestCase
@ -46,7 +48,8 @@ public class DisableProxyConnectorActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -62,6 +65,7 @@ public class DisableProxyConnectorActionTest
( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration( archivaConfiguration );
}
@Test
public void testConfirmDisableBadSourceOrTarget()
throws Exception
{
@ -96,6 +100,7 @@ public class DisableProxyConnectorActionTest
assertHasErrors( action );
}
@Test
public void testConfirmDisableNoSourceOrTarget()
throws Exception
{
@ -130,6 +135,7 @@ public class DisableProxyConnectorActionTest
assertHasErrors( action );
}
@Test
public void testDelete()
throws Exception
{
@ -158,6 +164,7 @@ public class DisableProxyConnectorActionTest
assertTrue( config.isDisabled() );
}
@Test
public void testSecureActionBundle()
throws Exception
{
@ -169,6 +176,7 @@ public class DisableProxyConnectorActionTest
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
@Test
public void testConfirmEnable()
throws Exception
{

View File

@ -43,6 +43,8 @@ import org.easymock.MockControl;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
/**
* EditProxyConnectorActionTest
@ -63,7 +65,8 @@ public class EditProxyConnectorActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -112,6 +115,7 @@ public class EditProxyConnectorActionTest
archivaConfiguration );
}
@Test
public void testAddBlackListPattern()
throws Exception
{
@ -145,6 +149,7 @@ public class EditProxyConnectorActionTest
assertEquals( 1, connector.getBlackListPatterns().size() );
}
@Test
public void testAddProperty()
throws Exception
{
@ -180,6 +185,7 @@ public class EditProxyConnectorActionTest
assertEquals( "gramov-a-bits", connector.getProperties().get( "eat-a" ) );
}
@Test
public void testAddWhiteListPattern()
throws Exception
{
@ -214,6 +220,7 @@ public class EditProxyConnectorActionTest
}
@SuppressWarnings( "unchecked" )
@Test
public void testEditProxyConnectorCommit()
throws Exception
{
@ -250,6 +257,7 @@ public class EditProxyConnectorActionTest
}
@Test
public void testEditProxyConnectorInitialPage()
throws Exception
{
@ -266,6 +274,7 @@ public class EditProxyConnectorActionTest
assertEquals( Action.INPUT, status );
}
@Test
public void testRemoveBlackListPattern()
throws Exception
{
@ -314,6 +323,7 @@ public class EditProxyConnectorActionTest
assertEquals( "Should have left 1 blacklist pattern", "**/*.war", connector.getBlackListPatterns().get( 0 ) );
}
@Test
public void testRemoveProperty()
throws Exception
{
@ -362,6 +372,7 @@ public class EditProxyConnectorActionTest
assertEquals( "Should have left 1 property", "general-tso", connector.getProperties().get( "username" ) );
}
@Test
public void testRemoveWhiteListPattern()
throws Exception
{
@ -410,6 +421,7 @@ public class EditProxyConnectorActionTest
assertEquals( "Should have left 1 whitelist pattern", "javax/**/*", connector.getWhiteListPatterns().get( 0 ) );
}
@Test
public void testSecureActionBundle()
throws Exception
{

View File

@ -30,6 +30,8 @@ import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.web.action.AbstractWebworkTestCase;
import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
import org.easymock.MockControl;
import org.junit.Before;
import org.junit.Test;
public class EnableProxyConnectorActionTest
extends AbstractWebworkTestCase
@ -45,7 +47,8 @@ public class EnableProxyConnectorActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -69,6 +72,7 @@ public class EnableProxyConnectorActionTest
archivaConfiguration.save( config );
}
@Test
public void testConfirmDeleteBadSourceOrTarget()
throws Exception
{
@ -103,6 +107,7 @@ public class EnableProxyConnectorActionTest
assertHasErrors( action );
}
@Test
public void testConfirmEnableNoSourceOrTarget()
throws Exception
{
@ -137,6 +142,7 @@ public class EnableProxyConnectorActionTest
assertHasErrors( action );
}
@Test
public void testEnable()
throws Exception
{
@ -165,6 +171,7 @@ public class EnableProxyConnectorActionTest
assertFalse( config.isDisabled() );
}
@Test
public void testSecureActionBundle()
throws Exception
{
@ -176,6 +183,7 @@ public class EnableProxyConnectorActionTest
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
@Test
public void testConfirmEnable()
throws Exception
{

View File

@ -33,6 +33,8 @@ import org.apache.archiva.web.action.AbstractWebworkTestCase;
import org.apache.archiva.redback.components.registry.RegistryException;
import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
import org.easymock.MockControl;
import org.junit.Before;
import org.junit.Test;
/**
* ProxyConnectorsActionTest
@ -55,7 +57,8 @@ public class ProxyConnectorsActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -72,6 +75,7 @@ public class ProxyConnectorsActionTest
archivaConfiguration );
}
@Test
public void testSecureActionBundle()
throws Exception
{
@ -84,6 +88,7 @@ public class ProxyConnectorsActionTest
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
@Test
public void testExecute()
throws Exception
{

View File

@ -38,6 +38,8 @@ import org.easymock.MockControl;
import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
/**
* SortProxyConnectorsActionTest
@ -62,7 +64,8 @@ public class SortProxyConnectorsActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
protected void setUp()
@Before
public void setUp()
throws Exception
{
super.setUp();
@ -90,6 +93,7 @@ public class SortProxyConnectorsActionTest
archivaConfiguration.save( config );
}
@Test
public void testSecureActionBundle()
throws Exception
{
@ -101,6 +105,7 @@ public class SortProxyConnectorsActionTest
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
@Test
public void testSortDown()
throws Exception
{
@ -115,6 +120,7 @@ public class SortProxyConnectorsActionTest
assertOrder( new String[]{ JAVAX, CENTRAL, CODEHAUS } );
}
@Test
public void testSortDownPastEnd()
throws Exception
{
@ -131,6 +137,7 @@ public class SortProxyConnectorsActionTest
assertOrder( new String[]{ CENTRAL, JAVAX, CODEHAUS } );
}
@Test
public void testSortUp()
throws Exception
{
@ -145,6 +152,7 @@ public class SortProxyConnectorsActionTest
assertOrder( new String[]{ CENTRAL, CODEHAUS, JAVAX } );
}
@Test
public void testSortUpPastBeginning()
throws Exception
{

Some files were not shown because too many files have changed in this diff Show More