Trying to fix merge test error on build server

This commit is contained in:
Martin Stockhammer 2019-08-31 18:59:37 +02:00
parent f1ae6b4145
commit 36249f6646
4 changed files with 15 additions and 9 deletions

View File

@ -71,7 +71,7 @@ public class DefaultMergeRepositoriesService
}
catch ( MetadataRepositoryException e )
{
e.printStackTrace( );
log.error( "Error while creating repository session {}", e.getMessage( ), e );
}
try
{

View 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 );

View 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 );
}

View 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 );
}
}