continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1049444 - in /continuum/trunk: continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ continuum-core/src/te...
Date Wed, 15 Dec 2010 07:18:29 GMT
Author: ctan
Date: Wed Dec 15 07:18:28 2010
New Revision: 1049444

URL: http://svn.apache.org/viewvc?rev=1049444&view=rev
Log:
[CONTINUUM-2597] ability to retrieve the operating system name of the build agent through
web service

Submitted by: Mark John Kennedy L. Magallanes

Added:
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SampleBuildAgentClient.java
Modified:
    continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
    continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
    continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/pom.xml
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/pom.xml
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
    continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentService.java
Wed Dec 15 07:18:28 2010
@@ -125,4 +125,13 @@ public interface ContinuumBuildAgentServ
         throws ContinuumBuildAgentException;
 
     boolean ping();
+    
+    /**
+     * Get build agent's platform.
+     * 
+     * @return The operating system name of the build agent
+     * @throws Exception
+     */
+    String getBuildAgentPlatform()
+        throws ContinuumBuildAgentException;
 }

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/ContinuumBuildAgentServiceImpl.java
Wed Dec 15 07:18:28 2010
@@ -1019,6 +1019,20 @@ public class ContinuumBuildAgentServiceI
         return Boolean.TRUE;
     }
 
+    public String getBuildAgentPlatform() 
+        throws ContinuumBuildAgentException
+    {
+        try
+        {
+            return System.getProperty( "os.name" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error in when trying to get build agent's platform", e );
+            throw new ContinuumBuildAgentException( "Error in when trying to get build agent's
platform", e );
+        }
+    }
+
     private void processProject( String workingDirectory, String pomFilename, boolean autoVersionSubmodules,
                                  List<Map<String, String>> projects )
         throws Exception

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/stubs/SlaveBuildAgentTransportClientStub.java
Wed Dec 15 07:18:28 2010
@@ -274,4 +274,10 @@ public class SlaveBuildAgentTransportCli
         return null;
     }
 
+    public String getBuildAgentPlatform()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/pom.xml?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/pom.xml
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-master/continuum-distributed-master-client/pom.xml
Wed Dec 15 07:18:28 2010
@@ -46,4 +46,28 @@ under the License.
       <artifactId>slf4j-api</artifactId>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <configuration>
+          <executable>java</executable>
+          <arguments>
+            <argument>-Dmyproperty=myvalue</argument>
+            <argument>-classpath</argument>
+            <!-- automatically creates the classpath using all project dependencies, also
adding the project build directory -->
+            <classpath />
+            <argument>org.apache.continuum.distributed.transport.slave.SampleBuildAgentClient</argument>
+            <argument>${url}/xmlrpc</argument>
+          </arguments>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <properties>
+    <url>http://localhost:${port}/continuum-buildagent</url>
+    <port>8181</port>
+  </properties>
 </project>

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-api/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportService.java
Wed Dec 15 07:18:28 2010
@@ -139,4 +139,13 @@ public interface SlaveBuildAgentTranspor
 
     public Boolean removeFromBuildQueue( List<String> hashCodes )
         throws Exception;
+    
+    /**
+     * Get build agent's platform.
+     * 
+     * @return The operating system name of the build agent
+     * @throws Exception
+     */
+    public String getBuildAgentPlatform()
+        throws Exception;
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/pom.xml?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/pom.xml
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/pom.xml
Wed Dec 15 07:18:28 2010
@@ -40,5 +40,38 @@ under the License.
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>compile</scope>
+    </dependency> 
   </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <configuration>
+          <executable>java</executable>
+          <mainClass>org.apache.continuum.distributed.transport.slave.SampleBuildAgentClient</mainClass>
+          <arguments>
+            <argument>${url}/xmlrpc</argument>
+          </arguments>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <properties>
+    <url>http://localhost:${port}/continuum-buildagent</url>
+    <port>8181</port>
+  </properties>
 </project>

Added: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SampleBuildAgentClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SampleBuildAgentClient.java?rev=1049444&view=auto
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SampleBuildAgentClient.java
(added)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SampleBuildAgentClient.java
Wed Dec 15 07:18:28 2010
@@ -0,0 +1,46 @@
+package org.apache.continuum.distributed.transport.slave;
+
+/*
+ * 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.net.MalformedURLException;
+import java.net.URL;
+
+public class SampleBuildAgentClient
+{
+
+    public static void main( String[] args )
+        throws Exception
+    {
+        try
+        {
+            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new
URL( args[0] ) );
+            client.ping();
+            System.out.println( client.getBuildAgentPlatform() );
+        }
+        catch ( MalformedURLException e )
+        {
+            System.out.println( "Invalid Url." + e );
+        }
+        catch ( Exception e )
+        {
+            System.out.println( "build agent is un reachable. " + e );
+        }
+    }
+}

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-client/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportClient.java
Wed Dec 15 07:18:28 2010
@@ -744,4 +744,19 @@ public class SlaveBuildAgentTransportCli
 
         return result;
     }
+
+    public String getBuildAgentPlatform()
+    throws Exception
+    {
+    
+        try
+        {
+            return slave.getBuildAgentPlatform();
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to return build agent platform", e );
+            throw new Exception( "Failed to return build agent platform", e );
+        }
+    }
 }

Modified: continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java?rev=1049444&r1=1049443&r2=1049444&view=diff
==============================================================================
--- continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
(original)
+++ continuum/trunk/continuum-distributed/continuum-distributed-slave/continuum-distributed-slave-server/src/main/java/org/apache/continuum/distributed/transport/slave/SlaveBuildAgentTransportServer.java
Wed Dec 15 07:18:28 2010
@@ -555,4 +555,10 @@ public class SlaveBuildAgentTransportSer
 
         return result;
     }
+
+    public String getBuildAgentPlatform()
+        throws Exception
+    {
+        return continuumBuildAgentService.getBuildAgentPlatform();
+    }
 }



Mime
View raw message