Author: oching
Date: Wed Oct 8 22:33:44 2008
New Revision: 703062
URL: http://svn.apache.org/viewvc?rev=703062&view=rev
Log:
added test cases to AdministrationServiceImplTest
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java?rev=703062&r1=703061&r2=703062&view=diff
==============================================================================
---
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
(original)
+++
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
Wed Oct 8 22:33:44 2008
@@ -29,22 +29,78 @@
@ServiceObject( "Administration" )
public interface AdministrationService
{
- public boolean executeRepositoryScanner( String repoId );
-
- public boolean executeDatabaseScanner();
-
+ /**
+ * Executes repository scanner on the given repository.
+ *
+ * @param repoId id of the repository to be scanned
+ * @return
+ * @throws Exception
+ */
+ public boolean executeRepositoryScanner( String repoId ) throws Exception;
+
+ /**
+ * Executes the database scanner.
+ *
+ * @return
+ * @throws Exception
+ */
+ public boolean executeDatabaseScanner() throws Exception;
+
+ /**
+ * Gets all available database consumers.
+ * @return
+ */
public List<String> getAllDatabaseConsumers();
-
- public boolean configureDatabaseConsumer( String consumerId, boolean
enable );
-
- // TODO should we already implement config of consumers per repository?
- public boolean configureRepositoryConsumer( String repoId, String
consumerId, boolean enable );
-
+
+ /**
+ * Configures (enable or disable) database consumer.
+ *
+ * @param consumerId id of the database consumer
+ * @param enable flag whether to enable or disable the specified consumer
+ * @return
+ * @throws Exception
+ */
+ public boolean configureDatabaseConsumer( String consumerId, boolean
enable ) throws Exception;
+
+ /**
+ * Gets all available repository consumers.
+ *
+ * @return
+ */
public List<String> getAllRepositoryConsumers();
+
+ // TODO should we already implement config of consumers per repository?
+ public boolean configureRepositoryConsumer( String repoId, String
consumerId, boolean enable ) throws Exception;
+ /**
+ * Gets all managed repositories.
+ *
+ * @return
+ */
public List<ManagedRepository> getAllManagedRepositories();
+ /**
+ * Gets all remote repositories.
+ *
+ * @return
+ */
public List<RemoteRepository> getAllRemoteRepositories();
- public boolean deleteArtifact( String repoId, String groupId, String
artifactId, String version );
+ /**
+ * Deletes given artifact from the specified repository.
+ *
+ * @param repoId id of the repository where the artifact to be deleted
resides
+ * @param groupId groupId of the artifact to be deleted
+ * @param artifactId artifactId of the artifact to be deleted
+ * @param version version of the artifact to be deleted
+ * @return
+ * @throws Exception
+ */
+ public boolean deleteArtifact( String repoId, String groupId, String
artifactId, String version )
+ throws Exception;
+
+ //TODO
+ // consider the following as additional services:
+ // - getAllConfiguredRepositoryConsumers( String repoId ) - list all
enabled consumers for the repo
+ // - getAllConfiguredDatabaseConsumers() - list all enabled db consumers
}
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml?rev=703062&r1=703061&r2=703062&view=diff
==============================================================================
---
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
(original)
+++
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
Wed Oct 8 22:33:44 2008
@@ -41,6 +41,10 @@
<artifactId>archiva-configuration</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-scheduled</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java?rev=703062&r1=703061&r2=703062&view=diff
==============================================================================
---
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
(original)
+++
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
Wed Oct 8 22:33:44 2008
@@ -35,7 +35,7 @@
*/
private ArchivaConfiguration archivaConfiguration;
- public boolean configureDatabaseConsumer( String consumerId, boolean
enable )
+ public boolean configureDatabaseConsumer( String consumerId, boolean
enable ) throws Exception
{
//Configuration config = archivaConfiguration.getConfiguration();
@@ -44,25 +44,27 @@
return false;
}
- public boolean configureRepositoryConsumer( String repoId, String
consumerId, boolean enable )
+ public boolean configureRepositoryConsumer( String repoId, String
consumerId, boolean enable ) throws Exception
{
// TODO Auto-generated method stub
return false;
}
- public boolean deleteArtifact( String repoId, String groupId, String
artifactId, String version )
+ public boolean deleteArtifact( String repoId, String groupId, String
artifactId, String version ) throws Exception
{
+ // TODO implement delete artifact in Archiva
+
// TODO Auto-generated method stub
return false;
}
- public boolean executeDatabaseScanner()
+ public boolean executeDatabaseScanner() throws Exception
{
// TODO Auto-generated method stub
return false;
}
- public boolean executeRepositoryScanner( String repoId )
+ public boolean executeRepositoryScanner( String repoId ) throws Exception
{
// TODO Auto-generated method stub
return false;
Modified:
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java?rev=703062&r1=703061&r2=703062&view=diff
==============================================================================
---
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
(original)
+++
archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
Wed Oct 8 22:33:44 2008
@@ -31,6 +31,9 @@
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
+import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
+import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.easymock.MockControl;
import org.easymock.classextension.MockClassControl;
@@ -52,6 +55,10 @@
private AdministrationService service;
+ private MockControl taskSchedulerControl;
+
+ private ArchivaTaskScheduler taskScheduler;
+
protected void setUp()
throws Exception
{
@@ -63,10 +70,14 @@
configControl = MockClassControl.createControl( Configuration.class );
config = ( Configuration ) configControl.getMock();
+ taskSchedulerControl = MockControl.createControl(
ArchivaTaskScheduler.class );
+ taskScheduler = ( ArchivaTaskScheduler )
taskSchedulerControl.getMock();
+
service = new AdministrationServiceImpl();
}
-
- public void testConfigureValidDatabaseConsumer()
+
+ // DATABASE CONSUMERS
+ public void testGetAllDbConsumers()
throws Exception
{
/*DatabaseScanningConfiguration dbScanning = new
DatabaseScanningConfiguration();
@@ -75,6 +86,36 @@
dbScanning.addUnprocessedConsumer( "unprocessed-artifacts" );
dbScanning.addUnprocessedConsumer( "unprocessed-poms" );
+ archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
+ configControl.expectAndReturn( config.getDatabaseScanning(),
dbScanning );
+
+ archivaConfigControl.replay();
+ configControl.replay();
+
+ List<String> dbConsumers = service.getAllDatabaseConsumers();
+
+ archivaConfigControl.verify();
+ configControl.verify();
+
+ assertNotNull( dbConsumers );
+ assertEquals( 4, dbConsumers.size() );
+ assertTrue( dbConsumers.contains( "cleanup-index" ) );
+ assertTrue( dbConsumers.contains( "cleanup-database" ) );
+ assertTrue( dbConsumers.contains( "unprocessed-artifacts" ) );
+ assertTrue( dbConsumers.contains( "unprocessed-poms" ) );*/
+ }
+
+/* public void testConfigureValidDatabaseConsumer()
+ throws Exception
+ {
+ DatabaseScanningConfiguration dbScanning = new
DatabaseScanningConfiguration();
+ dbScanning.addCleanupConsumer( "cleanup-index" );
+ dbScanning.addCleanupConsumer( "cleanup-database" );
+ dbScanning.addUnprocessedConsumer( "unprocessed-artifacts" );
+ dbScanning.addUnprocessedConsumer( "unprocessed-poms" );
+
+ //TODO mock checking whether the db consumer is valid or not
+
// test enable
archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
configControl.expectAndReturn( config.getDatabaseScanning(),
dbScanning );
@@ -89,17 +130,25 @@
archivaConfigControl.replay();
configControl.replay();
- boolean success = service.configureDatabaseConsumer(
"new-cleanup-consumer", true );
+ try
+ {
+ boolean success = service.configureDatabaseConsumer(
"new-cleanup-consumer", true );
+ assertTrue( success );
+ }
+ catch ( Exception e )
+ {
+ fail( "An exception should not have been thrown." );
+ }
archivaConfigControl.verify();
configControl.verify();
-
- assertTrue( success );
-
+
// test disable
archivaConfigControl.reset();
configControl.reset();
+ //TODO mock checking whether the db consumer is valid or not
+
archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
configControl.expectAndReturn( config.getDatabaseScanning(),
dbScanning );
@@ -113,130 +162,323 @@
archivaConfigControl.replay();
configControl.replay();
- success = service.configureDatabaseConsumer( "new-cleanup-consumer",
false );
+ try
+ {
+ boolean success = service.configureDatabaseConsumer(
"new-cleanup-consumer", false );
+ assertTrue( success );
+ }
+ catch ( Exception e )
+ {
+ fail( "An exception should not have been thrown." );
+ }
archivaConfigControl.verify();
configControl.verify();
-
- assertTrue( success );*/
}
public void testConfigureInvalidDatabaseConsumer()
throws Exception
{
+ //TODO mock checking whether the db consumer is valid or not
+
+ try
+ {
+ service.configureDatabaseConsumer( "invalid-consumer", true );
+ fail( "An exception should have been thrown." );
+ }
+ catch ( Exception e )
+ {
+ assertEquals( "Invalid database consumer.", e.getMessage() );
+ }
+ }
+
+ // REPOSITORY CONSUMERS
+ public void testGetAllRepoConsumers()
+ throws Exception
+ {
+ RepositoryScanningConfiguration repoScanning = new
RepositoryScanningConfiguration();
+ 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 );
+ configControl.expectAndReturn( config.getRepositoryScanning(),
repoScanning );
+ archivaConfigControl.replay();
+ configControl.replay();
+
+ List<String> repoConsumers = service.getAllDatabaseConsumers();
+
+ archivaConfigControl.verify();
+ configControl.verify();
+
+ assertNotNull( repoConsumers );
+ assertEquals( 5, repoConsumers.size() );
+ assertTrue( repoConsumers.contains( "index-artifacts" ) );
+ assertTrue( repoConsumers.contains( "index-poms" ) );
+ assertTrue( repoConsumers.contains( "fix-checksums" ) );
+ assertTrue( repoConsumers.contains( "check-poms" ) );
+ assertTrue( repoConsumers.contains( "check-metadata" ) );
}
public void testConfigureValidRepositoryConsumer()
throws Exception
{
- // test enable & disable
+ //TODO mock checking whether the repo consumer is valid or not
+
+ RepositoryScanningConfiguration repoScanning = new
RepositoryScanningConfiguration();
+ repoScanning.addKnownContentConsumer( "index-artifacts" );
+ repoScanning.addKnownContentConsumer( "index-poms" );
+ repoScanning.addKnownContentConsumer( "fix-checksums" );
+ repoScanning.addInvalidContentConsumer( "check-poms" );
+ repoScanning.addInvalidContentConsumer( "check-metadata" );
+
+ // test enable
+ archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
+ configControl.expectAndReturn( config.getRepositoryScanning(),
repoScanning );
+
+ config.setRepositoryScanning( repoScanning );
+
+ configControl.setMatcher( MockControl.ALWAYS_MATCHER );
+ configControl.setVoidCallable();
+
+ archivaConfig.save( config );
+ archivaConfigControl.setVoidCallable();
+
+ archivaConfigControl.replay();
+ configControl.replay();
+
+ try
+ {
+ boolean success = service.configureRepositoryConsumer( null,
"new-repo-consumer", true );
+ assertTrue( success );
+ }
+ catch ( Exception e )
+ {
+ fail( "An exception should not have been thrown." );
+ }
+
+ archivaConfigControl.verify();
+ configControl.verify();
+
+ // test disable
+ archivaConfigControl.reset();
+ configControl.reset();
+
+ //TODO mock checking whether the repo consumer is valid or not
+
+ archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
+ configControl.expectAndReturn( config.getRepositoryScanning(),
repoScanning );
+
+ config.setRepositoryScanning( repoScanning );
+ configControl.setMatcher( MockControl.ALWAYS_MATCHER );
+ configControl.setVoidCallable();
+
+ archivaConfig.save( config );
+ archivaConfigControl.setVoidCallable();
+
+ archivaConfigControl.replay();
+ configControl.replay();
+
+ try
+ {
+ boolean success = service.configureRepositoryConsumer( null,
"new-repo-consumer", false );
+ assertTrue( success );
+ }
+ catch ( Exception e )
+ {
+ fail( "An excecption should not have been thrown." );
+ }
+
+ archivaConfigControl.verify();
+ configControl.verify();
}
public void testConfigureInvalidRepositoryConsumer()
throws Exception
{
-
+ //TODO mock checking whether the repo consumer is valid or not
+
+ try
+ {
+ service.configureRepositoryConsumer( null, "invalid-consumer",
true );
+ fail( "An exception should have been thrown." );
+ }
+ catch ( Exception e )
+ {
+ assertEquals( "Invalid database consumer.", e.getMessage() );
+ }
}
+
+// DELETE ARTIFACT
public void testDeleteArtifactArtifactExists()
throws Exception
{
-
+ archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
+ configControl.expectAndReturn( config.findManagedRepositoryById(
"internal" ),
+ createManagedRepo( "internal",
"default", "Internal Repository", true, false ) );
+
+ // TODO
+ // - mock checking of artifact existence in the repo
+ // - mock artifact delete
+
+ archivaConfigControl.replay();
+ configControl.replay();
+
+ try
+ {
+ boolean success = service.deleteArtifact( "internal",
"org.apache.archiva", "archiva-test", "1.0" );
+ assertTrue( success );
+ }
+ catch ( Exception e )
+ {
+ fail( "An exception should not have been thrown." );
+ }
+
+ archivaConfigControl.verify();
+ configControl.verify();
}
public void testDeleteArtifactArtifactDoesNotExist()
throws Exception
{
-
+ archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
+ configControl.expectAndReturn( config.findManagedRepositoryById(
"internal" ),
+ createManagedRepo( "internal",
"default", "Internal Repository", true, false ) );
+
+ // TODO mock checking of artifact existence in the repo
+
+ archivaConfigControl.replay();
+ configControl.replay();
+
+ try
+ {
+ service.deleteArtifact( "internal", "org.apache.archiva",
"archiva-test", "1.0" );
+ fail( "An exception should have been thrown." );
+ }
+ catch ( Exception e )
+ {
+ assertEquals( "Artifact does not exist.", e.getMessage() );
+ }
+
+ archivaConfigControl.verify();
+ configControl.verify();
}
public void testDeleteArtifacRepositoryDoesNotExist()
throws Exception
{
-
- }
-
- public void testExecuteRepoScannerRepoExists()
- throws Exception
- {
-
+ archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
+ configControl.expectAndReturn( config.findManagedRepositoryById(
"internal" ), null );
+
+ archivaConfigControl.replay();
+ configControl.replay();
+
+ try
+ {
+ service.deleteArtifact( "internal", "org.apache.archiva",
"archiva-test", "1.0" );
+ fail( "An exception should have been thrown." );
+ }
+ catch ( Exception e )
+ {
+ assertEquals( "Repository does not exist.", e.getMessage() );
+ }
+
+ archivaConfigControl.verify();
+ configControl.verify();
}
- public void testExecuteRepoScannerRepoDoesNotExist()
- throws Exception
- {
-
- }
+// REPO SCANNING
- public void testExecuteDbScanner()
+ public void testExecuteRepoScannerRepoExists()
throws Exception
- {
+ {
+ archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
+ configControl.expectAndReturn( config.findManagedRepositoryById(
"internal" ),
+ createManagedRepo( "internal",
"default", "Internal Repository", true, false ) );
- }
-
- public void testGetAllDbConsumers()
- throws Exception
- {
- /*DatabaseScanningConfiguration dbScanning = new
DatabaseScanningConfiguration();
- dbScanning.addCleanupConsumer( "cleanup-index" );
- dbScanning.addCleanupConsumer( "cleanup-database" );
- dbScanning.addUnprocessedConsumer( "unprocessed-artifacts" );
- dbScanning.addUnprocessedConsumer( "unprocessed-poms" );
+ RepositoryTask task = new RepositoryTask();
- archivaConfigControl.expectAndReturn(
archivaConfig.getConfiguration(), config );
- configControl.expectAndReturn( config.getDatabaseScanning(),
dbScanning );
+ taskSchedulerControl.expectAndReturn(
taskScheduler.isProcessingAnyRepositoryTask(), false );
+ taskSchedulerControl.expectAndReturn(
taskScheduler.isProcessingRepositoryTask( "internal" ), false );
+
+ taskScheduler.queueRepositoryTask( task );
+ taskSchedulerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+ taskSchedulerControl.setVoidCallable();
archivaConfigControl.replay();
configControl.replay();
-
- List<String> dbConsumers = service.getAllDatabaseConsumers();
+ taskSchedulerControl.replay();
+
+ try
+ {
+ boolean success = service.executeRepositoryScanner( "internal" );
+ assertTrue( success );
+ }
+ catch ( Exception e )
+ {
+ fail( "An exception should not have been thrown." );
+ }
archivaConfigControl.verify();
configControl.verify();
-
- assertNotNull( dbConsumers );
- assertEquals( 4, dbConsumers.size() );
- assertTrue( dbConsumers.contains( "cleanup-index" ) );
- assertTrue( dbConsumers.contains( "cleanup-database" ) );
- assertTrue( dbConsumers.contains( "unprocessed-artifacts" ) );
- assertTrue( dbConsumers.contains( "unprocessed-poms" ) );*/
+ taskSchedulerControl.verify();
}
- public void testGetAllRepoConsumers()
+ public void testExecuteRepoScannerRepoDoesNotExist()
throws Exception
{
- /*RepositoryScanningConfiguration repoScanning = new
RepositoryScanningConfiguration();
- 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 );
- configControl.expectAndReturn( config.getRepositoryScanning(),
repoScanning );
+ configControl.expectAndReturn( config.findManagedRepositoryById(
"internal" ), null );
archivaConfigControl.replay();
configControl.replay();
-
- List<String> repoConsumers = service.getAllDatabaseConsumers();
+
+ try
+ {
+ service.executeRepositoryScanner( "internal" );
+ fail( "An exception should have been thrown." );
+ }
+ catch ( Exception e )
+ {
+ assertEquals( "Repository does not exist.", e.getMessage() );
+ }
archivaConfigControl.verify();
configControl.verify();
+ }
+
+ // DATABASE SCANNING
+
+ public void testExecuteDbScanner()
+ throws Exception
+ {
+ DatabaseTask task = new DatabaseTask();
- assertNotNull( repoConsumers );
- assertEquals( 5, repoConsumers.size() );
- assertTrue( repoConsumers.contains( "index-artifacts" ) );
- assertTrue( repoConsumers.contains( "index-poms" ) );
- assertTrue( repoConsumers.contains( "fix-checksums" ) );
- assertTrue( repoConsumers.contains( "check-poms" ) );
- assertTrue( repoConsumers.contains( "check-metadata" ) );*/
+ taskSchedulerControl.expectAndReturn(
taskScheduler.isProcessingDatabaseTask(), false );
+
+ taskScheduler.queueDatabaseTask( task );
+ taskSchedulerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+ taskSchedulerControl.setVoidCallable();
+
+ taskSchedulerControl.replay();
+
+ boolean success = service.executeDatabaseScanner();
+
+ taskSchedulerControl.verify();
+
+ assertTrue( success );
}
+
+ // REPOSITORIES
public void testGetAllManagedRepositories()
throws Exception
{
- /*List<ManagedRepositoryConfiguration> managedRepos = new
ArrayList<ManagedRepositoryConfiguration>();
+ List<ManagedRepositoryConfiguration> managedRepos = new
ArrayList<ManagedRepositoryConfiguration>();
managedRepos.add( createManagedRepo( "internal", "default", "Internal
Repository", true, false ) );
managedRepos.add( createManagedRepo( "snapshots", "default",
"Snapshots Repository", false, true ) );
@@ -255,13 +497,13 @@
assertEquals( 2, repos.size() );
assertManagedRepo( ( ManagedRepository ) repos.get( 0 ),
managedRepos.get( 0 ) );
- assertManagedRepo( ( ManagedRepository ) repos.get( 1 ),
managedRepos.get( 1 ) );*/
+ assertManagedRepo( ( ManagedRepository ) repos.get( 1 ),
managedRepos.get( 1 ) );
}
public void testGetAllRemoteRepositories()
throws Exception
{
- /*List<RemoteRepositoryConfiguration> remoteRepos = new
ArrayList<RemoteRepositoryConfiguration>();
+ List<RemoteRepositoryConfiguration> remoteRepos = new
ArrayList<RemoteRepositoryConfiguration>();
remoteRepos.add( createRemoteRepository( "central", "Central
Repository", "default", "http://repo1.maven.org/maven2") );
remoteRepos.add( createRemoteRepository( "dummy", "Dummy Remote
Repository", "legacy", "http://dummy.com/dummy") );
@@ -280,9 +522,9 @@
assertEquals( 2, repos.size() );
assertRemoteRepo( (RemoteRepository) repos.get( 0 ), remoteRepos.get(
0 ) );
- assertRemoteRepo( (RemoteRepository) repos.get( 1 ), remoteRepos.get(
1 ) ); */
+ assertRemoteRepo( (RemoteRepository) repos.get( 1 ), remoteRepos.get(
1 ) );
}
-
+*/
private void assertRemoteRepo( RemoteRepository remoteRepo,
RemoteRepositoryConfiguration expectedRepoConfig )
{
assertEquals( expectedRepoConfig.getId(), remoteRepo.getId() );