use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.
the class Sample53 method testFailOver.
public void testFailOver() {
String expectedError = "COULDN'T SEND THE MESSAGE TO THE SERVER";
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
SampleClientResult result = client.sessionlessClient(addUrl, null, 10);
assertResponseReceived(result);
// Stop BE server 1
getBackendServerControllers().get(0).stopProcess();
sleep(2000);
// Send another burst of messages and check
result = client.sessionlessClient(addUrl, null, 10);
assertResponseReceived(result);
// Stop BE server 2
getBackendServerControllers().get(1).stopProcess();
sleep(2000);
// Send some more messages and check
result = client.sessionlessClient(addUrl, null, 10);
assertResponseReceived(result);
// Stop BE server 3
getBackendServerControllers().get(2).stopProcess();
sleep(2000);
// 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());
assertTrue("Did not receive expected error", resultEx instanceof AxisFault);
assertTrue("Did not receive expected error", resultEx.getMessage().contains(expectedError));
}
use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.
the class Sample54 method testSessionFullLB.
public void testSessionFullLB() {
String addUrl = "http://localhost:8280/services/LBService1";
log.info("Running test: Session affinity load balancing between 3 endpoints");
StockQuoteSampleClient client = getStockQuoteClient();
SampleClientResult result = client.statefulClient(addUrl, null, 100);
assertResponseReceived(result);
}
use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.
the class Sample56 method testSmartClientMode.
public void testSmartClientMode() {
String addUrl = "http://localhost:8280";
StockQuoteSampleClient client = getStockQuoteClient();
log.info("Running test: Smart Client mode");
SampleClientResult result = client.requestStandardQuote(addUrl, null, null, "IBM", null);
assertResponseReceived(result);
}
use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.
the class Sample58 method testStaticLB.
public void testStaticLB() {
final String addUrl = "http://localhost:8280/services/LBService1";
final StockQuoteSampleClient client = getStockQuoteClient();
new Thread(new Runnable() {
public void run() {
result = client.sessionlessClient(addUrl, null, 200);
}
}).start();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
getBackendServerControllers().get(0).stopProcess();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
}
use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.
the class Sample11 method testFullRegistryBasedConfig.
public void testFullRegistryBasedConfig() {
String addUrl = "http://localhost:9000/services/SimpleStockQuoteService";
String trpUrl = "http://localhost:8280";
StockQuoteSampleClient client = getStockQuoteClient();
log.info("Running test: Local Registry entry definitions, reusable endpoints and sequences");
SampleClientResult result = client.requestStandardQuote(addUrl, trpUrl, null, "IBM", null);
assertResponseReceived(result);
}
Aggregations