mirror of
https://github.com/apache/archiva.git
synced 2025-02-07 02:29:23 +00:00
implemented getAllRepositoryConsumers() and configureRepositoryConsumer() in admin service
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@703301 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
39ea612f0c
commit
a5c6bf6119
@ -19,6 +19,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.archiva.web.xmlrpc.api.AdministrationService;
|
import org.apache.archiva.web.xmlrpc.api.AdministrationService;
|
||||||
@ -26,6 +27,13 @@
|
|||||||
import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
|
import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
import org.apache.maven.archiva.configuration.Configuration;
|
||||||
|
import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration;
|
||||||
|
import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
|
||||||
|
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
||||||
|
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
|
||||||
|
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||||
|
import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
|
||||||
|
import org.codehaus.plexus.registry.RegistryException;
|
||||||
|
|
||||||
public class AdministrationServiceImpl
|
public class AdministrationServiceImpl
|
||||||
implements AdministrationService
|
implements AdministrationService
|
||||||
@ -35,21 +43,72 @@ public class AdministrationServiceImpl
|
|||||||
*/
|
*/
|
||||||
private ArchivaConfiguration archivaConfiguration;
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
|
private RepositoryContentConsumers consumerUtil;
|
||||||
|
|
||||||
public boolean configureDatabaseConsumer( String consumerId, boolean enable ) throws Exception
|
public boolean configureDatabaseConsumer( String consumerId, boolean enable ) throws Exception
|
||||||
{
|
{
|
||||||
//Configuration config = archivaConfiguration.getConfiguration();
|
//Configuration config = archivaConfiguration.getConfiguration();
|
||||||
|
|
||||||
|
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable ) throws Exception
|
/**
|
||||||
|
* @see AdministrationService#configureRepositoryConsumer(String, String, boolean)
|
||||||
|
*/
|
||||||
|
public boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable )
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
List<KnownRepositoryContentConsumer> knownConsumers = consumerUtil.getAvailableKnownConsumers();
|
||||||
return false;
|
List<InvalidRepositoryContentConsumer> invalidConsumers = consumerUtil.getAvailableInvalidConsumers();
|
||||||
|
|
||||||
|
boolean found = false;
|
||||||
|
boolean isKnownContentConsumer = false;
|
||||||
|
for( KnownRepositoryContentConsumer consumer : knownConsumers )
|
||||||
|
{
|
||||||
|
if( consumer.getId().equals( consumerId ) )
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
isKnownContentConsumer = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !found )
|
||||||
|
{
|
||||||
|
for( InvalidRepositoryContentConsumer consumer : invalidConsumers )
|
||||||
|
{
|
||||||
|
if( consumer.getId().equals( consumerId ) )
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !found )
|
||||||
|
{
|
||||||
|
throw new Exception( "Invalid repository consumer." );
|
||||||
|
}
|
||||||
|
|
||||||
|
Configuration config = archivaConfiguration.getConfiguration();
|
||||||
|
RepositoryScanningConfiguration repoScanningConfig = config.getRepositoryScanning();
|
||||||
|
|
||||||
|
if( isKnownContentConsumer )
|
||||||
|
{
|
||||||
|
repoScanningConfig.addKnownContentConsumer( consumerId );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
repoScanningConfig.addInvalidContentConsumer( consumerId );
|
||||||
|
}
|
||||||
|
|
||||||
|
config.setRepositoryScanning( repoScanningConfig );
|
||||||
|
saveConfiguration( config );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deleteArtifact( String repoId, String groupId, String artifactId, String version ) throws Exception
|
public boolean deleteArtifact( String repoId, String groupId, String artifactId, String version ) throws Exception
|
||||||
{
|
{
|
||||||
// TODO implement delete artifact in Archiva
|
// TODO implement delete artifact in Archiva
|
||||||
@ -70,16 +129,37 @@ public boolean executeRepositoryScanner( String repoId ) throws Exception
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AdministrationService#getAllDatabaseConsumers()
|
||||||
|
*/
|
||||||
public List<String> getAllDatabaseConsumers()
|
public List<String> getAllDatabaseConsumers()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
List<String> consumers = new ArrayList<String>();
|
||||||
return null;
|
|
||||||
|
return consumers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AdministrationService#getAllRepositoryConsumers()
|
||||||
|
*/
|
||||||
public List<String> getAllRepositoryConsumers()
|
public List<String> getAllRepositoryConsumers()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
List<String> consumers = new ArrayList<String>();
|
||||||
return null;
|
|
||||||
|
List<KnownRepositoryContentConsumer> knownConsumers = consumerUtil.getAvailableKnownConsumers();
|
||||||
|
List<InvalidRepositoryContentConsumer> invalidConsumers = consumerUtil.getAvailableInvalidConsumers();
|
||||||
|
|
||||||
|
for( KnownRepositoryContentConsumer consumer : knownConsumers )
|
||||||
|
{
|
||||||
|
consumers.add( consumer.getId() );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( InvalidRepositoryContentConsumer consumer : invalidConsumers )
|
||||||
|
{
|
||||||
|
consumers.add( consumer.getId() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return consumers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ManagedRepository> getAllManagedRepositories()
|
public List<ManagedRepository> getAllManagedRepositories()
|
||||||
@ -91,4 +171,36 @@ public List<RemoteRepository> getAllRemoteRepositories()
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveConfiguration( Configuration config )
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
archivaConfiguration.save( config );
|
||||||
|
}
|
||||||
|
catch( RegistryException e )
|
||||||
|
{
|
||||||
|
throw new Exception( "Error occurred in the registry." );
|
||||||
|
}
|
||||||
|
catch ( IndeterminateConfigurationException e )
|
||||||
|
{
|
||||||
|
throw new Exception( "Error occurred while saving the configuration." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
|
||||||
|
{
|
||||||
|
this.archivaConfiguration = archivaConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RepositoryContentConsumers getConsumerUtil()
|
||||||
|
{
|
||||||
|
return consumerUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsumerUtil( RepositoryContentConsumers consumerUtil )
|
||||||
|
{
|
||||||
|
this.consumerUtil = consumerUtil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
||||||
|
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
|
||||||
|
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||||
|
import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
|
||||||
import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
|
import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
|
||||||
import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
|
import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
|
||||||
import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
|
import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
|
||||||
@ -53,11 +56,27 @@ public class AdministrationServiceImplTest
|
|||||||
|
|
||||||
private Configuration config;
|
private Configuration config;
|
||||||
|
|
||||||
private AdministrationService service;
|
private AdministrationServiceImpl service;
|
||||||
|
|
||||||
private MockControl taskSchedulerControl;
|
private MockControl taskSchedulerControl;
|
||||||
|
|
||||||
private ArchivaTaskScheduler taskScheduler;
|
private ArchivaTaskScheduler taskScheduler;
|
||||||
|
|
||||||
|
private MockControl consumerUtilControl;
|
||||||
|
|
||||||
|
private RepositoryContentConsumers consumerUtil;
|
||||||
|
|
||||||
|
private MockControl knownContentConsumerControl;
|
||||||
|
|
||||||
|
private MockControl invalidContentConsumerControl;
|
||||||
|
|
||||||
|
private KnownRepositoryContentConsumer indexArtifactConsumer;
|
||||||
|
|
||||||
|
private KnownRepositoryContentConsumer indexPomConsumer;
|
||||||
|
|
||||||
|
private InvalidRepositoryContentConsumer checkPomConsumer;
|
||||||
|
|
||||||
|
private InvalidRepositoryContentConsumer checkMetadataConsumer;
|
||||||
|
|
||||||
protected void setUp()
|
protected void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
@ -73,14 +92,27 @@ protected void setUp()
|
|||||||
taskSchedulerControl = MockControl.createControl( ArchivaTaskScheduler.class );
|
taskSchedulerControl = MockControl.createControl( ArchivaTaskScheduler.class );
|
||||||
taskScheduler = ( ArchivaTaskScheduler ) taskSchedulerControl.getMock();
|
taskScheduler = ( ArchivaTaskScheduler ) taskSchedulerControl.getMock();
|
||||||
|
|
||||||
|
consumerUtilControl = MockClassControl.createControl( RepositoryContentConsumers.class );
|
||||||
|
consumerUtil = ( RepositoryContentConsumers ) consumerUtilControl.getMock();
|
||||||
|
|
||||||
|
knownContentConsumerControl = MockControl.createControl( KnownRepositoryContentConsumer.class );
|
||||||
|
indexArtifactConsumer = ( KnownRepositoryContentConsumer ) knownContentConsumerControl.getMock();
|
||||||
|
indexPomConsumer = ( KnownRepositoryContentConsumer ) knownContentConsumerControl.getMock();
|
||||||
|
|
||||||
|
invalidContentConsumerControl = MockControl.createControl( InvalidRepositoryContentConsumer.class );
|
||||||
|
checkPomConsumer = ( InvalidRepositoryContentConsumer ) invalidContentConsumerControl.getMock();
|
||||||
|
checkMetadataConsumer = ( InvalidRepositoryContentConsumer ) invalidContentConsumerControl.getMock();
|
||||||
|
|
||||||
service = new AdministrationServiceImpl();
|
service = new AdministrationServiceImpl();
|
||||||
|
service.setArchivaConfiguration( archivaConfig );
|
||||||
|
service.setConsumerUtil( consumerUtil );
|
||||||
}
|
}
|
||||||
|
|
||||||
// DATABASE CONSUMERS
|
// DATABASE CONSUMERS
|
||||||
public void testGetAllDbConsumers()
|
/* public void testGetAllDbConsumers()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
/*DatabaseScanningConfiguration dbScanning = new DatabaseScanningConfiguration();
|
DatabaseScanningConfiguration dbScanning = new DatabaseScanningConfiguration();
|
||||||
dbScanning.addCleanupConsumer( "cleanup-index" );
|
dbScanning.addCleanupConsumer( "cleanup-index" );
|
||||||
dbScanning.addCleanupConsumer( "cleanup-database" );
|
dbScanning.addCleanupConsumer( "cleanup-database" );
|
||||||
dbScanning.addUnprocessedConsumer( "unprocessed-artifacts" );
|
dbScanning.addUnprocessedConsumer( "unprocessed-artifacts" );
|
||||||
@ -92,6 +124,8 @@ public void testGetAllDbConsumers()
|
|||||||
archivaConfigControl.replay();
|
archivaConfigControl.replay();
|
||||||
configControl.replay();
|
configControl.replay();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<String> dbConsumers = service.getAllDatabaseConsumers();
|
List<String> dbConsumers = service.getAllDatabaseConsumers();
|
||||||
|
|
||||||
archivaConfigControl.verify();
|
archivaConfigControl.verify();
|
||||||
@ -102,10 +136,10 @@ public void testGetAllDbConsumers()
|
|||||||
assertTrue( dbConsumers.contains( "cleanup-index" ) );
|
assertTrue( dbConsumers.contains( "cleanup-index" ) );
|
||||||
assertTrue( dbConsumers.contains( "cleanup-database" ) );
|
assertTrue( dbConsumers.contains( "cleanup-database" ) );
|
||||||
assertTrue( dbConsumers.contains( "unprocessed-artifacts" ) );
|
assertTrue( dbConsumers.contains( "unprocessed-artifacts" ) );
|
||||||
assertTrue( dbConsumers.contains( "unprocessed-poms" ) );*/
|
assertTrue( dbConsumers.contains( "unprocessed-poms" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public void testConfigureValidDatabaseConsumer()
|
public void testConfigureValidDatabaseConsumer()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
DatabaseScanningConfiguration dbScanning = new DatabaseScanningConfiguration();
|
DatabaseScanningConfiguration dbScanning = new DatabaseScanningConfiguration();
|
||||||
@ -192,67 +226,62 @@ public void testConfigureInvalidDatabaseConsumer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// REPOSITORY CONSUMERS
|
// REPOSITORY CONSUMERS
|
||||||
public void testGetAllRepoConsumers()
|
public void testGetAllRepoConsumers()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
|
recordRepoConsumerValidation();
|
||||||
repoScanning.addKnownContentConsumer( "index-artifacts" );
|
|
||||||
repoScanning.addKnownContentConsumer( "index-poms" );
|
|
||||||
repoScanning.addKnownContentConsumer( "fix-checksums" );
|
|
||||||
repoScanning.addInvalidContentConsumer( "check-poms" );
|
|
||||||
repoScanning.addInvalidContentConsumer( "check-metadata" );
|
|
||||||
|
|
||||||
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
consumerUtilControl.replay();
|
||||||
configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
|
knownContentConsumerControl.replay();
|
||||||
|
invalidContentConsumerControl.replay();
|
||||||
archivaConfigControl.replay();
|
|
||||||
configControl.replay();
|
List<String> repoConsumers = service.getAllRepositoryConsumers();
|
||||||
|
|
||||||
List<String> repoConsumers = service.getAllDatabaseConsumers();
|
|
||||||
|
|
||||||
archivaConfigControl.verify();
|
|
||||||
configControl.verify();
|
|
||||||
|
|
||||||
|
consumerUtilControl.verify();
|
||||||
|
knownContentConsumerControl.verify();
|
||||||
|
invalidContentConsumerControl.verify();
|
||||||
|
|
||||||
assertNotNull( repoConsumers );
|
assertNotNull( repoConsumers );
|
||||||
assertEquals( 5, repoConsumers.size() );
|
assertEquals( 4, repoConsumers.size() );
|
||||||
assertTrue( repoConsumers.contains( "index-artifacts" ) );
|
assertTrue( repoConsumers.contains( "index-artifact" ) );
|
||||||
assertTrue( repoConsumers.contains( "index-poms" ) );
|
assertTrue( repoConsumers.contains( "index-pom" ) );
|
||||||
assertTrue( repoConsumers.contains( "fix-checksums" ) );
|
assertTrue( repoConsumers.contains( "check-pom" ) );
|
||||||
assertTrue( repoConsumers.contains( "check-poms" ) );
|
|
||||||
assertTrue( repoConsumers.contains( "check-metadata" ) );
|
assertTrue( repoConsumers.contains( "check-metadata" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConfigureValidRepositoryConsumer()
|
public void testConfigureValidRepositoryConsumer()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
//TODO mock checking whether the repo consumer is valid or not
|
|
||||||
|
|
||||||
RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
|
RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
|
||||||
repoScanning.addKnownContentConsumer( "index-artifacts" );
|
repoScanning.addKnownContentConsumer( "index-artifact" );
|
||||||
repoScanning.addKnownContentConsumer( "index-poms" );
|
repoScanning.addKnownContentConsumer( "index-pom" );
|
||||||
repoScanning.addKnownContentConsumer( "fix-checksums" );
|
repoScanning.addInvalidContentConsumer( "check-pom" );
|
||||||
repoScanning.addInvalidContentConsumer( "check-poms" );
|
|
||||||
repoScanning.addInvalidContentConsumer( "check-metadata" );
|
// test enable "check-metadata" consumer
|
||||||
|
recordRepoConsumerValidation();
|
||||||
|
|
||||||
// test enable
|
|
||||||
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
||||||
configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
|
configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
|
||||||
|
|
||||||
config.setRepositoryScanning( repoScanning );
|
config.setRepositoryScanning( repoScanning );
|
||||||
|
|
||||||
configControl.setMatcher( MockControl.ALWAYS_MATCHER );
|
configControl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||||
configControl.setVoidCallable();
|
configControl.setVoidCallable();
|
||||||
|
|
||||||
archivaConfig.save( config );
|
archivaConfig.save( config );
|
||||||
archivaConfigControl.setVoidCallable();
|
archivaConfigControl.setVoidCallable();
|
||||||
|
|
||||||
|
consumerUtilControl.replay();
|
||||||
|
knownContentConsumerControl.replay();
|
||||||
|
invalidContentConsumerControl.replay();
|
||||||
archivaConfigControl.replay();
|
archivaConfigControl.replay();
|
||||||
configControl.replay();
|
configControl.replay();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boolean success = service.configureRepositoryConsumer( null, "new-repo-consumer", true );
|
boolean success = service.configureRepositoryConsumer( null, "check-metadata", true );
|
||||||
assertTrue( success );
|
assertTrue( success );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
@ -260,14 +289,22 @@ public void testConfigureValidRepositoryConsumer()
|
|||||||
fail( "An exception should not have been thrown." );
|
fail( "An exception should not have been thrown." );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
consumerUtilControl.verify();
|
||||||
|
knownContentConsumerControl.verify();
|
||||||
|
invalidContentConsumerControl.verify();
|
||||||
archivaConfigControl.verify();
|
archivaConfigControl.verify();
|
||||||
configControl.verify();
|
configControl.verify();
|
||||||
|
|
||||||
// test disable
|
// test disable "check-metadata" consumer
|
||||||
|
consumerUtilControl.reset();
|
||||||
|
knownContentConsumerControl.reset();
|
||||||
|
invalidContentConsumerControl.reset();
|
||||||
archivaConfigControl.reset();
|
archivaConfigControl.reset();
|
||||||
configControl.reset();
|
configControl.reset();
|
||||||
|
|
||||||
//TODO mock checking whether the repo consumer is valid or not
|
repoScanning.addInvalidContentConsumer( "check-metadata" );
|
||||||
|
|
||||||
|
recordRepoConsumerValidation();
|
||||||
|
|
||||||
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
||||||
configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
|
configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
|
||||||
@ -278,24 +315,32 @@ public void testConfigureValidRepositoryConsumer()
|
|||||||
|
|
||||||
archivaConfig.save( config );
|
archivaConfig.save( config );
|
||||||
archivaConfigControl.setVoidCallable();
|
archivaConfigControl.setVoidCallable();
|
||||||
|
|
||||||
|
consumerUtilControl.replay();
|
||||||
|
knownContentConsumerControl.replay();
|
||||||
|
invalidContentConsumerControl.replay();
|
||||||
archivaConfigControl.replay();
|
archivaConfigControl.replay();
|
||||||
configControl.replay();
|
configControl.replay();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boolean success = service.configureRepositoryConsumer( null, "new-repo-consumer", false );
|
boolean success = service.configureRepositoryConsumer( null, "check-metadata", false );
|
||||||
|
|
||||||
|
consumerUtilControl.verify();
|
||||||
|
knownContentConsumerControl.verify();
|
||||||
|
invalidContentConsumerControl.verify();
|
||||||
|
archivaConfigControl.verify();
|
||||||
|
configControl.verify();
|
||||||
|
|
||||||
assertTrue( success );
|
assertTrue( success );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
fail( "An excecption should not have been thrown." );
|
fail( "An excecption should not have been thrown." );
|
||||||
}
|
}
|
||||||
|
|
||||||
archivaConfigControl.verify();
|
|
||||||
configControl.verify();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public void testConfigureInvalidRepositoryConsumer()
|
public void testConfigureInvalidRepositoryConsumer()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
@ -308,7 +353,7 @@ public void testConfigureInvalidRepositoryConsumer()
|
|||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
assertEquals( "Invalid database consumer.", e.getMessage() );
|
assertEquals( "Invalid repository consumer.", e.getMessage() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,4 +612,23 @@ private ManagedRepositoryConfiguration createManagedRepo( String id, String layo
|
|||||||
return repoConfig;
|
return repoConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void recordRepoConsumerValidation()
|
||||||
|
{
|
||||||
|
List<KnownRepositoryContentConsumer> availableKnownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
|
||||||
|
availableKnownConsumers.add( indexArtifactConsumer );
|
||||||
|
availableKnownConsumers.add( indexPomConsumer );
|
||||||
|
|
||||||
|
List<InvalidRepositoryContentConsumer> availableInvalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
|
||||||
|
availableInvalidConsumers.add( checkPomConsumer );
|
||||||
|
availableInvalidConsumers.add( checkMetadataConsumer );
|
||||||
|
|
||||||
|
consumerUtilControl.expectAndReturn( consumerUtil.getAvailableKnownConsumers(), availableKnownConsumers );
|
||||||
|
knownContentConsumerControl.expectAndReturn( indexArtifactConsumer.getId(), "index-artifact" );
|
||||||
|
knownContentConsumerControl.expectAndReturn( indexPomConsumer.getId(), "index-pom" );
|
||||||
|
|
||||||
|
consumerUtilControl.expectAndReturn( consumerUtil.getAvailableInvalidConsumers(), availableInvalidConsumers );
|
||||||
|
invalidContentConsumerControl.expectAndReturn( checkPomConsumer.getId(), "check-pom" );
|
||||||
|
invalidContentConsumerControl.expectAndReturn( checkMetadataConsumer.getId(), "check-metadata" );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user