continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1141559 - 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, 30 Jun 2011 14:59:50 GMT
Author: ctan
Date: Thu Jun 30 14:59:49 2011
New Revision: 1141559

URL: http://svn.apache.org/viewvc?rev=1141559&view=rev
Log:
[CONTINUUM-2637] expose method to ping build agent from continuum master xmlrpc

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/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    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

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=1141559&r1=1141558&r2=1141559&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 Jun 30 14:59:49 2011
@@ -92,6 +92,9 @@ public interface DistributedBuildManager
     boolean isAgentAvailable( String buildAgentUrl )
         throws ContinuumException;
 
+    boolean pingBuildAgent( String buildAgentUrl )
+        throws ContinuumException;
+
     boolean isProjectInAnyPrepareBuildQueue( int projectId, int buildDefinitionId )
         throws ContinuumException;
 

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=1141559&r1=1141558&r2=1141559&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 Jun 30 14:59:49 2011
@@ -1470,22 +1470,40 @@ public class DefaultDistributedBuildMana
     {
         try
         {
+            if ( pingBuildAgent( buildAgentUrl ) )
+            {
+                return true;
+            }
+        }
+        catch ( Exception e )
+        {
+            log.warn( "Disable build agent: {}; Unable to ping due to {}", buildAgentUrl,
 e );
+        }
+
+        // disable it
+        disableBuildAgent( buildAgentUrl );
+
+        return false;
+    }
+
+    public boolean pingBuildAgent( String buildAgentUrl )
+        throws ContinuumException
+    {
+        try
+        {
             SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
buildAgentUrl );
 
             return client.ping();
         }
         catch ( MalformedURLException e )
         {
-            log.warn( "Invalid build agent url" + buildAgentUrl );
+            log.warn( "Invalid build agent url {}", buildAgentUrl );
         }
         catch ( Exception e )
         {
-            log.warn( "Unable to ping build agent: " + buildAgentUrl + "; disabling it..."
);
+            throw new ContinuumException( "Unable to ping build agent " + buildAgentUrl +
" : " + e.getMessage() );
         }
 
-        // disable it
-        disableBuildAgent( buildAgentUrl );
-
         return false;
     }
 

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=1141559&r1=1141558&r2=1141559&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 Jun 30 14:59:49 2011
@@ -354,7 +354,22 @@ public class DefaultDistributedBuildMana
         assertEquals( distributedBuildManager.getBuildAgentPlatform( TEST_BUILD_AGENT1 ),
"" );
         context.assertIsSatisfied();
     }
-    
+
+    public void testBuildAgentIsAvailable()
+        throws Exception
+    {
+        assertTrue( distributedBuildManagerStub.isAgentAvailable( TEST_BUILD_AGENT1 ) );
+        context.checking( new Expectations()
+        {
+            {
+                never( configurationService ).getBuildAgents();
+                never( configurationService ).updateBuildAgent( buildAgent1 );
+                never( configurationService ).store();
+            }
+        } );
+        context.assertIsSatisfied();
+    }
+
     private Map<String, OverallDistributedBuildQueue> getMockOverallDistributedBuildQueues(
int size )
     {
         Map<String, OverallDistributedBuildQueue> overallDistributedBuildQueues =

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=1141559&r1=1141558&r2=1141559&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
Thu Jun 30 14:59:49 2011
@@ -1752,4 +1752,6 @@ public interface ContinuumService
      */
     List<Object> getAllBuildAgentsRPC();
 
+    boolean pingBuildAgent( String buildAgentUrl )
+        throws Exception;
 }

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=1141559&r1=1141558&r2=1141559&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
Thu Jun 30 14:59:49 2011
@@ -1339,4 +1339,10 @@ public class ContinuumXmlRpcClient
     {
         return continuum.getProjectReleaseAndDevelopmentVersions( projectId, pomFilename,
autoVersionSubmodules );
     }
+
+    public boolean pingBuildAgent( String buildAgentUrl )
+        throws Exception
+    {
+        return continuum.pingBuildAgent( buildAgentUrl );
+    }
 }

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=1141559&r1=1141558&r2=1141559&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 Jun 30 14:59:49 2011
@@ -3860,6 +3860,12 @@ public class ContinuumServiceImpl
         return (ReleaseListenerSummary) mapper.map( listener, ReleaseListenerSummary.class
);
     }
 
+    public boolean pingBuildAgent( String buildAgentUrl )
+        throws Exception
+    {
+        return distributedBuildManager.pingBuildAgent( buildAgentUrl );
+    }
+
     private List getList( Object obj )
     {
         List<Object> list = new ArrayList<Object>();



Mime
View raw message