continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r1151797 - in /continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client: pom.xml src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
Date Thu, 28 Jul 2011 11:29:10 GMT
Author: oching
Date: Thu Jul 28 11:29:10 2011
New Revision: 1151797

URL: http://svn.apache.org/viewvc?rev=1151797&view=rev
Log:
[CONTINUUM-2641] Exceptions thrown by ContinuumXmlRpcClient when used by multiple threads
o used commons transport factory in ContinuumXmlRpcClient instead of default
o added test for this issue in SampleClient (contributed by Carlos Sanchez) 

Modified:
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/pom.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-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/pom.xml?rev=1151797&r1=1151796&r2=1151797&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/pom.xml (original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/pom.xml Thu Jul 28 11:29:10 2011
@@ -36,6 +36,32 @@ under the License.
       <groupId>org.apache.xmlrpc</groupId>
       <artifactId>xmlrpc-client</artifactId>
     </dependency>
+    <dependency>
+      <groupId>commons-httpclient</groupId>
+      <artifactId>commons-httpclient</artifactId>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>runtime</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
@@ -44,13 +70,13 @@ under the License.
         <artifactId>exec-maven-plugin</artifactId>
         <configuration>
           <executable>java</executable>
+          <mainClass>org.apache.maven.continuum.xmlrpc.client.SampleClient</mainClass>
           <arguments>
-            <argument>-Dmyproperty=myvalue</argument>
-            <argument>-classpath</argument>
+            <!--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.maven.continuum.xmlrpc.client.SampleClient</argument>
+            <!--classpath /-->
             <argument>${url}/xmlrpc</argument>
             <argument>${username}</argument>
             <argument>${password}</argument>

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=1151797&r1=1151796&r2=1151797&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 Jul 28 11:29:10 2011
@@ -52,6 +52,7 @@ import org.apache.maven.continuum.xmlrpc
 import org.apache.maven.continuum.xmlrpc.system.SystemConfiguration;
 import org.apache.xmlrpc.client.XmlRpcClient;
 import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;
 import org.apache.xmlrpc.client.util.ClientFactory;
 
 /**
@@ -102,6 +103,7 @@ public class ContinuumXmlRpcClient
         config.setServerURL( serviceUrl );
 
         XmlRpcClient client = new XmlRpcClient();
+        client.setTransportFactory( new XmlRpcCommonsTransportFactory( client ) );
         client.setConfig( config );
         ClientFactory factory = new ClientFactory( client );
         continuum = (ContinuumService) factory.newInstance( ContinuumService.class );

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java?rev=1151797&r1=1151796&r2=1151797&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
Thu Jul 28 11:29:10 2011
@@ -27,6 +27,7 @@ import org.apache.maven.continuum.xmlrpc
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
 import org.apache.maven.continuum.xmlrpc.project.BuildResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
+import org.apache.maven.continuum.xmlrpc.project.ContinuumProjectState;
 import org.apache.maven.continuum.xmlrpc.project.ProjectDependency;
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary;
 import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
@@ -36,6 +37,7 @@ import org.apache.maven.continuum.xmlrpc
 import org.apache.maven.continuum.xmlrpc.system.Installation;
 
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
@@ -51,7 +53,46 @@ public class SampleClient
         throws Exception
     {
         client = new ContinuumXmlRpcClient( new URL( args[0] ), args[1], args[2] );
-/*
+
+        /*
+        // Test for [CONTINUUM-2641]:
+        // make sure to set the projectIds to the actual projectIds of your projects added
in Continuum
+        int projectIds[] = new int[] { 2, 3, 4, 5, 6 };
+
+        List<Thread> threads = new ArrayList<Thread>();
+
+        for ( int i = 0; i < projectIds.length; i++ )
+        {
+            final int order = i;
+            final int projectId = projectIds[i];
+            Runnable task = new Runnable (){
+                public void run()
+                {
+                    BuildTrigger buildTrigger = new BuildTrigger();
+                    buildTrigger.setTrigger( ContinuumProjectState.TRIGGER_FORCED );
+                    buildTrigger.setTriggeredBy( "admin" );
+                    System.out.println( "Building project #" + order + " '" + projectId +
"'.." );
+                    try
+                    {
+                        client.buildProject( projectId, buildTrigger );
+                    }
+                    catch ( Exception e )
+                    {
+                        throw new RuntimeException( e );
+                    }
+                }
+            };
+            threads.add(new Thread(task));
+        }
+        
+        for ( Thread thread : threads )
+        {
+            thread.start();
+        }
+        */
+
+
+      /*
         System.out.println( "Adding project..." );
         AddingResult result = client.addMavenTwoProject( "http://svn.apache.org/repos/asf/continuum/sandbox/simple-example/pom.xml"
);
         if ( result.hasErrors() )
@@ -93,9 +134,8 @@ public class SampleClient
             Thread.sleep( 1000 );
         }
 
-        System.out.println();*/
+        System.out.println();    */
 
-        
         BuildDefinition buildDef = new BuildDefinition();
         buildDef.setArguments( "A-Za-z0-9_./=,\": \\-" );
         buildDef.setSchedule( client.getSchedule( 1 ) );



Mime
View raw message