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 junit.framework.TestCase;
23 import org.apache.archiva.metadata.model.ArtifactMetadata;
24 import org.apache.archiva.metadata.repository.MetadataRepository;
25 import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
26 import org.easymock.MockControl;
28 import java.text.SimpleDateFormat;
29 import java.util.ArrayList;
30 import java.util.Arrays;
31 import java.util.Collections;
32 import java.util.Date;
33 import java.util.LinkedHashMap;
34 import java.util.List;
36 import java.util.TimeZone;
38 public class RepositoryStatisticsManagerTest
41 private DefaultRepositoryStatisticsManager repositoryStatisticsManager;
43 private static final String TEST_REPO_ID = "test-repo";
45 private MockControl metadataRepositoryControl;
47 private MetadataRepository metadataRepository;
49 private static final String FIRST_TEST_SCAN = "2009/12/01/123456.789";
51 private static final String SECOND_TEST_SCAN = "2009/12/02/012345.678";
53 private Map<String, RepositoryStatistics> statsCreated = new LinkedHashMap<String, RepositoryStatistics>();
55 private static final SimpleDateFormat TIMESTAMP_FORMAT = createTimestampFormat();
57 private static SimpleDateFormat createTimestampFormat()
59 SimpleDateFormat fmt = new SimpleDateFormat( RepositoryStatistics.SCAN_TIMESTAMP_FORMAT );
60 fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
65 protected void setUp()
70 repositoryStatisticsManager = new DefaultRepositoryStatisticsManager();
72 metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
73 metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
76 public void testGetLatestStats()
79 Date startTime = TIMESTAMP_FORMAT.parse( SECOND_TEST_SCAN );
80 Date endTime = new Date( startTime.getTime() + 60000 );
82 RepositoryStatistics stats = new RepositoryStatistics();
83 stats.setScanStartTime( startTime );
84 stats.setScanEndTime( endTime );
85 stats.setTotalArtifactFileSize( 1314527915L );
86 stats.setNewFileCount( 123 );
87 stats.setTotalArtifactCount( 10386 );
88 stats.setTotalProjectCount( 2031 );
89 stats.setTotalGroupCount( 529 );
90 stats.setTotalFileCount( 56229 );
92 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
93 RepositoryStatistics.FACET_ID ),
94 Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
95 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
96 RepositoryStatistics.FACET_ID,
97 SECOND_TEST_SCAN ), stats );
98 metadataRepositoryControl.replay();
100 stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
101 assertNotNull( stats );
102 assertEquals( 1314527915L, stats.getTotalArtifactFileSize() );
103 assertEquals( 123, stats.getNewFileCount() );
104 assertEquals( 10386, stats.getTotalArtifactCount() );
105 assertEquals( 2031, stats.getTotalProjectCount() );
106 assertEquals( 529, stats.getTotalGroupCount() );
107 assertEquals( 56229, stats.getTotalFileCount() );
108 assertEquals( SECOND_TEST_SCAN, TIMESTAMP_FORMAT.format( stats.getScanStartTime() ) );
109 assertEquals( SECOND_TEST_SCAN, stats.getName() );
110 assertEquals( endTime, stats.getScanEndTime() );
112 metadataRepositoryControl.verify();
115 public void testGetLatestStatsWhenEmpty()
118 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
119 RepositoryStatistics.FACET_ID ),
120 Collections.emptyList() );
121 metadataRepositoryControl.replay();
123 RepositoryStatistics stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
126 metadataRepositoryControl.verify();
129 public void testAddNewStats()
133 Date current = new Date();
134 Date startTime = new Date( current.getTime() - 12345 );
136 RepositoryStatistics stats = createTestStats( startTime, current );
140 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
141 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
142 RepositoryStatistics.FACET_ID ),
143 Arrays.asList( stats.getName() ) );
144 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
145 RepositoryStatistics.FACET_ID,
146 stats.getName() ), stats );
148 metadataRepositoryControl.replay();
150 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime, current, 56345,
153 stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
154 assertNotNull( stats );
155 assertEquals( 246900, stats.getTotalArtifactFileSize() );
156 assertEquals( 45, stats.getNewFileCount() );
157 assertEquals( 20, stats.getTotalArtifactCount() );
158 assertEquals( 5, stats.getTotalProjectCount() );
159 assertEquals( 4, stats.getTotalGroupCount() );
160 assertEquals( 56345, stats.getTotalFileCount() );
161 assertEquals( current.getTime() - 12345, stats.getScanStartTime().getTime() );
162 assertEquals( current, stats.getScanEndTime() );
164 metadataRepositoryControl.verify();
167 public void testDeleteStats()
173 Date current = new Date();
175 Date startTime1 = new Date( current.getTime() - 12345 );
176 RepositoryStatistics stats1 = createTestStats( startTime1, new Date( current.getTime() - 6000 ) );
177 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats1 );
179 Date startTime2 = new Date( current.getTime() - 3000 );
180 RepositoryStatistics stats2 = createTestStats( startTime2, current );
181 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats2 );
183 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
184 RepositoryStatistics.FACET_ID ),
185 Arrays.asList( stats1.getName(), stats2.getName() ) );
186 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
187 RepositoryStatistics.FACET_ID,
188 stats2.getName() ), stats2 );
190 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
192 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
193 RepositoryStatistics.FACET_ID ),
194 Collections.emptyList() );
196 metadataRepositoryControl.replay();
198 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime1,
199 stats1.getScanEndTime(), 56345, 45 );
200 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime2,
201 stats2.getScanEndTime(), 56345, 45 );
203 assertNotNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
205 repositoryStatisticsManager.deleteStatistics( metadataRepository, TEST_REPO_ID );
207 assertNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
209 metadataRepositoryControl.verify();
212 public void testDeleteStatsWhenEmpty()
216 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
217 RepositoryStatistics.FACET_ID ),
218 Collections.emptyList(), 2 );
219 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
221 metadataRepositoryControl.replay();
223 assertNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
225 repositoryStatisticsManager.deleteStatistics( metadataRepository, TEST_REPO_ID );
227 assertNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
229 metadataRepositoryControl.verify();
232 public void testGetStatsRangeInside()
238 Date current = new Date();
240 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
241 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
242 addStats( new Date( current.getTime() - 1000 ), current );
244 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
245 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
246 RepositoryStatistics.FACET_ID ),
249 // only match the middle one
250 String key = keys.get( 1 );
251 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
252 RepositoryStatistics.FACET_ID,
253 key ), statsCreated.get(
256 metadataRepositoryControl.replay();
258 for ( RepositoryStatistics stats : statsCreated.values() )
260 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
261 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
265 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
266 TEST_REPO_ID, new Date(
267 current.getTime() - 4000 ), new Date( current.getTime() - 2000 ) );
269 assertEquals( 1, list.size() );
270 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
272 metadataRepositoryControl.verify();
275 public void testGetStatsRangeUpperOutside()
281 Date current = new Date();
283 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
284 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
285 addStats( new Date( current.getTime() - 1000 ), current );
287 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
288 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
289 RepositoryStatistics.FACET_ID ),
292 String key = keys.get( 1 );
293 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
294 RepositoryStatistics.FACET_ID,
295 key ), statsCreated.get(
298 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
299 RepositoryStatistics.FACET_ID,
300 key ), statsCreated.get(
303 metadataRepositoryControl.replay();
305 for ( RepositoryStatistics stats : statsCreated.values() )
307 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
308 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
312 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
313 TEST_REPO_ID, new Date(
314 current.getTime() - 4000 ), current );
316 assertEquals( 2, list.size() );
317 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
318 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
320 metadataRepositoryControl.verify();
323 public void testGetStatsRangeLowerOutside()
329 Date current = new Date();
331 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
332 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
333 addStats( new Date( current.getTime() - 1000 ), current );
335 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
336 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
337 RepositoryStatistics.FACET_ID ),
340 String key = keys.get( 0 );
341 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
342 RepositoryStatistics.FACET_ID,
343 key ), statsCreated.get(
346 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
347 RepositoryStatistics.FACET_ID,
348 key ), statsCreated.get(
351 metadataRepositoryControl.replay();
353 for ( RepositoryStatistics stats : statsCreated.values() )
355 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
356 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
360 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
361 TEST_REPO_ID, new Date(
362 current.getTime() - 20000 ), new Date( current.getTime() - 2000 ) );
364 assertEquals( 2, list.size() );
365 assertEquals( new Date( current.getTime() - 12345 ), list.get( 1 ).getScanStartTime() );
366 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
368 metadataRepositoryControl.verify();
371 public void testGetStatsRangeLowerAndUpperOutside()
377 Date current = new Date();
379 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
380 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
381 addStats( new Date( current.getTime() - 1000 ), current );
383 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
384 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
385 RepositoryStatistics.FACET_ID ),
388 String key = keys.get( 0 );
389 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
390 RepositoryStatistics.FACET_ID,
391 key ), statsCreated.get(
394 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
395 RepositoryStatistics.FACET_ID,
396 key ), statsCreated.get(
399 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
400 RepositoryStatistics.FACET_ID,
401 key ), statsCreated.get(
404 metadataRepositoryControl.replay();
406 for ( RepositoryStatistics stats : statsCreated.values() )
408 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
409 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
413 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
414 TEST_REPO_ID, new Date(
415 current.getTime() - 20000 ), current );
417 assertEquals( 3, list.size() );
418 assertEquals( new Date( current.getTime() - 12345 ), list.get( 2 ).getScanStartTime() );
419 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
420 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
422 metadataRepositoryControl.verify();
425 public void testGetStatsRangeNotInside()
431 Date current = new Date();
433 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
434 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
435 addStats( new Date( current.getTime() - 1000 ), current );
437 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
438 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
439 RepositoryStatistics.FACET_ID ),
442 metadataRepositoryControl.replay();
444 for ( RepositoryStatistics stats : statsCreated.values() )
446 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
447 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
451 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
452 TEST_REPO_ID, new Date(
453 current.getTime() - 20000 ), new Date( current.getTime() - 16000 ) );
455 assertEquals( 0, list.size() );
457 metadataRepositoryControl.verify();
460 private void addStats( Date startTime, Date endTime )
464 RepositoryStatistics stats = createTestStats( startTime, endTime );
465 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
466 statsCreated.put( stats.getName(), stats );
469 private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
471 ArtifactMetadata metadata = new ArtifactMetadata();
472 metadata.setRepositoryId( TEST_REPO_ID );
473 metadata.setId( projectId + "-" + projectVersion + "." + type );
474 metadata.setProject( projectId );
475 metadata.setSize( 12345L );
476 metadata.setProjectVersion( projectVersion );
477 metadata.setVersion( projectVersion );
478 metadata.setNamespace( namespace );
480 MavenArtifactFacet facet = new MavenArtifactFacet();
481 facet.setType( type );
482 metadata.addFacet( facet );
487 private RepositoryStatistics createTestStats( Date startTime, Date endTime )
489 RepositoryStatistics stats = new RepositoryStatistics();
490 stats.setScanStartTime( startTime );
491 stats.setScanEndTime( endTime );
492 stats.setTotalArtifactFileSize( 20 * 12345L );
493 stats.setNewFileCount( 45 );
494 stats.setTotalArtifactCount( 20 );
495 stats.setTotalProjectCount( 5 );
496 stats.setTotalGroupCount( 4 );
497 stats.setTotalFileCount( 56345 );
498 stats.setTotalCountForType( "jar", 10 );
499 stats.setTotalCountForType( "pom", 10 );
503 private void walkRepository( int count )
506 for ( int i = 0; i < count; i++ )
508 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
509 Arrays.asList( "com", "org" ) );
510 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
512 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
513 Arrays.asList( "example" ) );
514 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
516 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
517 Arrays.asList( "example-project" ) );
518 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
521 Arrays.asList( "1.0", "1.1" ) );
522 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
523 "example-project", "1.0" ),
524 Arrays.asList( createArtifact( "com.example", "example-project",
525 "1.0", "jar" ), createArtifact(
526 "com.example", "example-project", "1.0", "pom" ) ) );
527 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
528 "example-project", "1.1" ),
529 Arrays.asList( createArtifact( "com.example", "example-project",
530 "1.1", "jar" ), createArtifact(
531 "com.example", "example-project", "1.1", "pom" ) ) );
532 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
533 Arrays.asList( "apache", "codehaus" ) );
534 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
535 Arrays.asList( "archiva", "maven" ) );
536 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
538 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
539 "org.apache.archiva" ),
541 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
542 "org.apache.archiva" ),
543 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
544 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
545 "org.apache.archiva",
546 "metadata-repository-api" ),
547 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
548 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
549 "org.apache.archiva",
550 "metadata-repository-api",
551 "1.3-SNAPSHOT" ), Arrays.asList(
552 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
553 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "pom" ) ) );
554 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
555 "org.apache.archiva",
556 "metadata-repository-api",
557 "1.3" ), Arrays.asList(
558 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ), createArtifact(
559 "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
560 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
561 "org.apache.archiva",
563 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
564 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
565 "org.apache.archiva",
567 "1.3-SNAPSHOT" ), Arrays.asList(
568 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ), createArtifact(
569 "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
570 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
571 "org.apache.archiva",
572 "metadata-model", "1.3" ),
573 Arrays.asList( createArtifact( "org.apache.archiva",
574 "metadata-model", "1.3", "jar" ),
575 createArtifact( "org.apache.archiva",
576 "metadata-model", "1.3",
578 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
579 "org.apache.maven" ),
581 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
582 "org.apache.maven" ),
583 Arrays.asList( "maven-model" ) );
584 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
587 Arrays.asList( "2.2.1" ) );
588 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
590 "maven-model", "2.2.1" ),
591 Arrays.asList( createArtifact( "org.apache.archiva",
592 "maven-model", "2.2.1", "jar" ),
593 createArtifact( "org.apache.archiva",
594 "maven-model", "2.2.1",
596 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
597 Arrays.asList( "plexus" ) );
598 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
600 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
602 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
603 "org.codehaus.plexus" ),
605 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
606 "org.codehaus.plexus" ),
607 Arrays.asList( "plexus-spring" ) );
608 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
609 "org.codehaus.plexus",
611 Arrays.asList( "1.0", "1.1", "1.2" ) );
612 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
613 "org.codehaus.plexus",
614 "plexus-spring", "1.0" ),
615 Arrays.asList( createArtifact( "org.codehaus.plexus",
616 "plexus-spring", "1.0", "jar" ),
617 createArtifact( "org.codehaus.plexus",
618 "plexus-spring", "1.0",
620 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
621 "org.codehaus.plexus",
622 "plexus-spring", "1.1" ),
623 Arrays.asList( createArtifact( "org.codehaus.plexus",
624 "plexus-spring", "1.1", "jar" ),
625 createArtifact( "org.codehaus.plexus",
626 "plexus-spring", "1.1",
628 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
629 "org.codehaus.plexus",
630 "plexus-spring", "1.2" ),
631 Arrays.asList( createArtifact( "org.codehaus.plexus",
632 "plexus-spring", "1.2", "jar" ),
633 createArtifact( "org.codehaus.plexus",
634 "plexus-spring", "1.2",