]> source.dussan.org Git - archiva.git/commitdiff
avoid failing on cleaning test repo in unit tests: jackrabbit fail if deleting a...
authorOlivier Lamy <olamy@apache.org>
Fri, 29 Jun 2012 06:58:39 +0000 (06:58 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 29 Jun 2012 06:58:39 +0000 (06:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1355247 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java

index 085595cf4091f092752243bab1335f4b73a824eb..a607d17f35dc521833675d895a55d4b817f5629d 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
 
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 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.BrowseService;
 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.WebClient;
 import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
-import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
 import org.junit.Before;
 
 import javax.ws.rs.core.MediaType;
@@ -344,13 +344,29 @@ public abstract class AbstractArchivaRestTest
 
         if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) != null )
         {
-            getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( TARGET_REPO_ID, true );
-            assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) );
+            try
+            {
+                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 )
         {
-            getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SOURCE_REPO_ID, true );
-            assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) );
+            try
+            {
+                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 );
+            }
         }
 
     }
index 89d6fdb0123af08f98c926866c870fa42c26a6f1..96ce88b0983a095b90707a3dc3e309056edf01fb 100644 (file)
@@ -383,7 +383,6 @@ public class RepositoriesServiceTest
 
             repositoriesService.deleteArtifact( artifact );
 
-
             artifacts =
                 browseService.getArtifactDownloadInfos( "org.apache.archiva.redback.components", "spring-quartz",
                                                         "2.0-SNAPSHOT", SNAPSHOT_REPO_ID );
@@ -425,8 +424,7 @@ public class RepositoriesServiceTest
             getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SNAPSHOT_REPO_ID, true );
             assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) );
         }
-        ManagedRepository managedRepository =
-            getTestManagedRepository( SNAPSHOT_REPO_ID, "repo-with-snapshots" );
+        ManagedRepository managedRepository = getTestManagedRepository( SNAPSHOT_REPO_ID, "repo-with-snapshots" );
         /*managedRepository.setId( SNAPSHOT_REPO_ID );
         managedRepository.setLocation( );
         managedRepository.setCronExpression( "* * * * * ?" );*/
@@ -442,8 +440,16 @@ public class RepositoriesServiceTest
 
         if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) != null )
         {
-            getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( SNAPSHOT_REPO_ID, true );
-            assertNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) );
+            try
+            {
+                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 );
+            }
         }
 
     }