From 968ab1e0348b14878b1e44c1da9bd7fc5d514aad Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 6 Jul 2012 14:00:00 +0000 Subject: [PATCH] [MRM-1583] tests modifications Submitted by Adrien Lecharpentier git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1358215 13f79535-47bb-0310-9956-ffa450edef68 --- .../repository/TestRepositoryStatisticsManager.java | 1 + .../stats/JcrRepositoryStatisticsGatheringTest.java | 9 ++++++++- .../stats/RepositoryStatisticsManagerTest.java | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) 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 ba1fb931b..950f47789 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 @@ -54,6 +54,7 @@ public class TestRepositoryStatisticsManager repositoryStatistics.setScanEndTime( endTime ); repositoryStatistics.setNewFileCount( newFiles ); repositoryStatistics.setTotalFileCount( totalFiles ); + repositoryStatistics.setRepositoryId( repositoryId ); stats.add( repositoryStatistics ); } diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java index 5babb1625..189e2cf20 100644 --- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java +++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java @@ -73,6 +73,9 @@ public class JcrRepositoryStatisticsGatheringTest File dir = new File( "target/jcr" ); FileUtils.deleteDirectory( dir ); + assertTrue( confFile.exists() ); + assertFalse( dir.exists() ); + TransientRepository repository = new TransientRepository( confFile, dir ); session = repository.login( new SimpleCredentials( "username", "password".toCharArray() ) ); @@ -110,7 +113,10 @@ public class JcrRepositoryStatisticsGatheringTest public void tearDown() throws Exception { - session.logout(); + if ( session != null ) + { + session.logout(); + } super.tearDown(); } @@ -146,6 +152,7 @@ public class JcrRepositoryStatisticsGatheringTest expectedStatistics.setTotalCountForType( "xml", 3 ); expectedStatistics.setTotalCountForType( "war", 2 ); expectedStatistics.setTotalCountForType( "pom", 144 ); + expectedStatistics.setRepositoryId( TEST_REPO ); verify( metadataRepository ).addMetadataFacet( TEST_REPO, expectedStatistics ); } diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java index 18760d262..1367562a6 100644 --- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java +++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java @@ -502,6 +502,7 @@ public class RepositoryStatisticsManagerTest private RepositoryStatistics createTestStats( Date startTime, Date endTime ) { RepositoryStatistics stats = new RepositoryStatistics(); + stats.setRepositoryId( TEST_REPO_ID ); stats.setScanStartTime( startTime ); stats.setScanEndTime( endTime ); stats.setTotalArtifactFileSize( 20 * 12345L );