<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>
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.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
<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>
* 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
{
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
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.junit.Test;
/**
* ChecksumTest
{
private static final String UNSET_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
+ @Test
public void testConstructSha1()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
.getAlgorithm() );
}
+ @Test
public void testConstructMd5()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.MD5 );
.getAlgorithm() );
}
+ @Test
public void testUpdate()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
assertEquals( "Checksum", "e396119ae0542e85a74759602fd2f81e5d36d762", checksum.getChecksum() );
}
+ @Test
public void testUpdateMany()
throws IOException
{
assertEquals( "Checksum MD5", "21c2c5ca87ec018adacb2e2fb3432219", checksumMd5.getChecksum() );
}
+ @Test
public void testUpdateWholeUpdatePartial()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
+import org.junit.Test;
/**
* ChecksummedFileTest
*
* @version $Id$
*/
+
public class ChecksummedFileTest
extends AbstractChecksumTestCase
{
return jarFile;
}
+ @Test
public void testCalculateChecksumMd5()
throws IOException
{
assertEquals( expectedChecksum, actualChecksum );
}
+ @Test
public void testCalculateChecksumSha1()
throws IOException
{
assertEquals( expectedChecksum, actualChecksum );
}
+ @Test
public void testCreateChecksum()
throws IOException
{
assertEquals( "2bb14b388973351b0a4dfe11d171965f59cc61a1 redback-authz-open.jar", hashContents );
}
+ @Test
public void testFixChecksum()
throws IOException
{
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
{
assertTrue( "ChecksummedFile.isValid(SHA1)", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) );
}
+ @Test
public void testIsValidChecksumInvalidSha1Format()
throws IOException
{
}
+ @Test
public void testIsValidChecksumNoChecksumFiles()
throws IOException
{
}
+ @Test
public void testIsValidChecksumSha1AndMd5()
throws IOException
{
ChecksumAlgorithm.MD5 } ) );
}
+ @Test
public void testIsValidChecksumSha1NoMd5()
throws IOException
{
}
+ @Test
public void testParseChecksum()
throws IOException
{
}
+ @Test
public void testParseChecksumAltDash1()
throws IOException
{
assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
}
+ @Test
public void testParseChecksumAltDash2()
throws IOException
{
assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
}
+ @Test
public void testRemoteMetadataChecksumFilePathSha1()
throws IOException
{
}
}
+ @Test
public void testRemoteMetadataChecksumFilePathMd5()
throws IOException
{
<artifactId>archiva-policies</artifactId>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <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>
</dependencies>
<build>
<plugins>
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
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
{
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
*/
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
{
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
{
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>();
assertProxyOrder( new String[]{ "corporate", "snapshots", "3rdparty", "sandbox" }, proxies );
}
+ @Test
public void testSortNormal()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();
assertProxyOrder( new String[]{ "snapshots", "3rdparty", "corporate", "sandbox" }, proxies );
}
+ @Test
public void testSortPartial()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();
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();
<!-- 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>
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
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;
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
<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>
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.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
<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>
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.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* Test the repository converter.
* @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
<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>
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
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
{
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
<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>
*/
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
{
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
</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>
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
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;
import java.util.Properties;
import javax.inject.Inject;
import javax.inject.Named;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
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
{
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
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
<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>
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
<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>
import java.util.Collection;
import java.util.Date;
import java.util.Locale;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
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
{
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;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
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
{
</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>
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
<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>
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
{
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
{
assertEquals( port, url.getPort() );
assertEquals( path, url.getPath() );
}
-
+
+ @Test
public void testProtocolHttp()
throws MalformedURLException
{
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolWagonWebdav()
throws MalformedURLException
{
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithPort()
throws MalformedURLException
{
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithUsername()
throws MalformedURLException
{
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithUsernamePassword()
throws MalformedURLException
{
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithUsernamePasswordPort()
throws MalformedURLException
{
*/
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
{
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
{
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
{
-->
</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>
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;
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
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.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
<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>
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
{
import java.io.File;
import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
*/
private String source, oldChecksum;
+ @Override
+ @Before
public void setUp()
throws Exception
{
oldChecksum = readFile( testDestChecksum );
}
-
+
+ @Test
public void testCopyCommitRollback()
throws Exception
{
assertChecksumRollback( testDest );
}
+ @Test
public void testCopyCommitRollbackWithBackup()
throws Exception
{
assertChecksumRollback( testDest );
}
+ @Test
public void testCreateRollbackCommit()
throws Exception
{
assertTrue( "Test that the destination contents are copied correctly", source.equals( target ) );
}
- protected void tearDown()
+ @After
+ @Override
+ public void tearDown()
throws Exception
{
super.tearDown();
FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "target/transaction-tests" ) );
}
+ @Override
protected void assertChecksumCommit( File file )
throws IOException
{
assertFalse( "Test that the destination checksum contents are created correctly", oldChecksum.equals( target ) );
}
+ @Override
protected void assertChecksumRollback( File file )
throws IOException
{
import org.apache.commons.io.FileUtils;
import org.apache.archiva.common.utils.FileUtil;
+import org.junit.After;
+import org.junit.Test;
/**
*/
{
private File testDir = new File( FileUtil.getBasedir(), "target/transaction-tests/create-file" );
+ @Test
public void testCreateCommitRollback()
throws Exception
{
assertTrue( "target directory still exists", new File( FileUtil.getBasedir(), "target" ).exists() );
}
+ @Test
public void testCreateCommitRollbackWithBackup()
throws Exception
{
assertChecksumRollback( testFile );
}
+ @Test
public void testCreateRollbackCommit()
throws Exception
{
assertChecksumCommit( testFile );
}
- protected void tearDown()
+ @Override
+ @After
+ public void tearDown()
throws Exception
{
super.tearDown();
<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>
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
{
*/
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.
import java.io.Reader;
import java.io.StringWriter;
import java.net.URL;
+import org.junit.Test;
/**
* LatinEntityResolutionReaderTest
fail( "IOException: " + e.getMessage() );
}
}
-
+
+ @Test
public void testReaderNormalBufsize()
throws IOException
{
assertProperRead( expected, "no-prolog-with-entities.xml", 4096 );
}
+ @Test
public void testReaderSmallBufsize()
throws IOException
{
assertProperRead( expected, "no-prolog-with-entities.xml", 1024 );
}
+ @Test
public void testReaderRediculouslyTinyBufsize()
throws IOException
{
assertProperRead( expected, "no-prolog-with-entities.xml", 32 );
}
+ @Test
public void testReaderHugeBufsize()
throws IOException
{
assertProperRead( expected, "no-prolog-with-entities.xml", 409600 );
}
-
+ @Test
public void testReaderLeftOver()
throws IOException
{
}
}
-
+ @Test
public void testNoLatinEntitiesHugeLine()
{
assertProperRead( "commons-codec-1.2.pom", "commons-codec-1.2.pom", 4096 );
import java.util.List;
import org.dom4j.Element;
+import org.junit.Test;
/**
* XMLReaderTest
assertTrue( "Contains [" + expectedText + "]", texts.contains( expectedText ) );
}
}
-
+
+ @Test
public void testNoPrologBasicRead()
throws XMLException
{
assertElementTexts( fruits, new String[] { "apple", "cherry", "pear", "peach" } );
}
+ @Test
public void testNoPrologEntitiesRead()
throws XMLException
{
assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
}
+ @Test
public void testNoPrologUtf8Read()
throws XMLException
{
assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
}
+ @Test
public void testPrologUtf8Read()
throws XMLException
{
}
// MRM-1136
+ @Test
public void testProxiedMetadataRead()
throws XMLException
{
import org.dom4j.Element;
import java.io.StringWriter;
+import org.junit.Test;
/**
* XMLWriterTest
public class XMLWriterTest
extends AbstractArchivaXmlTestCase
{
+ @Test
public void testWrite()
throws Exception
{
<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>
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;
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
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
<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>
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
protected MetadataRepository metadataRepository;
@Before
+ @Override
public void setUp()
throws Exception
{
}
@After
+ @Override
public void tearDown()
throws Exception
{
/**
* 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
/**
* 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
<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>
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
{
<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>
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
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;
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
{
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;
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
{
<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>
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
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
<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>
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
{
<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>
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
{
<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>
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
{
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;
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
{
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
{
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
{
}
@Override
- protected void setUp( )
+ @Before
+ public void setUp( )
throws Exception
{
super.setUp( );
}
@Override
- protected void tearDown( )
+ @After
+ public void tearDown( )
throws Exception
{
super.tearDown( );
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
{
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;
private static final String OTHER_TEST_REPO = "other-repo";
- protected void setUp()
+ @Override
+ public void setUp()
throws Exception
{
super.setUp();
factory.setRepositorySession( repositorySession );
}
- protected void tearDown()
+ @Override
+ public void tearDown()
throws Exception
{
super.tearDown();
setObservableRepos( Lists.<String>newArrayList( "test-repo" ) );
}
+ @Test
public void testInstantiation()
{
assertFalse( action == getActionProxy( "/browse.action" ).getAction() );
}
+ @Test
public void testBrowse()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseNoObservableRepos()
throws Exception
{
assertNoOutputVariables();
}
+ @Test
public void testBrowseGroupNoObservableRepos()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseArtifactNoObservableRepos()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseGroupNoGroupId()
throws Exception
{
assertNoOutputVariables();
}
+ @Test
public void testBrowseGroupNoArtifacts()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseGroupWithArtifacts()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseWithCollapsedGroupsAndArtifacts()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseWithCollapsedGroupsAndArtifactsAcrossRepositories()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseGroupWithCollapsedGroupsAndArtifacts()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseArtifactNoGroupId()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseArtifactNoArtifactId()
throws Exception
{
assertNull( action.getSharedModel() );
}
+ @Test
public void testBrowseArtifact()
throws Exception
assertDefaultModel( model, selectedGroupId, selectedArtifactId, null );
}
+ @Test
public void testBrowseArtifactWithSnapshots()
throws Exception
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
{
}
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
}
@Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
action = null;
}
+ @Test
public void testNPEInDeleteArtifact()
throws Exception
{
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;
private RepositorySession session;
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
// quick search...
+ @Test
public void testQuickSearch()
throws Exception
{
searchControl.verify();
}
+ @Test
public void testSearchWithinSearchResults()
throws Exception
{
searchControl.verify();
}
+ @Test
public void testQuickSearchUserHasNoAccessToAnyRepository()
throws Exception
{
userReposControl.verify();
}
+ @Test
public void testQuickSearchNoSearchHits()
throws Exception
{
// advanced/filtered search...
+ @Test
public void testAdvancedSearchOneRepository()
throws Exception
{
searchControl.verify();
}
+ @Test
public void testAdvancedSearchAllRepositories()
throws Exception
{
userReposControl.verify();
}
+ @Test
public void testAdvancedSearchNoSearchHits()
throws Exception
{
searchControl.verify();
}
+ @Test
public void testAdvancedSearchUserHasNoAccessToAnyRepository()
throws Exception
{
assertEquals(GlobalResults.ACCESS_TO_NO_REPOS, result);
}
+ @Test
public void testAdvancedSearchNoSpecifiedCriteria()
throws Exception
{
}
// find artifact..
+ @Test
public void testFindArtifactWithOneHit()
throws Exception
{
userReposControl.verify();
}
+ @Test
public void testFindArtifactWithMultipleHits()
throws Exception
{
userReposControl.verify();
}
+ @Test
public void testFindArtifactNoChecksumSpecified()
throws Exception
{
assertEquals("Unable to search for a blank checksum", (String) action.getActionErrors().iterator().next());
}
+ @Test
public void testFindArtifactNoResults()
throws Exception
{
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;
private static final String TEST_TYPE = "jar";
- protected void setUp()
+ @Override
+ public void setUp()
throws Exception
{
super.setUp();
}
+ @Test
public void testInstantiation()
{
assertFalse( action == getActionProxy( "/showArtifact.action" ).getAction() );
}
+ @Test
public void testGetArtifactUniqueRelease()
{
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testGetArtifactUniqueSnapshot()
{
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
assertNull( action.getMailingLists() );
}
+ @Test
public void testGetArtifactUniqueSnapshotTimestamped()
{
metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
assertNoOutputFields();
}
+ @Test
public void testGetMissingProject()
{
setActionParameters();
assertNoOutputFields();
}
+ @Test
public void testGetArtifactNoObservableRepos()
{
setObservableRepos( Collections.<String>emptyList() );
assertNoOutputFields();
}
+ @Test
public void testGetArtifactNotInObservableRepos()
{
metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
assertNoOutputFields();
}
+ @Test
public void testGetArtifactOnlySeenInSecondObservableRepo()
{
setObservableRepos( Arrays.asList( OTHER_TEST_REPO, TEST_REPO ) );
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testGetArtifactSeenInBothObservableRepo()
{
setObservableRepos( Arrays.asList( TEST_REPO, OTHER_TEST_REPO ) );
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testGetArtifactCanOnlyObserveInOneOfTwoRepos()
{
setObservableRepos( Arrays.asList( TEST_REPO ) );
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testGetArtifactNoMavenFacet()
{
ProjectVersionMetadata versionMetadata = new ProjectVersionMetadata();
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testMetadataHasRepositoryFacetProblem()
{
String errMsg = "Error in resolving artifact's parent POM file: Sample Parent POM not found";
assertEquals( "Artifact metadata is incomplete: " + errMsg, action.getActionErrors().toArray()[0].toString() );
}
+ @Test
public void testMetadataIncomplete()
{
ProjectVersionMetadata metaData = createProjectModel( TEST_SNAPSHOT_VERSION );
assertEquals( "Artifact metadata is incomplete.", action.getActionErrors().toArray()[0].toString() );
}
+ @Test
public void testGetMailingLists()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testGetDependencies()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testGetDependees()
throws Exception
{
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testGetProjectMetadata()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
assertTrue( action.getArtifacts().isEmpty() );
}
+ @Test
public void testAddAndDeleteMetadataProperty()
{
ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
+import org.junit.Test;
/**
* UploadActionTest
private ManagedRepository managedRepository;
+ @Override
public void setUp()
throws Exception
{
}
+ @Override
public void tearDown()
throws Exception
{
return control;
}
+ @Test
public void testArtifactUploadWithPomSuccessful()
throws Exception
{
verifyProjectMetadataChecksums( repoLocation );
}
+ @Test
public void testArtifactUploadWithClassifier()
throws Exception
{
verifyProjectMetadataChecksums( repoLocation );
}
+ @Test
public void testArtifactUploadGeneratePomSuccessful()
throws Exception
{
verifyProjectMetadataChecksums( repoLocation );
}
+ @Test
public void testArtifactUploadNoPomSuccessful()
throws Exception
{
assertTrue( StringUtils.contains( contents, md5 ) );
}
+ @Test
public void testArtifactUploadFailedRepositoryNotFound()
throws Exception
{
new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
}
+ @Test
public void testArtifactUploadSnapshots()
throws Exception
{
assertEquals( "Incorrect build number in filename.", "2", buildnumber );
}
+ @Test
public void testChecksumIsCorrectWhenArtifactIsReUploaded()
throws Exception
{
verifyProjectMetadataChecksums( repoLocation );
}
+ @Test
public void testUploadArtifactAlreadyExistingRedeploymentsBlocked()
throws Exception
{
verifyProjectMetadataChecksums( repoLocation );
}
+ @Test
public void testUploadArtifactAlreadyExistingRedeploymentsAllowed()
throws Exception
{
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.web.action.AbstractWebworkTestCase;
import org.easymock.MockControl;
+import org.junit.Before;
/**
*/
protected abstract AbstractAppearanceAction getAction();
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
/**
*/
private ActionValidatorManager actionValidatorManager;
@Override
+ @Before
public void setUp()
throws Exception
{
actionValidatorManager = factory.createDefaultActionValidatorManager();
}
+ @Test
public void testOrganisationInfoSaves()
throws Exception
{
assertEquals( "URL1", orginfo.getUrl() );
}
+ @Test
public void testStruts2ValidationFrameworkWithNullInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithBlankInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithInvalidInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithValidInputs()
throws Exception
{
*/
import org.apache.archiva.configuration.OrganisationInformation;
+import org.junit.Test;
/**
*/
public class OrganizationInfoActionTest
extends AbstractOrganizationInfoActionTest
{
+ @Test
public void testOrganisationInfoLoads()
throws Exception
{
import java.util.List;
import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
/**
* AddProxyConnectorActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testAddBlackListPattern()
throws Exception
{
assertEquals( 1, connector.getBlackListPatterns().size() );
}
+ @Test
public void testAddProperty()
throws Exception
{
}
@SuppressWarnings( "unchecked" )
+ @Test
public void testAddProxyConnectorCommit()
throws Exception
{
assertEquals( "gramov-a-bits", actualConnector.getProperties().get( "eat-a" ) );
}
+ @Test
public void testAddProxyConnectorInitialPage()
throws Exception
{
assertEquals( Action.INPUT, status );
}
+ @Test
public void testAddWhiteListPattern()
throws Exception
{
assertEquals( 1, connector.getWhiteListPatterns().size() );
}
+ @Test
public void testRemoveBlackListPattern()
throws Exception
{
assertEquals( "Should have left 1 blacklist pattern", "**/*.war", connector.getBlackListPatterns().get( 0 ) );
}
+ @Test
public void testRemoveProperty()
throws Exception
{
assertEquals( "Should have left 1 property", "general-tso", connector.getProperties().get( "username" ) );
}
+ @Test
public void testRemoveWhiteListPattern()
throws Exception
{
assertEquals( "Should have left 1 whitelist pattern", "javax/**/*", connector.getWhiteListPatterns().get( 0 ) );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
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
*
private ArchivaConfiguration archivaConfiguration;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration(
archivaConfiguration );
}
-
+
+ @Test
public void testConfirmDelete()
throws Exception
{
assertNoErrors( action );
}
+ @Test
public void testConfirmDeleteBadSourceOrTarget()
throws Exception
{
assertHasErrors( action );
}
+ @Test
public void testConfirmDeleteNoSourceOrTarget()
throws Exception
{
assertHasErrors( action );
}
+ @Test
public void testDelete()
throws Exception
{
assertEquals( 0, archivaConfiguration.getConfiguration().getProxyConnectors().size() );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
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
private ArchivaConfiguration archivaConfiguration;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration( archivaConfiguration );
}
+ @Test
public void testConfirmDisableBadSourceOrTarget()
throws Exception
{
assertHasErrors( action );
}
+ @Test
public void testConfirmDisableNoSourceOrTarget()
throws Exception
{
assertHasErrors( action );
}
+ @Test
public void testDelete()
throws Exception
{
assertTrue( config.isDisabled() );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testConfirmEnable()
throws Exception
{
import java.util.List;
import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
/**
* EditProxyConnectorActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testAddBlackListPattern()
throws Exception
{
assertEquals( 1, connector.getBlackListPatterns().size() );
}
+ @Test
public void testAddProperty()
throws Exception
{
assertEquals( "gramov-a-bits", connector.getProperties().get( "eat-a" ) );
}
+ @Test
public void testAddWhiteListPattern()
throws Exception
{
}
@SuppressWarnings( "unchecked" )
+ @Test
public void testEditProxyConnectorCommit()
throws Exception
{
}
+ @Test
public void testEditProxyConnectorInitialPage()
throws Exception
{
assertEquals( Action.INPUT, status );
}
+ @Test
public void testRemoveBlackListPattern()
throws Exception
{
assertEquals( "Should have left 1 blacklist pattern", "**/*.war", connector.getBlackListPatterns().get( 0 ) );
}
+ @Test
public void testRemoveProperty()
throws Exception
{
assertEquals( "Should have left 1 property", "general-tso", connector.getProperties().get( "username" ) );
}
+ @Test
public void testRemoveWhiteListPattern()
throws Exception
{
assertEquals( "Should have left 1 whitelist pattern", "javax/**/*", connector.getWhiteListPatterns().get( 0 ) );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
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
private ArchivaConfiguration archivaConfiguration;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration.save( config );
}
+ @Test
public void testConfirmDeleteBadSourceOrTarget()
throws Exception
{
assertHasErrors( action );
}
+ @Test
public void testConfirmEnableNoSourceOrTarget()
throws Exception
{
assertHasErrors( action );
}
+ @Test
public void testEnable()
throws Exception
{
assertFalse( config.isDisabled() );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testConfirmEnable()
throws Exception
{
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
private ArchivaConfiguration archivaConfiguration;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testExecute()
throws Exception
{
import java.util.Collections;
import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
/**
* SortProxyConnectorsActionTest
private ArchivaConfiguration archivaConfiguration;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration.save( config );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testSortDown()
throws Exception
{
assertOrder( new String[]{ JAVAX, CENTRAL, CODEHAUS } );
}
+ @Test
public void testSortDownPastEnd()
throws Exception
{
assertOrder( new String[]{ CENTRAL, JAVAX, CODEHAUS } );
}
+ @Test
public void testSortUp()
throws Exception
{
assertOrder( new String[]{ CENTRAL, CODEHAUS, JAVAX } );
}
+ @Test
public void testSortUpPastBeginning()
throws Exception
{
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class AddLegacyArtifactPathActionTest
extends TestCase
{
private ActionValidatorManager actionValidatorManager;
@Override
+ @Before
public void setUp()
throws Exception
{
actionValidatorManager = factory.createDefaultActionValidatorManager();
}
+ @Test
public void testStruts2ValidationFrameworkWithNullInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithBlankInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithInvalidInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithValidInputs()
throws Exception
{
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ConfigureNetworkProxyActionTest extends TestCase
{
private static final String EMPTY_STRING = "";
private ActionValidatorManager actionValidatorManager;
@Override
+ @Before
public void setUp()
throws Exception
{
actionValidatorManager = factory.createDefaultActionValidatorManager();
}
+ @Test
public void testStruts2ValidationFrameworkWithNullInputs() throws Exception
{
// prep
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
}
+ @Test
public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception
{
// prep
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
}
+ @Test
public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception
{
// prep
ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
}
+ @Test
public void testStruts2ValidationFrameworkWithValidInputs() throws Exception
{
// prep
import org.apache.struts2.StrutsSpringTestCase;
import java.io.File;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractManagedRepositoryActionTest
extends StrutsSpringTestCase
{
}
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
/**
* AddManagedRepositoryActionTest
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testAddRepositoryInitialPage()
throws Exception
{
assertFalse( configuration.isSnapshots() );
}
+ @Test
public void testAddRepository()
throws Exception
{
}
+ @Test
public void testAddRepositoryExistingLocation()
throws Exception
{
registryControl.verify();
}
+ @Test
public void testStruts2ValidationFrameworkWithNullInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithBlankInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithInvalidInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithValidInputs()
throws Exception
{
import org.easymock.MockControl;
import java.util.Collections;
+import org.junit.Before;
+import org.junit.Test;
/**
* AddRemoteRepositoryActionTest
private static final String REPO_ID = "remote-repo-ident";
- protected void setUp()
+ @Override
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testSecureActionBundle()
throws Exception
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testAddRemoteRepositoryInitialPage()
throws Exception
{
assertEquals( Action.INPUT, status );
}
+ @Test
public void testAddRemoteRepository()
throws Exception
{
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
private MockControl metadataRepositoryControl;
- protected void setUp()
+ @Override
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
metadataRepositoryControl.replay();
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException, RepositoryAdminException
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testDeleteRepositoryAndReposUnderRepoGroup()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteRepositoryConfirmation()
throws Exception
{
action.getManagedRepositoryAdmin().getManagedRepositories() );
}
+ @Test
public void testDeleteRepositoryKeepContent()
throws Exception
{
return control;
}
+ @Test
public void testDeleteRepositoryDeleteContent()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteRepositoryAndAssociatedProxyConnectors()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteRepositoryCancelled()
throws Exception
{
import org.easymock.MockControl;
import java.util.Collections;
+import org.junit.Before;
+import org.junit.Test;
/**
* DeleteRemoteRepositoryActionTest
private ArchivaConfiguration archivaConfiguration;
- protected void setUp()
+ @Override
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testDeleteRemoteRepositoryConfirmation()
throws Exception
{
action.getRemoteRepositoryAdmin().getRemoteRepositories() );
}
+ @Test
public void testDeleteRemoteRepository()
throws org.apache.archiva.redback.components.registry.RegistryException, IndeterminateConfigurationException, RepositoryAdminException
{
assertEquals( 0, configuration.getProxyConnectors().size() );
}
+ @Test
public void testDeleteRemoteRepositoryCancelled()
throws Exception
{
import org.easymock.MockControl;
import java.util.Collections;
+import org.junit.Before;
+import org.junit.Test;
/**
* DeleteRepositoryGroupActionTest
private ArchivaConfiguration archivaConfiguration;
- protected void setUp()
+ @Override
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException, RepositoryAdminException
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testDeleteRepositoryGroupConfirmation()
throws Exception
{
assertEquals( Collections.singletonList( origRepoGroup ), configuration.getRepositoryGroups() );
}
+ @Test
public void testDeleteRepositoryGroup()
throws Exception
{
assertTrue( configuration.getRepositoryGroups().isEmpty() );
}
+ @Test
public void testDeleteRepositoryGroupCancelled()
throws Exception
{
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* EditManagedRepositoryActionTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class EditManagedRepositoryActionTest
extends AbstractManagedRepositoryActionTest
{
private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException, RepositoryAdminException
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testEditRepositoryInitialPage()
throws Exception
{
assertRepositoryEquals( repository, createRepository() );
}
+ @Test
public void testEditRepository()
throws Exception
{
registryControl.verify();
}
+ @Test
public void testEditRepositoryLocationChanged()
throws Exception
{
registryControl.verify();
}
+ @Test
public void testStruts2ValidationFrameworkWithNullInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithBlankInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithInvalidInputs()
throws Exception
{
ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
}
+ @Test
public void testStruts2ValidationFrameworkWithValidInputs()
throws Exception
{
import java.util.Collections;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* EditRemoteRepositoryActionTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class EditRemoteRepositoryActionTest
extends StrutsSpringTestCase
{
return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
}
- protected void setUp()
+ @Before
+ @Override
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testEditRemoteRepository()
throws Exception
{
archivaConfigurationControl.verify();
}
+ @Test
public void testEditRemoteRepositoryInitialPage()
throws Exception
{
assertRepositoryEquals( repository, createRepository() );
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException, RepositoryAdminException
{
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;
/**
* Test the repositories action returns the correct data.
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoriesActionTest
extends StrutsSpringTestCase
{
ArchivaConfiguration originalArchivaConfiguration;
- protected void setUp()
+ @Override
+ @Before
+ public void setUp()
throws Exception
{
@Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
super.tearDown();
return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
}
+ @Test
public void testGetRepositories()
throws Exception
{
}
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException
{
import java.util.Collections;
import java.util.List;
+import org.junit.Test;
/**
* RepositoryGroupsActionTest
private ArchivaConfiguration archivaConfiguration;
- protected void setUp()
+ @Override
+ public void setUp()
throws Exception
{
super.setUp();
archivaConfiguration );
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException, RepositoryAdminException
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testAddRepositoryGroup()
throws Exception
{
archivaConfigurationControl.verify();
}
+ @Test
public void testAddEmptyRepositoryGroup()
throws Exception
{
assertEquals( 0, configuration.getRepositoryGroups().size() );
}
+ @Test
public void testAddDuplicateRepositoryGroup()
throws Exception
{
action.getRepositoryGroupAdmin().getRepositoriesGroups() );
}
+ @Test
public void testGetRepositoryGroups()
throws Exception
{
assertEquals( REPO2_ID, repos.get( 0 ) );
}
+ @Test
public void testAddRepositoryToGroup()
throws Exception
{
assertNull( action.getGroupToRepositoryMap().get( repoGroup.getId() ) );
}
+ @Test
public void testRemoveRepositoryFromGroup()
throws Exception
{
assertEquals( REPO2_ID, repos.get( 1 ) );
}
+ @Test
public void testAddDuplicateRepositoryToGroup()
throws Exception
{
assertEquals( Action.ERROR, result );
}
+ @Test
public void testRemoveRepositoryNotInGroup()
throws Exception
{
import org.apache.archiva.redback.integration.interceptor.SecureActionException;
import org.easymock.MockControl;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* SortRepositoriesActionTest
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class SortRepositoriesActionTest
extends StrutsSpringTestCase
{
return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
}
- protected void setUp()
+ @Before
+ @Override
+ public void setUp()
throws Exception
{
super.setUp();
}
@Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
super.tearDown();
action.archivaConfiguration = originalArchivaConfiguration;
}
+ @Test
public void testSecureActionBundle()
throws SecureActionException
{
assertEquals( 1, bundle.getAuthorizationTuples().size() );
}
+ @Test
public void testSortDownFirstRepository()
throws Exception
{
assertEquals( REPO3_ID, repositories.get( 2 ) );
}
+ @Test
public void testSortDownLastRepository()
throws Exception
{
assertEquals( REPO3_ID, repositories.get( 2 ) );
}
+ @Test
public void testSortUpLastRepository()
throws Exception
{
assertEquals( REPO2_ID, repositories.get( 2 ) );
}
+ @Test
public void testSortUpFirstRepository()
throws Exception
{
import java.util.ArrayList;
import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
/*
* Licensed to the Apache Software Foundation (ASF) under one
private Configuration config;
- protected void setUp()
+ @Override
+ @Before
+ public void setUp()
throws Exception
{
}
+ @Test
public void testUpdateKnownConsumers()
throws Exception
{
assertEquals( "results " + results, 8, results.size() );
}
+ @Test
public void testDisableAllKnownConsumers()
throws Exception
{
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.junit.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
factory.setRepositorySession( repositorySession );
}
+
+ @Override
@After
public void tearDown()
throws Exception
assertEquals( availableRepositories, action.getAvailableRepositories() );
}
+ @Test
public void testGenerateStatisticsInvalidRowCount()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsInvalidEndDate()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsMalformedEndDate()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsInvalidEndDateMultiRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsMalformedEndDateMultiRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsNoRepos()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsSingleRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsSingleRepoNoStats()
throws Exception
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsOvershotPages()
throws Exception
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsMultipleRepoNoResults()
throws Exception
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testGenerateStatisticsMultipleRepo()
throws Exception
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsSingleRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsMultipleRepos()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsMalformedEndDateMultiRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsMalformedEndDateSingleRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsInvalidEndDateMultiRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsInvalidEndDateSingleRepo()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsSingleRepoNoStats()
throws Exception
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsNoRepos()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsMultipleRepoNoResults()
throws Exception
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testDownloadStatisticsMultipleRepoInStrutsFormat()
throws Exception
{
repositoryStatisticsManagerControl.verify();
}
+ @Test
public void testHealthReportSingleRepo()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testHealthReportInvalidRowCount()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testHealthReportAllRepos()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testHealthReportSingleRepoByCorrectGroupId()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testHealthReportSingleRepoByCorrectGroupIdAllRepositories()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testHealthReportSingleRepoByIncorrectGroupId()
throws Exception
{
return problem;
}
+ @Test
public void testHealthReportNoRepositoryId()
throws Exception
{
import org.apache.commons.io.IOUtils;
import junit.framework.TestCase;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* BannerTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class BannerTest
extends TestCase
{
assertEquals( "Encoding: ", encoded, Banner.encode( decoded ) );
assertEquals( "Decoding: ", decoded, Banner.decode( encoded ) );
}
-
+
+ @Test
public void testEncodeDecode()
{
assertEncodeDecode( "[$10 ]", "[ ]" );
assertEncodeDecode( "$$$5_$n$5_", "$_____" + eol + "_____" );
assertEncodeDecode( "$${Refgjuvyr}", "${Erstwhile}" );
}
-
+
+ @Test
public void testInjectVersion()
{
assertEquals( "[ 1.0 ]", Banner.injectVersion( "[#####]", "1.0" ) );
Banner.injectVersion( "Archiva:\"+eol+\" (##############)", "1.0-alpha-1" ) );
}
+ @Test
public void testGetBanner()
throws IOException
{
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.util.List;
import javax.inject.Inject;
+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",
"classpath:/spring-context-DependencyTreeTest.xml"} )
public class DependencyTreeTest
<artifactId>httpunit</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>
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 javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* AbstractRepositoryServletTestCase
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/repository-servlet-simple.xml" } )
public abstract class AbstractRepositoryServletTestCase
extends TestCase
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 java.util.ArrayList;
import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* ArchivaDavResourceFactoryTest
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class ArchivaDavResourceFactoryTest
extends TestCase
*/
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ArchivaDavResourceLocatorTest
extends TestCase
{
ArchivaDavLocatorFactory factory;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
factory = new ArchivaDavLocatorFactory();
}
+ @Test
public void testAvoidDoubleSlashInHref()
throws Exception
{
assertEquals( "/repository/internal", locator.getRepositoryPath() );
}
+ @Test
public void testLocatorWithPrefixHref()
throws Exception
{
assertEquals( "/repository/internal", locator.getRepositoryPath() );
}
+ @Test
public void testLocatorWithHrefThatContainsPrefix()
throws Exception
{
assertEquals( "/repository/internal", locator.getRepositoryPath() );
}
+ @Test
public void testLocatorWithRootHref()
throws Exception
{
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ArchivaDavSessionProviderTest
extends TestCase
{
private WebdavRequest request;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
request = new WebdavRequestImpl( new HttpServletRequestMock(), null );
}
+ @Test
public void testAttachSession()
throws Exception
{
assertNotNull( request.getDavSession() );
}
+ @Test
public void testReleaseSession()
throws Exception
{
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ArchivaDavSessionTest extends TestCase
{
+ @Test
public void testTokens()
{
ArchivaDavSession session = new ArchivaDavSession();
assertEquals(0, session.getLockTokens().length);
}
+ @Test
public void testAddReferencesThrowsUnsupportedOperationException()
{
ArchivaDavSession session = new ArchivaDavSession();
}
}
+ @Test
public void testRemoveReferencesThrowsUnsupportedOperationException()
{
ArchivaDavSession session = new ArchivaDavSession();
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.File;
import java.util.Collections;
+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 DavResourceTest
extends 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;
/**
* ArchivaMimeTypesTest
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class MimeTypesLoaderTest
extends TestCase
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 javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* RepositoryServletSecurityTest Test the flow of the authentication and authorization checks. This does not necessarily
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class RepositoryServletSecurityTest
extends 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;
/**
* MimeTypesTest
*
* @version $Id: MimeTypesTest.java 6556 2007-06-20 20:44:46Z joakime $
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class MimeTypesTest
extends TestCase
*/
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryPathUtilTest
extends TestCase
{
+ @Test
public void testGetRepositoryId()
{
String href = "/path/to/my/resource";
assertEquals( "/", RepositoryPathUtil.getLogicalResource( href ) );
}
+ @Test
public void testGetLogicalPath()
{
String href = "/repository/internal/org/apache/maven/someartifact.jar";
<artifactId>archiva-repository-admin-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>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+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 AbstractMetadataRepositoryTest
extends TestCase
<artifactId>metadata-repository-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>
</dependencies>
<build>
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class AuditManagerTest
extends TestCase
{
}
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
repository.setId( TEST_REPO_ID );
repository.setLocation( "" );
}
-
+
+ @Test
public void testGetMostRecentEvents()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetMostRecentEventsLessThan10()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetMostRecentEventsInterleavedRepositories()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetMostRecentEventsWhenEmpty()
throws Exception
metadataRepositoryControl.verify();
}
+ @Test
public void testAddAuditEvent()
throws Exception
metadataRepositoryControl.verify();
}
+ @Test
public void testAddAuditEventNoRepositoryId()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteStats()
throws Exception
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeInside()
throws Exception
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeUpperOutside()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeLowerOutside()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeLowerAndUpperOutside()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsWithResource()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsWithNonExistantResource()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeMultipleRepositories()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetEventsRangeNotInside()
throws Exception
{
<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>
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.Collections;
+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 DependencyTreeBuilderTest
extends TestCase
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+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 class Maven2RepositoryMetadataResolverTest
extends TestCase
import java.io.File;
import java.util.Arrays;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* RepositoryMetadataReaderTest
*
* @version $Id$
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class MavenRepositoryMetadataReaderTest
extends TestCase
{
<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>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<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>javax.jcr</groupId>
<artifactId>jcr</artifactId>
<artifactId>archiva-consumer-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>
import org.mockito.Matchers;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Date;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.mockito.Mockito.*;
@SuppressWarnings( { "ThrowableInstanceNeverThrown" } )
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class DuplicateArtifactsConsumerTest
extends TestCase
<artifactId>jackrabbit-jcr-commons</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.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
import java.util.Calendar;
import java.util.Date;
import java.util.zip.GZIPInputStream;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import static org.mockito.Mockito.*;
-
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class JcrRepositoryStatisticsGatheringTest
extends TestCase
{
private Session session;
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
}
@Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
session.logout();
super.tearDown();
}
+ @Test
public void testJcrStatisticsQuery()
throws Exception
{
import java.util.Map;
import java.util.TimeZone;
import javax.jcr.Session;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryStatisticsManagerTest
extends TestCase
{
}
@Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
}
+ @Test
public void testGetLatestStats()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetLatestStatsWhenEmpty()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testAddNewStats()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteStats()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testDeleteStatsWhenEmpty()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeInside()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeUpperOutside()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeLowerOutside()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeLowerAndUpperOutside()
throws Exception
{
metadataRepositoryControl.verify();
}
+ @Test
public void testGetStatsRangeNotInside()
throws Exception
{
<artifactId>wagon-http-lightweight</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>
<plugins>
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.mockito.Mockito.*;
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class Maven2RepositoryMergerTest
extends TestCase
private MetadataRepository metadataRepository;
@Before
+ @Override
public void setUp()
throws Exception
{
<url>http://archiva.apache.org</url>
<modules>
+ <module>archiva-testutil</module>
<module>archiva-cli</module>
<module>archiva-modules</module>
<module>archiva-docs</module>