mirror of https://github.com/apache/archiva.git
ensure starting unit tests with clean configuration to prevent sporadic failure
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1137376 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
701a06014a
commit
c3af85436f
|
@ -100,25 +100,24 @@ public abstract class AbstractRepositoryServletTestCase
|
|||
}
|
||||
FileUtils.copyFile( testConf, testConfDest );
|
||||
|
||||
|
||||
archivaConfiguration = applicationContext.getBean( ArchivaConfiguration.class );
|
||||
|
||||
|
||||
//archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
|
||||
repoRootInternal = new File( appserverBase, "data/repositories/internal" );
|
||||
repoRootLegacy = new File( appserverBase, "data/repositories/legacy" );
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
|
||||
if ( !config.getManagedRepositoriesAsMap().containsKey( REPOID_INTERNAL ) )
|
||||
{
|
||||
config.addManagedRepository(
|
||||
createManagedRepository( REPOID_INTERNAL, "Internal Test Repo", repoRootInternal, true ) );
|
||||
}
|
||||
if ( !config.getManagedRepositoriesAsMap().containsKey( REPOID_LEGACY ) )
|
||||
{
|
||||
config.addManagedRepository(
|
||||
createManagedRepository( REPOID_LEGACY, "Legacy Format Test Repo", repoRootLegacy, "legacy", true ) );
|
||||
}
|
||||
config.getManagedRepositories().clear();
|
||||
|
||||
config.addManagedRepository(
|
||||
createManagedRepository( REPOID_INTERNAL, "Internal Test Repo", repoRootInternal, true ) );
|
||||
|
||||
config.addManagedRepository(
|
||||
createManagedRepository( REPOID_LEGACY, "Legacy Format Test Repo", repoRootLegacy, "legacy", true ) );
|
||||
|
||||
config.getProxyConnectors().clear();
|
||||
|
||||
config.getRemoteRepositories().clear();
|
||||
|
||||
saveConfiguration( archivaConfiguration );
|
||||
|
||||
|
@ -161,7 +160,6 @@ public abstract class AbstractRepositoryServletTestCase
|
|||
}
|
||||
|
||||
|
||||
|
||||
protected void assertFileContents( String expectedContents, File repoRoot, String path )
|
||||
throws IOException
|
||||
{
|
||||
|
|
|
@ -86,19 +86,19 @@ public class RepositoryServletBrowseTest
|
|||
|
||||
WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/org/apache/archiva/artifactId" );
|
||||
WebResponse response = sc.getResponse( request );
|
||||
assertEquals( "Response", HttpServletResponse.SC_OK, response.getResponseCode() );
|
||||
assertEquals( "1st Response", HttpServletResponse.SC_OK, response.getResponseCode() );
|
||||
|
||||
request = new GetMethodWebRequest( "http://machine.com/repository/internal/org/apache/archiva/artifactId/" );
|
||||
response = sc.getResponse( request );
|
||||
assertEquals( "Response", HttpServletResponse.SC_OK, response.getResponseCode() );
|
||||
assertEquals( "2nd Response", HttpServletResponse.SC_OK, response.getResponseCode() );
|
||||
|
||||
request = new GetMethodWebRequest( "http://machine.com/repository/internal/org/apache/archiva/artifactId/1.0/artifactId-1.0.jar" );
|
||||
response = sc.getResponse( request );
|
||||
assertEquals( "Response", HttpServletResponse.SC_OK, response.getResponseCode() );
|
||||
assertEquals( "3rd Response", HttpServletResponse.SC_OK, response.getResponseCode() );
|
||||
|
||||
request = new GetMethodWebRequest( "http://machine.com/repository/internal/org/apache/archiva/artifactId/1.0/artifactId-1.0.jar/" );
|
||||
response = sc.getResponse( request );
|
||||
assertEquals( "Response", HttpServletResponse.SC_NOT_FOUND, response.getResponseCode() );
|
||||
assertEquals( "4th Response", HttpServletResponse.SC_NOT_FOUND, response.getResponseCode() );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue