continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1165986 - in /continuum/trunk/continuum-xmlrpc: continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ continuum-xmlrpc-api/src/main/mdo/ continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ contin...
Date Wed, 07 Sep 2011 03:04:14 GMT
Author: ctan
Date: Wed Sep  7 03:04:14 2011
New Revision: 1165986

URL: http://svn.apache.org/viewvc?rev=1165986&view=rev
Log:
[CONTINUUM-2668] additional method in XMLRPC to retrieve enabled agents with their installations

Modified:
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/test/java/org/apache/continuum/xmlrpc/server/ContinuumServiceImplTest.java

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java?rev=1165986&r1=1165985&r2=1165986&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
Wed Sep  7 03:04:14 2011
@@ -1850,6 +1850,23 @@ public interface ContinuumService
      */
     List<Object> getAllBuildAgentsRPC();
 
+    /**
+     * Retrieve all enabled build agents with their available installations
+     * @return
+     * @throws Exception
+     */
+    List<BuildAgentConfiguration> getBuildAgentsWithInstallations()
+        throws Exception;
+
+    /**
+     * Same method but compatible with standard XMLRPC
+     * 
+     * @return
+     * @throws Exception
+     */
+    List<Object> getBuildAgentsWithInstallationsRPC()
+        throws Exception;
+    
     boolean pingBuildAgent( String buildAgentUrl )
         throws Exception;
 

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml?rev=1165986&r1=1165985&r2=1165986&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
Wed Sep  7 03:04:14 2011
@@ -1507,6 +1507,14 @@
           <version>1.4.1+</version>
           <type>String</type>
         </field>
+        <field>
+          <name>installations</name>
+          <version>1.4.1+</version>
+          <association>
+            <type>Installation</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
       </fields>
     </class>
     <class>

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java?rev=1165986&r1=1165985&r2=1165986&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
Wed Sep  7 03:04:14 2011
@@ -1454,4 +1454,16 @@ public class ContinuumXmlRpcClient
     {
         return continuum.removeBuildAgentGroup( name );
     }
+
+    public List<BuildAgentConfiguration> getBuildAgentsWithInstallations()
+        throws Exception
+    {
+        return continuum.getBuildAgentsWithInstallations();
+    }
+
+    public List<Object> getBuildAgentsWithInstallationsRPC()
+        throws Exception
+    {
+        return continuum.getBuildAgentsWithInstallationsRPC();
+    }
 }

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=1165986&r1=1165985&r2=1165986&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Wed Sep  7 03:04:14 2011
@@ -2142,6 +2142,30 @@ public class ContinuumServiceImpl
         return buildAgentConfigurations;
     }
 
+    public List<BuildAgentConfiguration> getBuildAgentsWithInstallations()
+        throws Exception
+    {
+        ConfigurationService configurationService = continuum.getConfiguration();
+
+        List<org.apache.continuum.configuration.BuildAgentConfiguration> buildAgents
=
+            configurationService.getBuildAgents();
+        List<BuildAgentConfiguration> buildAgentConfigurations = new ArrayList<BuildAgentConfiguration>();
+
+        if ( buildAgents != null )
+        {
+            for ( org.apache.continuum.configuration.BuildAgentConfiguration buildAgent :
buildAgents )
+            {
+                if ( buildAgent.isEnabled() )
+                {
+                    BuildAgentConfiguration agent = populateBuildAgent( buildAgent );
+                    agent.setInstallations( getBuildAgentInstallations( buildAgent.getUrl()
) );
+                    buildAgentConfigurations.add( agent );
+                }
+            }
+        }
+        return buildAgentConfigurations;
+    }
+
     // ----------------------------------------------------------------------
     // Build agent group
     // ----------------------------------------------------------------------
@@ -3766,6 +3790,12 @@ public class ContinuumServiceImpl
         return serializeObject( this.getAllBuildAgents() );
     }
 
