]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1583] tests modifications
authorOlivier Lamy <olamy@apache.org>
Fri, 6 Jul 2012 14:00:00 +0000 (14:00 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 6 Jul 2012 14:00:00 +0000 (14:00 +0000)
Submitted by Adrien Lecharpentier

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1358215 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/TestRepositoryStatisticsManager.java
archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java

index ba1fb931b89a1fc3ba67f4780f7599fd0368c32a..950f4778931bd5fbd09a0aec8ce6453f68d33463 100644 (file)
@@ -54,6 +54,7 @@ public class TestRepositoryStatisticsManager
         repositoryStatistics.setScanEndTime( endTime );
         repositoryStatistics.setNewFileCount( newFiles );
         repositoryStatistics.setTotalFileCount( totalFiles );
+        repositoryStatistics.setRepositoryId( repositoryId );
 
         stats.add( repositoryStatistics );
     }
index 5babb162564722596f77ff5da0844aa434f4097e..189e2cf205b9ca34c5bc756777ec9fd620c7dcfd 100644 (file)
@@ -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 );
     }
index 18760d2628a7239b1b88f34574ccc9d87ffa08fb..1367562a6499bceac047e3b1a6ca76e01457a1c9 100644 (file)
@@ -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 );