[jboss-svn-commits] JBL Code SVN: r37403 - in labs/jbosstm/trunk/rest-tx/quickstarts: demo and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 12 11:19:52 EDT 2011


Author: mmusgrov
Date: 2011-08-12 11:19:51 -0400 (Fri, 12 Aug 2011)
New Revision: 37403

Modified:
   labs/jbosstm/trunk/rest-tx/quickstarts/demo/test.sh
   labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml
   labs/jbosstm/trunk/rest-tx/quickstarts/service/pom.xml
   labs/jbosstm/trunk/rest-tx/quickstarts/service/src/main/java/quickstart/MultipleParticipants.java
   labs/jbosstm/trunk/rest-tx/quickstarts/simple/src/main/java/RestTransactionExample.java
Log:
[JBTM-747]

Modified: labs/jbosstm/trunk/rest-tx/quickstarts/demo/test.sh
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/demo/test.sh	2011-08-12 14:48:25 UTC (rev 37402)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/demo/test.sh	2011-08-12 15:19:51 UTC (rev 37403)
@@ -28,7 +28,7 @@
 #mvn compile exec:java -Dexec.mainClass=quickstart.TransactionAwareResource -Dexec.args="-a 127.0.0.1:8081"
 	ep="172.17.130.188:8081"
 	ep="127.0.0.1:8081"
-	auth="127.0.0.1:8080"
+	auth="127.0.0.1:9090"
 	proxies=0
 fi
 

Modified: labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml	2011-08-12 14:48:25 UTC (rev 37402)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml	2011-08-12 15:19:51 UTC (rev 37403)
@@ -57,6 +57,15 @@
       </plugin>
     </plugins>
   </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-logmanager</artifactId>
+      <version>2.2.0.CR2</version>
+    </dependency>
+  </dependencies>
+
   <modules>
     <module>simple</module>
     <module>service</module>

Modified: labs/jbosstm/trunk/rest-tx/quickstarts/service/pom.xml
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/service/pom.xml	2011-08-12 14:48:25 UTC (rev 37402)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/service/pom.xml	2011-08-12 15:19:51 UTC (rev 37403)
@@ -51,6 +51,7 @@
       <artifactId>rest-tx-api</artifactId>
       <version>5.0.0.M1-SNAPSHOT</version>
     </dependency>
+
     <!-- Jersey container for running participant services -->
     <dependency>
       <groupId>com.sun.jersey</groupId>

Modified: labs/jbosstm/trunk/rest-tx/quickstarts/service/src/main/java/quickstart/MultipleParticipants.java
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/service/src/main/java/quickstart/MultipleParticipants.java	2011-08-12 14:48:25 UTC (rev 37402)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/service/src/main/java/quickstart/MultipleParticipants.java	2011-08-12 15:19:51 UTC (rev 37403)
@@ -24,21 +24,22 @@
 import java.net.HttpURLConnection;
 
 public class MultipleParticipants {
-    // construct the well known http endpoint for the REST Atomic Transactions coordinator
-    private static final int host = 0;
-    private static final String[] hosts = {"localhost:8080", "184.72.71.236", "jbossapp1-mmusgrov1.dev.rhcloud.com"};
-    private static final String TXN_MGR_URL = "http://" + hosts[host] + "/rest-tx/tx/transaction-manager";
-
     // construct the endpoint for the example web service that will take part in a transaction
     private static final int SERVICE_PORT = 58082;
     private static final String SERVICE_URL =  "http://localhost:" + SERVICE_PORT + '/' + TransactionAwareResource.PSEGMENT;
 
     public static void main(String[] args) {
+        String authority = "localhost:8080";  //"184.72.71.236", "jbossapp1-mmusgrov1.dev.rhcloud.com"
+
+        if (args.length > 1 && "-h".equals(args[0]))
+            authority = args[1];
+
+//        authority = "eapp-mmusgrov.dev.rhcloud.com";
         // the example uses an embedded JAX-RS server for running the service that will take part in a transaction
         JaxrsServer.startServer("localhost", SERVICE_PORT);
 
         // get a helper for using REST Atomic Transactions, passing in the well know resource endpoint for the transaction coordinator
-        TxSupport txn = new TxSupport(TXN_MGR_URL);
+        TxSupport txn = new TxSupport("http://" + authority + "/rest-tx/tx/transaction-manager");
 
         // start a REST Atomic transaction
         txn.startTx();
@@ -64,13 +65,13 @@
         // the web service should have received prepare and commit requests from the transaction coordinator (TXN_MGR_URL) for each work unit
         String cnt = txn.httpRequest(new int[] {HttpURLConnection.HTTP_OK}, SERVICE_URL + "/query", "GET", TxSupport.PLAIN_MEDIA_TYPE, null, null);
 
+        // shutdown the embedded JAX-RS server
+        JaxrsServer.stopServer();
+
         // check that the service has been asked to commit twice
         if ("2".equals(cnt))
             System.out.println("SUCCESS: Both service work loads received commit requests");
         else
-            System.out.println("FAILURE: At leas one server work load did not receive a commit request: " + cnt);
-
-        // shutdown the embedded JAX-RS server
-        JaxrsServer.stopServer();
+            throw new RuntimeException("FAILURE: At least one server work load did not receive a commit request: " + cnt);
     }
 }

Modified: labs/jbosstm/trunk/rest-tx/quickstarts/simple/src/main/java/RestTransactionExample.java
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/simple/src/main/java/RestTransactionExample.java	2011-08-12 14:48:25 UTC (rev 37402)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/simple/src/main/java/RestTransactionExample.java	2011-08-12 15:19:51 UTC (rev 37403)
@@ -21,11 +21,12 @@
 import org.jboss.jbossts.star.util.TxSupport;
 
 public class RestTransactionExample {
-    private static final String[] hosts = {"localhost:8080"};
-    private static final String TXN_MGR_URL = "http://" + hosts[0] + "/rest-tx/tx/transaction-manager";
+    private static final String[] authorities = {"172.17.130.188:8080", "localhost:8080"};
+    private static final String TXN_MGR_URL = "http://" + authorities[1]  + "/rest-tx/tx/transaction-manager";
 
+    //-Dhttp.proxyHost=file.rdu.redhat.com -Dhttp.proxyPort=3128
     public static void main(String args[]) throws Exception {
-        // create a helper with the desired transaction manager resource endpoint
+        // create a helper with thin(e desired transaction manager resource endpoint
         TxSupport txn = new TxSupport(TXN_MGR_URL);
 
         // start a transaction
@@ -52,5 +53,4 @@
 
         System.out.println("Success");
     }
-
 }



More information about the jboss-svn-commits mailing list