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();
74 repositoryStatisticsManager.setMetadataRepository( metadataRepository );
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( 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( TEST_REPO_ID );
127 metadataRepositoryControl.verify();
130 public void testAddNewStats()
134 Date current = new Date();
135 Date startTime = new Date( current.getTime() - 12345 );
137 RepositoryStatistics stats = createTestStats( startTime, current );
141 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
142 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
143 RepositoryStatistics.FACET_ID ),
144 Arrays.asList( stats.getName() ) );
145 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
146 RepositoryStatistics.FACET_ID,
147 stats.getName() ), stats );
149 metadataRepositoryControl.replay();
151 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime, current, 56345, 45 );
153 stats = repositoryStatisticsManager.getLastStatistics( 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( TEST_REPO_ID, startTime1, stats1.getScanEndTime(), 56345,
200 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime2, stats2.getScanEndTime(), 56345,
203 assertNotNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
205 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
207 assertNull( repositoryStatisticsManager.getLastStatistics( 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( TEST_REPO_ID ) );
225 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
227 assertNull( repositoryStatisticsManager.getLastStatistics( 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( TEST_REPO_ID, stats.getScanStartTime(),
261 stats.getScanEndTime(), 56345, 45 );
264 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date(
265 current.getTime() - 4000 ), new Date( current.getTime() - 2000 ) );
267 assertEquals( 1, list.size() );
268 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
270 metadataRepositoryControl.verify();
273 public void testGetStatsRangeUpperOutside()
279 Date current = new Date();
281 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
282 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
283 addStats( new Date( current.getTime() - 1000 ), current );
285 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
286 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
287 RepositoryStatistics.FACET_ID ),
290 String key = keys.get( 1 );
291 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
292 RepositoryStatistics.FACET_ID,
293 key ), statsCreated.get(
296 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
297 RepositoryStatistics.FACET_ID,
298 key ), statsCreated.get(
301 metadataRepositoryControl.replay();
303 for ( RepositoryStatistics stats : statsCreated.values() )
305 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
306 stats.getScanEndTime(), 56345, 45 );
309 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date(
310 current.getTime() - 4000 ), current );
312 assertEquals( 2, list.size() );
313 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
314 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
316 metadataRepositoryControl.verify();
319 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( metadataRepository.getMetadataFacets( TEST_REPO_ID,
333 RepositoryStatistics.FACET_ID ),
336 String key = keys.get( 0 );
337 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
338 RepositoryStatistics.FACET_ID,
339 key ), statsCreated.get(
342 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
343 RepositoryStatistics.FACET_ID,
344 key ), statsCreated.get(
347 metadataRepositoryControl.replay();
349 for ( RepositoryStatistics stats : statsCreated.values() )
351 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
352 stats.getScanEndTime(), 56345, 45 );
355 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date(
356 current.getTime() - 20000 ), new Date( current.getTime() - 2000 ) );
358 assertEquals( 2, list.size() );
359 assertEquals( new Date( current.getTime() - 12345 ), list.get( 1 ).getScanStartTime() );
360 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
362 metadataRepositoryControl.verify();
365 public void testGetStatsRangeLowerAndUpperOutside()
371 Date current = new Date();
373 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
374 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
375 addStats( new Date( current.getTime() - 1000 ), current );
377 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
378 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
379 RepositoryStatistics.FACET_ID ),
382 String key = keys.get( 0 );
383 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
384 RepositoryStatistics.FACET_ID,
385 key ), statsCreated.get(
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.replay();
400 for ( RepositoryStatistics stats : statsCreated.values() )
402 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
403 stats.getScanEndTime(), 56345, 45 );
406 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date(
407 current.getTime() - 20000 ), current );
409 assertEquals( 3, list.size() );
410 assertEquals( new Date( current.getTime() - 12345 ), list.get( 2 ).getScanStartTime() );
411 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
412 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
414 metadataRepositoryControl.verify();
417 public void testGetStatsRangeNotInside()
423 Date current = new Date();
425 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
426 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
427 addStats( new Date( current.getTime() - 1000 ), current );
429 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
430 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
431 RepositoryStatistics.FACET_ID ),
434 metadataRepositoryControl.replay();
436 for ( RepositoryStatistics stats : statsCreated.values() )
438 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
439 stats.getScanEndTime(), 56345, 45 );
442 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date(
443 current.getTime() - 20000 ), new Date( current.getTime() - 16000 ) );
445 assertEquals( 0, list.size() );
447 metadataRepositoryControl.verify();
450 private void addStats( Date startTime, Date endTime )
454 RepositoryStatistics stats = createTestStats( startTime, endTime );
455 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
456 statsCreated.put( stats.getName(), stats );
459 private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
461 ArtifactMetadata metadata = new ArtifactMetadata();
462 metadata.setRepositoryId( TEST_REPO_ID );
463 metadata.setId( projectId + "-" + projectVersion + "." + type );
464 metadata.setProject( projectId );
465 metadata.setSize( 12345L );
466 metadata.setProjectVersion( projectVersion );
467 metadata.setVersion( projectVersion );
468 metadata.setNamespace( namespace );
470 MavenArtifactFacet facet = new MavenArtifactFacet();
471 facet.setType( type );
472 metadata.addFacet( facet );
477 private RepositoryStatistics createTestStats( Date startTime, Date endTime )
479 RepositoryStatistics stats = new RepositoryStatistics();
480 stats.setScanStartTime( startTime );
481 stats.setScanEndTime( endTime );
482 stats.setTotalArtifactFileSize( 20 * 12345L );
483 stats.setNewFileCount( 45 );
484 stats.setTotalArtifactCount( 20 );
485 stats.setTotalProjectCount( 5 );
486 stats.setTotalGroupCount( 4 );
487 stats.setTotalFileCount( 56345 );
488 stats.setTotalCountForType( "jar", 10 );
489 stats.setTotalCountForType( "pom", 10 );
493 private void walkRepository( int count )
496 for ( int i = 0; i < count; i++ )
498 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
499 Arrays.asList( "com", "org" ) );
500 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
502 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
503 Arrays.asList( "example" ) );
504 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
506 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
507 Arrays.asList( "example-project" ) );
508 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
511 Arrays.asList( "1.0", "1.1" ) );
512 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
513 "example-project", "1.0" ),
514 Arrays.asList( createArtifact( "com.example", "example-project",
515 "1.0", "jar" ), createArtifact(
516 "com.example", "example-project", "1.0", "pom" ) ) );
517 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
518 "example-project", "1.1" ),
519 Arrays.asList( createArtifact( "com.example", "example-project",
520 "1.1", "jar" ), createArtifact(
521 "com.example", "example-project", "1.1", "pom" ) ) );
522 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
523 Arrays.asList( "apache", "codehaus" ) );
524 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
525 Arrays.asList( "archiva", "maven" ) );
526 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
528 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
529 "org.apache.archiva" ),
531 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
532 "org.apache.archiva" ),
533 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
534 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
535 "org.apache.archiva",
536 "metadata-repository-api" ),
537 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
538 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
539 "org.apache.archiva",
540 "metadata-repository-api",
541 "1.3-SNAPSHOT" ), Arrays.asList(
542 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
543 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "pom" ) ) );
544 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
545 "org.apache.archiva",
546 "metadata-repository-api",
547 "1.3" ), Arrays.asList(
548 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ), createArtifact(
549 "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
550 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
551 "org.apache.archiva",
553 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
554 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
555 "org.apache.archiva",
557 "1.3-SNAPSHOT" ), Arrays.asList(
558 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ), createArtifact(
559 "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
560 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
561 "org.apache.archiva",
562 "metadata-model", "1.3" ),
563 Arrays.asList( createArtifact( "org.apache.archiva",
564 "metadata-model", "1.3", "jar" ),
565 createArtifact( "org.apache.archiva",
566 "metadata-model", "1.3",
568 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
569 "org.apache.maven" ),
571 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
572 "org.apache.maven" ),
573 Arrays.asList( "maven-model" ) );
574 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
577 Arrays.asList( "2.2.1" ) );
578 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
580 "maven-model", "2.2.1" ),
581 Arrays.asList( createArtifact( "org.apache.archiva",
582 "maven-model", "2.2.1", "jar" ),
583 createArtifact( "org.apache.archiva",
584 "maven-model", "2.2.1",
586 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
587 Arrays.asList( "plexus" ) );
588 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
590 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
592 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
593 "org.codehaus.plexus" ),
595 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
596 "org.codehaus.plexus" ),
597 Arrays.asList( "plexus-spring" ) );
598 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
599 "org.codehaus.plexus",
601 Arrays.asList( "1.0", "1.1", "1.2" ) );
602 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
603 "org.codehaus.plexus",
604 "plexus-spring", "1.0" ),
605 Arrays.asList( createArtifact( "org.codehaus.plexus",
606 "plexus-spring", "1.0", "jar" ),
607 createArtifact( "org.codehaus.plexus",
608 "plexus-spring", "1.0",
610 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
611 "org.codehaus.plexus",
612 "plexus-spring", "1.1" ),
613 Arrays.asList( createArtifact( "org.codehaus.plexus",
614 "plexus-spring", "1.1", "jar" ),
615 createArtifact( "org.codehaus.plexus",
616 "plexus-spring", "1.1",
618 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
619 "org.codehaus.plexus",
620 "plexus-spring", "1.2" ),
621 Arrays.asList( createArtifact( "org.codehaus.plexus",
622 "plexus-spring", "1.2", "jar" ),
623 createArtifact( "org.codehaus.plexus",
624 "plexus-spring", "1.2",