revert previous changes for this test as it fail on jenkins but not locally... It Works On My Machine is back :-)

Signed-off-by: olivier lamy <olamy@apache.org>
This commit is contained in:
olivier lamy 2017-06-21 16:34:03 +10:00
parent 4e41052135
commit 7fc559dce1
1 changed files with 16 additions and 7 deletions

View File

@ -45,12 +45,12 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
public void testExecutorScanOnlyNewArtifacts() public void testExecutorScanOnlyNewArtifacts()
throws Exception throws Exception
{ {
createAndSaveTestStats();
RepositoryTask repoTask = new RepositoryTask(); RepositoryTask repoTask = new RepositoryTask();
repoTask.setRepositoryId( TEST_REPO_ID ); repoTask.setRepositoryId( TEST_REPO_ID );
repoTask.setScanAll( false ); repoTask.setScanAll( false );
createAndSaveTestStats();
taskExecutor.executeTask( repoTask ); taskExecutor.executeTask( repoTask );
// check no artifacts processed // check no artifacts processed
@ -64,7 +64,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
RepositoryStatistics newStats = RepositoryStatistics newStats =
repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ); repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
assertEquals( 0, newStats.getNewFileCount() ); assertEquals( 0, newStats.getNewFileCount() );
assertEquals( 41, newStats.getTotalFileCount() ); assertEquals( 31, newStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation // FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
@ -97,7 +97,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
RepositoryStatistics updatedStats = RepositoryStatistics updatedStats =
repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ); repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
assertEquals( 2, updatedStats.getNewFileCount() ); assertEquals( 2, updatedStats.getNewFileCount() );
assertEquals( 43, updatedStats.getTotalFileCount() ); assertEquals( 33, updatedStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation // FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
@ -144,7 +144,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
RepositoryStatistics newStats = RepositoryStatistics newStats =
repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ); repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
assertEquals( 2, newStats.getNewFileCount() ); assertEquals( 2, newStats.getNewFileCount() );
assertEquals( 43, newStats.getTotalFileCount() ); assertEquals( 33, newStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation // FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
@ -191,7 +191,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
RepositoryStatistics newStats = RepositoryStatistics newStats =
repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ); repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
assertEquals( 2, newStats.getNewFileCount() ); assertEquals( 2, newStats.getNewFileCount() );
assertEquals( 43, newStats.getTotalFileCount() ); assertEquals( 33, newStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation // FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
@ -225,9 +225,18 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
Date date = Calendar.getInstance().getTime(); Date date = Calendar.getInstance().getTime();
RepositoryStatistics stats = new RepositoryStatistics();
stats.setScanStartTime( new Date( date.getTime() - 1234567 ) );
stats.setScanEndTime( date );
stats.setNewFileCount( 31 );
stats.setTotalArtifactCount( 8 );
stats.setTotalFileCount( 31 );
stats.setTotalGroupCount( 3 );
stats.setTotalProjectCount( 5 );
stats.setTotalArtifactFileSize( 38545 );
repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, // repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, //
new Date( date.getTime() - 1234567 ), date, // new Date( date.getTime() - 1234567 ), //
41, 41 ); date, 31, 31 );
} }
} }