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;
37 import javax.jcr.Session;
39 public class RepositoryStatisticsManagerTest
42 private DefaultRepositoryStatisticsManager repositoryStatisticsManager;
44 private static final String TEST_REPO_ID = "test-repo";
46 private MockControl metadataRepositoryControl;
48 private MetadataRepository metadataRepository;
50 private static final String FIRST_TEST_SCAN = "2009/12/01/123456.789";
52 private static final String SECOND_TEST_SCAN = "2009/12/02/012345.678";
54 private Map<String, RepositoryStatistics> statsCreated = new LinkedHashMap<String, RepositoryStatistics>();
56 private static final SimpleDateFormat TIMESTAMP_FORMAT = createTimestampFormat();
58 private static SimpleDateFormat createTimestampFormat()
60 SimpleDateFormat fmt = new SimpleDateFormat( RepositoryStatistics.SCAN_TIMESTAMP_FORMAT );
61 fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
66 protected void setUp()
71 repositoryStatisticsManager = new DefaultRepositoryStatisticsManager();
73 metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
74 metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
77 public void testGetLatestStats()
80 Date startTime = TIMESTAMP_FORMAT.parse( SECOND_TEST_SCAN );
81 Date endTime = new Date( startTime.getTime() + 60000 );
83 RepositoryStatistics stats = new RepositoryStatistics();
84 stats.setScanStartTime( startTime );
85 stats.setScanEndTime( endTime );
86 stats.setTotalArtifactFileSize( 1314527915L );
87 stats.setNewFileCount( 123 );
88 stats.setTotalArtifactCount( 10386 );
89 stats.setTotalProjectCount( 2031 );
90 stats.setTotalGroupCount( 529 );
91 stats.setTotalFileCount( 56229 );
93 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
94 RepositoryStatistics.FACET_ID ),
95 Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
96 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
97 RepositoryStatistics.FACET_ID,
98 SECOND_TEST_SCAN ), stats );
99 metadataRepositoryControl.replay();
101 stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
102 assertNotNull( stats );
103 assertEquals( 1314527915L, stats.getTotalArtifactFileSize() );
104 assertEquals( 123, stats.getNewFileCount() );
105 assertEquals( 10386, stats.getTotalArtifactCount() );
106 assertEquals( 2031, stats.getTotalProjectCount() );
107 assertEquals( 529, stats.getTotalGroupCount() );
108 assertEquals( 56229, stats.getTotalFileCount() );
109 assertEquals( SECOND_TEST_SCAN, TIMESTAMP_FORMAT.format( stats.getScanStartTime() ) );
110 assertEquals( SECOND_TEST_SCAN, stats.getName() );
111 assertEquals( endTime, stats.getScanEndTime() );
113 metadataRepositoryControl.verify();
116 public void testGetLatestStatsWhenEmpty()
119 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
120 RepositoryStatistics.FACET_ID ),
121 Collections.emptyList() );
122 metadataRepositoryControl.replay();
124 RepositoryStatistics stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
127 metadataRepositoryControl.verify();
130 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 );
147 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false );
149 metadataRepositoryControl.replay();
151 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime, current, 56345,
154 stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
155 assertNotNull( stats );
156 assertEquals( 246900, stats.getTotalArtifactFileSize() );
157 assertEquals( 45, stats.getNewFileCount() );
158 assertEquals( 20, stats.getTotalArtifactCount() );
159 assertEquals( 5, stats.getTotalProjectCount() );
160 assertEquals( 4, stats.getTotalGroupCount() );
161 assertEquals( 56345, stats.getTotalFileCount() );
162 assertEquals( current.getTime() - 12345, stats.getScanStartTime().getTime() );
163 assertEquals( current, stats.getScanEndTime() );
165 metadataRepositoryControl.verify();
168 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() );
195 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 2 );
197 metadataRepositoryControl.replay();
199 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime1,
200 stats1.getScanEndTime(), 56345, 45 );
201 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime2,
202 stats2.getScanEndTime(), 56345, 45 );
204 assertNotNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
206 repositoryStatisticsManager.deleteStatistics( metadataRepository, TEST_REPO_ID );
208 assertNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
210 metadataRepositoryControl.verify();
213 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()
237 Date current = new Date();
239 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
240 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
241 addStats( new Date( current.getTime() - 1000 ), current );
243 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
244 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
245 RepositoryStatistics.FACET_ID ),
248 // only match the middle one
249 String key = keys.get( 1 );
250 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
251 RepositoryStatistics.FACET_ID,
252 key ), statsCreated.get(
254 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
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()
280 Date current = new Date();
282 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
283 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
284 addStats( new Date( current.getTime() - 1000 ), current );
286 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
287 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
288 RepositoryStatistics.FACET_ID ),
291 String key = keys.get( 1 );
292 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
293 RepositoryStatistics.FACET_ID,
294 key ), statsCreated.get(
297 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
298 RepositoryStatistics.FACET_ID,
299 key ), statsCreated.get(
301 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
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()
328 Date current = new Date();
330 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
331 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
332 addStats( new Date( current.getTime() - 1000 ), current );
334 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
335 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
336 RepositoryStatistics.FACET_ID ),
339 String key = keys.get( 0 );
340 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
341 RepositoryStatistics.FACET_ID,
342 key ), statsCreated.get(
345 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
346 RepositoryStatistics.FACET_ID,
347 key ), statsCreated.get(
349 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
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()
376 Date current = new Date();
378 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
379 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
380 addStats( new Date( current.getTime() - 1000 ), current );
382 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
383 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
384 RepositoryStatistics.FACET_ID ),
387 String key = keys.get( 0 );
388 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
389 RepositoryStatistics.FACET_ID,
390 key ), statsCreated.get(
393 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
394 RepositoryStatistics.FACET_ID,
395 key ), statsCreated.get(
398 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
399 RepositoryStatistics.FACET_ID,
400 key ), statsCreated.get(
402 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
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()
430 Date current = new Date();
432 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
433 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
434 addStats( new Date( current.getTime() - 1000 ), current );
436 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
437 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
438 RepositoryStatistics.FACET_ID ),
440 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
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 )
463 RepositoryStatistics stats = createTestStats( startTime, endTime );
464 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
465 statsCreated.put( stats.getName(), stats );
468 private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
470 ArtifactMetadata metadata = new ArtifactMetadata();
471 metadata.setRepositoryId( TEST_REPO_ID );
472 metadata.setId( projectId + "-" + projectVersion + "." + type );
473 metadata.setProject( projectId );
474 metadata.setSize( 12345L );
475 metadata.setProjectVersion( projectVersion );
476 metadata.setVersion( projectVersion );
477 metadata.setNamespace( namespace );
479 MavenArtifactFacet facet = new MavenArtifactFacet();
480 facet.setType( type );
481 metadata.addFacet( facet );
486 private RepositoryStatistics createTestStats( Date startTime, Date endTime )
488 RepositoryStatistics stats = new RepositoryStatistics();
489 stats.setScanStartTime( startTime );
490 stats.setScanEndTime( endTime );
491 stats.setTotalArtifactFileSize( 20 * 12345L );
492 stats.setNewFileCount( 45 );
493 stats.setTotalArtifactCount( 20 );
494 stats.setTotalProjectCount( 5 );
495 stats.setTotalGroupCount( 4 );
496 stats.setTotalFileCount( 56345 );
497 stats.setTotalCountForType( "jar", 10 );
498 stats.setTotalCountForType( "pom", 10 );
502 private void walkRepository( int count )
505 for ( int i = 0; i < count; i++ )
507 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
508 Arrays.asList( "com", "org" ) );
509 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
511 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
512 Arrays.asList( "example" ) );
513 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
515 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
516 Arrays.asList( "example-project" ) );
517 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
520 Arrays.asList( "1.0", "1.1" ) );
521 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
522 "example-project", "1.0" ),
523 Arrays.asList( createArtifact( "com.example", "example-project",
524 "1.0", "jar" ), createArtifact(
525 "com.example", "example-project", "1.0", "pom" ) ) );
526 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
527 "example-project", "1.1" ),
528 Arrays.asList( createArtifact( "com.example", "example-project",
529 "1.1", "jar" ), createArtifact(
530 "com.example", "example-project", "1.1", "pom" ) ) );
531 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
532 Arrays.asList( "apache", "codehaus" ) );
533 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
534 Arrays.asList( "archiva", "maven" ) );
535 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
537 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
538 "org.apache.archiva" ),
540 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
541 "org.apache.archiva" ),
542 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
543 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
544 "org.apache.archiva",
545 "metadata-repository-api" ),
546 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
547 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
548 "org.apache.archiva",
549 "metadata-repository-api",
550 "1.3-SNAPSHOT" ), Arrays.asList(
551 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
552 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "pom" ) ) );
553 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
554 "org.apache.archiva",
555 "metadata-repository-api",
556 "1.3" ), Arrays.asList(
557 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ), createArtifact(
558 "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
559 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
560 "org.apache.archiva",
562 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
563 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
564 "org.apache.archiva",
566 "1.3-SNAPSHOT" ), Arrays.asList(
567 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ), createArtifact(
568 "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
569 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
570 "org.apache.archiva",
571 "metadata-model", "1.3" ),
572 Arrays.asList( createArtifact( "org.apache.archiva",
573 "metadata-model", "1.3", "jar" ),
574 createArtifact( "org.apache.archiva",
575 "metadata-model", "1.3",
577 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
578 "org.apache.maven" ),
580 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
581 "org.apache.maven" ),
582 Arrays.asList( "maven-model" ) );
583 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
586 Arrays.asList( "2.2.1" ) );
587 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
589 "maven-model", "2.2.1" ),
590 Arrays.asList( createArtifact( "org.apache.archiva",
591 "maven-model", "2.2.1", "jar" ),
592 createArtifact( "org.apache.archiva",
593 "maven-model", "2.2.1",
595 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
596 Arrays.asList( "plexus" ) );
597 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
599 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
601 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
602 "org.codehaus.plexus" ),
604 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
605 "org.codehaus.plexus" ),
606 Arrays.asList( "plexus-spring" ) );
607 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
608 "org.codehaus.plexus",
610 Arrays.asList( "1.0", "1.1", "1.2" ) );
611 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
612 "org.codehaus.plexus",
613 "plexus-spring", "1.0" ),
614 Arrays.asList( createArtifact( "org.codehaus.plexus",
615 "plexus-spring", "1.0", "jar" ),
616 createArtifact( "org.codehaus.plexus",
617 "plexus-spring", "1.0",
619 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
620 "org.codehaus.plexus",
621 "plexus-spring", "1.1" ),
622 Arrays.asList( createArtifact( "org.codehaus.plexus",
623 "plexus-spring", "1.1", "jar" ),
624 createArtifact( "org.codehaus.plexus",
625 "plexus-spring", "1.1",
627 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
628 "org.codehaus.plexus",
629 "plexus-spring", "1.2" ),
630 Arrays.asList( createArtifact( "org.codehaus.plexus",
631 "plexus-spring", "1.2", "jar" ),
632 createArtifact( "org.codehaus.plexus",
633 "plexus-spring", "1.2",