exclude .svn directories in the test

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@887051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-12-04 04:07:12 +00:00
parent d03e92ca26
commit 6c1cd8d63f
2 changed files with 10 additions and 6 deletions

View File

@ -187,7 +187,7 @@ public class ArchivaRepositoryScanningTaskExecutor
log.error( "Error occurred while querying artifacts for artifact count : " + ae.getMessage() ); log.error( "Error occurred while querying artifacts for artifact count : " + ae.getMessage() );
} }
// total repo size // total repo size -- TODO: needs to exclude ignored files (eg .svn)
long size = FileUtils.sizeOfDirectory( new File( arepo.getLocation() ) ); long size = FileUtils.sizeOfDirectory( new File( arepo.getLocation() ) );
dbstats.setTotalSize( size ); dbstats.setTotalSize( size );

View File

@ -154,6 +154,10 @@ public class ArchivaRepositoryScanningTaskExecutorTest
{ {
f.setLastModified( cal.getTimeInMillis() ); f.setLastModified( cal.getTimeInMillis() );
} }
for ( String dir : (List<String>) FileUtils.getDirectoryNames( repoDir, "**/.svn", null, false ) )
{
FileUtils.deleteDirectory( new File( repoDir, dir ) );
}
assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() ); assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
@ -226,7 +230,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
// assertEquals( 5, newStats.getTotalProjectCount() ); // assertEquals( 5, newStats.getTotalProjectCount() );
assertEquals( 38545, newStats.getTotalSize() ); assertEquals( 14159, newStats.getTotalSize() );
File newArtifactGroup = new File( repoDir, "org/apache/archiva" ); File newArtifactGroup = new File( repoDir, "org/apache/archiva" );
@ -260,7 +264,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
// assertEquals( 5, newStats.getTotalProjectCount() ); // assertEquals( 5, newStats.getTotalProjectCount() );
assertEquals( 43687, updatedStats.getTotalSize() ); assertEquals( 19301, updatedStats.getTotalSize() );
} }
public void testExecutorScanOnlyNewArtifactsChangeTimes() public void testExecutorScanOnlyNewArtifactsChangeTimes()
@ -308,7 +312,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
// assertEquals( 5, newStats.getTotalProjectCount() ); // assertEquals( 5, newStats.getTotalProjectCount() );
assertEquals( 43687, newStats.getTotalSize() ); assertEquals( 19301, newStats.getTotalSize() );
} }
public void testExecutorScanOnlyNewArtifactsMidScan() public void testExecutorScanOnlyNewArtifactsMidScan()
@ -356,7 +360,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
// assertEquals( 8, newStats.getTotalArtifactCount() ); // assertEquals( 8, newStats.getTotalArtifactCount() );
// assertEquals( 3, newStats.getTotalGroupCount() ); // assertEquals( 3, newStats.getTotalGroupCount() );
// assertEquals( 5, newStats.getTotalProjectCount() ); // assertEquals( 5, newStats.getTotalProjectCount() );
assertEquals( 43687, newStats.getTotalSize() ); assertEquals( 19301, newStats.getTotalSize() );
} }
private void createAndSaveTestStats() private void createAndSaveTestStats()
@ -369,7 +373,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
stats.setTotalFileCount( 31 ); stats.setTotalFileCount( 31 );
stats.setTotalGroupCount( 3 ); stats.setTotalGroupCount( 3 );
stats.setTotalProjectCount( 5 ); stats.setTotalProjectCount( 5 );
stats.setTotalSize( 38545 ); stats.setTotalSize( 14159 );
stats.setWhenGathered( Calendar.getInstance().getTime() ); stats.setWhenGathered( Calendar.getInstance().getTime() );
dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( stats ); dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( stats );