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.easymock.MockControl;
27 import java.text.ParseException;
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(
94 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
95 Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
96 metadataRepositoryControl.expectAndReturn(
97 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, SECOND_TEST_SCAN ),
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()
118 metadataRepositoryControl.expectAndReturn(
119 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
120 Collections.emptyList() );
121 metadataRepositoryControl.replay();
123 RepositoryStatistics stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
126 metadataRepositoryControl.verify();
129 public void testAddNewStats()
131 Date current = new Date();
132 Date startTime = new Date( current.getTime() - 12345 );
134 RepositoryStatistics stats = createTestStats( startTime, current );
138 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
139 metadataRepositoryControl.expectAndReturn(
140 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
141 Arrays.asList( stats.getName() ) );
142 metadataRepositoryControl.expectAndReturn(
143 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats.getName() ),
146 metadataRepositoryControl.replay();
148 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime, current, 56345, 45 );
150 stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
151 assertNotNull( stats );
152 assertEquals( 246900, stats.getTotalArtifactFileSize() );
153 assertEquals( 45, stats.getNewFileCount() );
154 assertEquals( 20, stats.getTotalArtifactCount() );
155 assertEquals( 5, stats.getTotalProjectCount() );
156 assertEquals( 4, stats.getTotalGroupCount() );
157 assertEquals( 56345, stats.getTotalFileCount() );
158 assertEquals( current.getTime() - 12345, stats.getScanStartTime().getTime() );
159 assertEquals( current, stats.getScanEndTime() );
161 metadataRepositoryControl.verify();
164 public void testDeleteStats()
168 Date current = new Date();
170 Date startTime1 = new Date( current.getTime() - 12345 );
171 RepositoryStatistics stats1 = createTestStats( startTime1, new Date( current.getTime() - 6000 ) );
172 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats1 );
174 Date startTime2 = new Date( current.getTime() - 3000 );
175 RepositoryStatistics stats2 = createTestStats( startTime2, current );
176 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats2 );
178 metadataRepositoryControl.expectAndReturn(
179 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
180 Arrays.asList( stats1.getName(), stats2.getName() ) );
181 metadataRepositoryControl.expectAndReturn(
182 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats2.getName() ),
185 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
187 metadataRepositoryControl.expectAndReturn(
188 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
189 Collections.emptyList() );
191 metadataRepositoryControl.replay();
193 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime1, stats1.getScanEndTime(), 56345,
195 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime2, stats2.getScanEndTime(), 56345,
198 assertNotNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
200 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
202 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
204 metadataRepositoryControl.verify();
207 public void testDeleteStatsWhenEmpty()
209 metadataRepositoryControl.expectAndReturn(
210 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
211 Collections.emptyList(), 2 );
212 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
214 metadataRepositoryControl.replay();
216 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
218 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
220 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
222 metadataRepositoryControl.verify();
225 public void testGetStatsRangeInside()
229 Date current = new Date();
231 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
232 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
233 addStats( new Date( current.getTime() - 1000 ), current );
235 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
236 metadataRepositoryControl.expectAndReturn(
237 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
239 // only match the middle one
240 String key = keys.get( 1 );
241 metadataRepositoryControl.expectAndReturn(
242 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
243 statsCreated.get( key ) );
245 metadataRepositoryControl.replay();
247 for ( RepositoryStatistics stats : statsCreated.values() )
249 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
250 stats.getScanEndTime(), 56345, 45 );
253 List<RepositoryStatistics> list =
254 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 4000 ),
255 new Date( current.getTime() - 2000 ) );
257 assertEquals( 1, list.size() );
258 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
260 metadataRepositoryControl.verify();
263 public void testGetStatsRangeUpperOutside()
267 Date current = new Date();
269 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
270 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
271 addStats( new Date( current.getTime() - 1000 ), current );
273 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
274 metadataRepositoryControl.expectAndReturn(
275 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
277 String key = keys.get( 1 );
278 metadataRepositoryControl.expectAndReturn(
279 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
280 statsCreated.get( key ) );
282 metadataRepositoryControl.expectAndReturn(
283 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
284 statsCreated.get( key ) );
286 metadataRepositoryControl.replay();
288 for ( RepositoryStatistics stats : statsCreated.values() )
290 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
291 stats.getScanEndTime(), 56345, 45 );
294 List<RepositoryStatistics> list =
295 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 4000 ),
298 assertEquals( 2, list.size() );
299 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
300 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
302 metadataRepositoryControl.verify();
305 public void testGetStatsRangeLowerOutside()
309 Date current = new Date();
311 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
312 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
313 addStats( new Date( current.getTime() - 1000 ), current );
315 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
316 metadataRepositoryControl.expectAndReturn(
317 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
319 String key = keys.get( 0 );
320 metadataRepositoryControl.expectAndReturn(
321 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
322 statsCreated.get( key ) );
324 metadataRepositoryControl.expectAndReturn(
325 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
326 statsCreated.get( key ) );
328 metadataRepositoryControl.replay();
330 for ( RepositoryStatistics stats : statsCreated.values() )
332 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
333 stats.getScanEndTime(), 56345, 45 );
336 List<RepositoryStatistics> list =
337 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
338 new Date( current.getTime() - 2000 ) );
340 assertEquals( 2, list.size() );
341 assertEquals( new Date( current.getTime() - 12345 ), list.get( 1 ).getScanStartTime() );
342 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
344 metadataRepositoryControl.verify();
347 public void testGetStatsRangeLowerAndUpperOutside()
351 Date current = new Date();
353 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
354 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
355 addStats( new Date( current.getTime() - 1000 ), current );
357 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
358 metadataRepositoryControl.expectAndReturn(
359 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
361 String key = keys.get( 0 );
362 metadataRepositoryControl.expectAndReturn(
363 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
364 statsCreated.get( key ) );
366 metadataRepositoryControl.expectAndReturn(
367 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
368 statsCreated.get( key ) );
370 metadataRepositoryControl.expectAndReturn(
371 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
372 statsCreated.get( key ) );
374 metadataRepositoryControl.replay();
376 for ( RepositoryStatistics stats : statsCreated.values() )
378 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
379 stats.getScanEndTime(), 56345, 45 );
382 List<RepositoryStatistics> list =
383 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
386 assertEquals( 3, list.size() );
387 assertEquals( new Date( current.getTime() - 12345 ), list.get( 2 ).getScanStartTime() );
388 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
389 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
391 metadataRepositoryControl.verify();
394 public void testGetStatsRangeNotInside()
398 Date current = new Date();
400 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
401 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
402 addStats( new Date( current.getTime() - 1000 ), current );
404 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
405 metadataRepositoryControl.expectAndReturn(
406 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
408 metadataRepositoryControl.replay();
410 for ( RepositoryStatistics stats : statsCreated.values() )
412 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
413 stats.getScanEndTime(), 56345, 45 );
416 List<RepositoryStatistics> list =
417 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
418 new Date( current.getTime() - 16000 ) );
420 assertEquals( 0, list.size() );
422 metadataRepositoryControl.verify();
425 private void addStats( Date startTime, Date endTime )
427 RepositoryStatistics stats = createTestStats( startTime, endTime );
428 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
429 statsCreated.put( stats.getName(), stats );
432 private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
434 ArtifactMetadata metadata = new ArtifactMetadata();
435 metadata.setRepositoryId( TEST_REPO_ID );
436 metadata.setId( projectId + "-" + projectVersion + "." + type );
437 metadata.setProject( projectId );
438 metadata.setSize( 12345L );
439 metadata.setVersion( projectVersion );
440 metadata.setNamespace( namespace );
444 private RepositoryStatistics createTestStats( Date startTime, Date endTime )
446 RepositoryStatistics stats = new RepositoryStatistics();
447 stats.setScanStartTime( startTime );
448 stats.setScanEndTime( endTime );
449 stats.setTotalArtifactFileSize( 20 * 12345L );
450 stats.setNewFileCount( 45 );
451 stats.setTotalArtifactCount( 20 );
452 stats.setTotalProjectCount( 5 );
453 stats.setTotalGroupCount( 4 );
454 stats.setTotalFileCount( 56345 );
455 stats.setTotalCountForType( "jar", 10 );
456 stats.setTotalCountForType( "pom", 10 );
460 private void walkRepository( int count )
462 for ( int i = 0; i < count; i++ )
464 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
465 Arrays.asList( "com", "org" ) );
466 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
468 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
469 Arrays.asList( "example" ) );
470 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
472 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
473 Arrays.asList( "example-project" ) );
474 metadataRepositoryControl.expectAndReturn(
475 metadataRepository.getProjectVersions( TEST_REPO_ID, "com.example", "example-project" ),
476 Arrays.asList( "1.0", "1.1" ) );
477 metadataRepositoryControl.expectAndReturn(
478 metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.0" ),
479 Arrays.asList( createArtifact( "com.example", "example-project", "1.0", "jar" ),
480 createArtifact( "com.example", "example-project", "1.0", "pom" ) ) );
481 metadataRepositoryControl.expectAndReturn(
482 metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.1" ),
483 Arrays.asList( createArtifact( "com.example", "example-project", "1.1", "jar" ),
484 createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
485 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
486 Arrays.asList( "apache", "codehaus" ) );
487 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
488 Arrays.asList( "archiva", "maven" ) );
489 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
491 metadataRepositoryControl.expectAndReturn(
492 metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.archiva" ), Arrays.asList() );
493 metadataRepositoryControl.expectAndReturn(
494 metadataRepository.getProjects( TEST_REPO_ID, "org.apache.archiva" ),
495 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
496 metadataRepositoryControl.expectAndReturn(
497 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ),
498 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
499 metadataRepositoryControl.expectAndReturn(
500 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api",
502 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
503 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
505 metadataRepositoryControl.expectAndReturn(
506 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ),
507 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
508 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
509 metadataRepositoryControl.expectAndReturn(
510 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-model" ),
511 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
512 metadataRepositoryControl.expectAndReturn(
513 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ),
514 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ),
515 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
516 metadataRepositoryControl.expectAndReturn(
517 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ),
518 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
519 createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
520 metadataRepositoryControl.expectAndReturn(
521 metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList() );
522 metadataRepositoryControl.expectAndReturn(
523 metadataRepository.getProjects( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList( "maven-model" ) );
524 metadataRepositoryControl.expectAndReturn(
525 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", "maven-model" ),
526 Arrays.asList( "2.2.1" ) );
527 metadataRepositoryControl.expectAndReturn(
528 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ),
529 Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
530 createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
531 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
532 Arrays.asList( "plexus" ) );
533 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
535 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
537 metadataRepositoryControl.expectAndReturn(
538 metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus.plexus" ), Arrays.asList() );
539 metadataRepositoryControl.expectAndReturn(
540 metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus.plexus" ),
541 Arrays.asList( "plexus-spring" ) );
542 metadataRepositoryControl.expectAndReturn(
543 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ),
544 Arrays.asList( "1.0", "1.1", "1.2" ) );
545 metadataRepositoryControl.expectAndReturn(
546 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ),
547 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "jar" ),
548 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "pom" ) ) );
549 metadataRepositoryControl.expectAndReturn(
550 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ),
551 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "jar" ),
552 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "pom" ) ) );
553 metadataRepositoryControl.expectAndReturn(
554 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ),
555 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "jar" ),
556 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "pom" ) ) );