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.ParseException;
29 import java.text.SimpleDateFormat;
30 import java.util.ArrayList;
31 import java.util.Arrays;
32 import java.util.Collections;
33 import java.util.Date;
34 import java.util.LinkedHashMap;
35 import java.util.List;
37 import java.util.TimeZone;
39 public class RepositoryStatisticsManagerTest
42 private DefaultRepositoryStatisticsManager repositoryStatisticsManager;
44 private static final String TEST_REPO_ID = "test-repo";
46 private MockControl metadataRepositoryControl;
48 private MetadataRepository metadataRepository;
50 private static final String FIRST_TEST_SCAN = "2009/12/01/123456.789";
52 private static final String SECOND_TEST_SCAN = "2009/12/02/012345.678";
54 private Map<String, RepositoryStatistics> statsCreated = new LinkedHashMap<String, RepositoryStatistics>();
56 private static final SimpleDateFormat TIMESTAMP_FORMAT = createTimestampFormat();
58 private static SimpleDateFormat createTimestampFormat()
60 SimpleDateFormat fmt = new SimpleDateFormat( RepositoryStatistics.SCAN_TIMESTAMP_FORMAT );
61 fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
66 protected void setUp()
71 repositoryStatisticsManager = new DefaultRepositoryStatisticsManager();
73 metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
74 metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
75 repositoryStatisticsManager.setMetadataRepository( metadataRepository );
78 public void testGetLatestStats()
81 Date startTime = TIMESTAMP_FORMAT.parse( SECOND_TEST_SCAN );
82 Date endTime = new Date( startTime.getTime() + 60000 );
84 RepositoryStatistics stats = new RepositoryStatistics();
85 stats.setScanStartTime( startTime );
86 stats.setScanEndTime( endTime );
87 stats.setTotalArtifactFileSize( 1314527915L );
88 stats.setNewFileCount( 123 );
89 stats.setTotalArtifactCount( 10386 );
90 stats.setTotalProjectCount( 2031 );
91 stats.setTotalGroupCount( 529 );
92 stats.setTotalFileCount( 56229 );
94 metadataRepositoryControl.expectAndReturn(
95 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
96 Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
97 metadataRepositoryControl.expectAndReturn(
98 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, SECOND_TEST_SCAN ),
100 metadataRepositoryControl.replay();
102 stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
103 assertNotNull( stats );
104 assertEquals( 1314527915L, stats.getTotalArtifactFileSize() );
105 assertEquals( 123, stats.getNewFileCount() );
106 assertEquals( 10386, stats.getTotalArtifactCount() );
107 assertEquals( 2031, stats.getTotalProjectCount() );
108 assertEquals( 529, stats.getTotalGroupCount() );
109 assertEquals( 56229, stats.getTotalFileCount() );
110 assertEquals( SECOND_TEST_SCAN, TIMESTAMP_FORMAT.format( stats.getScanStartTime() ) );
111 assertEquals( SECOND_TEST_SCAN, stats.getName() );
112 assertEquals( endTime, stats.getScanEndTime() );
114 metadataRepositoryControl.verify();
117 public void testGetLatestStatsWhenEmpty()
119 metadataRepositoryControl.expectAndReturn(
120 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
121 Collections.emptyList() );
122 metadataRepositoryControl.replay();
124 RepositoryStatistics stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
127 metadataRepositoryControl.verify();
130 public void testAddNewStats()
132 Date current = new Date();
133 Date startTime = new Date( current.getTime() - 12345 );
135 RepositoryStatistics stats = createTestStats( startTime, current );
139 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
140 metadataRepositoryControl.expectAndReturn(
141 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
142 Arrays.asList( stats.getName() ) );
143 metadataRepositoryControl.expectAndReturn(
144 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats.getName() ),
147 metadataRepositoryControl.replay();
149 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime, current, 56345, 45 );
151 stats = repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID );
152 assertNotNull( stats );
153 assertEquals( 246900, stats.getTotalArtifactFileSize() );
154 assertEquals( 45, stats.getNewFileCount() );
155 assertEquals( 20, stats.getTotalArtifactCount() );
156 assertEquals( 5, stats.getTotalProjectCount() );
157 assertEquals( 4, stats.getTotalGroupCount() );
158 assertEquals( 56345, stats.getTotalFileCount() );
159 assertEquals( current.getTime() - 12345, stats.getScanStartTime().getTime() );
160 assertEquals( current, stats.getScanEndTime() );
162 metadataRepositoryControl.verify();
165 public void testDeleteStats()
169 Date current = new Date();
171 Date startTime1 = new Date( current.getTime() - 12345 );
172 RepositoryStatistics stats1 = createTestStats( startTime1, new Date( current.getTime() - 6000 ) );
173 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats1 );
175 Date startTime2 = new Date( current.getTime() - 3000 );
176 RepositoryStatistics stats2 = createTestStats( startTime2, current );
177 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats2 );
179 metadataRepositoryControl.expectAndReturn(
180 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
181 Arrays.asList( stats1.getName(), stats2.getName() ) );
182 metadataRepositoryControl.expectAndReturn(
183 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats2.getName() ),
186 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
188 metadataRepositoryControl.expectAndReturn(
189 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
190 Collections.emptyList() );
192 metadataRepositoryControl.replay();
194 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime1, stats1.getScanEndTime(), 56345,
196 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, startTime2, stats2.getScanEndTime(), 56345,
199 assertNotNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
201 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
203 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
205 metadataRepositoryControl.verify();
208 public void testDeleteStatsWhenEmpty()
210 metadataRepositoryControl.expectAndReturn(
211 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
212 Collections.emptyList(), 2 );
213 metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
215 metadataRepositoryControl.replay();
217 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
219 repositoryStatisticsManager.deleteStatistics( TEST_REPO_ID );
221 assertNull( repositoryStatisticsManager.getLastStatistics( TEST_REPO_ID ) );
223 metadataRepositoryControl.verify();
226 public void testGetStatsRangeInside()
230 Date current = new Date();
232 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
233 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
234 addStats( new Date( current.getTime() - 1000 ), current );
236 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
237 metadataRepositoryControl.expectAndReturn(
238 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
240 // only match the middle one
241 String key = keys.get( 1 );
242 metadataRepositoryControl.expectAndReturn(
243 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
244 statsCreated.get( key ) );
246 metadataRepositoryControl.replay();
248 for ( RepositoryStatistics stats : statsCreated.values() )
250 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
251 stats.getScanEndTime(), 56345, 45 );
254 List<RepositoryStatistics> list =
255 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 4000 ),
256 new Date( current.getTime() - 2000 ) );
258 assertEquals( 1, list.size() );
259 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
261 metadataRepositoryControl.verify();
264 public void testGetStatsRangeUpperOutside()
268 Date current = new Date();
270 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
271 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
272 addStats( new Date( current.getTime() - 1000 ), current );
274 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
275 metadataRepositoryControl.expectAndReturn(
276 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
278 String key = keys.get( 1 );
279 metadataRepositoryControl.expectAndReturn(
280 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
281 statsCreated.get( key ) );
283 metadataRepositoryControl.expectAndReturn(
284 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
285 statsCreated.get( key ) );
287 metadataRepositoryControl.replay();
289 for ( RepositoryStatistics stats : statsCreated.values() )
291 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
292 stats.getScanEndTime(), 56345, 45 );
295 List<RepositoryStatistics> list =
296 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 4000 ),
299 assertEquals( 2, list.size() );
300 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
301 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
303 metadataRepositoryControl.verify();
306 public void testGetStatsRangeLowerOutside()
310 Date current = new Date();
312 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
313 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
314 addStats( new Date( current.getTime() - 1000 ), current );
316 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
317 metadataRepositoryControl.expectAndReturn(
318 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
320 String key = keys.get( 0 );
321 metadataRepositoryControl.expectAndReturn(
322 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
323 statsCreated.get( key ) );
325 metadataRepositoryControl.expectAndReturn(
326 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
327 statsCreated.get( key ) );
329 metadataRepositoryControl.replay();
331 for ( RepositoryStatistics stats : statsCreated.values() )
333 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
334 stats.getScanEndTime(), 56345, 45 );
337 List<RepositoryStatistics> list =
338 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
339 new Date( current.getTime() - 2000 ) );
341 assertEquals( 2, list.size() );
342 assertEquals( new Date( current.getTime() - 12345 ), list.get( 1 ).getScanStartTime() );
343 assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
345 metadataRepositoryControl.verify();
348 public void testGetStatsRangeLowerAndUpperOutside()
352 Date current = new Date();
354 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
355 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
356 addStats( new Date( current.getTime() - 1000 ), current );
358 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
359 metadataRepositoryControl.expectAndReturn(
360 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
362 String key = keys.get( 0 );
363 metadataRepositoryControl.expectAndReturn(
364 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
365 statsCreated.get( key ) );
367 metadataRepositoryControl.expectAndReturn(
368 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
369 statsCreated.get( key ) );
371 metadataRepositoryControl.expectAndReturn(
372 metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
373 statsCreated.get( key ) );
375 metadataRepositoryControl.replay();
377 for ( RepositoryStatistics stats : statsCreated.values() )
379 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
380 stats.getScanEndTime(), 56345, 45 );
383 List<RepositoryStatistics> list =
384 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
387 assertEquals( 3, list.size() );
388 assertEquals( new Date( current.getTime() - 12345 ), list.get( 2 ).getScanStartTime() );
389 assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
390 assertEquals( new Date( current.getTime() - 1000 ), list.get( 0 ).getScanStartTime() );
392 metadataRepositoryControl.verify();
395 public void testGetStatsRangeNotInside()
399 Date current = new Date();
401 addStats( new Date( current.getTime() - 12345 ), new Date( current.getTime() - 6000 ) );
402 addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
403 addStats( new Date( current.getTime() - 1000 ), current );
405 ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
406 metadataRepositoryControl.expectAndReturn(
407 metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
409 metadataRepositoryControl.replay();
411 for ( RepositoryStatistics stats : statsCreated.values() )
413 repositoryStatisticsManager.addStatisticsAfterScan( TEST_REPO_ID, stats.getScanStartTime(),
414 stats.getScanEndTime(), 56345, 45 );
417 List<RepositoryStatistics> list =
418 repositoryStatisticsManager.getStatisticsInRange( TEST_REPO_ID, new Date( current.getTime() - 20000 ),
419 new Date( current.getTime() - 16000 ) );
421 assertEquals( 0, list.size() );
423 metadataRepositoryControl.verify();
426 private void addStats( Date startTime, Date endTime )
428 RepositoryStatistics stats = createTestStats( startTime, endTime );
429 metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
430 statsCreated.put( stats.getName(), stats );
433 private ArtifactMetadata createArtifact( String namespace, String projectId, String projectVersion, String type )
435 ArtifactMetadata metadata = new ArtifactMetadata();
436 metadata.setRepositoryId( TEST_REPO_ID );
437 metadata.setId( projectId + "-" + projectVersion + "." + type );
438 metadata.setProject( projectId );
439 metadata.setSize( 12345L );
440 metadata.setVersion( projectVersion );
441 metadata.setNamespace( namespace );
443 MavenArtifactFacet facet = new MavenArtifactFacet();
444 facet.setType( type );
445 metadata.addFacet( facet );
450 private RepositoryStatistics createTestStats( Date startTime, Date endTime )
452 RepositoryStatistics stats = new RepositoryStatistics();
453 stats.setScanStartTime( startTime );
454 stats.setScanEndTime( endTime );
455 stats.setTotalArtifactFileSize( 20 * 12345L );
456 stats.setNewFileCount( 45 );
457 stats.setTotalArtifactCount( 20 );
458 stats.setTotalProjectCount( 5 );
459 stats.setTotalGroupCount( 4 );
460 stats.setTotalFileCount( 56345 );
461 stats.setTotalCountForType( "jar", 10 );
462 stats.setTotalCountForType( "pom", 10 );
466 private void walkRepository( int count )
468 for ( int i = 0; i < count; i++ )
470 metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
471 Arrays.asList( "com", "org" ) );
472 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
474 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
475 Arrays.asList( "example" ) );
476 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
478 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
479 Arrays.asList( "example-project" ) );
480 metadataRepositoryControl.expectAndReturn(
481 metadataRepository.getProjectVersions( TEST_REPO_ID, "com.example", "example-project" ),
482 Arrays.asList( "1.0", "1.1" ) );
483 metadataRepositoryControl.expectAndReturn(
484 metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.0" ),
485 Arrays.asList( createArtifact( "com.example", "example-project", "1.0", "jar" ),
486 createArtifact( "com.example", "example-project", "1.0", "pom" ) ) );
487 metadataRepositoryControl.expectAndReturn(
488 metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.1" ),
489 Arrays.asList( createArtifact( "com.example", "example-project", "1.1", "jar" ),
490 createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
491 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
492 Arrays.asList( "apache", "codehaus" ) );
493 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
494 Arrays.asList( "archiva", "maven" ) );
495 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
497 metadataRepositoryControl.expectAndReturn(
498 metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.archiva" ), Arrays.asList() );
499 metadataRepositoryControl.expectAndReturn(
500 metadataRepository.getProjects( TEST_REPO_ID, "org.apache.archiva" ),
501 Arrays.asList( "metadata-repository-api", "metadata-model" ) );
502 metadataRepositoryControl.expectAndReturn(
503 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ),
504 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
505 metadataRepositoryControl.expectAndReturn(
506 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api",
508 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
509 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
511 metadataRepositoryControl.expectAndReturn(
512 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ),
513 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
514 createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
515 metadataRepositoryControl.expectAndReturn(
516 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-model" ),
517 Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
518 metadataRepositoryControl.expectAndReturn(
519 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ),
520 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ),
521 createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
522 metadataRepositoryControl.expectAndReturn(
523 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ),
524 Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
525 createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
526 metadataRepositoryControl.expectAndReturn(
527 metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList() );
528 metadataRepositoryControl.expectAndReturn(
529 metadataRepository.getProjects( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList( "maven-model" ) );
530 metadataRepositoryControl.expectAndReturn(
531 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", "maven-model" ),
532 Arrays.asList( "2.2.1" ) );
533 metadataRepositoryControl.expectAndReturn(
534 metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ),
535 Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
536 createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
537 metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
538 Arrays.asList( "plexus" ) );
539 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
541 metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
543 metadataRepositoryControl.expectAndReturn(
544 metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus.plexus" ), Arrays.asList() );
545 metadataRepositoryControl.expectAndReturn(
546 metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus.plexus" ),
547 Arrays.asList( "plexus-spring" ) );
548 metadataRepositoryControl.expectAndReturn(
549 metadataRepository.getProjectVersions( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ),
550 Arrays.asList( "1.0", "1.1", "1.2" ) );
551 metadataRepositoryControl.expectAndReturn(
552 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ),
553 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "jar" ),
554 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "pom" ) ) );
555 metadataRepositoryControl.expectAndReturn(
556 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ),
557 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "jar" ),
558 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "pom" ) ) );
559 metadataRepositoryControl.expectAndReturn(
560 metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ),
561 Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "jar" ),
562 createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "pom" ) ) );