]> source.dussan.org Git - archiva.git/commitdiff
Trying to fix merge test error on build server
authorMartin Stockhammer <martin_s@apache.org>
Sat, 31 Aug 2019 16:59:37 +0000 (18:59 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Sat, 31 Aug 2019 16:59:37 +0000 (18:59 +0200)
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java
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/BrowseServiceTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java

index 95cbdc984ab6390d7c64ba67a15c4b8f91f1a113..7bd45f0e72939f41eb36363621cd9f7fe4450241 100644 (file)
@@ -71,7 +71,7 @@ public class DefaultMergeRepositoriesService
         }
         catch ( MetadataRepositoryException e )
         {
-            e.printStackTrace( );
+            log.error( "Error while creating repository session {}", e.getMessage( ), e );
         }
         try
         {
index 82a8fe720332a427e884d04af342884d1cce8d27..4848c7f300bbf194b66f6f43614fc8f8738da306 100644 (file)
@@ -553,7 +553,7 @@ public abstract class AbstractArchivaRestTest
 
     }
 
-    protected void createAndIndexRepo( String testRepoId, Path srcRepoPath, boolean stageNeeded )
+    protected void createAndIndexRepo( String testRepoId, Path srcRepoPath, Path stagedSrcRepoPath, boolean stageNeeded )
         throws ArchivaRestServiceException, IOException, RedbackServiceException
     {
         if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( testRepoId ) != null )
@@ -572,10 +572,17 @@ public abstract class AbstractArchivaRestTest
         }
 
         Path repoPath = getAppserverBase().resolve( "data" ).resolve( "repositories" ).resolve( testRepoId);
+        Path stagedRepoPath = getAppserverBase().resolve( "data" ).resolve( "repositories" ).resolve( testRepoId + "-stage");
 
         FileUtils.deleteQuietly(repoPath.toFile());
         FileUtils.copyDirectory(srcRepoPath.toFile(), repoPath.toFile());
 
+        if (stagedSrcRepoPath!=null) {
+            FileUtils.deleteQuietly(stagedRepoPath.toFile());
+            FileUtils.copyDirectory(stagedSrcRepoPath.toFile(), stagedRepoPath.toFile());
+
+        }
+
         managedRepository.setLocation( repoPath.toAbsolutePath().toString() );
         String suffix = Long.toString( new Date().getTime() );
         Path baseDir = Files.createTempDirectory( "archiva-test-index" ).toAbsolutePath();
@@ -607,14 +614,14 @@ public abstract class AbstractArchivaRestTest
     protected void createAndIndexRepo( String testRepoId, Path srcRepoPath )
         throws Exception
     {
-        createAndIndexRepo( testRepoId, srcRepoPath, false );
+        createAndIndexRepo( testRepoId, srcRepoPath, null, false );
         scanRepo( testRepoId );
     }
 
-    protected void createStagedNeededRepo( String testRepoId, Path srcRepoPath, boolean scan )
+    protected void createStagedNeededRepo( String testRepoId, Path srcRepoPath, Path stagedSrcRepoPath, boolean scan )
         throws Exception
     {
-        createAndIndexRepo( testRepoId, srcRepoPath, true );
+        createAndIndexRepo( testRepoId, srcRepoPath, stagedSrcRepoPath, true );
         if ( scan )
         {
             scanRepo( testRepoId );
index f85287214c418d6494c44b09e5bcde9929b70cd4..350d849cb6f981205ea4559a539f43d6f244e335 100644 (file)
@@ -509,7 +509,7 @@ public class BrowseServiceTest
         }
 
         createAndIndexRepo( TEST_REPO_ID, getProjectDirectory().resolve( "src/test/repo-with-osgi" ),
-                            false );
+                            null, false );
 
         waitForScanToComplete( TEST_REPO_ID );
     }
index aaa601e3f67a07716137e2d58ddc80eecb912eec..60b4b51168844866530e521e2bb0ead30a4f7252 100644 (file)
@@ -144,8 +144,7 @@ public class MergeRepositoriesServiceTest
         // FileUtils.copyDirectory( Paths.get( System.getProperty( "basedir" ), "src/test/repo-with-osgi" ).toFile(), repo.toFile() );
 
         Path srcRepo = getProjectDirectory().resolve(  "src/test/repo-with-osgi" );
-        createStagedNeededRepo( TEST_REPOSITORY, srcRepo , true );
-        FileUtils.copyDirectory( getProjectDirectory().resolve("src/test/repo-with-osgi-stage" ).toFile(),
-                                 repoStage.toFile() );
+        createStagedNeededRepo( TEST_REPOSITORY, srcRepo , getProjectDirectory().resolve("src/test/repo-with-osgi-stage" ),  true );
+
     }
 }