@Inject
private RepositoryContentFactory repositoryFactory;
+
private void initSourceTargetRepo()
throws Exception
{
assertFalse( targetRepo.exists() );
targetRepo.mkdirs();
+ if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) != null )
+ {
+ getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( TARGET_REPO_ID, true );
+ assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) );
+ }
ManagedRepository managedRepository = getTestManagedRepository();
managedRepository.setId( TARGET_REPO_ID );
managedRepository.setLocation( targetRepo.getCanonicalPath() );
getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository );
assertNotNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) );
-
File originRepo = new File( "target/test-origin-repo" );
if ( originRepo.exists() )
{
assertFalse( originRepo.exists() );
FileUtils.copyDirectory( new File( "src/test/repo-with-osgi" ), originRepo );
+ if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) != null )
+ {
+ getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SOURCE_REPO_ID, true );
+ assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) );
+ }
+
managedRepository = getTestManagedRepository();
managedRepository.setId( SOURCE_REPO_ID );
managedRepository.setLocation( originRepo.getCanonicalPath() );
}
+ public void clean() throws Exception
+ {
+
+ if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) != null )
+ {
+ getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( TARGET_REPO_ID, true );
+ assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) );
+ }
+ if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) != null )
+ {
+ getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SOURCE_REPO_ID, true );
+ assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) );
+ }
+
+ }
+
@Test
public void copyToAnEmptyRepo()
throws Exception
"/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.pom" );
assertTrue( "not exists " + pom.getPath(), pom.exists() );
-
+ clean();
}
//@Test
throws Exception
{
initSourceTargetRepo();
+ clean();
}
}