Author: hiranya
Date: Mon Aug 12 05:28:55 2013
New Revision: 1513041

URL: http://svn.apache.org/r1513041
Log:
Removing unnecessary threading from the sample53 test

Modified:
    
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/Axis2BackEndServerController.java
    
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java

Modified: 
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/Axis2BackEndServerController.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/Axis2BackEndServerController.java?rev=1513041&r1=1513040&r2=1513041&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/Axis2BackEndServerController.java
 (original)
+++ 
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/Axis2BackEndServerController.java
 Mon Aug 12 05:28:55 2013
@@ -183,6 +183,7 @@ public class Axis2BackEndServerControlle
             log.info("Shutting down Axis2 server...");
             try {
                 listenerManager.stop();
+                listenerManager.destroy();
                 configContext.terminate();
             } catch (Exception e) {
                 log.warn("Error while shutting down Axis2 server", e);

Modified: 
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java?rev=1513041&r1=1513040&r2=1513041&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
 (original)
+++ 
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
 Mon Aug 12 05:28:55 2013
@@ -26,85 +26,39 @@ import org.apache.synapse.samples.framew
 
 public class Sample53 extends SynapseTestCase {
 
-    private SampleClientResult result;
-    private String addUrl;
-
     public Sample53() {
         super(53);
     }
 
-
     public void testFailOver() {
         String expectedError = "COULDN'T SEND THE MESSAGE TO THE SERVER";
-        addUrl = "http://localhost:8280/services/LBService1";;
+        String addUrl = "http://localhost:8280/services/LBService1";;
         log.info("Running test: Failover sending among 3 endpoints");
         final StockQuoteSampleClient client = getStockQuoteClient();
 
         // Send some messages and check
-        Thread t = new Thread(new Runnable() {
-            public void run() {
-                result = client.sessionlessClient(addUrl, null, 10);
-            }
-        });
-        t.start();
-        try {
-            t.join();
-        } catch (InterruptedException e) {
-
-        }
+        SampleClientResult result = client.sessionlessClient(addUrl, null, 10);
         assertResponseReceived(result);
 
         // Stop BE server 1
         getBackendServerControllers().get(0).stopProcess();
-        try {
-            Thread.sleep(2000);
-        } catch (InterruptedException e) {
-
-        }
+        sleep(2000);
 
         // Send another burst of messages and check
-        t = new Thread(new Runnable() {
-            public void run() {
-                result = client.sessionlessClient(addUrl, null, 10);
-            }
-        });
-        t.start();
-        try {
-            t.join();
-        } catch (InterruptedException e) {
-
-        }
+        result = client.sessionlessClient(addUrl, null, 10);
         assertResponseReceived(result);
 
         // Stop BE server 2
         getBackendServerControllers().get(1).stopProcess();
-        try {
-            Thread.sleep(2000);
-        } catch (InterruptedException e) {
-
-        }
+        sleep(2000);
 
         // Send some more messages and check
-        t = new Thread(new Runnable() {
-            public void run() {
-                result = client.sessionlessClient(addUrl, null, 10);
-            }
-        });
-        t.start();
-        try {
-            t.join();
-        } catch (InterruptedException e) {
-
-        }
+        result = client.sessionlessClient(addUrl, null, 10);
         assertResponseReceived(result);
 
         // Stop BE server 3
         getBackendServerControllers().get(2).stopProcess();
-        try {
-            Thread.sleep(2000);
-        } catch (InterruptedException e) {
-
-        }
+        sleep(2000);
 
         // Send another message - Should fail
         result = client.sessionlessClient(addUrl, null, 1);
@@ -115,4 +69,11 @@ public class Sample53 extends SynapseTes
         assertTrue("Did not receive expected error", 
resultEx.getMessage().contains(expectedError));
     }
 
+    private void sleep(long millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
 }


Reply via email to