mirror of https://github.com/apache/archiva.git
avoid failing on cleaning test repo in unit tests: jackrabbit fail if deleting a repo with stale items
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1355247 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d570728de8
commit
21ad158d57
|
@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
|
||||||
|
|
||||||
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||||
import org.apache.archiva.common.utils.FileUtil;
|
import org.apache.archiva.common.utils.FileUtil;
|
||||||
|
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
|
||||||
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
|
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
|
||||||
import org.apache.archiva.rest.api.services.BrowseService;
|
import org.apache.archiva.rest.api.services.BrowseService;
|
||||||
import org.apache.archiva.rest.api.services.CommonServices;
|
import org.apache.archiva.rest.api.services.CommonServices;
|
||||||
|
@ -38,7 +39,6 @@ import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||||
import org.apache.cxf.jaxrs.client.WebClient;
|
import org.apache.cxf.jaxrs.client.WebClient;
|
||||||
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
|
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
|
||||||
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
@ -344,13 +344,29 @@ public abstract class AbstractArchivaRestTest
|
||||||
|
|
||||||
if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) != null )
|
if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) != null )
|
||||||
{
|
{
|
||||||
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( TARGET_REPO_ID, true );
|
try
|
||||||
assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) );
|
{
|
||||||
|
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( TARGET_REPO_ID, true );
|
||||||
|
assertNull(
|
||||||
|
getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) );
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
log.warn( "skip issue while cleaning test repository: this can cause test failure", e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) != null )
|
if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) != null )
|
||||||
{
|
{
|
||||||
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SOURCE_REPO_ID, true );
|
try
|
||||||
assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) );
|
{
|
||||||
|
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SOURCE_REPO_ID, true );
|
||||||
|
assertNull(
|
||||||
|
getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) );
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
log.warn( "skip issue while cleaning test repository: this can cause test failure", e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,7 +383,6 @@ public class RepositoriesServiceTest
|
||||||
|
|
||||||
repositoriesService.deleteArtifact( artifact );
|
repositoriesService.deleteArtifact( artifact );
|
||||||
|
|
||||||
|
|
||||||
artifacts =
|
artifacts =
|
||||||
browseService.getArtifactDownloadInfos( "org.apache.archiva.redback.components", "spring-quartz",
|
browseService.getArtifactDownloadInfos( "org.apache.archiva.redback.components", "spring-quartz",
|
||||||
"2.0-SNAPSHOT", SNAPSHOT_REPO_ID );
|
"2.0-SNAPSHOT", SNAPSHOT_REPO_ID );
|
||||||
|
@ -425,8 +424,7 @@ public class RepositoriesServiceTest
|
||||||
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SNAPSHOT_REPO_ID, true );
|
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SNAPSHOT_REPO_ID, true );
|
||||||
assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) );
|
assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) );
|
||||||
}
|
}
|
||||||
ManagedRepository managedRepository =
|
ManagedRepository managedRepository = getTestManagedRepository( SNAPSHOT_REPO_ID, "repo-with-snapshots" );
|
||||||
getTestManagedRepository( SNAPSHOT_REPO_ID, "repo-with-snapshots" );
|
|
||||||
/*managedRepository.setId( SNAPSHOT_REPO_ID );
|
/*managedRepository.setId( SNAPSHOT_REPO_ID );
|
||||||
managedRepository.setLocation( );
|
managedRepository.setLocation( );
|
||||||
managedRepository.setCronExpression( "* * * * * ?" );*/
|
managedRepository.setCronExpression( "* * * * * ?" );*/
|
||||||
|
@ -442,8 +440,16 @@ public class RepositoriesServiceTest
|
||||||
|
|
||||||
if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) != null )
|
if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) != null )
|
||||||
{
|
{
|
||||||
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SNAPSHOT_REPO_ID, true );
|
try
|
||||||
assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) );
|
{
|
||||||
|
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SNAPSHOT_REPO_ID, true );
|
||||||
|
assertNull(
|
||||||
|
getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) );
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
log.warn( "skip issue while cleaning test repository: this can cause test failure", e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue