aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/repository-statistics/src
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2009-12-16 02:25:42 +0000
committerBrett Porter <brett@apache.org>2009-12-16 02:25:42 +0000
commit0960c24cfbf3c11faa4871b1029308e78d8caa7c (patch)
treec409cc04f8b2f603333c8e0cf32cd31e14be9622 /archiva-modules/plugins/repository-statistics/src
parent2a5c2bb81a01346573cf298e9b285747cf9a31ca (diff)
downloadarchiva-0960c24cfbf3c11faa4871b1029308e78d8caa7c.tar.gz
archiva-0960c24cfbf3c11faa4871b1029308e78d8caa7c.zip
[MRM-1301] add back summary statistics for various counts
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@891102 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/repository-statistics/src')
-rw-r--r--archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java59
-rw-r--r--archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java73
-rw-r--r--archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManager.java2
-rw-r--r--archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java167
4 files changed, 274 insertions, 27 deletions
diff --git a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
index 5d877951a..506f593d9 100644
--- a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
+++ b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
@@ -21,10 +21,12 @@ package org.apache.archiva.metadata.repository.stats;
import java.text.ParseException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,23 +61,60 @@ public class DefaultRepositoryStatisticsManager
}
}
- public void addStatisticsAfterScan( String repositoryId, RepositoryStatistics repositoryStatistics )
+ private void walkRepository( RepositoryStatistics stats, String repositoryId, String ns )
{
+ for ( String namespace : metadataRepository.getNamespaces( repositoryId, ns ) )
+ {
+ walkRepository( stats, repositoryId, ns + "." + namespace );
+ }
+
+ Collection<String> projects = metadataRepository.getProjects( repositoryId, ns );
+ if ( !projects.isEmpty() )
+ {
+ stats.setTotalGroupCount( stats.getTotalGroupCount() + 1 );
+ stats.setTotalProjectCount( stats.getTotalProjectCount() + projects.size() );
+
+ for ( String project : projects )
+ {
+ for ( String version : metadataRepository.getProjectVersions( repositoryId, ns, project ) )
+ {
+ for ( ArtifactMetadata artifact : metadataRepository.getArtifacts( repositoryId, ns, project,
+ version ) )
+ {
+ stats.setTotalArtifactCount( stats.getTotalArtifactCount() + 1 );
+ stats.setTotalArtifactFileSize( stats.getTotalArtifactFileSize() + artifact.getSize() );
+
+ // TODO: add by type
+ }
+ }
+ }
+ }
+ }
+
+
+ public void addStatisticsAfterScan( String repositoryId, Date startTime, Date endTime, long totalFiles, long newFiles )
+ {
+ RepositoryStatistics repositoryStatistics = new RepositoryStatistics();
+ repositoryStatistics.setScanStartTime( startTime );
+ repositoryStatistics.setScanEndTime( endTime );
+ repositoryStatistics.setTotalFileCount( totalFiles );
+ repositoryStatistics.setNewFileCount( newFiles );
+
// In the future, instead of being tied to a scan we might want to record information in the fly based on
// events that are occurring. Even without these totals we could query much of the information on demand based
// on information from the metadata content repository. In the mean time, we lock information in at scan time.
// Note that if new types are later discoverable due to a code change or new plugin, historical stats will not
// be updated and the repository will need to be rescanned.
- // TODO, populate these and also a count per artifact type
- // populate total artifact count from content repository
-// repositoryStatistics.setTotalArtifactCount( );
- // populate total size from content repository
-// repositoryStatistics.setTotalArtifactFileSize( );
- // populate total group count from content repository
-// repositoryStatistics.setTotalGroupCount( );
- // populate total project count from content repository
-// repositoryStatistics.setTotalProjectCount( );
+ long startWalk = System.currentTimeMillis();
+ // TODO: we can probably get a more efficient implementation directly from the metadata repository, but for now
+ // we just walk it. Alternatively, we could build an index, or store the aggregate information and update
+ // it on the fly
+ for ( String ns : metadataRepository.getRootNamespaces( repositoryId ) )
+ {
+ walkRepository( repositoryStatistics, repositoryId, ns );
+ }
+ log.info( "Repository walk for statistics executed in " + ( System.currentTimeMillis() - startWalk ) + "ms" );
metadataRepository.addMetadataFacet( repositoryId, repositoryStatistics );
}
diff --git a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java
index 272d524dd..6b8020054 100644
--- a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java
+++ b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java
@@ -170,4 +170,77 @@ public class RepositoryStatistics
totalProjectCount = Long.valueOf( properties.get( "totalProjectCount" ) );
newFileCount = Long.valueOf( properties.get( "newFileCount" ) );
}
+
+ @Override
+ public String toString()
+ {
+ return "RepositoryStatistics{" + "scanEndTime=" + scanEndTime + ", scanStartTime=" + scanStartTime +
+ ", totalArtifactCount=" + totalArtifactCount + ", totalArtifactFileSize=" + totalArtifactFileSize +
+ ", totalFileCount=" + totalFileCount + ", totalGroupCount=" + totalGroupCount + ", totalProjectCount=" +
+ totalProjectCount + ", newFileCount=" + newFileCount + '}';
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() )
+ {
+ return false;
+ }
+
+ RepositoryStatistics that = (RepositoryStatistics) o;
+
+ if ( newFileCount != that.newFileCount )
+ {
+ return false;
+ }
+ if ( totalArtifactCount != that.totalArtifactCount )
+ {
+ return false;
+ }
+ if ( totalArtifactFileSize != that.totalArtifactFileSize )
+ {
+ return false;
+ }
+ if ( totalFileCount != that.totalFileCount )
+ {
+ return false;
+ }
+ if ( totalGroupCount != that.totalGroupCount )
+ {
+ return false;
+ }
+ if ( totalProjectCount != that.totalProjectCount )
+ {
+ return false;
+ }
+ if ( !scanEndTime.equals( that.scanEndTime ) )
+ {
+ return false;
+ }
+ if ( !scanStartTime.equals( that.scanStartTime ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = scanEndTime.hashCode();
+ result = 31 * result + scanStartTime.hashCode();
+ result = 31 * result + (int) ( totalArtifactCount ^ ( totalArtifactCount >>> 32 ) );
+ result = 31 * result + (int) ( totalArtifactFileSize ^ ( totalArtifactFileSize >>> 32 ) );
+ result = 31 * result + (int) ( totalFileCount ^ ( totalFileCount >>> 32 ) );
+ result = 31 * result + (int) ( totalGroupCount ^ ( totalGroupCount >>> 32 ) );
+ result = 31 * result + (int) ( totalProjectCount ^ ( totalProjectCount >>> 32 ) );
+ result = 31 * result + (int) ( newFileCount ^ ( newFileCount >>> 32 ) );
+ return result;
+ }
}
diff --git a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManager.java b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManager.java
index f5388a4b5..6abc44348 100644
--- a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManager.java
+++ b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManager.java
@@ -26,7 +26,7 @@ public interface RepositoryStatisticsManager
{
RepositoryStatistics getLastStatistics( String repositoryId );
- void addStatisticsAfterScan( String repositoryId, RepositoryStatistics repositoryStatistics );
+ void addStatisticsAfterScan( String repositoryId, Date startTime, Date endTime, long totalFiles, long newFiles );
void deleteStatistics( String repositoryId );
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 f806291c8..289a33820 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
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.easymock.MockControl;
@@ -120,6 +121,8 @@ public class RepositoryStatisticsManagerTest
RepositoryStatistics stats = createTestStats( startTime, current );
+ walkRepository( 1 );
+
metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
metadataRepositoryControl.expectAndReturn(
metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
@@ -130,15 +133,15 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.replay();
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime, current, 56345, 45 );
stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
assertNotNull( stats );
- assertEquals( 1400032000L, stats.getTotalArtifactFileSize() );
+ assertEquals( 246900, stats.getTotalArtifactFileSize() );
assertEquals( 45, stats.getNewFileCount() );
- assertEquals( 10412, stats.getTotalArtifactCount() );
- assertEquals( 2036, stats.getTotalProjectCount() );
- assertEquals( 531, stats.getTotalGroupCount() );
+ assertEquals( 20, stats.getTotalArtifactCount() );
+ assertEquals( 5, stats.getTotalProjectCount() );
+ assertEquals( 4, stats.getTotalGroupCount() );
assertEquals( 56345, stats.getTotalFileCount() );
assertEquals( current.getTime() - 12345, stats.getScanStartTime().getTime() );
assertEquals( current, stats.getScanEndTime() );
@@ -148,6 +151,8 @@ public class RepositoryStatisticsManagerTest
public void testDeleteStats()
{
+ walkRepository( 2 );
+
Date current = new Date();
Date startTime1 = new Date( current.getTime() - 12345 );
@@ -173,8 +178,10 @@ public class RepositoryStatisticsManagerTest
metadataRepositoryControl.replay();
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats1 );
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats2 );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime1, stats1.getScanEndTime(), 56345,
+ 45 );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime2, stats2.getScanEndTime(), 56345,
+ 45 );
assertNotNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
@@ -205,6 +212,8 @@ public class RepositoryStatisticsManagerTest
public void testGetStatsRangeInside()
{
+ walkRepository( 3 );
+
Date current = new Date();
addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
@@ -225,7 +234,8 @@ public class RepositoryStatisticsManagerTest
for ( RepositoryStatistics stats : statsCreated.values() )
{
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
+ stats.getScanEndTime(), 56345, 45 );
}
List<RepositoryStatistics> list =
@@ -240,6 +250,8 @@ public class RepositoryStatisticsManagerTest
public void testGetStatsRangeUpperOutside()
{
+ walkRepository( 3 );
+
Date current = new Date();
addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
@@ -263,7 +275,8 @@ public class RepositoryStatisticsManagerTest
for ( RepositoryStatistics stats : statsCreated.values() )
{
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
+ stats.getScanEndTime(), 56345, 45 );
}
List<RepositoryStatistics> list =
@@ -279,6 +292,8 @@ public class RepositoryStatisticsManagerTest
public void testGetStatsRangeLowerOutside()
{
+ walkRepository( 3 );
+
Date current = new Date();
addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
@@ -302,7 +317,8 @@ public class RepositoryStatisticsManagerTest
for ( RepositoryStatistics stats : statsCreated.values() )
{
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
+ stats.getScanEndTime(), 56345, 45 );
}
List<RepositoryStatistics> list =
@@ -318,6 +334,8 @@ public class RepositoryStatisticsManagerTest
public void testGetStatsRangeLowerAndUpperOutside()
{
+ walkRepository( 3 );
+
Date current = new Date();
addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
@@ -345,7 +363,8 @@ public class RepositoryStatisticsManagerTest
for ( RepositoryStatistics stats : statsCreated.values() )
{
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
+ stats.getScanEndTime(), 56345, 45 );
}
List<RepositoryStatistics> list =
@@ -362,6 +381,8 @@ public class RepositoryStatisticsManagerTest
public void testGetStatsRangeNotInside()
{
+ walkRepository( 3 );
+
Date current = new Date();
addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
@@ -376,7 +397,8 @@ public class RepositoryStatisticsManagerTest
for ( RepositoryStatistics stats : statsCreated.values() )
{
- repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats );
+ repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
+ stats.getScanEndTime(), 56345, 45 );
}
List<RepositoryStatistics> list =
@@ -395,17 +417,130 @@ public class RepositoryStatisticsManagerTest
statsCreated.put( stats.getName(), stats );
}
+ private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
+ {
+ ArtifactMetadata metadata = new ArtifactMetadata();
+ metadata.setRepositoryId( TEST_REPO_ID );
+ metadata.setId( projectId + "-" + projectVersion + "." + type );
+ metadata.setProject( projectId );
+ metadata.setSize( 12345L );
+ metadata.setVersion( projectVersion );
+ metadata.setNamespace( namespace );
+ return metadata;
+ }
+
private RepositoryStatistics createTestStats( Date startTime, Date endTime )
{
RepositoryStatistics stats = new RepositoryStatistics();
stats.setScanStartTime( startTime );
stats.setScanEndTime( endTime );
- stats.setTotalArtifactFileSize( 1400032000L );
+ stats.setTotalArtifactFileSize( 20 * 12345L );
stats.setNewFileCount( 45 );
- stats.setTotalArtifactCount( 10412 );
- stats.setTotalProjectCount( 2036 );
- stats.setTotalGroupCount( 531 );
+ stats.setTotalArtifactCount( 20 );
+ stats.setTotalProjectCount( 5 );
+ stats.setTotalGroupCount( 4 );
stats.setTotalFileCount( 56345 );
return stats;
}
+
+ private void walkRepository( int count )
+ {
+ for ( int i = 0; i < count; i++ )
+ {
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
+ Arrays.asList( "com", "org" ) );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
+ Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
+ Arrays.asList( "example" ) );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
+ Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
+ Arrays.asList( "example-project" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjectVersions( TEST_REPO_ID, "com.example", "example-project" ),
+ Arrays.asList( "1.0", "1.1" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.0" ),
+ Arrays.asList( createArtifact( "com.example", "example-project", "1.0", "jar" ),
+ createArtifact( "com.example", "example-project", "1.0", "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.1" ),
+ Arrays.asList( createArtifact( "com.example", "example-project", "1.1", "jar" ),
+ createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
+ Arrays.asList( "apache", "codehaus" ) );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
+ Arrays.asList( "archiva", "maven" ) );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
+ Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.archiva" ), Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjects( TEST_REPO_ID, "org.apache.archiva" ),
+ Arrays.asList( "metadata-repository-api", "metadata-model" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ),
+ Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api",
+ "1.3-SNAPSHOT" ),
+ Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
+ "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ),
+ Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-model" ),
+ Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ),
+ Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
+ "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ),
+ Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjects( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList( "maven-model" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", "maven-model" ),
+ Arrays.asList( "2.2.1" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ),
+ Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "2.2.1", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-repository-api", "2.2.1", "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
+ Arrays.asList( "plexus" ) );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
+ Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
+ Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus.plexus" ), Arrays.asList() );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus.plexus" ),
+ Arrays.asList( "plexus-spring" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getProjectVersions( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ),
+ Arrays.asList( "1.0", "1.1", "1.2" ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ),
+ Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "jar" ),
+ createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ),
+ Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "jar" ),
+ createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "pom" ) ) );
+ metadataRepositoryControl.expectAndReturn(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ),
+ Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "jar" ),
+ createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "pom" ) ) );
+ }
+ }
}