archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
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 GMT
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 @@
   </bean>
   
   <bean name="testXmlRpcService" lazy-init="true" scope="singleton" class="org.apache.maven.archiva.web.xmlrpc.services.PingServiceImpl"/>
+  
+  <bean name="administrationXmlRpcService" lazy-init="true" scope="singleton" class="org.apache.maven.archiva.web.xmlrpc.services.AdministrationServiceImpl"/>
 
   <bean name="xmlrpcServicesList" class="java.util.ArrayList">
     <constructor-arg>
         <ref bean="testXmlRpcService"/>
+        <ref bean="administrationXmlRpcService"/>
     </constructor-arg>
   </bean>
 

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 @@
       <groupId>com.atlassian.xmlrpc</groupId>
       <artifactId>atlassian-xmlrpc-binder-annotations</artifactId>
     </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.codehaus.modello</groupId>
-        <artifactId>modello-maven-plugin</artifactId>
-        <version>1.0-alpha-15</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>java</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <version>1.0.0</version>
-          <model>src/main/mdo/archiva-service.xml</model>
-          <packageWithVersion>false</packageWithVersion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+  </dependencies>  
 </project>

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<String> getAllRepositoryConsumers( String repoId );
+    public List<String> getAllRepositoryConsumers();
 
     public List<ManagedRepository> 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 @@
-<?xml version="1.0" ?>
-<!--
-  ~ 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.
-  -->
-<model>
-  <id>archiva-client</id>
-  <name>ArchivaClient</name>
-  <version>1.0.0</version>
-  <description>Archiva web services model.</description>
-  <defaults>
-    <default>
-      <key>package</key>
-      <value>org.apache.archiva.web.xmlrpc.api</value>
-    </default>
-  </defaults>
-  <classes>
-    <class>
-      <name>ManagedRepository</name>
-      <version>1.0.0+</version>
-      <description><![CDATA[
-        This class represents a managed repository.
-      ]]></description>
-      <fields>
-        <field>
-          <name>id</name>
-          <version>1.0.0+</version>
-          <required>true</required>
-          <type>String</type>
-          <identifier>true</identifier>
-        </field>
-        <field>
-          <name>name</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>url</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>layout</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>snapshots</name>
-          <version>1.0.0+</version>
-          <type>boolean</type>
-        </field>
-        <field>
-          <name>releases</name>
-          <version>1.0.0+</version>
-          <type>boolean</type>
-        </field>
-      </fields>
-    </class>    
-    <class>
-      <name>RemoteRepository</name>
-      <version>1.0.0+</version>
-      <description><![CDATA[
-        This class represents a remote repository.
-      ]]></description>
-      <fields>
-        <field>
-          <name>id</name>
-          <version>1.0.0+</version>
-          <required>true</required>
-          <type>String</type>
-          <identifier>true</identifier>
-        </field>
-        <field>
-          <name>name</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>url</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>layout</name>
-          <version>1.0.0+</version>
-          <type>String</type>
-        </field>
-      </fields>
-    </class>        
-  </classes>
-</model>

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 @@
       <artifactId>archiva-xmlrpc-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-configuration</artifactId>
+    </dependency>
+    <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
     </dependency>
@@ -44,5 +48,9 @@
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-spring</artifactId>
+    </dependency>
   </dependencies>
 </project>

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<String> getAllRepositoryConsumers( String repoId )
+    public List<String> 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<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 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 testGetAllManagedRepositories()
+        throws Exception
+    {
+        /*List<ManagedRepositoryConfiguration> managedRepos = new ArrayList<ManagedRepositoryConfiguration>();
       
+        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<ManagedRepository> 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<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") );
+        
+        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
+        configControl.expectAndReturn( config.getRemoteRepositories(), remoteRepos );
+        
+        archivaConfigControl.replay();
+        configControl.replay();
+        
+        List<RemoteRepository> 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 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+      <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.registry.Registry</role>
+          <role-hint>configured</role-hint>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.codehaus.plexus.registry.Registry</role>
+      <role-hint>configured</role-hint>
+      <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
+      <configuration>
+        <properties>
+          <system/>
+          <xml fileName="${basedir}/target/test-conf/archiva.xml"
+               config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
+        </properties>
+      </configuration>
+    </component>
+    
+  </components>
+</component-set>
\ No newline at end of file



Mime
View raw message