aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-11-13 06:31:24 +0000
committerOlivier Lamy <olamy@apache.org>2013-11-13 06:31:24 +0000
commitab6f5bde33f4ab6899557733fac009497053952e (patch)
tree87f9bc0ff11f7429ffbead336649d57ece92e4ac /archiva-modules/plugins
parent16b6da8bf0942336143734e6992d3a81b3b977df (diff)
downloadarchiva-ab6f5bde33f4ab6899557733fac009497053952e.tar.gz
archiva-ab6f5bde33f4ab6899557733fac009497053952e.zip
move to last easymock 3.2
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1541399 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins')
-rw-r--r--archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java414
-rwxr-xr-xarchiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java10
-rw-r--r--archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java548
3 files changed, 556 insertions, 416 deletions
diff --git a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
index 6b5b7e9f5..0deec674c 100644
--- a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
+++ b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
@@ -20,9 +20,14 @@ package org.apache.archiva.audit;
*/
import junit.framework.TestCase;
-import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.easymock.MockControl;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.text.DecimalFormat;
import java.text.ParseException;
@@ -35,18 +40,14 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
-import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-@RunWith( ArchivaBlockJUnit4ClassRunner.class )
+@RunWith(ArchivaBlockJUnit4ClassRunner.class)
public class AuditManagerTest
extends TestCase
{
private DefaultAuditManager auditManager;
- private MockControl metadataRepositoryControl;
+ private IMocksControl metadataRepositoryControl;
private MetadataRepository metadataRepository;
@@ -82,14 +83,14 @@ public class AuditManagerTest
auditManager = new DefaultAuditManager();
- metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
- metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
+ metadataRepositoryControl = EasyMock.createControl();
+ metadataRepository = metadataRepositoryControl.createMock( MetadataRepository.class );
ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
repository.setId( TEST_REPO_ID );
repository.setLocation( "" );
}
-
+
@Test
public void testGetMostRecentEvents()
throws Exception
@@ -102,20 +103,25 @@ public class AuditManagerTest
expectedEvents.add( event );
}
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- getEventNames( expectedEvents ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // getEventNames( expectedEvents ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ getEventNames( expectedEvents ) );
for ( AuditEvent event : expectedEvents.subList( 1, expectedEvents.size() ) )
{
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- event.getName() ), event );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // event.getName() ), event );
+ EasyMock.expect(
+ metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
+ event );
}
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getMostRecentAuditEvents( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ) );
+ List<AuditEvent> events =
+ auditManager.getMostRecentAuditEvents( metadataRepository, Collections.singletonList( TEST_REPO_ID ) );
assertNotNull( events );
assertEquals( numEvents - 1, events.size() );
int expectedTimestampCounter = numEvents - 1;
@@ -140,20 +146,24 @@ public class AuditManagerTest
expectedEvents.add( createEvent( AUDIT_EVENT_BASE + MILLIS_FORMAT.format( i ) ) );
}
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- getEventNames( expectedEvents ) );
-
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // getEventNames( expectedEvents ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ getEventNames( expectedEvents ) );
for ( AuditEvent event : expectedEvents )
{
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- event.getName() ), event );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // event.getName() ), event );
+ EasyMock.expect(
+ metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
+ event );
}
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getMostRecentAuditEvents( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ) );
+ List<AuditEvent> events =
+ auditManager.getMostRecentAuditEvents( metadataRepository, Collections.singletonList( TEST_REPO_ID ) );
assertNotNull( events );
assertEquals( numEvents, events.size() );
int expectedTimestampCounter = numEvents - 1;
@@ -185,23 +195,29 @@ public class AuditManagerTest
eventNames.get( repositoryId ).add( event.getName() );
}
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- eventNames.get( TEST_REPO_ID ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID_2,
- AuditEvent.FACET_ID ),
- eventNames.get( TEST_REPO_ID_2 ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // eventNames.get( TEST_REPO_ID ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ eventNames.get( TEST_REPO_ID ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID_2,
+ // AuditEvent.FACET_ID ),
+ // eventNames.get( TEST_REPO_ID_2 ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID_2, AuditEvent.FACET_ID ) ).andReturn(
+ eventNames.get( TEST_REPO_ID_2 ) );
for ( AuditEvent event : events.subList( 1, events.size() ) )
{
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( event.getRepositoryId(),
- AuditEvent.FACET_ID,
- event.getName() ), event );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( event.getRepositoryId(),
+ // AuditEvent.FACET_ID,
+ // event.getName() ), event );
+ EasyMock.expect( metadataRepository.getMetadataFacet( event.getRepositoryId(), AuditEvent.FACET_ID,
+ event.getName() ) ).andReturn( event );
}
metadataRepositoryControl.replay();
- events = auditManager.getMostRecentAuditEvents( metadataRepository, Arrays.asList( TEST_REPO_ID,
- TEST_REPO_ID_2 ) );
+ events =
+ auditManager.getMostRecentAuditEvents( metadataRepository, Arrays.asList( TEST_REPO_ID, TEST_REPO_ID_2 ) );
assertNotNull( events );
assertEquals( numEvents - 1, events.size() );
int expectedTimestampCounter = numEvents - 1;
@@ -221,13 +237,15 @@ public class AuditManagerTest
throws Exception
{
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Collections.emptyList() );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // Collections.emptyList() );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ Collections.<String>emptyList() );
metadataRepositoryControl.replay();
- assertTrue( auditManager.getMostRecentAuditEvents( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ) ).isEmpty() );
+ assertTrue( auditManager.getMostRecentAuditEvents( metadataRepository,
+ Collections.singletonList( TEST_REPO_ID ) ).isEmpty() );
metadataRepositoryControl.verify();
}
@@ -290,21 +308,27 @@ public class AuditManagerTest
AuditEvent expectedEvent = createEvent( expectedTimestamp );
AuditEvent event3 = createEvent( new Date( current.getTime() - 1000 ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( event1.getName(), expectedEvent.getName(),
- event3.getName() ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // Arrays.asList( event1.getName(), expectedEvent.getName(),
+ // event3.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ Arrays.asList( event1.getName(), expectedEvent.getName(), event3.getName() ) );
// only match the middle one
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent.getName() ),
- expectedEvent );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent.getName() ),
+ // expectedEvent );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent.getName() ) ).andReturn( expectedEvent );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ), new Date( current.getTime() - 4000 ), new Date( current.getTime() - 2000 ) );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList( TEST_REPO_ID ),
+ new Date( current.getTime() - 4000 ),
+ new Date( current.getTime() - 2000 ) );
assertEquals( 1, events.size() );
assertTestEvent( events.get( 0 ), TIMESTAMP_FORMAT.format( expectedTimestamp ), expectedEvent.getResource() );
@@ -324,24 +348,30 @@ public class AuditManagerTest
Date ts3 = new Date( current.getTime() - 1000 );
AuditEvent expectedEvent3 = createEvent( ts3 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( event1.getName(), expectedEvent2.getName(),
- expectedEvent3.getName() ) );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent2.getName() ),
- expectedEvent2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent3.getName() ),
- expectedEvent3 );
-
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // Arrays.asList( event1.getName(), expectedEvent2.getName(),
+ // expectedEvent3.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ Arrays.asList( event1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
+
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent2.getName() ),
+ // expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent3.getName() ),
+ // expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ), new Date( current.getTime() - 4000 ), current );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList( TEST_REPO_ID ),
+ new Date( current.getTime() - 4000 ), current );
assertEquals( 2, events.size() );
assertTestEvent( events.get( 0 ), TIMESTAMP_FORMAT.format( ts3 ), expectedEvent3.getResource() );
@@ -362,24 +392,31 @@ public class AuditManagerTest
AuditEvent expectedEvent2 = createEvent( expectedTimestamp );
AuditEvent event3 = createEvent( new Date( current.getTime() - 1000 ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
- event3.getName() ) );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent1.getName() ),
- expectedEvent1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent2.getName() ),
- expectedEvent2 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
+ // event3.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), event3.getName() ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent1.getName() ),
+ // expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent2.getName() ),
+ // expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ), new Date( current.getTime() - 20000 ), new Date( current.getTime() - 2000 ) );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList( TEST_REPO_ID ),
+ new Date( current.getTime() - 20000 ),
+ new Date( current.getTime() - 2000 ) );
assertEquals( 2, events.size() );
assertTestEvent( events.get( 0 ), TIMESTAMP_FORMAT.format( expectedTimestamp ), expectedEvent2.getResource() );
@@ -401,28 +438,35 @@ public class AuditManagerTest
Date ts3 = new Date( current.getTime() - 1000 );
AuditEvent expectedEvent3 = createEvent( ts3 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
- expectedEvent3.getName() ) );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent1.getName() ),
- expectedEvent1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent2.getName() ),
- expectedEvent2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent3.getName() ),
- expectedEvent3 );
-
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
+ // expectedEvent3.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent1.getName() ),
+ // expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent2.getName() ),
+ // expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent3.getName() ),
+ // expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ), new Date( current.getTime() - 20000 ), current );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList( TEST_REPO_ID ),
+ new Date( current.getTime() - 20000 ), current );
assertEquals( 3, events.size() );
assertTestEvent( events.get( 0 ), TIMESTAMP_FORMAT.format( ts3 ), expectedEvent3.getResource() );
@@ -446,28 +490,36 @@ public class AuditManagerTest
Date ts3 = new Date( current.getTime() - 1000 );
AuditEvent expectedEvent3 = createEvent( ts3 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
- expectedEvent3.getName() ) );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent1.getName() ),
- expectedEvent1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent2.getName() ),
- expectedEvent2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent3.getName() ),
- expectedEvent3 );
-
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
+ // expectedEvent3.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
+
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent1.getName() ),
+ // expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent2.getName() ),
+ // expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // AuditEvent.FACET_ID,
+ // expectedEvent3.getName() ),
+ // expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
+ expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ), TEST_RESOURCE_BASE, new Date( current.getTime() - 20000 ), current );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList( TEST_REPO_ID ),
+ TEST_RESOURCE_BASE, new Date( current.getTime() - 20000 ), current );
assertEquals( 2, events.size() );
assertTestEvent( events.get( 0 ), TIMESTAMP_FORMAT.format( ts3 ), expectedEvent3.getResource() );
@@ -488,28 +540,31 @@ public class AuditManagerTest
expectedEvent2.setResource( "different-resource" );
AuditEvent expectedEvent3 = createEvent( new Date( current.getTime() - 1000 ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
- expectedEvent3.getName() ) );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent1.getName() ),
- expectedEvent1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent2.getName() ),
- expectedEvent2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent3.getName() ),
- expectedEvent3 );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // AuditEvent.FACET_ID ),
+ // Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(),
+ // expectedEvent3.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) ).andReturn(
+ Arrays.asList( expectedEvent1.getName(), expectedEvent2.getName(), expectedEvent3.getName() ) );
+
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ),
+ // expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ) ).andReturn( expectedEvent1 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent2.getName() ),
+ // expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent2.getName() ) ).andReturn( expectedEvent2 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ),
+ // expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ) ).andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ), "foo", new Date( current.getTime() - 20000 ), current );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList( TEST_REPO_ID ), "foo",
+ new Date( current.getTime() - 20000 ), current );
assertEquals( 0, events.size() );
@@ -530,32 +585,38 @@ public class AuditManagerTest
Date ts3 = new Date( current.getTime() - 1000 );
AuditEvent expectedEvent3 = createEvent( ts3 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( expectedEvent1.getName(),
- expectedEvent3.getName() ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID_2,
- AuditEvent.FACET_ID ),
- Arrays.asList( expectedEvent2.getName() ) );
-
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent1.getName() ),
- expectedEvent1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID_2,
- AuditEvent.FACET_ID,
- expectedEvent2.getName() ),
- expectedEvent2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- AuditEvent.FACET_ID,
- expectedEvent3.getName() ),
- expectedEvent3 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ),
+ // Arrays.asList( expectedEvent1.getName(), expectedEvent3.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) )
+ .andReturn( Arrays.asList( expectedEvent1.getName(), expectedEvent3.getName() ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID_2, AuditEvent.FACET_ID ),
+ // Arrays.asList( expectedEvent2.getName() ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID_2, AuditEvent.FACET_ID ) )
+ .andReturn( Arrays.asList( expectedEvent2.getName() ) );
+
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ),
+ // expectedEvent1 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent1.getName() ) )
+ .andReturn( expectedEvent1 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID_2, AuditEvent.FACET_ID, expectedEvent2.getName() ),
+ // expectedEvent2 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID_2, AuditEvent.FACET_ID, expectedEvent2.getName() ) )
+ .andReturn( expectedEvent2 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ),
+ // expectedEvent3 );
+ EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, expectedEvent3.getName() ) )
+ .andReturn( expectedEvent3 );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Arrays.asList( TEST_REPO_ID,
- TEST_REPO_ID_2 ),
- new Date( current.getTime() - 20000 ), current );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Arrays.asList( TEST_REPO_ID, TEST_REPO_ID_2 ),
+ new Date( current.getTime() - 20000 ), current );
assertEquals( 3, events.size() );
assertTestEvent( events.get( 0 ), TEST_REPO_ID, TIMESTAMP_FORMAT.format( ts3 ), expectedEvent3.getResource() );
@@ -577,14 +638,18 @@ public class AuditManagerTest
String name2 = createEvent( expectedTimestamp ).getName();
String name3 = createEvent( new Date( current.getTime() - 1000 ) ).getName();
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- AuditEvent.FACET_ID ),
- Arrays.asList( name1, name2, name3 ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ),
+ // Arrays.asList( name1, name2, name3 ) );
+ EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) )
+ .andReturn( Arrays.asList( name1, name2, name3 ) );
metadataRepositoryControl.replay();
- List<AuditEvent> events = auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList(
- TEST_REPO_ID ), new Date( current.getTime() - 20000 ), new Date( current.getTime() - 16000 ) );
+ List<AuditEvent> events =
+ auditManager.getAuditEventsInRange( metadataRepository, Collections.singletonList( TEST_REPO_ID ),
+ new Date( current.getTime() - 20000 ),
+ new Date( current.getTime() - 16000 ) );
assertEquals( 0, events.size() );
@@ -605,9 +670,8 @@ public class AuditManagerTest
private static AuditEvent createEvent( String ts )
throws ParseException
{
- return createEvent( TEST_REPO_ID, ts, getDefaultTestResourceName( ts.substring( AUDIT_EVENT_BASE.length(),
- AUDIT_EVENT_BASE.length() +
- 3 ) ) );
+ return createEvent( TEST_REPO_ID, ts, getDefaultTestResourceName(
+ ts.substring( AUDIT_EVENT_BASE.length(), AUDIT_EVENT_BASE.length() + 3 ) ) );
}
private static AuditEvent createEvent( String repositoryId, String timestamp, String resource )
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java
index db6285207..c953e9512 100755
--- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java
+++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java
@@ -25,12 +25,14 @@ import org.apache.archiva.configuration.ConfigurationListener;
import org.apache.archiva.redback.components.registry.Registry;
import org.apache.archiva.redback.components.registry.RegistryException;
import org.apache.archiva.redback.components.registry.RegistryListener;
-import org.easymock.MockControl;
+import org.easymock.IMocksControl;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.Set;
+import static org.easymock.EasyMock.createNiceControl;
+
/**
* MockConfiguration
*
@@ -46,14 +48,14 @@ public class MockConfiguration
private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>();
private Set<ConfigurationListener> configListeners = new HashSet<ConfigurationListener>();
- private MockControl registryControl;
+ private IMocksControl registryControl;
private Registry registryMock;
public MockConfiguration()
{
- registryControl = MockControl.createNiceControl( Registry.class );
- registryMock = (Registry) registryControl.getMock();
+ registryControl = createNiceControl();
+ registryMock = registryControl.createMock( Registry.class );
}
public void addChangeListener( RegistryListener listener )
diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
index 8c39e402b..61ced3a38 100644
--- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
+++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
@@ -23,8 +23,16 @@ import junit.framework.TestCase;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.maven2.MavenArtifactFacet;
import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.easymock.MockControl;
+import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.easymock.IMocksControl;
+
+import static org.easymock.EasyMock.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import javax.jcr.Session;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,11 +42,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
-import javax.jcr.Session;
-import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryStatisticsManagerTest
@@ -48,7 +51,7 @@ public class RepositoryStatisticsManagerTest
private static final String TEST_REPO_ID = "test-repo";
- private MockControl metadataRepositoryControl;
+ private IMocksControl metadataRepositoryControl;
private MetadataRepository metadataRepository;
@@ -76,8 +79,8 @@ public class RepositoryStatisticsManagerTest
repositoryStatisticsManager = new DefaultRepositoryStatisticsManager();
- metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
- metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
+ metadataRepositoryControl = createControl();
+ metadataRepository = metadataRepositoryControl.createMock( MetadataRepository.class );
}
@Test
@@ -97,12 +100,17 @@ public class RepositoryStatisticsManagerTest
stats.setTotalGroupCount( 529 );
stats.setTotalFileCount( 56229 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- SECOND_TEST_SCAN ), stats );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
+ // RepositoryStatistics.FACET_ID ),
+ // Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn(
+ Arrays.asList( FIRST_TEST_SCAN, SECOND_TEST_SCAN ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
+ // RepositoryStatistics.FACET_ID,
+ // SECOND_TEST_SCAN ), stats );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID,
+ SECOND_TEST_SCAN ) ).andReturn( stats );
+
metadataRepositoryControl.replay();
stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
@@ -124,9 +132,11 @@ public class RepositoryStatisticsManagerTest
public void testGetLatestStatsWhenEmpty()
throws Exception
{
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- Collections.emptyList() );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
+ // Collections.emptyList() );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn(
+ Collections.<String>emptyList() );
metadataRepositoryControl.replay();
RepositoryStatistics stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, TEST_REPO_ID );
@@ -147,13 +157,18 @@ public class RepositoryStatisticsManagerTest
walkRepository( 1 );
metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- Arrays.asList( stats.getName() ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- stats.getName() ), stats );
- metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
+ // Arrays.asList( stats.getName() ) );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn(
+ Arrays.asList( stats.getName() ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats.getName() ),
+ // stats );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID,
+ stats.getName() ) ).andReturn( stats );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false );
+ expect( metadataRepository.canObtainAccess( Session.class ) ).andReturn( false );
metadataRepositoryControl.replay();
@@ -190,20 +205,25 @@ public class RepositoryStatisticsManagerTest
RepositoryStatistics stats2 = createTestStats( startTime2, current );
metadataRepository.addMetadataFacet( TEST_REPO_ID, stats2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- Arrays.asList( stats1.getName(), stats2.getName() ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- stats2.getName() ), stats2 );
-
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
+ // Arrays.asList( stats1.getName(), stats2.getName() ) );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn(
+ Arrays.asList( stats1.getName(), stats2.getName() ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, stats2.getName() ),
+ // stats2 );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID,
+ stats2.getName() ) ).andReturn( stats2 );
metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- Collections.emptyList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 2 );
-
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
+ // Collections.emptyList() );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn(
+ Collections.<String>emptyList() );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 2 );
+ expect( metadataRepository.canObtainAccess( Session.class ) ).andReturn( false ).times( 2 );
metadataRepositoryControl.replay();
repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, TEST_REPO_ID, startTime1,
@@ -224,9 +244,11 @@ public class RepositoryStatisticsManagerTest
public void testDeleteStatsWhenEmpty()
throws Exception
{
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- Collections.emptyList(), 2 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ),
+ // Collections.emptyList(), 2 );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn(
+ Collections.<String>emptyList() ).times( 2 );
metadataRepository.removeMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID );
metadataRepositoryControl.replay();
@@ -253,17 +275,20 @@ public class RepositoryStatisticsManagerTest
addStats( new Date( current.getTime() - 1000 ), current );
ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- keys );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys );
// only match the middle one
String key = keys.get( 1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
+
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ expect( metadataRepository.canObtainAccess( Session.class ) ).andReturn( false ).times( 3 );
metadataRepositoryControl.replay();
@@ -274,9 +299,10 @@ public class RepositoryStatisticsManagerTest
45 );
}
- List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
- TEST_REPO_ID, new Date(
- current.getTime() - 4000 ), new Date( current.getTime() - 2000 ) );
+ List<RepositoryStatistics> list =
+ repositoryStatisticsManager.getStatisticsInRange( metadataRepository, TEST_REPO_ID,
+ new Date( current.getTime() - 4000 ),
+ new Date( current.getTime() - 2000 ) );
assertEquals( 1, list.size() );
assertEquals( new Date( current.getTime() - 3000 ), list.get( 0 ).getScanStartTime() );
@@ -296,22 +322,27 @@ public class RepositoryStatisticsManagerTest
addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
addStats( new Date( current.getTime() - 1000 ), current );
- ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- keys );
+ List<String> keys = new ArrayList<String>( statsCreated.keySet() );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys );
String key = keys.get( 1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
+
key = keys.get( 2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
+
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ expect( metadataRepository.canObtainAccess( Session.class ) ).andReturn( false ).times( 3 );
metadataRepositoryControl.replay();
@@ -322,9 +353,9 @@ public class RepositoryStatisticsManagerTest
45 );
}
- List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
- TEST_REPO_ID, new Date(
- current.getTime() - 4000 ), current );
+ List<RepositoryStatistics> list =
+ repositoryStatisticsManager.getStatisticsInRange( metadataRepository, TEST_REPO_ID,
+ new Date( current.getTime() - 4000 ), current );
assertEquals( 2, list.size() );
assertEquals( new Date( current.getTime() - 3000 ), list.get( 1 ).getScanStartTime() );
@@ -345,22 +376,25 @@ public class RepositoryStatisticsManagerTest
addStats( new Date( current.getTime() - 3000 ), new Date( current.getTime() - 2000 ) );
addStats( new Date( current.getTime() - 1000 ), current );
- ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- keys );
+ List<String> keys = new ArrayList<String>( statsCreated.keySet() );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys );
String key = keys.get( 0 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
key = keys.get( 1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ expect( metadataRepository.canObtainAccess( Session.class ) ).andReturn( false ).times( 3 );
metadataRepositoryControl.replay();
@@ -371,9 +405,10 @@ public class RepositoryStatisticsManagerTest
45 );
}
- List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
- TEST_REPO_ID, new Date(
- current.getTime() - 20000 ), new Date( current.getTime() - 2000 ) );
+ List<RepositoryStatistics> list =
+ repositoryStatisticsManager.getStatisticsInRange( metadataRepository, TEST_REPO_ID,
+ new Date( current.getTime() - 20000 ),
+ new Date( current.getTime() - 2000 ) );
assertEquals( 2, list.size() );
assertEquals( new Date( current.getTime() - 12345 ), list.get( 1 ).getScanStartTime() );
@@ -395,26 +430,30 @@ public class RepositoryStatisticsManagerTest
addStats( new Date( current.getTime() - 1000 ), current );
ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- keys );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys );
String key = keys.get( 0 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
key = keys.get( 1 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
key = keys.get( 2 );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID,
- key ), statsCreated.get(
- key ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ),
+ // statsCreated.get( key ) );
+ expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, RepositoryStatistics.FACET_ID, key ) ).andReturn(
+ statsCreated.get( key ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ expect( metadataRepository.canObtainAccess( Session.class ) ).andReturn( false ).times( 3 );
metadataRepositoryControl.replay();
@@ -425,9 +464,9 @@ public class RepositoryStatisticsManagerTest
45 );
}
- List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
- TEST_REPO_ID, new Date(
- current.getTime() - 20000 ), current );
+ List<RepositoryStatistics> list =
+ repositoryStatisticsManager.getStatisticsInRange( metadataRepository, TEST_REPO_ID,
+ new Date( current.getTime() - 20000 ), current );
assertEquals( 3, list.size() );
assertEquals( new Date( current.getTime() - 12345 ), list.get( 2 ).getScanStartTime() );
@@ -450,10 +489,11 @@ public class RepositoryStatisticsManagerTest
addStats( new Date( current.getTime() - 1000 ), current );
ArrayList<String> keys = new ArrayList<String>( statsCreated.keySet() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( TEST_REPO_ID,
- RepositoryStatistics.FACET_ID ),
- keys );
- metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ), keys );
+ expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, RepositoryStatistics.FACET_ID ) ).andReturn( keys );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.canObtainAccess( Session.class ), false, 3 );
+ expect( metadataRepository.canObtainAccess( Session.class ) ).andReturn( false ).times( 3 );
metadataRepositoryControl.replay();
@@ -464,9 +504,10 @@ public class RepositoryStatisticsManagerTest
45 );
}
- List<RepositoryStatistics> list = repositoryStatisticsManager.getStatisticsInRange( metadataRepository,
- TEST_REPO_ID, new Date(
- current.getTime() - 20000 ), new Date( current.getTime() - 16000 ) );
+ List<RepositoryStatistics> list =
+ repositoryStatisticsManager.getStatisticsInRange( metadataRepository, TEST_REPO_ID,
+ new Date( current.getTime() - 20000 ),
+ new Date( current.getTime() - 16000 ) );
assertEquals( 0, list.size() );
@@ -521,134 +562,167 @@ public class RepositoryStatisticsManagerTest
{
for ( int i = 0; i < count; i++ )
{
- metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
- Arrays.asList( "com", "org" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
- Arrays.asList( "example" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
- Arrays.asList( "example-project" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
- "com.example",
- "example-project" ),
- Arrays.asList( "1.0", "1.1" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
- "example-project", "1.0" ),
- Arrays.asList( createArtifact( "com.example", "example-project",
- "1.0", "jar" ), createArtifact(
- "com.example", "example-project", "1.0", "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID, "com.example",
- "example-project", "1.1" ),
- Arrays.asList( createArtifact( "com.example", "example-project",
- "1.1", "jar" ), createArtifact(
- "com.example", "example-project", "1.1", "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
- Arrays.asList( "apache", "codehaus" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
- Arrays.asList( "archiva", "maven" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
- "org.apache.archiva" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
- "org.apache.archiva" ),
- Arrays.asList( "metadata-repository-api", "metadata-model" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
- "org.apache.archiva",
- "metadata-repository-api" ),
- Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.apache.archiva",
- "metadata-repository-api",
- "1.3-SNAPSHOT" ), Arrays.asList(
- createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
- createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.apache.archiva",
- "metadata-repository-api",
- "1.3" ), Arrays.asList(
- createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ), createArtifact(
- "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
- "org.apache.archiva",
- "metadata-model" ),
- Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.apache.archiva",
- "metadata-model",
- "1.3-SNAPSHOT" ), Arrays.asList(
- createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ), createArtifact(
- "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.apache.archiva",
- "metadata-model", "1.3" ),
- Arrays.asList( createArtifact( "org.apache.archiva",
- "metadata-model", "1.3", "jar" ),
- createArtifact( "org.apache.archiva",
- "metadata-model", "1.3",
- "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
- "org.apache.maven" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
- "org.apache.maven" ),
- Arrays.asList( "maven-model" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
- "org.apache.maven",
- "maven-model" ),
- Arrays.asList( "2.2.1" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.apache.maven",
- "maven-model", "2.2.1" ),
- Arrays.asList( createArtifact( "org.apache.archiva",
- "maven-model", "2.2.1", "jar" ),
- createArtifact( "org.apache.archiva",
- "maven-model", "2.2.1",
- "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
- Arrays.asList( "plexus" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID,
- "org.codehaus.plexus" ),
- Arrays.asList() );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID,
- "org.codehaus.plexus" ),
- Arrays.asList( "plexus-spring" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO_ID,
- "org.codehaus.plexus",
- "plexus-spring" ),
- Arrays.asList( "1.0", "1.1", "1.2" ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.codehaus.plexus",
- "plexus-spring", "1.0" ),
- Arrays.asList( createArtifact( "org.codehaus.plexus",
- "plexus-spring", "1.0", "jar" ),
- createArtifact( "org.codehaus.plexus",
- "plexus-spring", "1.0",
- "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.codehaus.plexus",
- "plexus-spring", "1.1" ),
- Arrays.asList( createArtifact( "org.codehaus.plexus",
- "plexus-spring", "1.1", "jar" ),
- createArtifact( "org.codehaus.plexus",
- "plexus-spring", "1.1",
- "pom" ) ) );
- metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO_ID,
- "org.codehaus.plexus",
- "plexus-spring", "1.2" ),
- Arrays.asList( createArtifact( "org.codehaus.plexus",
- "plexus-spring", "1.2", "jar" ),
- createArtifact( "org.codehaus.plexus",
- "plexus-spring", "1.2",
- "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getRootNamespaces( TEST_REPO_ID ),
+ // Arrays.asList( "com", "org" ) );
+ expect( metadataRepository.getRootNamespaces( TEST_REPO_ID ) ).andReturn( Arrays.asList( "com", "org" ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com" ),
+ // Arrays.asList() );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "com" ) ).andReturn( Arrays.<String>asList() );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ),
+ // Arrays.asList( "example" ) );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "com" ) ).andReturn( Arrays.asList( "example" ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ),
+ // Arrays.asList() );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "com.example" ) ).andReturn(
+ Arrays.<String>asList() );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ),
+ // Arrays.asList( "example-project" ) );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "com.example" ) ).andReturn(
+ Arrays.asList( "example-project" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjectVersions( TEST_REPO_ID, "com.example", "example-project" ),
+ // Arrays.asList( "1.0", "1.1" ) );
+ expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "com.example", "example-project" ) ).andReturn(
+ Arrays.asList( "1.0", "1.1" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.0" ),
+ // Arrays.asList( createArtifact( "com.example", "example-project", "1.0", "jar" ),
+ // createArtifact( "com.example", "example-project", "1.0", "pom" ) ) );
+ expect(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.0" ) ).andReturn(
+ Arrays.asList( createArtifact( "com.example", "example-project", "1.0", "jar" ),
+ createArtifact( "com.example", "example-project", "1.0", "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.1" ),
+ // Arrays.asList( createArtifact( "com.example", "example-project", "1.1", "jar" ),
+ // createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
+ expect(
+ metadataRepository.getArtifacts( TEST_REPO_ID, "com.example", "example-project", "1.1" ) ).andReturn(
+ Arrays.asList( createArtifact( "com.example", "example-project", "1.1", "jar" ),
+ createArtifact( "com.example", "example-project", "1.1", "pom" ) ) );
+
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ),
+ // Arrays.asList( "apache", "codehaus" ) );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org" ) ).andReturn( Arrays.asList( "apache", "codehaus" ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ),
+ // Arrays.asList( "archiva", "maven" ) );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.asList( "archiva", "maven" ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ),
+ // Arrays.asList() );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "org.apache" ) ).andReturn( Arrays.<String>asList() );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.archiva" ), Arrays.asList() );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.<String>asList() );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjects( TEST_REPO_ID, "org.apache.archiva" ),
+ /// Arrays.asList( "metadata-repository-api", "metadata-model" ) );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "org.apache.archiva" ) ).andReturn( Arrays.asList( "metadata-repository-api", "metadata-model" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ),
+ // Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
+ expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api" ) )
+ .andReturn( Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api",
+ // "1.3-SNAPSHOT" ),
+ // Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
+ // createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
+ // "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3-SNAPSHOT",
+ "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ),
+ // Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
+ // createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-repository-api", "1.3" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-repository-api", "1.3", "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-model" ),
+ // Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
+ expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.archiva", "metadata-model" ) )
+ .andReturn( Arrays.asList( "1.3-SNAPSHOT", "1.3" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ),
+ // Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ),
+ // createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-model", "1.3-SNAPSHOT", "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ),
+ // Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
+ // createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.archiva", "metadata-model", "1.3" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "metadata-model", "1.3", "jar" ),
+ createArtifact( "org.apache.archiva", "metadata-model", "1.3", "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList() );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.apache.maven" ) ).andReturn( Arrays.<String>asList() );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjects( TEST_REPO_ID, "org.apache.maven" ), Arrays.asList( "maven-model" ) );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "org.apache.maven" ) )
+ .andReturn( Arrays.asList( "maven-model" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", "maven-model" ),
+ // Arrays.asList( "2.2.1" ) );
+ expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.apache.maven", "maven-model" ) )
+ .andReturn( Arrays.asList( "2.2.1" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ),
+ // Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
+ // createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.apache.maven", "maven-model", "2.2.1" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "jar" ),
+ createArtifact( "org.apache.archiva", "maven-model", "2.2.1", "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ),
+ // Arrays.asList( "plexus" ) );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus" ) ).andReturn( Arrays.asList( "plexus" ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org" ),
+ // Arrays.asList() );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "org" ) ).andReturn( Arrays.<String>asList( ) );
+ //metadataRepositoryControl.expectAndReturn( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ),
+ // Arrays.asList() );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus" ) )
+ .andReturn( Arrays.<String>asList( ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus.plexus" ), Arrays.asList() );
+ expect( metadataRepository.getNamespaces( TEST_REPO_ID, "org.codehaus.plexus" ) )
+ .andReturn( Arrays.<String>asList( ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus.plexus" ),
+ // Arrays.asList( "plexus-spring" ) );
+ expect( metadataRepository.getProjects( TEST_REPO_ID, "org.codehaus.plexus" ) )
+ .andReturn( Arrays.asList( "plexus-spring" ) );
+
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getProjectVersions( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ),
+ // Arrays.asList( "1.0", "1.1", "1.2" ) );
+ expect( metadataRepository.getProjectVersions( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring" ) )
+ .andReturn( Arrays.asList( "1.0", "1.1", "1.2" ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ),
+ // Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "jar" ),
+ // createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.0" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "jar" ),
+ createArtifact( "org.codehaus.plexus", "plexus-spring", "1.0", "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ),
+ // Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "jar" ),
+ // createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.1" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "jar" ),
+ createArtifact( "org.codehaus.plexus", "plexus-spring", "1.1", "pom" ) ) );
+ //metadataRepositoryControl.expectAndReturn(
+ // metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ),
+ // Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "jar" ),
+ // createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "pom" ) ) );
+ expect( metadataRepository.getArtifacts( TEST_REPO_ID, "org.codehaus.plexus", "plexus-spring", "1.2" ) )
+ .andReturn( Arrays.asList( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "jar" ),
+ createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2", "pom" ) ) );
}
}
}