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;
38 import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
39 import org.junit.Before;
40 import org.junit.Test;
41 import org.junit.runner.RunWith;
43 @RunWith( ArchivaBlockJUnit4ClassRunner.class )
44 public class RepositoryStatisticsManagerTest
47 private DefaultRepositoryStatisticsManager repositoryStatisticsManager;
49 private static final String TEST_REPO_ID = "test-repo";
51 private MockControl metadataRepositoryControl;
53 private MetadataRepository metadataRepository;
55 private static final String FIRST_TEST_SCAN = "2009/12/01/123456.789";
57 private static final String SECOND_TEST_SCAN = "2009/12/02/012345.678";
59 private Map<String, RepositoryStatistics> statsCreated = new LinkedHashMap<String, RepositoryStatistics>();
61 private static final SimpleDateFormat TIMESTAMP_FORMAT = createTimestampFormat();
63 private static SimpleDateFormat createTimestampFormat()
65 SimpleDateFormat fmt = new SimpleDateFormat( RepositoryStatistics.SCAN_TIMESTAMP_FORMAT );
66 fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
77 repositoryStatisticsManager = new DefaultRepositoryStatisticsManager();
79 metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
80 metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
84 public void testGetLatestStats()
87 Date startTime = TIMESTAMP_FORMAT.parse( SECOND_TEST_SCAN );
88 Date endTime = new Date( startTime.getTime() + 60000 );
90 RepositoryStatistics stats = new RepositoryStatistics();
91 stats.setScanStartTime( startTime );
92 stats.setScanEndTime( endTime );
93 stats.setTotalArtifactFileSize( 1314527915L );
94 stats.setNewFileCount( 123 );
95 stats.setTotalArtifactCount( 10386 );
96 stats.setTotalProjectCount( 2031 );
97 stats.setTotalGroupCount( 529 );
98 stats.setTotalFileCount( 56229 );
100 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
101 RepositoryStatistics.FACET_ID ),
102 Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
103 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
104 RepositoryStatistics.FACET_ID,
105 SECOND_TEST_SCAN ), stats );
106 metadataRepositoryControl.replay();
108 stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
109 assertNotNull( stats );
110 assertEquals( 1314527915L, stats.getTotalArtifactFileSize() );
111 assertEquals( 123, stats.getNewFileCount() );
112 assertEquals( 10386, stats.getTotalArtifactCount() );
113 assertEquals( 2031, stats.getTotalProjectCount() );
114 assertEquals( 529, stats.getTotalGroupCount() );
115 assertEquals( 56229, stats.getTotalFileCount() );
116 assertEquals( SECOND_TEST_SCAN, TIMESTAMP_FORMAT.format( stats.getScanStartTime() ) );
117 assertEquals( SECOND_TEST_SCAN, stats.getName() );
118 assertEquals( endTime, stats.getScanEndTime() );
120 metadataRepositoryControl.verify();
124 public void testGetLatestStatsWhenEmpty()
127 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
128 RepositoryStatistics.FACET_ID ),
129 Collections.emptyList() );
130 metadataRepositoryControl.replay();
132 RepositoryStatistics stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
135 metadataRepositoryControl.verify();
139 public void testAddNewStats()
142 Date current = new Date();
143 Date startTime = new Date( current.getTime() - 12345 );
145 RepositoryStatistics stats = createTestStats( startTime, current );
149 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
150 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
151 RepositoryStatistics.FACET_ID ),
152 Arrays.asList( stats.getName() ) );
153 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
154 RepositoryStatistics.FACET_ID,
155 stats.getName() ), stats );
156 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false );
158 metadataRepositoryControl.replay();
160 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime, current, 56345,
163 stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
164 assertNotNull( stats );
165 assertEquals( 246900, stats.getTotalArtifactFileSize() );
166 assertEquals( 45, stats.getNewFileCount() );
167 assertEquals( 20, stats.getTotalArtifactCount() );
168 assertEquals( 5, stats.getTotalProjectCount() );
169 assertEquals( 4, stats.getTotalGroupCount() );
170 assertEquals( 56345, stats.getTotalFileCount() );
171 assertEquals( current.getTime() - 12345, stats.getScanStartTime().getTime() );
172 assertEquals( current, stats.getScanEndTime() );
174 metadataRepositoryControl.verify();
178 public void testDeleteStats()
183 Date current = new Date();
185 Date startTime1 = new Date( current.getTime() - 12345 );
186 RepositoryStatistics stats1 = createTestStats( startTime1, new Date( current.getTime() - 6000 ) );
187 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats1 );
189 Date startTime2 = new Date( current.getTime() - 3000 );
190 RepositoryStatistics stats2 = createTestStats( startTime2, current );
191 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats2 );
193 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
194 RepositoryStatistics.FACET_ID ),
195 Arrays.asList( stats1.getName(), stats2.getName() ) );
196 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
197 RepositoryStatistics.FACET_ID,
198 stats2.getName() ), stats2 );
200 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
202 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
203 RepositoryStatistics.FACET_ID ),
204 Collections.emptyList() );
205 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 2 );
207 metadataRepositoryControl.replay();
209 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime1,
210 stats1.getScanEndTime(), 56345, 45 );
211 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime2,
212 stats2.getScanEndTime(), 56345, 45 );
214 assertNotNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
216 repositoryStatisticsManager.deleteStatistics( metadataRepository, TEST_REPO_ID );
218 assertNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
220 metadataRepositoryControl.verify();
224 public void testDeleteStatsWhenEmpty()
227 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
228 RepositoryStatistics.FACET_ID ),
229 Collections.emptyList(), 2 );
230 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
232 metadataRepositoryControl.replay();
234 assertNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
236 repositoryStatisticsManager.deleteStatistics( metadataRepository, TEST_REPO_ID );
238 assertNull( repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID ) );
240 metadataRepositoryControl.verify();
244 public void testGetStatsRangeInside()
249 Date current = new Date();
251 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
252 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
253 addStats( new Date( current.getTime() - 1000 ), current );
255 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
256 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
257 RepositoryStatistics.FACET_ID ),
260 // only match the middle one
261 String key = keys.get( 1 );
262 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
263 RepositoryStatistics.FACET_ID,
264 key ), statsCreated.get(
266 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
268 metadataRepositoryControl.replay();
270 for ( RepositoryStatistics stats : statsCreated.values() )
272 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
273 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
277 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
278 TEST_REPO_ID, new Date(
279 current.getTime() - 4000 ), new Date( current.getTime() - 2000 ) );
281 assertEquals( 1, list.size() );
282 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
284 metadataRepositoryControl.verify();
288 public void testGetStatsRangeUpperOutside()
293 Date current = new Date();
295 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
296 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
297 addStats( new Date( current.getTime() - 1000 ), current );
299 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
300 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
301 RepositoryStatistics.FACET_ID ),
304 String key = keys.get( 1 );
305 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
306 RepositoryStatistics.FACET_ID,
307 key ), statsCreated.get(
310 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
311 RepositoryStatistics.FACET_ID,
312 key ), statsCreated.get(
314 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
316 metadataRepositoryControl.replay();
318 for ( RepositoryStatistics stats : statsCreated.values() )
320 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
321 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
325 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
326 TEST_REPO_ID, new Date(
327 current.getTime() - 4000 ), current );
329 assertEquals( 2, list.size() );
330 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
331 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
333 metadataRepositoryControl.verify();
337 public void testGetStatsRangeLowerOutside()
342 Date current = new Date();
344 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
345 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
346 addStats( new Date( current.getTime() - 1000 ), current );
348 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
349 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
350 RepositoryStatistics.FACET_ID ),
353 String key = keys.get( 0 );
354 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
355 RepositoryStatistics.FACET_ID,
356 key ), statsCreated.get(
359 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
360 RepositoryStatistics.FACET_ID,
361 key ), statsCreated.get(
363 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
365 metadataRepositoryControl.replay();
367 for ( RepositoryStatistics stats : statsCreated.values() )
369 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
370 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
374 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
375 TEST_REPO_ID, new Date(
376 current.getTime() - 20000 ), new Date( current.getTime() - 2000 ) );
378 assertEquals( 2, list.size() );
379 assertEquals( new Date( current.getTime() - 12345 ), list.get( 1 ).getScanStartTime() );
380 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
382 metadataRepositoryControl.verify();
386 public void testGetStatsRangeLowerAndUpperOutside()
391 Date current = new Date();
393 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
394 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
395 addStats( new Date( current.getTime() - 1000 ), current );
397 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
398 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
399 RepositoryStatistics.FACET_ID ),
402 String key = keys.get( 0 );
403 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
404 RepositoryStatistics.FACET_ID,
405 key ), statsCreated.get(
408 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
409 RepositoryStatistics.FACET_ID,
410 key ), statsCreated.get(
413 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
414 RepositoryStatistics.FACET_ID,
415 key ), statsCreated.get(
417 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
419 metadataRepositoryControl.replay();
421 for ( RepositoryStatistics stats : statsCreated.values() )
423 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
424 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
428 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
429 TEST_REPO_ID, new Date(
430 current.getTime() - 20000 ), current );
432 assertEquals( 3, list.size() );
433 assertEquals( new Date( current.getTime() - 12345 ), list.get( 2 ).getScanStartTime() );
434 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
435 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
437 metadataRepositoryControl.verify();
441 public void testGetStatsRangeNotInside()
446 Date current = new Date();
448 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
449 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
450 addStats( new Date( current.getTime() - 1000 ), current );
452 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
453 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
454 RepositoryStatistics.FACET_ID ),
456 metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
458 metadataRepositoryControl.replay();
460 for ( RepositoryStatistics stats : statsCreated.values() )
462 repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID,
463 stats.getScanStartTime(), stats.getScanEndTime(), 56345,
467 List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
468 TEST_REPO_ID, new Date(
469 current.getTime() - 20000 ), new Date( current.getTime() - 16000 ) );
471 assertEquals( 0, list.size() );
473 metadataRepositoryControl.verify();
476 private void addStats( Date startTime, Date endTime )
479 RepositoryStatistics stats = createTestStats( startTime, endTime );
480 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
481 statsCreated.put( stats.getName(), stats );
484 private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
486 ArtifactMetadata metadata = new ArtifactMetadata();
487 metadata.setRepositoryId( TEST_REPO_ID );
488 metadata.setId( projectId + "-" + projectVersion + "." + type );
489 metadata.setProject( projectId );
490 metadata.setSize( 12345L );
491 metadata.setProjectVersion( projectVersion );
492 metadata.setVersion( projectVersion );
493 metadata.setNamespace( namespace );
495 MavenArtifactFacet facet = new MavenArtifactFacet();
496 facet.setType( type );
497 metadata.addFacet( facet );
502 private RepositoryStatistics createTestStats( Date startTime, Date endTime )
504 RepositoryStatistics stats = new RepositoryStatistics();
505 stats.setScanStartTime( startTime );
506 stats.setScanEndTime( endTime );
507 stats.setTotalArtifactFileSize( 20 * 12345L );
508 stats.setNewFileCount( 45 );
509 stats.setTotalArtifactCount( 20 );
510 stats.setTotalProjectCount( 5 );
511 stats.setTotalGroupCount( 4 );
512 stats.setTotalFileCount( 56345 );
513 stats.setTotalCountForType( "jar", 10 );
514 stats.setTotalCountForType( "pom", 10 );
518 private void walkRepository( int count )
521 for ( int i = 0; i < count; i++ )
523 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
524 Arrays.asList( "com", "org" ) );
525 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
527 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
528 Arrays.asList( "example" ) );
529 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
531 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
532 Arrays.asList( "example-project" ) );
533 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
536 Arrays.asList( "1.0", "1.1" ) );
537 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
538 "example-project", "1.0" ),
539 Arrays.asList( createArtifact( "com.example", "example-project",
540 "1.0", "jar" ), createArtifact(
541 "com.example", "example-project", "1.0", "pom" ) ) );
542 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
543 "example-project", "1.1" ),
544 Arrays.asList( createArtifact( "com.example", "example-project",
545 "1.1", "jar" ), createArtifact(
546 "com.example", "example-project", "1.1", "pom" ) ) );
547 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
548 Arrays.asList( "apache", "codehaus" ) );
549 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
550 Arrays.asList( "archiva", "maven" ) );
551 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
553 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
554 "org.apache.archiva" ),
556 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
557 "org.apache.archiva" ),
558 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
559 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
560 "org.apache.archiva",
561 "metadata-repository-api" ),
562 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
563 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
564 "org.apache.archiva",
565 "metadata-repository-api",
566 "1.3-SNAPSHOT" ), Arrays.asList(
567 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
568 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "pom" ) ) );
569 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
570 "org.apache.archiva",
571 "metadata-repository-api",
572 "1.3" ), Arrays.asList(
573 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ), createArtifact(
574 "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
575 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
576 "org.apache.archiva",
578 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
579 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
580 "org.apache.archiva",
582 "1.3-SNAPSHOT" ), Arrays.asList(
583 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ), createArtifact(
584 "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
585 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
586 "org.apache.archiva",
587 "metadata-model", "1.3" ),
588 Arrays.asList( createArtifact( "org.apache.archiva",
589 "metadata-model", "1.3", "jar" ),
590 createArtifact( "org.apache.archiva",
591 "metadata-model", "1.3",
593 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
594 "org.apache.maven" ),
596 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
597 "org.apache.maven" ),
598 Arrays.asList( "maven-model" ) );
599 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
602 Arrays.asList( "2.2.1" ) );
603 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
605 "maven-model", "2.2.1" ),
606 Arrays.asList( createArtifact( "org.apache.archiva",
607 "maven-model", "2.2.1", "jar" ),
608 createArtifact( "org.apache.archiva",
609 "maven-model", "2.2.1",
611 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
612 Arrays.asList( "plexus" ) );
613 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
615 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
617 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
618 "org.codehaus.plexus" ),
620 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
621 "org.codehaus.plexus" ),
622 Arrays.asList( "plexus-spring" ) );
623 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
624 "org.codehaus.plexus",
626 Arrays.asList( "1.0", "1.1", "1.2" ) );
627 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
628 "org.codehaus.plexus",
629 "plexus-spring", "1.0" ),
630 Arrays.asList( createArtifact( "org.codehaus.plexus",
631 "plexus-spring", "1.0", "jar" ),
632 createArtifact( "org.codehaus.plexus",
633 "plexus-spring", "1.0",
635 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
636 "org.codehaus.plexus",
637 "plexus-spring", "1.1" ),
638 Arrays.asList( createArtifact( "org.codehaus.plexus",
639 "plexus-spring", "1.1", "jar" ),
640 createArtifact( "org.codehaus.plexus",
641 "plexus-spring", "1.1",
643 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
644 "org.codehaus.plexus",
645 "plexus-spring", "1.2" ),
646 Arrays.asList( createArtifact( "org.codehaus.plexus",
647 "plexus-spring", "1.2", "jar" ),
648 createArtifact( "org.codehaus.plexus",
649 "plexus-spring", "1.2",