From: Martin Stockhammer Date: Sat, 31 Aug 2019 16:59:37 +0000 (+0200) Subject: Trying to fix merge test error on build server X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=36249f664600be844e3204276d957f23767f83f0;p=archiva.git Trying to fix merge test error on build server --- diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java index 95cbdc984..7bd45f0e7 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java @@ -71,7 +71,7 @@ public class DefaultMergeRepositoriesService } catch ( MetadataRepositoryException e ) { - e.printStackTrace( ); + log.error( "Error while creating repository session {}", e.getMessage( ), e ); } try { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java index 82a8fe720..4848c7f30 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java @@ -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 ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java index f85287214..350d849cb 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java @@ -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 ); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java index aaa601e3f..60b4b5116 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java @@ -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 ); + } }