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.model.maven2.MavenArtifactFacet;
25 import org.apache.archiva.metadata.repository.MetadataRepository;
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.utils.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.setRepositoryId( TEST_REPO_ID );
506 stats.setScanStartTime( startTime );
507 stats.setScanEndTime( endTime );
508 stats.setTotalArtifactFileSize( 20 * 12345L );
509 stats.setNewFileCount( 45 );
510 stats.setTotalArtifactCount( 20 );
511 stats.setTotalProjectCount( 5 );
512 stats.setTotalGroupCount( 4 );
513 stats.setTotalFileCount( 56345 );
514 stats.setTotalCountForType( "jar", 10 );
515 stats.setTotalCountForType( "pom", 10 );
519 private void walkRepository( int count )
522 for ( int i = 0; i < count; i++ )
524 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
525 Arrays.asList( "com", "org" ) );
526 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
528 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
529 Arrays.asList( "example" ) );
530 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
532 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
533 Arrays.asList( "example-project" ) );
534 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
537 Arrays.asList( "1.0", "1.1" ) );
538 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
539 "example-project", "1.0" ),
540 Arrays.asList( createArtifact( "com.example", "example-project",
541 "1.0", "jar" ), createArtifact(
542 "com.example", "example-project", "1.0", "pom" ) ) );
543 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
544 "example-project", "1.1" ),
545 Arrays.asList( createArtifact( "com.example", "example-project",
546 "1.1", "jar" ), createArtifact(
547 "com.example", "example-project", "1.1", "pom" ) ) );
548 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
549 Arrays.asList( "apache", "codehaus" ) );
550 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
551 Arrays.asList( "archiva", "maven" ) );
552 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
554 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
555 "org.apache.archiva" ),
557 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
558 "org.apache.archiva" ),
559 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
560 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
561 "org.apache.archiva",
562 "metadata-repository-api" ),
563 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
564 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
565 "org.apache.archiva",
566 "metadata-repository-api",
567 "1.3-SNAPSHOT" ), Arrays.asList(
568 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
569 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "pom" ) ) );
570 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
571 "org.apache.archiva",
572 "metadata-repository-api",
573 "1.3" ), Arrays.asList(
574 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ), createArtifact(
575 "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
576 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
577 "org.apache.archiva",
579 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
580 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
581 "org.apache.archiva",
583 "1.3-SNAPSHOT" ), Arrays.asList(
584 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ), createArtifact(
585 "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
586 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
587 "org.apache.archiva",
588 "metadata-model", "1.3" ),
589 Arrays.asList( createArtifact( "org.apache.archiva",
590 "metadata-model", "1.3", "jar" ),
591 createArtifact( "org.apache.archiva",
592 "metadata-model", "1.3",
594 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
595 "org.apache.maven" ),
597 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
598 "org.apache.maven" ),
599 Arrays.asList( "maven-model" ) );
600 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
603 Arrays.asList( "2.2.1" ) );
604 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
606 "maven-model", "2.2.1" ),
607 Arrays.asList( createArtifact( "org.apache.archiva",
608 "maven-model", "2.2.1", "jar" ),
609 createArtifact( "org.apache.archiva",
610 "maven-model", "2.2.1",
612 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
613 Arrays.asList( "plexus" ) );
614 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
616 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
618 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
619 "org.codehaus.plexus" ),
621 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
622 "org.codehaus.plexus" ),
623 Arrays.asList( "plexus-spring" ) );
624 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
625 "org.codehaus.plexus",
627 Arrays.asList( "1.0", "1.1", "1.2" ) );
628 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
629 "org.codehaus.plexus",
630 "plexus-spring", "1.0" ),
631 Arrays.asList( createArtifact( "org.codehaus.plexus",
632 "plexus-spring", "1.0", "jar" ),
633 createArtifact( "org.codehaus.plexus",
634 "plexus-spring", "1.0",
636 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
637 "org.codehaus.plexus",
638 "plexus-spring", "1.1" ),
639 Arrays.asList( createArtifact( "org.codehaus.plexus",
640 "plexus-spring", "1.1", "jar" ),
641 createArtifact( "org.codehaus.plexus",
642 "plexus-spring", "1.1",
644 metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
645 "org.codehaus.plexus",
646 "plexus-spring", "1.2" ),
647 Arrays.asList( createArtifact( "org.codehaus.plexus",
648 "plexus-spring", "1.2", "jar" ),
649 createArtifact( "org.codehaus.plexus",
650 "plexus-spring", "1.2",