/**
* AbstractProxyTestCase
*/
-@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractProxyTestCase
{
@Inject
// Setup source repository (using default layout)
String name = getClass().getSimpleName();
String repoPath = "target/test-repository/managed/" + name;
- File repoLocation = new File( repoPath );
managedDefaultRepository =
createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
// to prevent windauze file leaking
removeMavenIndexes();
- applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
+ ManagedRepositoryAdmin managedRepositoryAdmin = applicationContext.getBean( ManagedRepositoryAdmin.class );
+
+ if ( managedRepositoryAdmin.getManagedRepository( repoConfig.getId() ) != null )
+ {
+ managedRepositoryAdmin.deleteManagedRepository( repoConfig.getId(), null, true );
+ }
+
+ managedRepositoryAdmin.addManagedRepository( repoConfig, false, null );
// Setup target (proxied to) repository.
saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class );
// Setup the wagon mock.
- wagonMockControl = EasyMock.createNiceControl( );
+ wagonMockControl = EasyMock.createNiceControl();
wagonMock = wagonMockControl.createMock( Wagon.class );
delegate = (WagonDelegate) applicationContext.getBean( "wagon#test", Wagon.class );
assertNull( "Found file: " + downloadedFile + "; but was expecting a failure", downloadedFile );
}
- @SuppressWarnings ( "unchecked" )
+ @SuppressWarnings( "unchecked" )
protected void assertNoTempFiles( File expectedFile )
{
File workingDir = expectedFile.getParentFile();
if ( !sourceDir.exists() )
{
// This is just a warning.
- System.err.println(
- "[WARN] Skipping setup of testable managed repository, source dir does not exist: " + sourceDir );
+ log.error( "[WARN] Skipping setup of testable managed repository, source dir does not exist: {}", //
+ sourceDir );
}
else
{
}
-
protected void assertNotExistsInManagedDefaultRepo( File file )
throws Exception
{