1 package org.apache.archiva.metadata.repository.stats;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import java.text.ParseException;
23 import java.text.SimpleDateFormat;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.Collections;
27 import java.util.Date;
28 import java.util.LinkedHashMap;
29 import java.util.List;
31 import java.util.TimeZone;
33 import junit.framework.TestCase;
34 import org.apache.archiva.metadata.model.ArtifactMetadata;
35 import org.apache.archiva.metadata.repository.MetadataRepository;
36 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
37 import org.apache.maven.archiva.repository.RepositoryContentFactory;
38 import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
39 import org.easymock.MockControl;
40 import org.easymock.classextension.MockClassControl;
42 public class RepositoryStatisticsManagerTest
45 private DefaultRepositoryStatisticsManager repositoryStatisticsManager;
47 private static final String TEST_REPO_ID = "test-repo";
49 private MockControl metadataRepositoryControl;
51 private MetadataRepository metadataRepository;
53 private static final String FIRST_TEST_SCAN = "2009/12/01/123456.789";
55 private static final String SECOND_TEST_SCAN = "2009/12/02/012345.678";
57 private Map<String, RepositoryStatistics> statsCreated = new LinkedHashMap<String, RepositoryStatistics>();
59 private static final SimpleDateFormat TIMESTAMP_FORMAT = createTimestampFormat();
61 private static SimpleDateFormat createTimestampFormat()
63 SimpleDateFormat fmt = new SimpleDateFormat( RepositoryStatistics.SCAN_TIMESTAMP_FORMAT );
64 fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
69 protected void setUp()
74 repositoryStatisticsManager = new DefaultRepositoryStatisticsManager();
76 metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
77 metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
78 repositoryStatisticsManager.setMetadataRepository( metadataRepository );
80 ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
81 repository.setId( TEST_REPO_ID );
82 repository.setLocation( "" );
83 ManagedDefaultRepositoryContent content = new ManagedDefaultRepositoryContent();
84 content.setRepository( repository );
85 MockControl control = MockClassControl.createControl( RepositoryContentFactory.class );
86 RepositoryContentFactory contentFactory = (RepositoryContentFactory) control.getMock();
87 contentFactory.getManagedRepositoryContent( TEST_REPO_ID );
88 control.setDefaultReturnValue( content );
90 repositoryStatisticsManager.setRepositoryContentFactory( contentFactory );
93 public void testGetLatestStats()
96 Date startTime = TIMESTAMP_FORMAT.parse( SECOND_TEST_SCAN );
97 Date endTime = new Date( startTime.getTime() + 60000 );
99 RepositoryStatistics stats = new RepositoryStatistics();
100 stats.setScanStartTime( startTime );
101 stats.setScanEndTime( endTime );
102 stats.setTotalArtifactFileSize( 1314527915L );
103 stats.setNewFileCount( 123 );
104 stats.setTotalArtifactCount( 10386 );
105 stats.setTotalProjectCount( 2031 );
106 stats.setTotalGroupCount( 529 );
107 stats.setTotalFileCount( 56229 );
109 metadataRepositoryControl.expectAndReturn(
110 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
111 Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
112 metadataRepositoryControl.expectAndReturn(
113 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, SECOND_TEST_SCAN ),
115 metadataRepositoryControl.replay();
117 stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
118 assertNotNull( stats );
119 assertEquals( 1314527915L, stats.getTotalArtifactFileSize() );
120 assertEquals( 123, stats.getNewFileCount() );
121 assertEquals( 10386, stats.getTotalArtifactCount() );
122 assertEquals( 2031, stats.getTotalProjectCount() );
123 assertEquals( 529, stats.getTotalGroupCount() );
124 assertEquals( 56229, stats.getTotalFileCount() );
125 assertEquals( SECOND_TEST_SCAN, TIMESTAMP_FORMAT.format( stats.getScanStartTime() ) );
126 assertEquals( SECOND_TEST_SCAN, stats.getName() );
127 assertEquals( endTime, stats.getScanEndTime() );
129 metadataRepositoryControl.verify();
132 public void testGetLatestStatsWhenEmpty()
134 metadataRepositoryControl.expectAndReturn(
135 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
136 Collections.emptyList() );
137 metadataRepositoryControl.replay();
139 RepositoryStatistics stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
142 metadataRepositoryControl.verify();
145 public void testAddNewStats()
147 Date current = new Date();
148 Date startTime = new Date( current.getTime() - 12345 );
150 RepositoryStatistics stats = createTestStats( startTime, current );
154 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
155 metadataRepositoryControl.expectAndReturn(
156 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
157 Arrays.asList( stats.getName() ) );
158 metadataRepositoryControl.expectAndReturn(
159 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats.getName() ),
162 metadataRepositoryControl.replay();
164 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime, current, 56345, 45 );
166 stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
167 assertNotNull( stats );
168 assertEquals( 246900, stats.getTotalArtifactFileSize() );
169 assertEquals( 45, stats.getNewFileCount() );
170 assertEquals( 20, stats.getTotalArtifactCount() );
171 assertEquals( 5, stats.getTotalProjectCount() );
172 assertEquals( 4, stats.getTotalGroupCount() );
173 assertEquals( 56345, stats.getTotalFileCount() );
174 assertEquals( current.getTime() - 12345, stats.getScanStartTime().getTime() );
175 assertEquals( current, stats.getScanEndTime() );
177 metadataRepositoryControl.verify();
180 public void testDeleteStats()
184 Date current = new Date();
186 Date startTime1 = new Date( current.getTime() - 12345 );
187 RepositoryStatistics stats1 = createTestStats( startTime1, new Date( current.getTime() - 6000 ) );
188 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats1 );
190 Date startTime2 = new Date( current.getTime() - 3000 );
191 RepositoryStatistics stats2 = createTestStats( startTime2, current );
192 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats2 );
194 metadataRepositoryControl.expectAndReturn(
195 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
196 Arrays.asList( stats1.getName(), stats2.getName() ) );
197 metadataRepositoryControl.expectAndReturn(
198 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats2.getName() ),
201 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
203 metadataRepositoryControl.expectAndReturn(
204 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
205 Collections.emptyList() );
207 metadataRepositoryControl.replay();
209 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime1, stats1.getScanEndTime(), 56345,
211 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime2, stats2.getScanEndTime(), 56345,
214 assertNotNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
216 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
218 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
220 metadataRepositoryControl.verify();
223 public void testDeleteStatsWhenEmpty()
225 metadataRepositoryControl.expectAndReturn(
226 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
227 Collections.emptyList(), 2 );
228 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
230 metadataRepositoryControl.replay();
232 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
234 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
236 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
238 metadataRepositoryControl.verify();
241 public void testGetStatsRangeInside()
245 Date current = new Date();
247 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
248 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
249 addStats( new Date( current.getTime() - 1000 ), current );
251 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
252 metadataRepositoryControl.expectAndReturn(
253 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
255 // only match the middle one
256 String key = keys.get( 1 );
257 metadataRepositoryControl.expectAndReturn(
258 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
259 statsCreated.get( key ) );
261 metadataRepositoryControl.replay();
263 for ( RepositoryStatistics stats : statsCreated.values() )
265 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
266 stats.getScanEndTime(), 56345, 45 );
269 List<RepositoryStatistics> list =
270 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 4000 ),
271 new Date( current.getTime() - 2000 ) );
273 assertEquals( 1, list.size() );
274 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
276 metadataRepositoryControl.verify();
279 public void testGetStatsRangeUpperOutside()
283 Date current = new Date();
285 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
286 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
287 addStats( new Date( current.getTime() - 1000 ), current );
289 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
290 metadataRepositoryControl.expectAndReturn(
291 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
293 String key = keys.get( 1 );
294 metadataRepositoryControl.expectAndReturn(
295 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
296 statsCreated.get( key ) );
298 metadataRepositoryControl.expectAndReturn(
299 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
300 statsCreated.get( key ) );
302 metadataRepositoryControl.replay();
304 for ( RepositoryStatistics stats : statsCreated.values() )
306 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
307 stats.getScanEndTime(), 56345, 45 );
310 List<RepositoryStatistics> list =
311 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 4000 ),
314 assertEquals( 2, list.size() );
315 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
316 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
318 metadataRepositoryControl.verify();
321 public void testGetStatsRangeLowerOutside()
325 Date current = new Date();
327 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
328 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
329 addStats( new Date( current.getTime() - 1000 ), current );
331 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
332 metadataRepositoryControl.expectAndReturn(
333 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
335 String key = keys.get( 0 );
336 metadataRepositoryControl.expectAndReturn(
337 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
338 statsCreated.get( key ) );
340 metadataRepositoryControl.expectAndReturn(
341 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
342 statsCreated.get( key ) );
344 metadataRepositoryControl.replay();
346 for ( RepositoryStatistics stats : statsCreated.values() )
348 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
349 stats.getScanEndTime(), 56345, 45 );
352 List<RepositoryStatistics> list =
353 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
354 new Date( current.getTime() - 2000 ) );
356 assertEquals( 2, list.size() );
357 assertEquals( new Date( current.getTime() - 12345 ), list.get( 1 ).getScanStartTime() );
358 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
360 metadataRepositoryControl.verify();
363 public void testGetStatsRangeLowerAndUpperOutside()
367 Date current = new Date();
369 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
370 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
371 addStats( new Date( current.getTime() - 1000 ), current );
373 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
374 metadataRepositoryControl.expectAndReturn(
375 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
377 String key = keys.get( 0 );
378 metadataRepositoryControl.expectAndReturn(
379 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
380 statsCreated.get( key ) );
382 metadataRepositoryControl.expectAndReturn(
383 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
384 statsCreated.get( key ) );
386 metadataRepositoryControl.expectAndReturn(
387 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
388 statsCreated.get( key ) );
390 metadataRepositoryControl.replay();
392 for ( RepositoryStatistics stats : statsCreated.values() )
394 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
395 stats.getScanEndTime(), 56345, 45 );
398 List<RepositoryStatistics> list =
399 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
402 assertEquals( 3, list.size() );
403 assertEquals( new Date( current.getTime() - 12345 ), list.get( 2 ).getScanStartTime() );
404 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
405 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
407 metadataRepositoryControl.verify();
410 public void testGetStatsRangeNotInside()
414 Date current = new Date();
416 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
417 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
418 addStats( new Date( current.getTime() - 1000 ), current );
420 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
421 metadataRepositoryControl.expectAndReturn(
422 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
424 metadataRepositoryControl.replay();
426 for ( RepositoryStatistics stats : statsCreated.values() )
428 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
429 stats.getScanEndTime(), 56345, 45 );
432 List<RepositoryStatistics> list =
433 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
434 new Date( current.getTime() - 16000 ) );
436 assertEquals( 0, list.size() );
438 metadataRepositoryControl.verify();
441 private void addStats( Date startTime, Date endTime )
443 RepositoryStatistics stats = createTestStats( startTime, endTime );
444 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
445 statsCreated.put( stats.getName(), stats );
448 private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
450 ArtifactMetadata metadata = new ArtifactMetadata();
451 metadata.setRepositoryId( TEST_REPO_ID );
452 metadata.setId( projectId + "-" + projectVersion + "." + type );
453 metadata.setProject( projectId );
454 metadata.setSize( 12345L );
455 metadata.setVersion( projectVersion );
456 metadata.setNamespace( namespace );
460 private RepositoryStatistics createTestStats( Date startTime, Date endTime )
462 RepositoryStatistics stats = new RepositoryStatistics();
463 stats.setScanStartTime( startTime );
464 stats.setScanEndTime( endTime );
465 stats.setTotalArtifactFileSize( 20 * 12345L );
466 stats.setNewFileCount( 45 );
467 stats.setTotalArtifactCount( 20 );
468 stats.setTotalProjectCount( 5 );
469 stats.setTotalGroupCount( 4 );
470 stats.setTotalFileCount( 56345 );
471 stats.setTotalCountForType( "jar", 10 );
472 stats.setTotalCountForType( "pom", 10 );
476 private void walkRepository( int count )
478 for ( int i = 0; i < count; i++ )
480 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
481 Arrays.asList( "com", "org" ) );
482 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
484 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
485 Arrays.asList( "example" ) );
486 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
488 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
489 Arrays.asList( "example-project" ) );
490 metadataRepositoryControl.expectAndReturn(
491 metadataRepository.getProjectVersions( TEST_REPO_ID, "com.example", "example-project" ),
492 Arrays.asList( "1.0", "1.1" ) );
493 metadataRepositoryControl.expectAndReturn(
494 metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.0" ),
495 Arrays.asList( createArtifact( "com.example", "example-project", "1.0", "jar" ),
496 createArtifact( "com.example", "example-project", "1.0", "pom" ) ) );
497 metadataRepositoryControl.expectAndReturn(
498 metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.1" ),
499 Arrays.asList( createArtifact( "com.example", "example-project", "1.1", "jar" ),
500 createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
501 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
502 Arrays.asList( "apache", "codehaus" ) );
503 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
504 Arrays.asList( "archiva", "maven" ) );
505 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
507 metadataRepositoryControl.expectAndReturn(
508 metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.archiva" ), Arrays.asList() );
509 metadataRepositoryControl.expectAndReturn(
510 metadataRepository.getProjects( TEST_REPO_ID, "org.apache.archiva" ),
511 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
512 metadataRepositoryControl.expectAndReturn(
513 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ),
514 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
515 metadataRepositoryControl.expectAndReturn(
516 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api",
518 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
519 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
521 metadataRepositoryControl.expectAndReturn(
522 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ),
523 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
524 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
525 metadataRepositoryControl.expectAndReturn(
526 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-model" ),
527 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
528 metadataRepositoryControl.expectAndReturn(
529 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ),
530 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ),
531 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
532 metadataRepositoryControl.expectAndReturn(
533 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ),
534 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
535 createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
536 metadataRepositoryControl.expectAndReturn(
537 metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList() );
538 metadataRepositoryControl.expectAndReturn(
539 metadataRepository.getProjects( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList( "maven-model" ) );
540 metadataRepositoryControl.expectAndReturn(
541 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", "maven-model" ),
542 Arrays.asList( "2.2.1" ) );
543 metadataRepositoryControl.expectAndReturn(
544 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ),
545 Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
546 createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
547 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
548 Arrays.asList( "plexus" ) );
549 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
551 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
553 metadataRepositoryControl.expectAndReturn(
554 metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus.plexus" ), Arrays.asList() );
555 metadataRepositoryControl.expectAndReturn(
556 metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus.plexus" ),
557 Arrays.asList( "plexus-spring" ) );
558 metadataRepositoryControl.expectAndReturn(
559 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ),
560 Arrays.asList( "1.0", "1.1", "1.2" ) );
561 metadataRepositoryControl.expectAndReturn(
562 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ),
563 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "jar" ),
564 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "pom" ) ) );
565 metadataRepositoryControl.expectAndReturn(
566 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ),
567 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "jar" ),
568 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "pom" ) ) );
569 metadataRepositoryControl.expectAndReturn(
570 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ),
571 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "jar" ),
572 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "pom" ) ) );