aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-scheduler
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-08-16 22:36:09 +0200
committerMartin Stockhammer <martin_s@apache.org>2019-08-16 22:36:09 +0200
commit118604a706f1fd66bcda450c1ac8370eff60e4cf (patch)
treeb181604dbf884a82697e987500ceb2ed81e24f28 /archiva-modules/archiva-scheduler
parente4f38c2fbe1f6ce82da98ca9d67d6cc41757f833 (diff)
downloadarchiva-118604a706f1fd66bcda450c1ac8370eff60e4cf.tar.gz
archiva-118604a706f1fd66bcda450c1ac8370eff60e4cf.zip
Fixing unit tests
Diffstat (limited to 'archiva-modules/archiva-scheduler')
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java4
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java2
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java12
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/TestRepositoryStatisticsManager.java11
4 files changed, 14 insertions, 15 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java
index 2c97314ef..bb7690e5e 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java
@@ -141,7 +141,7 @@ public class ArchivaRepositoryScanningTaskExecutor
if ( !task.isScanAll() )
{
RepositoryStatistics previousStats =
- repositoryStatisticsManager.getLastStatistics( metadataRepository, repoId );
+ repositoryStatisticsManager.getLastStatistics( repoId );
if ( previousStats != null )
{
sinceWhen = previousStats.getScanStartTime().getTime();
@@ -166,7 +166,7 @@ public class ArchivaRepositoryScanningTaskExecutor
log.info( "Gathering repository statistics" );
- repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, repoId,
+ repositoryStatisticsManager.addStatisticsAfterScan( repoId,
stats.getWhenGathered(), endTime,
stats.getTotalFileCount(),
stats.getTotalFileCount() - previousFileCount );
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
index ef9067df5..d87e10a72 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
@@ -315,7 +315,7 @@ public class DefaultRepositoryArchivaTaskScheduler
{
long start = System.currentTimeMillis();
- boolean res = repositoryStatisticsManager.hasStatistics( metadataRepository, repoConfig.getId() );
+ boolean res = repositoryStatisticsManager.hasStatistics( repoConfig.getId() );
long end = System.currentTimeMillis();
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java
index 835454370..291d6678e 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java
@@ -66,7 +66,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
// check correctness of new stats
RepositoryStatistics newStats =
- repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
+ repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
assertEquals( 0, newStats.getNewFileCount() );
assertEquals( 31, newStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
@@ -99,7 +99,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
// check correctness of new stats
RepositoryStatistics updatedStats =
- repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
+ repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
assertEquals( 2, updatedStats.getNewFileCount() );
assertEquals( 33, updatedStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
@@ -146,7 +146,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
// check correctness of new stats
RepositoryStatistics newStats =
- repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
+ repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
assertEquals( 2, newStats.getNewFileCount() );
assertEquals( 33, newStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
@@ -193,7 +193,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
// check correctness of new stats
RepositoryStatistics newStats =
- repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
+ repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
assertEquals( 2, newStats.getNewFileCount() );
assertEquals( 33, newStats.getTotalFileCount() );
// FIXME: can't test these as they weren't stored in the database, move to tests for RepositoryStatisticsManager implementation
@@ -213,7 +213,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
repoTask.setScanAll( true );
Date date = Calendar.getInstance().getTime();
- repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, //
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, //
new Date( date.getTime() - 1234567 ), //
date, 8, 8 ); //
@@ -239,7 +239,7 @@ public class ArchivaRepositoryScanningTaskExecutorPhase2Test
stats.setTotalProjectCount( 5 );
stats.setTotalArtifactFileSize( 38545 );
- repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, //
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, //
new Date( date.getTime() - 1234567 ), //
date, 31, 31 );
}
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/TestRepositoryStatisticsManager.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/TestRepositoryStatisticsManager.java
index 7f0512c84..8f1e0c505 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/TestRepositoryStatisticsManager.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/TestRepositoryStatisticsManager.java
@@ -19,7 +19,6 @@ package org.apache.archiva.scheduler.repository;
* under the License.
*/
-import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.stats.model.DefaultRepositoryStatistics;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
@@ -39,14 +38,14 @@ public class TestRepositoryStatisticsManager
private Map<String, List<RepositoryStatistics>> repoStats = new HashMap<>();
@Override
- public boolean hasStatistics( MetadataRepository metadataRepository, String repositoryId )
+ public boolean hasStatistics( String repositoryId )
throws MetadataRepositoryException
{
return !repoStats.isEmpty();
}
@Override
- public RepositoryStatistics getLastStatistics( MetadataRepository metadataRepository, String repositoryId )
+ public RepositoryStatistics getLastStatistics( String repositoryId )
{
List<RepositoryStatistics> repositoryStatisticsList = getStatsList( repositoryId );
return !repositoryStatisticsList.isEmpty()
@@ -55,7 +54,7 @@ public class TestRepositoryStatisticsManager
}
@Override
- public void addStatisticsAfterScan( MetadataRepository metadataRepository, String repositoryId, Date startTime,
+ public void addStatisticsAfterScan( String repositoryId, Date startTime,
Date endTime, long totalFiles, long newFiles )
{
List<RepositoryStatistics> stats = getStatsList( repositoryId );
@@ -71,13 +70,13 @@ public class TestRepositoryStatisticsManager
}
@Override
- public void deleteStatistics( MetadataRepository metadataRepository, String repositoryId )
+ public void deleteStatistics( String repositoryId )
{
repoStats.remove( repositoryId );
}
@Override
- public List<RepositoryStatistics> getStatisticsInRange( MetadataRepository metadataRepository, String repositoryId,
+ public List<RepositoryStatistics> getStatisticsInRange( String repositoryId,
Date startDate, Date endDate )
{
throw new UnsupportedOperationException();