You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2011/12/08 11:59:32 UTC
svn commit: r1211822 -
/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
Author: hiranya
Date: Thu Dec 8 10:59:31 2011
New Revision: 1211822
URL: http://svn.apache.org/viewvc?rev=1211822&view=rev
Log:
Updated sample 53 test
Modified:
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/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=1211822&r1=1211821&r2=1211822&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 Thu Dec 8 10:59:31 2011
@@ -44,29 +44,74 @@ public class Sample53 extends SynapseTes
addUrl = "http://localhost:8280/services/LBService1";
log.info("Running test: Failover sending among 3 endpoints");
+ // Send some messages and check
Thread t = new Thread(new Runnable() {
public void run() {
- result = client.sessionlessClient(addUrl, null, 10000);
+ result = client.sessionlessClient(addUrl, null, 10);
}
});
t.start();
+ try {
+ t.join();
+ } catch (InterruptedException e) {
- for (int i = 0; i < 3; i++) {
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
+ }
+ assertResponseReceived(result);
+
+ // Stop BE server 1
+ getBackendServerControllers().get(0).stop();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
- }
- getBackendServerControllers().get(i).stop();
}
+ // 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) {
}
+ assertResponseReceived(result);
+
+ // Stop BE server 2
+ getBackendServerControllers().get(1).stop();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+ // 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) {
+
+ }
assertResponseReceived(result);
+
+ // Stop BE server 3
+ getBackendServerControllers().get(2).stop();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+
+ // Send another message - Should fail
+ result = client.sessionlessClient(addUrl, null, 1);
Exception resultEx = result.getException();
assertNotNull("Did not receive expected error", resultEx);
log.info("Got an error as expected: " + resultEx.getMessage());