use of org.apache.synapse.samples.framework.SampleClientResult 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.SampleClientResult 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.SampleClientResult 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.SampleClientResult 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);
}
use of org.apache.synapse.samples.framework.SampleClientResult in project wso2-synapse by wso2.
the class Sample5 method testCreateFaultAndChangeDirection.
public void testCreateFaultAndChangeDirection() {
String addUrl = "http://localhost:9000/services/SimpleStockQuoteService";
String trpUrl = "http://localhost:8280";
String expectedError_MSFT = "Error connecting to the back end";
String expectedError_SUN = "Error connecting to the back end";
StockQuoteSampleClient client = getStockQuoteClient();
log.info("Running test: Creating SOAP fault messages and changing the direction of a message");
SampleClientResult result = client.requestStandardQuote(addUrl, trpUrl, null, "MSFT", null);
assertFalse("Must not get a response", result.responseReceived());
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_MSFT));
result = client.requestStandardQuote(addUrl, trpUrl, null, "SUN", null);
assertFalse("Must not get a response", result.responseReceived());
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_SUN));
result = client.requestStandardQuote(addUrl, trpUrl, null, "IBM", null);
assertFalse("Must not get a response", result.responseReceived());
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);
}
Aggregations