Search in sources :

Example 86 with StockQuoteSampleClient

use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.

the class Sample15 method testMessageEnrichment.

public void testMessageEnrichment() {
    String trpUrl = "http://localhost:8280/services/StockQuote";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: Message Enrichment through Synapse");
    SampleClientResult result = client.requestStandardQuote(null, trpUrl, null, "IBM", null);
    assertResponseReceived(result);
}
Also used : SampleClientResult(org.apache.synapse.samples.framework.SampleClientResult) StockQuoteSampleClient(org.apache.synapse.samples.framework.clients.StockQuoteSampleClient)

Example 87 with StockQuoteSampleClient

use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.

the class Sample4 method testErrorHandling.

public void testErrorHandling() {
    String addUrl = "http://localhost:9000/services/SimpleStockQuoteService";
    String trpUrl = "http://localhost:8280";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: Introduction to error handling");
    SampleClientResult result = client.requestStandardQuote(addUrl, trpUrl, null, "IBM", null);
    assertResponseReceived(result);
    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);
    result = client.requestStandardQuote(addUrl, trpUrl, null, "SUN", null);
    assertFalse("Must not get a response", result.responseReceived());
    Exception resultEx2 = result.getException();
    assertNotNull("Did not receive expected error", resultEx);
    log.info("Got an error as expected: " + resultEx.getMessage());
    assertTrue("Did not receive expected error", resultEx2 instanceof AxisFault);
}
Also used : AxisFault(org.apache.axis2.AxisFault) SampleClientResult(org.apache.synapse.samples.framework.SampleClientResult) StockQuoteSampleClient(org.apache.synapse.samples.framework.clients.StockQuoteSampleClient)

Example 88 with StockQuoteSampleClient

use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.

the class Sample150 method testBasicProxy.

public void testBasicProxy() {
    String addUrl = "http://localhost:8280/services/StockQuoteProxy";
    log.info("Running test: Introduction to proxy services");
    StockQuoteSampleClient client = getStockQuoteClient();
    SampleClientResult result = client.requestStandardQuote(addUrl, null, null, "IBM", null);
    assertTrue("Client did not get run successfully ", result.responseReceived());
}
Also used : SampleClientResult(org.apache.synapse.samples.framework.SampleClientResult) StockQuoteSampleClient(org.apache.synapse.samples.framework.clients.StockQuoteSampleClient)

Example 89 with StockQuoteSampleClient

use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.

the class Sample370 method testThrottling.

public void testThrottling() {
    String addUrl = "http://localhost:8280/";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: Introduction to throttle mediator and concurrency throttling");
    result = client.requestStandardQuote(addUrl, null, null, "IBM", null);
    assertTrue("Client did not get run successfully ", result.responseReceived());
}
Also used : StockQuoteSampleClient(org.apache.synapse.samples.framework.clients.StockQuoteSampleClient)

Example 90 with StockQuoteSampleClient

use of org.apache.synapse.samples.framework.clients.StockQuoteSampleClient in project wso2-synapse by wso2.

the class Sample372 method testConcurrencyAndRateThrottling.

public void testConcurrencyAndRateThrottling() {
    String addUrl = "http://localhost:8280/services/StockQuoteProxy";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: concurrency throttling and request rate based throttling");
    result = client.requestStandardQuote(addUrl, null, null, "IBM", null);
    assertTrue("Client did not get run successfully ", result.responseReceived());
}
Also used : StockQuoteSampleClient(org.apache.synapse.samples.framework.clients.StockQuoteSampleClient)

Aggregations

StockQuoteSampleClient (org.apache.synapse.samples.framework.clients.StockQuoteSampleClient)99 SampleClientResult (org.apache.synapse.samples.framework.SampleClientResult)45 OMElement (org.apache.axiom.om.OMElement)23 AxisFault (org.apache.axis2.AxisFault)5 QName (javax.xml.namespace.QName)4 Axis2BackEndServerController (org.apache.synapse.samples.framework.Axis2BackEndServerController)1