From 438026ad5cf685678d9cb1b0d3c91a2643dd0d89 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Fri, 23 Sep 2011 08:42:40 +0000 Subject: [PATCH] make test more robust - the executor was previously disabled so it didn't operate and the queue removal was not reliable. Now wait for initial scan to complete, then force a scan. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174596 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/services/RepositoriesServiceTest.java | 13 ++++--------- .../test/resources/META-INF/spring-context-test.xml | 6 ++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java index 2c4f6ab8a..3714def7c 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java @@ -66,19 +66,14 @@ public class RepositoriesServiceTest String repoId = managedRepositoriesService.getManagedRepositories().get( 0 ).getId(); - // take care if already in scan queue by startup phase - if ( service.alreadyScanning( repoId ) ) + int timeout = 20000; + while ( timeout > 0 && service.alreadyScanning( repoId ) ) { - service.removeScanningTaskFromQueue( repoId ); - assertFalse( service.alreadyScanning( repoId ) ); + Thread.sleep( 500 ); + timeout -= 500; } assertTrue( service.scanRepository( repoId, true ) ); - - log.info( "scanRepo call ok " ); - - assertTrue( service.alreadyScanning( repoId ) ); - } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml index 5c1b5976a..2968237ba 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml @@ -56,4 +56,10 @@ + + + + + + \ No newline at end of file -- 2.39.5