continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r1055810 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-core/src/test/java/org/apache/continuum/b...
Date Thu, 06 Jan 2011 10:01:05 GMT
Author: oching
Date: Thu Jan  6 10:01:04 2011
New Revision: 1055810

URL: http://svn.apache.org/viewvc?rev=1055810&view=rev
Log:
[CONTINUUM-2600] submitted by Mark John Kennedy Magallanes
o set build agent's platform when retrieving build agent from continuum web service + unit
test
o added xmlrpc method for getting the build agent's platform 

Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
    continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java?rev=1055810&r1=1055809&r2=1055810&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
Thu Jan  6 10:01:04 2011
@@ -48,6 +48,9 @@ public interface DistributedBuildManager
 
     List<Installation> getAvailableInstallations( String buildAgentUrl )
         throws ContinuumException;
+    
+    String getBuildAgentPlatform( String buildAgentUrl )
+        throws ContinuumException;
 
     Map<String, List<PrepareBuildProjectsTask>> getProjectsInPrepareBuildQueue()
         throws ContinuumException;
@@ -100,4 +103,4 @@ public interface DistributedBuildManager
 
     boolean isProjectCurrentlyBuilding( int projectId, int buildDefinitionId )
         throws ContinuumException;
-}
\ No newline at end of file
+}

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java?rev=1055810&r1=1055809&r2=1055810&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
Thu Jan  6 10:01:04 2011
@@ -595,6 +595,28 @@ public class DefaultDistributedBuildMana
         return map;
     }
 
+    public String getBuildAgentPlatform( String buildAgentUrl )
+        throws ContinuumException
+    {
+        try
+        {
+            String platform = "";
+            if ( isAgentAvailable( buildAgentUrl ) )
+            {
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
buildAgentUrl );
+                platform = client.getBuildAgentPlatform();
+            }
+            // call reload in case we disable the build agent
+            reload();
+            return platform;
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "Unable to get platform of build agent", e );
+        }
+    }
+
+    
     public List<Installation> getAvailableInstallations( String buildAgentUrl )
         throws ContinuumException
     {

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java?rev=1055810&r1=1055809&r2=1055810&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
Thu Jan  6 10:01:04 2011
@@ -318,6 +318,40 @@ public class DefaultDistributedBuildMana
         distributedBuildManagerStub.prepareBuildProjects( projectsBuildDefinitionsMap, buildTrigger,
1, "sample", "scmRootAddress", 1, scmRoots );
     }
     
+    public void testGetBuildAgentPlatform()
+        throws Exception
+    {
+        distributedBuildManager.setOverallDistributedBuildQueues( getMockOverallDistributedBuildQueues(
1 ) );
+        context.checking( new Expectations()
+        {
+            {
+                exactly( 2 ).of( configurationService ).getBuildAgents();
+                will( returnValue( buildAgents ) );
+
+                one( configurationService ).updateBuildAgent( buildAgent1 );
+                one( configurationService ).store();
+
+                exactly( 2 ).of( overallDistributedBuildQueue1 ).getDistributedBuildTaskQueueExecutor();
+                will( returnValue( distributedBuildTaskQueueExecutor ) );
+                
+                one( distributedBuildTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+
+                one( overallDistributedBuildQueue1 ).getProjectsInQueue();
+                will( returnValue( new ArrayList<PrepareBuildProjectsTask>() ) );
+
+                one( overallDistributedBuildQueue1 ).getDistributedBuildQueue();
+                will( returnValue( distributedBuildQueue ) );
+
+                one( distributedBuildQueue ).removeAll( new ArrayList<PrepareBuildProjectsTask>()
);
+
+                one( distributedBuildTaskQueueExecutor ).stop();
+            }
+        } );
+        assertEquals( distributedBuildManager.getBuildAgentPlatform( TEST_BUILD_AGENT1 ),
"" );
+        context.assertIsSatisfied();
+    }
+    
     private Map<String, OverallDistributedBuildQueue> getMockOverallDistributedBuildQueues(
int size )
     {
         Map<String, OverallDistributedBuildQueue> overallDistributedBuildQueues =

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=1055810&r1=1055809&r2=1055810&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
Thu Jan  6 10:01:04 2011
@@ -1491,6 +1491,11 @@
           <version>1.4.1+</version>
           <type>boolean</type>
         </field>
+        <field>
+          <name>platform</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
       </fields>
     </class>    
   </classes>

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=1055810&r1=1055809&r2=1055810&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
Thu Jan  6 10:01:04 2011
@@ -84,6 +84,8 @@ import org.codehaus.plexus.redback.autho
 import org.codehaus.plexus.redback.role.RoleManager;
 import org.codehaus.plexus.redback.role.RoleManagerException;
 import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import net.sf.dozer.util.mapping.DozerBeanMapperSingletonWrapper;
 import net.sf.dozer.util.mapping.MapperIF;
@@ -98,6 +100,8 @@ public class ContinuumServiceImpl
 {
     private static final MapperIF mapper = DozerBeanMapperSingletonWrapper.getInstance();
 
+    private final Logger logger = LoggerFactory.getLogger( ContinuumServiceImpl.class );
+    
     /**
      * @plexus.requirement
      */
@@ -2221,7 +2225,19 @@ public class ContinuumServiceImpl
 
     private BuildAgentConfiguration populateBuildAgent( org.apache.continuum.configuration.BuildAgentConfiguration
buildAgent )
     {
-        return (BuildAgentConfiguration) mapper.map( buildAgent, BuildAgentConfiguration.class
);
+        BuildAgentConfiguration buildAgentConfiguration =
+            (BuildAgentConfiguration) mapper.map( buildAgent, BuildAgentConfiguration.class
);
+        try
+        {
+            buildAgentConfiguration.setPlatform( distributedBuildManager.getBuildAgentPlatform(
buildAgentConfiguration.getUrl() ) );
+            return buildAgentConfiguration;
+        }
+        catch ( ContinuumException e )
+        {
+            logger.warn( "Unable to connect to build agent " + buildAgentConfiguration.getUrl()
+ "." , e );
+            buildAgentConfiguration.setPlatform( "" );
+            return buildAgentConfiguration;
+        }
     }
 
     private Map<String, Object> serializeObject( Object o, final String... ignore )



Mime
View raw message