/**
* Test the configuration store.
*/
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@RunWith(ArchivaSpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
public class ArchivaConfigurationTest
{
{
ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-defaults" );
Configuration configuration = archivaConfiguration.getConfiguration();
-
+
assertConfiguration( configuration, 2, 1, 1 );
assertEquals( "check network proxies", 0, configuration.getNetworkProxies().size() );
assertEquals( "check managed repositories", "default", repository.getLayout() );
assertTrue( "check managed repositories", repository.isScanned() );
}
-
+
@Test
public void testGetConfigurationFromRegistryWithASingleNamedConfigurationResource()
throws Exception
configuration.getWebapp().getUi().setAppletFindEnabled( false );
// add a change listener
- //MockControl control = createConfigurationListenerMockControl();
- ConfigurationListener listener = createMock( ConfigurationListener.class );// (ConfigurationListener) control.getMock();
+ ConfigurationListener listener = createMock( ConfigurationListener.class );
archivaConfiguration.addListener( listener );
listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
- //control.setVoidCallable();
-
- //control.replay();
replay( listener );
archivaConfiguration.save( configuration );
- //control.verify();
verify( listener );
assertTrue( "Check file exists", file.exists() );
assertFalse( userFile.exists() );
userFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName("UTF-8") );
+ FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName( "UTF-8" ) );
ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
configuration.getWebapp().getUi().setAppletFindEnabled( false );
// add a change listener
- //MockControl control = createConfigurationListenerMockControl();
- //ConfigurationListener listener = (ConfigurationListener) control.getMock();
ConfigurationListener listener = createConfigurationListenerMockControl();
archivaConfiguration.addListener( listener );
listener.configurationEvent( new ConfigurationEvent( ConfigurationEvent.SAVED ) );
- //control.setVoidCallable( 1 );
-
- //control.replay();
-
replay( listener );
archivaConfiguration.save( configuration );
- //control.verify();
-
verify( listener );
assertTrue( "Check file exists", userFile.exists() );
assertFalse( userFile.exists() );
baseFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( baseFile, "<configuration/>", Charset.forName("UTF-8") );
+ FileUtils.writeStringToFile( baseFile, "<configuration/>", Charset.forName( "UTF-8" ) );
ArchivaConfiguration archivaConfiguration =
(ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user-fallback" );
assertFalse( userFile.exists() );
baseFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( baseFile, "<configuration/>", Charset.forName("UTF-8") );
+ FileUtils.writeStringToFile( baseFile, "<configuration/>", Charset.forName( "UTF-8" ) );
userFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName("UTF-8") );
+ FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName( "UTF-8" ) );
- ArchivaConfiguration archivaConfiguration =
- (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user" );
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
archivaConfiguration.reload();
assertTrue( "Check file exists", baseFile.exists() );
assertEquals( "Check base file is unchanged", "<configuration/>",
- FileUtils.readFileToString( baseFile, Charset.forName("UTF-8") ) );
+ FileUtils.readFileToString( baseFile, Charset.forName( "UTF-8" ) ) );
assertTrue( "Check file exists", userFile.exists() );
assertFalse( "Check base file is changed",
- "<configuration/>".equals( FileUtils.readFileToString( userFile, Charset.forName("UTF-8") ) ) );
+ "<configuration/>".equals( FileUtils.readFileToString( userFile, Charset.forName( "UTF-8" ) ) ) );
// check it
configuration = archivaConfiguration.getConfiguration();
FileUtils.copyFile( getTestFile( "src/test/conf/conf-user.xml" ), userFile );
baseFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( baseFile, "<configuration/>", Charset.forName("UTF-8") );
+ FileUtils.writeStringToFile( baseFile, "<configuration/>", Charset.forName( "UTF-8" ) );
- ArchivaConfiguration archivaConfiguration =
- (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user" );
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
archivaConfiguration.reload();
assertTrue( "Check file exists", baseFile.exists() );
assertEquals( "Check base file is unchanged", "<configuration/>",
- FileUtils.readFileToString( baseFile, Charset.forName("UTF-8") ) );
+ FileUtils.readFileToString( baseFile, Charset.forName( "UTF-8" ) ) );
assertTrue( "Check file exists", userFile.exists() );
assertFalse( "Check base file is changed",
- "<configuration/>".equals( FileUtils.readFileToString( userFile, Charset.forName("UTF-8") ) ) );
+ "<configuration/>".equals( FileUtils.readFileToString( userFile, Charset.forName( "UTF-8" ) ) ) );
// check it
configuration = archivaConfiguration.getConfiguration();
FileUtils.copyFile( getTestFile( "src/test/conf/conf-base.xml" ), baseFile );
userFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName("UTF-8") );
+ FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName( "UTF-8" ) );
- ArchivaConfiguration archivaConfiguration =
- (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-save-user" );
+ ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-save-user" );
archivaConfiguration.reload();
// Save the file.
archivaConfiguration.save( configuration );
- // Release existing
- //release( archivaConfiguration );
-
// Reload.
archivaConfiguration = lookup( ArchivaConfiguration.class, "test-autodetect-v1" );
configuration = archivaConfiguration.getConfiguration();
assertEquals( "check remote repositories size.", 2, configuration.getRemoteRepositoriesAsMap().size() );
assertEquals( "check v1 repositories size.", 0, configuration.getRepositories().size() );
- String actualXML = FileUtils.readFileToString( userFile, Charset.forName("UTF-8") );
+ String actualXML = FileUtils.readFileToString( userFile, Charset.forName( "UTF-8" ) );
XMLAssert.assertXpathNotExists( "//configuration/repositories/repository", actualXML );
XMLAssert.assertXpathNotExists( "//configuration/repositories", actualXML );
}
FileUtils.copyFile( getTestFile( "src/test/conf/conf-single-list-elements.xml" ), baseFile );
userFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName("UTF-8") );
+ FileUtils.writeStringToFile( userFile, "<configuration/>", Charset.forName( "UTF-8" ) );
ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-remove-central" );
* under the License.
*/
-import java.io.File;
-import javax.inject.Inject;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
import org.junit.After;
-import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.runner.RunWith;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
+import javax.inject.Inject;
+import java.io.File;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
/**
*/
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@RunWith(ArchivaSpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
public abstract class AbstractRepositoryPurgeTest
{
public static final String TEST_REPO_ID = "test-repo";
public void setUp()
throws Exception
{
-
+
removeMavenIndexes();
- listenerControl = EasyMock.createControl( );
+ listenerControl = EasyMock.createControl();
listener = listenerControl.createMock( RepositoryListener.class );
when( repositorySession.getRepository() ).thenReturn( metadataRepository );
-
}
@After
}
}
- protected static String fixPath( String path )
+ protected static String fixPath( String path )
{
if ( path.contains( " " ) )
{
- LoggerFactory.getLogger(AbstractRepositoryPurgeTest.class.getName()).error(
- "You are building and testing with a path: \n "
- + path + " containing space. Consider relocating.");
- return path.replaceAll(" ", "&20");
+ LoggerFactory.getLogger( AbstractRepositoryPurgeTest.class.getName() ).error(
+ "You are building and testing with a path: \n " + path + " containing space. Consider relocating." );
+ return path.replaceAll( " ", "&20" );
}
return path;
}
-
+
public ManagedRepository getRepoConfiguration( String repoId, String repoName )
{
config = new ManagedRepository();
config.setId( repoId );
config.setName( repoName );
config.setDaysOlder( TEST_DAYS_OLDER );
- String path = AbstractRepositoryPurgeTest.fixPath( new File( "target/test-" + getName() + "/" + repoId ).getAbsolutePath() );
+ String path = AbstractRepositoryPurgeTest.fixPath(
+ new File( "target/test-" + getName() + "/" + repoId ).getAbsolutePath() );
config.setLocation( path );
config.setReleases( true );
config.setSnapshots( true );
removeMavenIndexes();
File testDir = new File( AbstractRepositoryPurgeTest.fixPath( getTestRepoRoot().getAbsolutePath() ) );
FileUtils.deleteDirectory( testDir );
- File sourceDir = new File ( new File( "target/test-classes/" + TEST_REPO_ID).getAbsolutePath() );
+ File sourceDir = new File( new File( "target/test-classes/" + TEST_REPO_ID ).getAbsolutePath() );
FileUtils.copyDirectory( sourceDir, testDir );
- File releasesTestDir = new File( AbstractRepositoryPurgeTest.fixPath( new File( "target/test-" + getName() + "/" + RELEASES_TEST_REPO_ID ).getAbsolutePath() ) );
-
+ File releasesTestDir = new File( AbstractRepositoryPurgeTest.fixPath(
+ new File( "target/test-" + getName() + "/" + RELEASES_TEST_REPO_ID ).getAbsolutePath() ) );
+
FileUtils.deleteDirectory( releasesTestDir );
- File sourceReleasesDir = new File ( new File( "target/test-classes/" + RELEASES_TEST_REPO_ID).getAbsolutePath() );
+ File sourceReleasesDir =
+ new File( new File( "target/test-classes/" + RELEASES_TEST_REPO_ID ).getAbsolutePath() );
FileUtils.copyDirectory( sourceReleasesDir, releasesTestDir );
return AbstractRepositoryPurgeTest.fixPath( testDir.getAbsolutePath() );
List<String> selectedRepos = Arrays.asList( TEST_REPO_1 );
// search artifactId
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
archivaConfigControl.reset();
// search groupId
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
List<String> selectedRepos = Arrays.asList( TEST_REPO_1 );
// search artifactId
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
archivaConfigControl.reset();
// search groupId
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
selectedRepos.add( TEST_REPO_1 );
// search artifactId
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
selectedRepos.add( TEST_REPO_1 );
// search artifactId
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
List<String> selectedRepos = new ArrayList<String>();
selectedRepos.add( TEST_REPO_1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
SearchResultLimits limits = new SearchResultLimits( 0 );
limits.setPageSize( 1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
limits = new SearchResultLimits( 1 );
limits.setPageSize( 1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
config.addManagedRepository( createRepositoryConfig( TEST_REPO_2 ) );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 5 );
archivaConfigControl.replay();
List<String> selectedRepos = new ArrayList<String>();
selectedRepos.add( TEST_REPO_1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
List<String> selectedRepos = new ArrayList<String>();
selectedRepos.add( TEST_REPO_1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
List<String> selectedRepos = new ArrayList<String>();
selectedRepos.add( "non-existing-repo" );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
List<String> previousSearchTerms = new ArrayList<String>();
previousSearchTerms.add( "archiva-test" );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setVersion( "1.0" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
SearchResultLimits limits = new SearchResultLimits( 0 );
limits.setPageSize( 1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
limits = new SearchResultLimits( 1 );
limits.setPageSize( 1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setArtifactId( "artifactid-numeric" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
try
{
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
try
{
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setClassName( "org.apache.archiva.test.App" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setPackaging( "jar" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setPackaging( "war" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndDefaultReturn( archivaConfig.getConfiguration(), config );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setClassName( "com.classname.search.App" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setGroupId( "org.apache.archiva" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
searchFields.setClassName( "SomeClass" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
List<String> selectedRepos = Arrays.asList( TEST_REPO_1 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 0, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 0, 2 );
archivaConfigControl.replay();
searchFields.setClassName( "SomeClass" );
searchFields.setRepositories( selectedRepos );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 2 );
archivaConfigControl.replay();
SearchResultLimits limits = new SearchResultLimits( 0 );
limits.setPageSize( 300 );
- //archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 1, 5 );
archivaConfigControl.replay();
repoConfig = managedLegacyRepository.getRepository();
- //config.getConfiguration().addManagedRepository( repoConfig );
applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
// Setup target (proxied to) repository.
saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false );
- //wagonMock.get( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new ResourceDoesNotExistException( "resource does not exist." ), 2 );
-
wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "resource does not exist." ) ).times( 2 );
saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
- //wagonMock.get( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new ResourceDoesNotExistException( "resource does not exist." ), 2 );
-
wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "resource does not exist." ) ).times( 2 );
// Second attempt to download same artifact DOES NOT use cache
wagonMockControl.reset();
-
- //wagonMock.get( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new ResourceDoesNotExistException( "resource does not exist." ), 2 );
-
wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "resource does not exist." ) ).times( 2 );
saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
- //wagonMock.get( path, new File( expectedFile.getAbsolutePath() + ".tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setVoidCallable();
wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().once();
- //wagonMock.get( path + ".sha1", new File( expectedFile.getAbsolutePath() + ".sha1.tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setVoidCallable();
wagonMock.get( EasyMock.eq( path + ".sha1" ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().once();
- //wagonMock.get( path + ".md5", new File( expectedFile.getAbsolutePath() + ".md5.tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new ResourceDoesNotExistException( "Resource does not exist." ) );
-
wagonMock.get( EasyMock.eq( path + ".md5" ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "Resource does not exist." ) ).once();
private void simulateGetError( String path, File expectedFile, Exception throwable )
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
- //wagonMock.get( path, createExpectedTempFile( expectedFile ) );
- //wagonMockControl.setMatcher(customWagonGetMatcher);
- //wagonMockControl.setThrowable( throwable, 1 );
wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().andThrow(throwable );
}
private void simulateGetIfNewerError( String path, File expectedFile, TransferFailedException exception )
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
- //wagonMock.getIfNewer( path, createExpectedTempFile( expectedFile ), expectedFile.lastModified() );
- //wagonMockControl.setMatcher(customWagonGetIfNewerMatcher);
- //wagonMockControl.setThrowable( exception, 1 );
wagonMock.getIfNewer( EasyMock.eq( path ), EasyMock.anyObject( File.class ), EasyMock.eq( expectedFile.lastModified() ));
EasyMock.expectLastCall().andThrow( exception );
}
// Configure Repository (usually done within archiva.xml configuration)
saveRemoteRepositoryConfig( "badproxied", "Bad Proxied", "test://bad.machine.com/repo/", "default" );
- //wagonMock.get( path, new File( expectedFile.getAbsolutePath() + ".tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new ResourceDoesNotExistException( "transfer failed" ) );
-
wagonMock.get( EasyMock.eq( path), EasyMock.anyObject( File.class ) );
EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "transfer failed" ) );
wagonMockControl.replay();
File tmpFile = new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" );
- //wagonMock.get( path, tmpFile );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new ResourceDoesNotExistException( "Can't find resource." ) );
wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ) );
EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "Can't find resource." ) );
- //wagonMock.get( path, tmpFile );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new ResourceDoesNotExistException( "Can't find resource." ) );
wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ) );
EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "Can't find resource." ) );
File expectedFile = new File( managedDefaultDir.getAbsoluteFile(),
metadataTools.getRepositorySpecificName( "badproxied1", requestedResource ) );
- //wagonMock.get( requestedResource, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) );
- //wagonMockControl.setMatcher( customWagonGetMatcher );
- //wagonMockControl.setThrowable( new TransferFailedException( "can't connect" ) );
wagonMock.get( EasyMock.eq( requestedResource ), EasyMock.anyObject( File.class ));
EasyMock.expectLastCall().andThrow( new TransferFailedException( "can't connect" ) );
RepositoryContentConsumers consumers = lookupRepositoryConsumers( );
KnownRepositoryContentConsumer selectedKnownConsumer = knownControl.createMock( KnownRepositoryContentConsumer.class );
- //KnownRepositoryContentConsumer unselectedKnownConsumer =
- // (KnownRepositoryContentConsumer) MockControl.createNiceControl(
- // KnownRepositoryContentConsumer.class ).getMock( );
-
KnownRepositoryContentConsumer unselectedKnownConsumer = createNiceControl().createMock( KnownRepositoryContentConsumer.class );
InvalidRepositoryContentConsumer selectedInvalidConsumer = invalidControl.createMock( InvalidRepositoryContentConsumer.class );
- //InvalidRepositoryContentConsumer unselectedInvalidConsumer =
- // (InvalidRepositoryContentConsumer) MockControl.createControl(
- // InvalidRepositoryContentConsumer.class ).getMock( );
-
InvalidRepositoryContentConsumer unselectedInvalidConsumer = createControl().createMock( InvalidRepositoryContentConsumer.class );
consumers.setApplicationContext(
expect( selectedKnownConsumer.getIncludes( ) ).andReturn( Collections.singletonList( "**/*.txt" ) );
selectedKnownConsumer.processFile( _OS( "path/to/test-file.txt" ), false );
- // knownConsumer.completeScan();
knownControl.replay( );
selectedInvalidConsumer.beginScan( repo, startTime, false );
- // invalidConsumer.completeScan();
invalidControl.replay( );
knownControl.verify( );
invalidControl.verify( );
- //verify( in );
knownControl.reset( );
invalidControl.reset( );
-
File notIncludedTestFile = new File( "target/test-repo/path/to/test-file.xml" );
selectedKnownConsumer.beginScan( repo, startTime, false );
- //selectedKnownConsumer.getExcludes( );
- //knownControl.setReturnValue( Collections.EMPTY_LIST );
expect( selectedKnownConsumer.getExcludes() ).andReturn( Collections.<String>emptyList() );
- //selectedKnownConsumer.getIncludes( );
- //knownControl.setReturnValue( Collections.singletonList( "**/*.txt" ) );
expect( selectedKnownConsumer.getIncludes( ) ).andReturn( Collections.singletonList( "**/*.txt" ) );
- // knownConsumer.completeScan();
knownControl.replay( );
selectedInvalidConsumer.beginScan( repo, startTime, false );
selectedInvalidConsumer.processFile( _OS( "path/to/test-file.xml" ), false );
expect( selectedInvalidConsumer.getId() ).andReturn( "invalid" );
- // invalidConsumer.completeScan();
invalidControl.replay( );
consumers.executeConsumers( repo, notIncludedTestFile, true );
selectedKnownConsumer.beginScan( repo, startTime, false );
expect( selectedKnownConsumer.getExcludes() ).andReturn( Collections.singletonList( "**/test-file.txt" ) );
- // knownConsumer.completeScan();
knownControl.replay( );
selectedInvalidConsumer.beginScan( repo, startTime, false );
selectedInvalidConsumer.processFile( _OS( "path/to/test-file.txt" ), false );
expect( selectedInvalidConsumer.getId() ).andReturn( "invalid" );
- // invalidConsumer.completeScan();
invalidControl.replay( );
consumers.executeConsumers( repo, excludedTestFile, true );
reqParams.put( RssFeedProcessor.KEY_GROUP_ID, GROUP_ID );
reqParams.put( RssFeedProcessor.KEY_ARTIFACT_ID, ARTIFACT_ID );
- //metadataRepositoryControl.expectAndReturn( metadataRepository.getRepositories(), Collections.singletonList(
- // TEST_REPO ) );
expect( metadataRepository.getRepositories() ).andReturn( Collections.singletonList( TEST_REPO ) );
- //metadataRepositoryControl.expectAndReturn( metadataRepository.getProjectVersions( TEST_REPO, GROUP_ID,
- // ARTIFACT_ID ), Arrays.asList(
- // "1.0.1", "1.0.2", "1.0.3-SNAPSHOT" ) );
expect( metadataRepository.getProjectVersions( TEST_REPO, GROUP_ID, ARTIFACT_ID ) ).andReturn(
Arrays.asList( "1.0.1", "1.0.2", "1.0.3-SNAPSHOT" ) );
- //metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID,
- // "1.0.1" ),
- // Collections.singletonList( artifact1 ) );
expect( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.1" ) ).andReturn(
Collections.singletonList( artifact1 ) );
- //metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID,
- // "1.0.2" ),
- // Collections.singletonList( artifact2 ) );
expect( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.2" ) ).andReturn(
Collections.singletonList( artifact2 ) );
- //metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID,
- // "1.0.3-SNAPSHOT" ),
- // Collections.singletonList( artifact3 ) );
expect( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.3-SNAPSHOT" ) ).andReturn(
Collections.singletonList( artifact3 ) );
metadataRepositoryControl.replay();
archivaConfiguration = archivaConfigurationControl.createMock( ArchivaConfiguration.class );
config = new Configuration();
- //archivaConfiguration.getConfiguration();
- //archivaConfigurationControl.setReturnValue( config, 5, 20 );
expect( archivaConfiguration.getConfiguration() ).andReturn( config ).times( 5, 20 );
archivaConfiguration.save( config );
- //archivaConfigurationControl.setVoidCallable( 1, 4 );
+
expectLastCall().times( 1, 4 );
archivaConfigurationControl.replay();
try
{
archivaConfigurationControl.reset();
- //archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
+
expect( archivaConfiguration.getConfiguration() ).andReturn( config );
- //requestControl.expectAndReturn( request.getMethod(), "GET", 2 );
+
expect( request.getMethod() ).andReturn( "GET" ).times( 2 );
- //requestControl.expectAndReturn( request.getPathInfo(), "org/apache/archiva", 0, 2 );
+
expect( request.getPathInfo() ).andReturn( "org/apache/archiva" ).times( 0, 2 );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( RELEASES_REPO ),
- // releasesRepo );
+
expect( repoFactory.getManagedRepositoryContent( RELEASES_REPO ) ).andReturn( releasesRepo );
- //requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 2 );
+
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 2 );
- //requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 2 );
+
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // false );
expect( repoRequest.isSupportFile(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( true );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ), false );
+
expect(
repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn(
false );
- //repoRequestControl.expectAndReturn(
- // repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // null );
+
expect( repoRequest.toArtifactReference(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( null );
- //repoRequestControl.expectAndReturn(
- // repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", internalRepo ),
- // new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
- // "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
+
expect( repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
internalRepo ) ).andReturn(
new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
"target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
- // internalRepo );
+
expect( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ) ).andReturn( internalRepo );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // false );
+
expect( repoRequest.isArchetypeCatalog(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false );
archivaConfigurationControl.replay();
try
{
archivaConfigurationControl.reset();
- //archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
+
expect( archivaConfiguration.getConfiguration() ).andReturn( config );
- //requestControl.expectAndReturn( request.getMethod(), "GET", 2 );
+
expect( request.getMethod() ).andReturn( "GET" ).times( 2 );
- //requestControl.expectAndReturn( request.getPathInfo(), "org/apache/archiva", 0, 2 );
+
expect( request.getPathInfo() ).andReturn( "org/apache/archiva" ).times( 0, 2 );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
- // internalRepo );
+
expect( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ) ).andReturn( internalRepo );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( RELEASES_REPO ),
- // releasesRepo );
+
expect( repoFactory.getManagedRepositoryContent( RELEASES_REPO ) ).andReturn( releasesRepo );
- //requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 2 );
+
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 2 );
- //requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 2 );
+
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // false );
+
expect( repoRequest.isSupportFile(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ), false );
+
expect(
repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn(
false );
- //repoRequestControl.expectAndReturn(
- // repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // null );
+
expect( repoRequest.toArtifactReference(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( null );
- //repoRequestControl.expectAndReturn(
- // repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", internalRepo ),
- // new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
- // "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
+
expect( repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
internalRepo ) ).andReturn(
new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
"target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // false );
+
expect( repoRequest.isArchetypeCatalog(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false );
archivaConfigurationControl.replay();
try
{
archivaConfigurationControl.reset();
- //archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
+
expect( archivaConfiguration.getConfiguration() ).andReturn( config );
- //requestControl.expectAndReturn( request.getMethod(), "GET", 4 );
+
expect( request.getMethod() ).andReturn( "GET" ).times( 4 );
- //requestControl.expectAndReturn( request.getPathInfo(), "org/apache/archiva", 0, 2 );
+
expect( request.getPathInfo() ).andReturn( "org/apache/archiva" ).times( 0, 2 );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
- // internalRepo );
+
expect( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ) ).andReturn( internalRepo );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( LOCAL_MIRROR_REPO ),
- // localMirrorRepo );
+
expect( repoFactory.getManagedRepositoryContent( LOCAL_MIRROR_REPO ) ).andReturn( localMirrorRepo );
- //requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 4 );
+
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 4 );
- //requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 4 );
+
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 4 );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ), false,
- // 2 );
+
expect( repoRequest.isSupportFile(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false ).times( 2 );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ), false, 2 );
+
expect(
repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn(
false ).times( 2 );
- //repoRequestControl.expectAndReturn(
- // repoRequest.toArtifactReference( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // null, 2 );
+
expect( repoRequest.toArtifactReference(
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( null ).times( 2 );
- //repoRequestControl.expectAndReturn(
- //repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
- // internalRepo ),
- //new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
- // "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
+
expect( repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
internalRepo ) ).andReturn(
new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
"target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
- //repoRequestControl.expectAndReturn(
- // repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar", localMirrorRepo ),
- // new File( config.findManagedRepositoryById( LOCAL_MIRROR_REPO ).getLocation(),
- // "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
+
expect( repoRequest.toNativePath( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar",
localMirrorRepo ) )
.andReturn( new File( config.findManagedRepositoryById( LOCAL_MIRROR_REPO ).getLocation(),
"target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
- //repoRequestControl.expectAndReturn(
- // repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
- // false, 2 );
+
expect( repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false ).times( 2 );
archivaConfigurationControl.replay();
requestControl.replay();
try
{
archivaConfigurationControl.reset();
- //archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
+
expect( archivaConfiguration.getConfiguration() ).andReturn( config );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
- // internalRepo );
+
expect( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ) ).andReturn( internalRepo );
- //requestControl.expectAndReturn( request.getMethod(), "GET", 3 );
+
expect( request.getMethod() ).andReturn( "GET" ).times( 3 );
- //requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 3 );
+
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 3 );
- //requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 2 );
+
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
- //requestControl.expectAndReturn( request.getRequestURI(),
- // "http://localhost:8080/archiva/repository/" + INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml" );
+
expect( request.getRequestURI() ).andReturn( "http://localhost:8080/archiva/repository/" + INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml" );
response.setHeader( "Pragma", "no-cache" );
- //responseControl.setVoidCallable();
+
expectLastCall();
response.setHeader( "Cache-Control", "no-cache" );
- //responseControl.setVoidCallable();
+
expectLastCall();
- //long date = 2039842134;
response.setDateHeader( eq("Last-Modified"), anyLong() );
- //responseControl.setVoidCallable();
expectLastCall();
archivaConfigurationControl.replay();
try
{
archivaConfigurationControl.reset();
- //archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
+
expect( archivaConfiguration.getConfiguration() ).andReturn( config );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
- // internalRepo );
+
expect( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ) ).andReturn( internalRepo );
- //requestControl.expectAndReturn( request.getMethod(), "GET", 2 );
+
expect( request.getMethod() ).andReturn( "GET" ).times( 2 );
- //requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 2 );
+
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 2 );
- //requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 2 );
+
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
archivaConfigurationControl.replay();
try
{
archivaConfigurationControl.reset();
- //archivaConfigurationControl.expectAndReturn( archivaConfiguration.getConfiguration(), config );
+
expect( archivaConfiguration.getConfiguration() ).andReturn( config );
- //repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( LEGACY_REPO ),
- // legacyRepo );
+
expect( repoFactory.getManagedRepositoryContent( LEGACY_REPO ) ).andReturn( legacyRepo );
- //requestControl.expectAndReturn( request.getMethod(), "GET", 2 );
+
expect( request.getMethod() ).andReturn( "GET" ).times( 2 );
- //requestControl.expectAndReturn( request.getRemoteAddr(), "http://localhost:8080", 2 );
+
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 2 );
- //requestControl.expectAndReturn( request.getDavSession(), new ArchivaDavSession(), 2 );
+
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
archivaConfigurationControl.replay();
sr.registerServlet( "/repository/*", RepositoryServlet.class.getName() );
sc = sr.newClient();
- servletAuthControl = EasyMock.createControl();// MockControl.createControl( ServletAuthenticator.class );
- //servletAuthControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
+ servletAuthControl = EasyMock.createControl();
+
servletAuth = servletAuthControl.createMock( ServletAuthenticator.class );
httpAuthControl = EasyMock.createControl();
- //MockClassControl.createControl( HttpBasicAuthentication.class, HttpBasicAuthentication.class.getMethods() );
- //httpAuthControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
+
httpAuth = httpAuthControl.createMock( HttpAuthenticator.class );
davSessionProvider = new ArchivaDavSessionProvider( servletAuth, httpAuth );
servlet.setDavSessionProvider( davSessionProvider );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ),
anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //servletAuthControl.expectAndThrow( servletAuth.isAuthenticated( null, null ),
- // new AuthenticationException( "Authentication error" ) );
+
servletAuth.isAuthenticated( EasyMock.anyObject( HttpServletRequest.class ),
EasyMock.anyObject( AuthenticationResult.class ) );
EasyMock.expectLastCall().andThrow( new AuthenticationException( "Authentication error" ) );
servletAuth.isAuthorized( "guest", "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD );
- //servletAuthControl.setMatcher( MockControl.EQUALS_MATCHER );
- //servletAuthControl.setThrowable( new UnauthorizedException( "'guest' has no write access to repository" ) );
+
EasyMock.expectLastCall().andThrow( new UnauthorizedException( "'guest' has no write access to repository" ) );
httpAuthControl.replay();
httpAuthControl.verify();
servletAuthControl.verify();
- // assertEquals(HttpServletResponse.SC_UNAUTHORIZED, response.getResponseCode());
+ //assertEquals(HttpServletResponse.SC_UNAUTHORIZED, response.getResponseCode());
}
// test deploy with invalid user, but guest has write access to repo
servlet.setResourceFactory( archivaDavResourceFactory );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ),
anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //servletAuthControl.expectAndThrow( servletAuth.isAuthenticated( null, null ),
- // new AuthenticationException( "Authentication error" ) );
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ),
anyObject( AuthenticationResult.class ) ) ).andThrow(
new AuthenticationException( "Authentication error" ) );
- //servletAuthControl.setMatcher( MockControl.EQUALS_MATCHER );
- //servletAuthControl.setReturnValue( true );
EasyMock.expect(servletAuth.isAuthorized( "guest", "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD )).andReturn( true );
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ),
anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
+
EasyMock.expect( httpAuth.getSecuritySession( anyObject( HttpSession.class ) ) ).andReturn( session );
- //servletAuthControl.expectAndThrow( servletAuth.isAuthenticated( null, result ),
- // new AuthenticationException( "Authentication error" ) );
+
EasyMock.expect(servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), eq(result) )).andThrow( new AuthenticationException( "Authentication error" ) );
- //httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), null );
EasyMock.expect( httpAuth.getSessionUser( anyObject( HttpSession.class ) ) ).andReturn( null );
// check if guest has write access
- //servletAuth.isAuthorized( "guest", "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD );
- //servletAuthControl.setMatcher( MockControl.EQUALS_MATCHER );
- //servletAuthControl.setReturnValue( true );
EasyMock.expect( servletAuth.isAuthorized( "guest", "internal",
ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD ) ).andReturn(
true );
servlet.setResourceFactory( archivaDavResourceFactory );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ),
anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, null ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ),
anyObject( AuthenticationResult.class ) ) ).andReturn( true );
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ),
anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
+
EasyMock.expect( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ) ).andReturn( session );
- //httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), new SimpleUser() );
+
EasyMock.expect( httpAuth.getSessionUser( ic.getRequest().getSession() ) ).andReturn( new SimpleUser() );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, result ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ),
eq( result ) ) ).andReturn( true );
- //servletAuthControl.expectAndThrow(
- // servletAuth.isAuthorized( null, session, "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD ),
- // new UnauthorizedException( "User not authorized" ) );
+
EasyMock.expect( servletAuth.isAuthorized( anyObject( HttpServletRequest.class ), eq(session), eq("internal"),
eq(ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD) ) ).andThrow(
new UnauthorizedException( "User not authorized" ) );
servlet.setResourceFactory( archivaDavResourceFactory );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ),
anyObject( HttpServletResponse.class) )).andReturn( result );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, null ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ),
anyObject( AuthenticationResult.class ) ) ).andReturn( true );
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult(anyObject( HttpServletRequest.class ),
anyObject( HttpServletResponse.class) ) ).andReturn( result );
- //httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
+
EasyMock.expect( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ) ).andReturn( session );
- //httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), user );
+
EasyMock.expect( httpAuth.getSessionUser( ic.getRequest().getSession() ) ).andReturn( user );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, result ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), eq(result) ) ).andReturn(
true );
- //servletAuthControl.expectAndReturn(
- // servletAuth.isAuthorized( null, session, "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD ),
- // true );
+
EasyMock.expect( servletAuth.isAuthorized( anyObject( HttpServletRequest.class ), eq(session), eq("internal"),
eq(ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD) ) ).andReturn(
true );
servlet.setResourceFactory( archivaDavResourceFactory );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ), anyObject( HttpServletResponse.class ) ) )
.andReturn( result );
- //servletAuthControl.expectAndThrow( servletAuth.isAuthenticated( null, null ),
- // new AuthenticationException( "Authentication error" ) );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), anyObject( AuthenticationResult.class ) ) ).andThrow(
new AuthenticationException( "Authentication error" ) );
- //servletAuthControl.expectAndReturn(
- // servletAuth.isAuthorized( "guest", "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ),
- // true );
+
EasyMock.expect( servletAuth.isAuthorized( "guest", "internal",
ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ) ).andReturn(
true );
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ), anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
+
EasyMock.expect( httpAuth.getSecuritySession( anyObject( HttpSession.class ) ) ).andReturn( session );
- //httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), null );
+
EasyMock.expect( httpAuth.getSessionUser( anyObject( HttpSession.class ) ) ).andReturn( null );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, result ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), eq(result) ) ).andReturn(
true );
- //servletAuthControl.expectAndReturn(
- // servletAuth.isAuthorized( null, session, "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD ),
- // true );
+
EasyMock.expect( servletAuth.isAuthorized( anyObject( HttpServletRequest.class ), eq(session), eq("internal"),
eq(ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS) ) ).andReturn(
true );
servlet.setDavSessionProvider( davSessionProvider );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ), anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //servletAuthControl.expectAndThrow( servletAuth.isAuthenticated( null, null ),
- // new AuthenticationException( "Authentication error" ) );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), anyObject( AuthenticationResult.class ) ) ).andThrow(
new AuthenticationException( "Authentication error" ) );
- //servletAuthControl.expectAndReturn(
- // servletAuth.isAuthorized( "guest", "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ),
- // false );
+
EasyMock.expect( servletAuth.isAuthorized( "guest", "internal",
ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ) ).andReturn(
false );
servlet.setResourceFactory( archivaDavResourceFactory );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ), anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, null ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), anyObject( AuthenticationResult.class ) ) ).andReturn( true );
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ), anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
+
EasyMock.expect( httpAuth.getSecuritySession( anyObject( HttpSession.class ) ) ).andReturn( session );
- //httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), new SimpleUser() );
+
EasyMock.expect( httpAuth.getSessionUser( anyObject( HttpSession.class ) ) ).andReturn( new SimpleUser() );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, result ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), eq(result) ) ).andReturn(
true );
- //servletAuthControl.expectAndReturn(
- // servletAuth.isAuthorized( null, session, "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD ),
- // true );
+
EasyMock.expect( servletAuth.isAuthorized( anyObject( HttpServletRequest.class ), eq(session), eq("internal"),
eq(ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS) ) ).andReturn(
true );
servlet.setResourceFactory( archivaDavResourceFactory );
AuthenticationResult result = new AuthenticationResult();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ), anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, null ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), anyObject( AuthenticationResult.class ) ) ).andReturn( true );
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
- //httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
+
EasyMock.expect( httpAuth.getAuthenticationResult( anyObject( HttpServletRequest.class ), anyObject( HttpServletResponse.class ) ) ).andReturn( result );
- //httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
+
EasyMock.expect( httpAuth.getSecuritySession( anyObject( HttpSession.class) ) ).andReturn( session );
- //httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), new SimpleUser() );
+
EasyMock.expect( httpAuth.getSessionUser( anyObject( HttpSession.class) ) ).andReturn( new SimpleUser() );
- //servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, result ), true );
+
EasyMock.expect( servletAuth.isAuthenticated( anyObject( HttpServletRequest.class ), eq(result) ) ).andReturn(
true );
- //servletAuthControl.expectAndThrow( servletAuth.isAuthorized( null, session, "internal", ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD ),
- // new UnauthorizedException( "User not authorized to read repository." ) );
+
EasyMock.expect( servletAuth.isAuthorized( anyObject( HttpServletRequest.class ), eq(session), eq("internal"),
eq(ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS) ) ).andThrow(
new UnauthorizedException( "User not authorized to read repository." ) );
expectedEvents.add( event );
}
- //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 );
EasyMock.expect(
metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
event );
expectedEvents.add( createEvent( AUDIT_EVENT_BASE + MILLIS_FORMAT.format( i ) ) );
}
- //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 );
EasyMock.expect(
metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID, event.getName() ) ).andReturn(
event );
eventNames.get( repositoryId ).add( event.getName() );
}
- //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 );
EasyMock.expect( metadataRepository.getMetadataFacet( event.getRepositoryId(), AuditEvent.FACET_ID,
event.getName() ) ).andReturn( event );
}
throws Exception
{
- //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();
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() ) );
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 );
EasyMock.expect( metadataRepository.getMetadataFacet( TEST_REPO_ID, AuditEvent.FACET_ID,
expectedEvent.getName() ) ).andReturn( expectedEvent );
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() ) );
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();
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() ) );
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 );
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() ) );
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();
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() ) );
+
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();
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() ) );
+
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();
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() ) );
+
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 );
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 ) );
EasyMock.expect( metadataRepository.getMetadataFacets( TEST_REPO_ID, AuditEvent.FACET_ID ) )
.andReturn( Arrays.asList( name1, name2, name3 ) );
stats.setTotalGroupCount( 529 );
stats.setTotalFileCount( 56229 );
- //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 );
public void testGetLatestStatsWhenEmpty()
throws Exception
{
- //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();
walkRepository( 1 );
metadataRepository.addMetadataFacet( TEST_REPO_ID, stats );
- //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();
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() ) );
+
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() );
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();
public void testDeleteStatsWhenEmpty()
throws Exception
{
- //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 );
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 );
+
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 ) );
+
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();
addStats( new Date( current.getTime() - 1000 ), current );
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 ) );
+
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 ) );
+
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();
addStats( new Date( current.getTime() - 1000 ), current );
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 ) );
+
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 ) );
+
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();
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 );
+
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 ) );
+
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 ) );
+
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 ) );
+
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();
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 );
+
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();
{
for ( int i = 0; i < count; i++ )
{
- //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" ) ) );