+    public List<Object> getBuildAgentsWithInstallationsRPC()
+        throws Exception
+    {
+        return serializeObject( this.getBuildAgentsWithInstallations() );
+    }
+
     public Map<String, Object> addBuildAgentGroupRPC( Map<String, Object> buildAgentGroup
) 
         throws ConfigurationException, ConfigurationStoringException, ContinuumConfigurationException
     {

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/test/java/org/apache/continuum/xmlrpc/server/ContinuumServiceImplTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/test/java/org/apache/continuum/xmlrpc/server/ContinuumServiceImplTest.java?rev=1165986&r1=1165985&r2=1165986&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/test/java/org/apache/continuum/xmlrpc/server/ContinuumServiceImplTest.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/test/java/org/apache/continuum/xmlrpc/server/ContinuumServiceImplTest.java
Wed Sep  7 03:04:14 2011
@@ -7,6 +7,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
+import org.apache.continuum.configuration.BuildAgentGroupConfiguration;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
 import org.apache.continuum.xmlrpc.utils.BuildTrigger;
@@ -16,6 +17,7 @@ import org.apache.maven.continuum.config
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
+import org.apache.maven.continuum.xmlrpc.project.BuildAgentConfiguration;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
 import org.apache.maven.continuum.xmlrpc.project.ContinuumProjectState;
 import org.apache.maven.continuum.xmlrpc.project.ReleaseListenerSummary;
@@ -333,6 +335,82 @@ public class ContinuumServiceImplTest
         context.assertIsSatisfied();
     }
 
+    public void testRemoveNonExistingBuildAgentGroup()
+        throws Exception
+    {
+        context.checking( new Expectations() 
+        {
+            {
+                one( continuum ).getConfiguration();
+                will( returnValue( configurationService ) );
+                
+                one( configurationService ).getBuildAgentGroup( "Agent Group Name" );
+                will( returnValue ( null ) );
+                
+                never( configurationService ).removeBuildAgentGroup( with( any( BuildAgentGroupConfiguration.class
) ) );
+            }
+        });
+
+        continuumService.removeBuildAgentGroup( "Agent Group Name" );
+        context.assertIsSatisfied();
+    }
+
+    public void testGetBuildAgentsWithInstallations()
+        throws Exception
+    {
+        final List<org.apache.continuum.configuration.BuildAgentConfiguration> buildAgents
= 
+            new ArrayList<org.apache.continuum.configuration.BuildAgentConfiguration>();
+
+        org.apache.continuum.configuration.BuildAgentConfiguration buildAgent = 
+            new org.apache.continuum.configuration.BuildAgentConfiguration();
+        buildAgent.setUrl( "http://localhost:8080/xmlrpc" );
+        buildAgent.setEnabled( true );
+        buildAgents.add( buildAgent );
+
+        org.apache.continuum.configuration.BuildAgentConfiguration buildAgent2 = 
+            new org.apache.continuum.configuration.BuildAgentConfiguration();
+        buildAgent2.setUrl( "http://localhost:8181/xmlrpc" );
+        buildAgent2.setEnabled( false );
+        buildAgents.add( buildAgent2 );
+
+        final List<org.apache.maven.continuum.model.system.Installation> buildAgentInstallations
= 
+            new ArrayList<org.apache.maven.continuum.model.system.Installation>();
+
+        org.apache.maven.continuum.model.system.Installation buildAgentInstallation = 
+            new org.apache.maven.continuum.model.system.Installation();
+        buildAgentInstallation.setInstallationId( 1 );
+        buildAgentInstallation.setName( "JDK 6" );
+        buildAgentInstallation.setType( "jdk" );
+        buildAgentInstallation.setVarName( "JAVA_HOME" );
+        buildAgentInstallation.setVarValue( "/opt/java" );
+        buildAgentInstallations.add( buildAgentInstallation );
+
+        context.checking( new Expectations()
+        {
+            {
+                one( continuum ).getConfiguration();
+                will( returnValue( configurationService ) );
+
+                one( configurationService ).getBuildAgents();
+                will( returnValue( buildAgents ) );
+
+                one( distributedBuildManager ).getBuildAgentPlatform( "http://localhost:8080/xmlrpc"
);
+                will( returnValue( "Linux" ) );
+
+                one( distributedBuildManager ).getAvailableInstallations( "http://localhost:8080/xmlrpc"
);
+                will( returnValue( buildAgentInstallations ) );
+            }
+        });
+        List<BuildAgentConfiguration> agents = continuumService.getBuildAgentsWithInstallations();
+        assertEquals( 1, agents.size() );
+        BuildAgentConfiguration agent = agents.get( 0 );
+        assertEquals( "http://localhost:8080/xmlrpc", agent.getUrl() );
+        assertEquals( "Linux", agent.getPlatform() );
+        assertEquals( 1, agent.getInstallations().size() );
+
+        context.assertIsSatisfied();
+    }
+
     private BuildDefinition createBuildDefinition()
     {
         BuildDefinition buildDef = new BuildDefinition();



Mime
View raw message