geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r803207 - in /geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests: jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/RollbackTest.java jms-ejb/src/main/java/org/apache/geronimo/jms/test/bmt/JmsBmtBean.java
Date Tue, 11 Aug 2009 17:12:44 GMT
Author: djencks
Date: Tue Aug 11 17:12:44 2009
New Revision: 803207

URL: http://svn.apache.org/viewvc?rev=803207&view=rev
Log:
GERONIMO-4784 improve test slightly

Modified:
    geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/RollbackTest.java
    geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/bmt/JmsBmtBean.java

Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/RollbackTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/RollbackTest.java?rev=803207&r1=803206&r2=803207&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/RollbackTest.java
(original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ear/src/test/java/org/apache/geronimo/testsuite/enterprise/jms/RollbackTest.java
Tue Aug 11 17:12:44 2009
@@ -40,8 +40,8 @@
      *
      * @throws Exception if exception occurs
      */
-    @Test
-    public void testRollback() throws Exception {
+//    @Test
+    public void XXtestRollbackQUeueAndTopic() throws Exception {
         InitialContext ctx = new InitialContext();
         String totalShipStr = System.getProperty("total-shipment");
         String msgsPerShipStr = System.getProperty("requests-per-shipment");
@@ -67,14 +67,74 @@
             if (!pass) {
                 throw new Exception("Failed, see out and logs");
             }
-            //enable is receiveMessage is modified to detect messages on request queue
-/*
-            Thread.sleep(10000);
-            Integer id = jmsSender.receiveMessage();
-            if (id != null) {
-                throw new Exception("received request message: " + id);
+        } else {
+            throw new Exception("Sender is null");
+        }
+    }
+
+    /**
+     * Creates customer instance
+     *
+     * @throws Exception if exception occurs
+     */
+    @Test
+    public void testRollbackQueue() throws Exception {
+        InitialContext ctx = new InitialContext();
+        String totalShipStr = System.getProperty("total-shipment");
+        String msgsPerShipStr = System.getProperty("requests-per-shipment");
+
+        int totalShip = (totalShipStr == null ? 10 : Integer.parseInt(totalShipStr));
+        int msgsPerShip = (msgsPerShipStr == null ? 20 : Integer.parseInt(msgsPerShipStr));
+
+        JmsBmtRemote jmsSender = (JmsBmtRemote) ctx.lookup("JmsBmtRemote");
+        boolean pass = true;
+        if (jmsSender != null) {
+            System.out.println("JmsBmtRemote initialized");
+            for (int i = 0; i < totalShip; ++i) {
+                String messageName = (i + 1) + ".Request";
+
+                System.out.format("Sending (%1$s) request(s) with name %2$s%n", msgsPerShip,
messageName);
+                String result = jmsSender.sendMessageQueue(messageName, 0, msgsPerShip);
+                System.out.println("QUeue equests sent, result: " + result);
+                if ("FAIL".equals(result)) pass = false;
+            }
+            if (!pass) {
+                throw new Exception("Failed, see out and logs");
+            }
+        } else {
+            throw new Exception("Sender is null");
+        }
+    }
+
+    /**
+     * Creates customer instance
+     *
+     * @throws Exception if exception occurs
+     */
+    @Test
+    public void testRollbackTopic() throws Exception {
+        InitialContext ctx = new InitialContext();
+        String totalShipStr = System.getProperty("total-shipment");
+        String msgsPerShipStr = System.getProperty("requests-per-shipment");
+
+        int totalShip = (totalShipStr == null ? 10 : Integer.parseInt(totalShipStr));
+        int msgsPerShip = (msgsPerShipStr == null ? 20 : Integer.parseInt(msgsPerShipStr));
+
+        JmsBmtRemote jmsSender = (JmsBmtRemote) ctx.lookup("JmsBmtRemote");
+        boolean pass = true;
+        if (jmsSender != null) {
+            System.out.println("JmsBmtRemote initialized");
+            for (int i = 0; i < totalShip; ++i) {
+                String messageName = (i + 1) + ".Request";
+
+                System.out.format("Sending (%1$s) request(s) with name %2$s%n", msgsPerShip,
messageName);
+                String result = jmsSender.sendMessageTopic(messageName, 0, msgsPerShip);
+                System.out.println("Topic requests sent, result: " + result);
+                if ("FAIL".equals(result)) pass = false;
+            }
+            if (!pass) {
+                throw new Exception("Failed, see out and logs");
             }
-*/
         } else {
             throw new Exception("Sender is null");
         }

Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/bmt/JmsBmtBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/bmt/JmsBmtBean.java?rev=803207&r1=803206&r2=803207&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/bmt/JmsBmtBean.java
(original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/jms-tests/jms-ejb/src/main/java/org/apache/geronimo/jms/test/bmt/JmsBmtBean.java
Tue Aug 11 17:12:44 2009
@@ -145,7 +145,7 @@
             return "OK";
 
         } catch (Exception e) {
-            logger.error("Bad news! Sending failed due to exception: " + e.getMessage());
+            logger.error("Bad news! Sending failed due to exception: " + e.getMessage(),
e);
             return "FAIL";
         } finally {
             try {



Mime
View raw message