Return-Path: Delivered-To: apmail-archiva-commits-archive@www.apache.org Received: (qmail 13589 invoked from network); 9 Oct 2008 02:09:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Oct 2008 02:09:40 -0000 Received: (qmail 43562 invoked by uid 500); 9 Oct 2008 02:09:39 -0000 Delivered-To: apmail-archiva-commits-archive@archiva.apache.org Received: (qmail 43527 invoked by uid 500); 9 Oct 2008 02:09:39 -0000 Mailing-List: contact commits-help@archiva.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@archiva.apache.org Delivered-To: mailing list commits@archiva.apache.org Received: (qmail 43518 invoked by uid 99); 9 Oct 2008 02:09:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Oct 2008 19:09:39 -0700 X-ASF-Spam-Status: No, hits=-1999.9 required=10.0 tests=ALL_TRUSTED,DNS_FROM_SECURITYSAGE X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Oct 2008 02:08:35 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 262F923888D5; Wed, 8 Oct 2008 19:09:11 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r703043 - in /archiva/branches/MRM-124/archiva-modules/archiva-web: archiva-webapp/src/main/webapp/WEB-INF/ archiva-xmlrpc/archiva-xmlrpc-api/ archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/ archiva-xmlrpc... Date: Thu, 09 Oct 2008 02:09:10 -0000 To: commits@archiva.apache.org From: oching@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081009020911.262F923888D5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: oching Date: Wed Oct 8 19:09:09 2008 New Revision: 703043 URL: http://svn.apache.org/viewvc?rev=703043&view=rev Log: -removed modello config and descriptor -created service beans -added test for AdministrationServiceImpl Added: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.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 archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/xmlrpc/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/xmlrpc/services/ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.xml Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml 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-api/src/main/mdo/archiva-service.xml 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 Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml?rev=703043&r1=703042&r2=703043&view=diff ============================================================================== --- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml (original) +++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml Wed Oct 8 19:09:09 2008 @@ -32,10 +32,13 @@ + + + Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml?rev=703043&r1=703042&r2=703043&view=diff ============================================================================== --- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml (original) +++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml Wed Oct 8 19:09:09 2008 @@ -36,26 +36,5 @@ com.atlassian.xmlrpc atlassian-xmlrpc-binder-annotations - - - - - org.codehaus.modello - modello-maven-plugin - 1.0-alpha-15 - - - - java - - - - - 1.0.0 - src/main/mdo/archiva-service.xml - false - - - - + 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=703043&r1=703042&r2=703043&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 19:09:09 2008 @@ -21,6 +21,9 @@ import java.util.List; +import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository; +import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository; + import com.atlassian.xmlrpc.ServiceObject; @ServiceObject( "Administration" ) @@ -37,7 +40,7 @@ // TODO should we already implement config of consumers per repository? public boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable ); - public List getAllRepositoryConsumers( String repoId ); + public List getAllRepositoryConsumers(); public List getAllManagedRepositories(); Added: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.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/beans/ManagedRepository.java?rev=703043&view=auto ============================================================================== --- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java (added) +++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/ManagedRepository.java Wed Oct 8 19:09:09 2008 @@ -0,0 +1,138 @@ +package org.apache.archiva.web.xmlrpc.api.beans; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.Serializable; + +import com.atlassian.xmlrpc.ServiceBean; + +@ServiceBean +public class ManagedRepository + implements Serializable +{ + private String id; + + private String name; + + private String url; + + private String layout; + + private boolean snapshots = false; + + private boolean releases = false; + + public boolean equals(Object other) + { + if ( this == other) + { + return true; + } + + if ( !(other instanceof ManagedRepository) ) + { + return false; + } + + ManagedRepository that = (ManagedRepository) other; + boolean result = true; + result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) ); + return result; + } + + public String getId() + { + return this.id; + } + + public String getLayout() + { + return this.layout; + } + + public String getName() + { + return this.name; + } + + public String getUrl() + { + return this.url; + } + + public int hashCode() + { + int result = 17; + long tmp; + result = 37 * result + ( id != null ? id.hashCode() : 0 ); + return result; + } + + public boolean isReleases() + { + return this.releases; + } + + /** + * Get null + */ + public boolean isSnapshots() + { + return this.snapshots; + } + + public void setId(String id) + { + this.id = id; + } + + public void setLayout(String layout) + { + this.layout = layout; + } + + public void setName(String name) + { + this.name = name; + } + + public void setReleases(boolean releases) + { + this.releases = releases; + } + + public void setSnapshots(boolean snapshots) + { + this.snapshots = snapshots; + } + + public void setUrl(String url) + { + this.url = url; + } + + public java.lang.String toString() + { + StringBuffer buf = new StringBuffer(); + buf.append( "id = '" ); + buf.append( getId() + "'" ); + return buf.toString(); + } +} \ No newline at end of file Added: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.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/beans/RemoteRepository.java?rev=703043&view=auto ============================================================================== --- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java (added) +++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/RemoteRepository.java Wed Oct 8 19:09:09 2008 @@ -0,0 +1,111 @@ +package org.apache.archiva.web.xmlrpc.api.beans; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.Serializable; + +import com.atlassian.xmlrpc.ServiceBean; + +@ServiceBean +public class RemoteRepository + implements Serializable +{ + private String id; + + private String name; + + private String url; + + private String layout; + + public boolean equals(Object other) + { + if ( this == other) + { + return true; + } + + if ( !(other instanceof RemoteRepository) ) + { + return false; + } + + RemoteRepository that = (RemoteRepository) other; + boolean result = true; + result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) ); + return result; + } + + public String getId() + { + return this.id; + } + + public String getLayout() + { + return this.layout; + } + + public String getName() + { + return this.name; + } + + public String getUrl() + { + return this.url; + } + + public int hashCode() + { + int result = 17; + long tmp; + result = 37 * result + ( id != null ? id.hashCode() : 0 ); + return result; + } + + public void setId(String id) + { + this.id = id; + } + + public void setLayout(String layout) + { + this.layout = layout; + } + + public void setName(String name) + { + this.name = name; + } + + public void setUrl(String url) + { + this.url = url; + } + + public java.lang.String toString() + { + StringBuffer buf = new StringBuffer(); + buf.append( "id = '" ); + buf.append( getId() + "'" ); + return buf.toString(); + } +} \ No newline at end of file Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/mdo/archiva-service.xml URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/mdo/archiva-service.xml?rev=703043&r1=703042&r2=703043&view=diff ============================================================================== --- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/mdo/archiva-service.xml (original) +++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/mdo/archiva-service.xml Wed Oct 8 19:09:09 2008 @@ -1,105 +0,0 @@ - - - - archiva-client - ArchivaClient - 1.0.0 - Archiva web services model. - - - package - org.apache.archiva.web.xmlrpc.api - - - - - ManagedRepository - 1.0.0+ - - - - id - 1.0.0+ - true - String - true - - - name - 1.0.0+ - String - - - url - 1.0.0+ - String - - - layout - 1.0.0+ - String - - - snapshots - 1.0.0+ - boolean - - - releases - 1.0.0+ - boolean - - - - - RemoteRepository - 1.0.0+ - - - - id - 1.0.0+ - true - String - true - - - name - 1.0.0+ - String - - - url - 1.0.0+ - String - - - layout - 1.0.0+ - String - - - - - 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=703043&r1=703042&r2=703043&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 19:09:09 2008 @@ -37,6 +37,10 @@ archiva-xmlrpc-api + org.apache.archiva + archiva-configuration + + javax.servlet servlet-api @@ -44,5 +48,9 @@ org.springframework spring-web + + org.codehaus.plexus + plexus-spring + 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=703043&r1=703042&r2=703043&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 19:09:09 2008 @@ -22,15 +22,24 @@ import java.util.List; import org.apache.archiva.web.xmlrpc.api.AdministrationService; -import org.apache.archiva.web.xmlrpc.api.ManagedRepository; -import org.apache.archiva.web.xmlrpc.api.RemoteRepository; +import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository; +import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; public class AdministrationServiceImpl implements AdministrationService { - + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + public boolean configureDatabaseConsumer( String consumerId, boolean enable ) { + //Configuration config = archivaConfiguration.getConfiguration(); + + // TODO Auto-generated method stub return false; } @@ -65,7 +74,7 @@ return null; } - public List getAllRepositoryConsumers( String repoId ) + public List getAllRepositoryConsumers() { // TODO Auto-generated method stub return null; Added: 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=703043&view=auto ============================================================================== --- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java (added) +++ 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 19:09:09 2008 @@ -0,0 +1,328 @@ +package org.apache.archiva.web.xmlrpc.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +import org.apache.archiva.web.xmlrpc.api.AdministrationService; +import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository; +import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; +import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; +import org.codehaus.plexus.spring.PlexusInSpringTestCase; +import org.easymock.MockControl; +import org.easymock.classextension.MockClassControl; + +/** + * + * @version $Id$ + */ +public class AdministrationServiceImplTest + extends PlexusInSpringTestCase +{ + private MockControl archivaConfigControl; + + private ArchivaConfiguration archivaConfig; + + private MockControl configControl; + + private Configuration config; + + private AdministrationService service; + + protected void setUp() + throws Exception + { + super.setUp(); + + archivaConfigControl = MockControl.createControl( ArchivaConfiguration.class ); + archivaConfig = ( ArchivaConfiguration ) archivaConfigControl.getMock(); + + configControl = MockClassControl.createControl( Configuration.class ); + config = ( Configuration ) configControl.getMock(); + + service = new AdministrationServiceImpl(); + } + + 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" ); + + // test enable + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); + configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning ); + + config.setDatabaseScanning( dbScanning ); + configControl.setMatcher( MockControl.ALWAYS_MATCHER ); + configControl.setVoidCallable(); + + archivaConfig.save( config ); + archivaConfigControl.setVoidCallable(); + + archivaConfigControl.replay(); + configControl.replay(); + + boolean success = service.configureDatabaseConsumer( "new-cleanup-consumer", true ); + + archivaConfigControl.verify(); + configControl.verify(); + + assertTrue( success ); + + // test disable + archivaConfigControl.reset(); + configControl.reset(); + + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); + configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning ); + + config.setDatabaseScanning( dbScanning ); + configControl.setMatcher( MockControl.ALWAYS_MATCHER ); + configControl.setVoidCallable(); + + archivaConfig.save( config ); + archivaConfigControl.setVoidCallable(); + + archivaConfigControl.replay(); + configControl.replay(); + + success = service.configureDatabaseConsumer( "new-cleanup-consumer", false ); + + archivaConfigControl.verify(); + configControl.verify(); + + assertTrue( success );*/ + } + + public void testConfigureInvalidDatabaseConsumer() + throws Exception + { + + } + + public void testConfigureValidRepositoryConsumer() + throws Exception + { + // test enable & disable + } + + public void testConfigureInvalidRepositoryConsumer() + throws Exception + { + + } + + public void testDeleteArtifactArtifactExists() + throws Exception + { + + } + + public void testDeleteArtifactArtifactDoesNotExist() + throws Exception + { + + } + + public void testDeleteArtifacRepositoryDoesNotExist() + throws Exception + { + + } + + public void testExecuteRepoScannerRepoExists() + throws Exception + { + + } + + public void testExecuteRepoScannerRepoDoesNotExist() + throws Exception + { + + } + + public void testExecuteDbScanner() + throws Exception + { + + } + + 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" ); + + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); + configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning ); + + archivaConfigControl.replay(); + configControl.replay(); + + List 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 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 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 testGetAllManagedRepositories() + throws Exception + { + /*List managedRepos = new ArrayList(); + managedRepos.add( createManagedRepo( "internal", "default", "Internal Repository", true, false ) ); + managedRepos.add( createManagedRepo( "snapshots", "default", "Snapshots Repository", false, true ) ); + + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); + configControl.expectAndReturn( config.getManagedRepositories(), managedRepos ); + + archivaConfigControl.replay(); + configControl.replay(); + + List repos = service.getAllManagedRepositories(); + + archivaConfigControl.verify(); + configControl.verify(); + + assertNotNull( repos ); + assertEquals( 2, repos.size() ); + + assertManagedRepo( ( ManagedRepository ) repos.get( 0 ), managedRepos.get( 0 ) ); + assertManagedRepo( ( ManagedRepository ) repos.get( 1 ), managedRepos.get( 1 ) );*/ + } + + public void testGetAllRemoteRepositories() + throws Exception + { + /*List remoteRepos = new ArrayList(); + remoteRepos.add( createRemoteRepository( "central", "Central Repository", "default", "http://repo1.maven.org/maven2") ); + remoteRepos.add( createRemoteRepository( "dummy", "Dummy Remote Repository", "legacy", "http://dummy.com/dummy") ); + + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); + configControl.expectAndReturn( config.getRemoteRepositories(), remoteRepos ); + + archivaConfigControl.replay(); + configControl.replay(); + + List repos = service.getAllRemoteRepositories(); + + archivaConfigControl.verify(); + configControl.verify(); + + assertNotNull( repos ); + assertEquals( 2, repos.size() ); + + assertRemoteRepo( (RemoteRepository) repos.get( 0 ), remoteRepos.get( 0 ) ); + assertRemoteRepo( (RemoteRepository) repos.get( 1 ), remoteRepos.get( 1 ) ); */ + } + + private void assertRemoteRepo( RemoteRepository remoteRepo, RemoteRepositoryConfiguration expectedRepoConfig ) + { + assertEquals( expectedRepoConfig.getId(), remoteRepo.getId() ); + assertEquals( expectedRepoConfig.getLayout(), remoteRepo.getLayout() ); + assertEquals( expectedRepoConfig.getName(), remoteRepo.getName() ); + assertEquals( expectedRepoConfig.getUrl(), remoteRepo.getUrl() ); + } + + private RemoteRepositoryConfiguration createRemoteRepository(String id, String name, String layout, String url) + { + RemoteRepositoryConfiguration remoteConfig = new RemoteRepositoryConfiguration(); + remoteConfig.setId( id ); + remoteConfig.setName( name ); + remoteConfig.setLayout( layout ); + remoteConfig.setUrl( url ); + + return remoteConfig; + } + + private void assertManagedRepo( ManagedRepository managedRepo, ManagedRepositoryConfiguration expectedRepoConfig ) + { + assertEquals( expectedRepoConfig.getId(), managedRepo.getId() ); + assertEquals( expectedRepoConfig.getLayout(), managedRepo.getLayout() ); + assertEquals( expectedRepoConfig.getName(), managedRepo.getName() ); + assertEquals( "http://localhost:8080/archiva/repository/" + expectedRepoConfig.getId(), managedRepo.getUrl() ); + assertEquals( expectedRepoConfig.isReleases(), managedRepo.isReleases() ); + assertEquals( expectedRepoConfig.isSnapshots(), managedRepo.isSnapshots() ); + } + + private ManagedRepositoryConfiguration createManagedRepo( String id, String layout, String name, + boolean hasReleases, boolean hasSnapshots ) + { + ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration(); + repoConfig.setId( id ); + repoConfig.setLayout( layout ); + repoConfig.setName( name ); + repoConfig.setReleases( hasReleases ); + repoConfig.setSnapshots( hasSnapshots ); + + return repoConfig; + } + +} \ No newline at end of file Added: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.xml URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.xml?rev=703043&view=auto ============================================================================== --- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.xml (added) +++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.xml Wed Oct 8 19:09:09 2008 @@ -0,0 +1,27 @@ + + + + org.apache.maven.archiva.configuration.ArchivaConfiguration + org.apache.maven.archiva.configuration.DefaultArchivaConfiguration + + + org.codehaus.plexus.registry.Registry + configured + + + + + org.codehaus.plexus.registry.Registry + configured + org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry + + + + + + + + + + \ No newline at end of file