Search in sources :

Example 76 with StockQuoteSampleClient

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

the class Sample364 method testExecuteStoredProcedures.

public void testExecuteStoredProcedures() {
    String addUrl = "http://localhost:9000/services/SimpleStockQuoteService";
    String trpUrl = "http://localhost:8280/";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: Using Mediators to Execute Database Stored Procedures");
    SampleClientResult result = client.requestStandardQuote(addUrl, trpUrl, 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 77 with StockQuoteSampleClient

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

the class Sample1 method testDumbClientMode.

public void testDumbClientMode() {
    String trpUrl = "http://localhost:8280/services/StockQuote";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: Dumb Client mode");
    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 78 with StockQuoteSampleClient

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

the class Sample371 method testRestrictedThrottling.

public void testRestrictedThrottling() {
    String addUrl = "http://localhost:8280/";
    String expectedError = "Access Denied";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: Restricting requests based on policies ");
    for (int i = 0; i < 4; i++) {
        result = client.requestStandardQuote(addUrl, null, null, "IBM", null);
    }
    assertTrue("Client did not get run successfully ", result.responseReceived());
    result = client.requestStandardQuote(addUrl, null, null, "IBM", null);
    assertFalse("Should 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().indexOf(expectedError) != -1);
}
Also used : AxisFault(org.apache.axis2.AxisFault) StockQuoteSampleClient(org.apache.synapse.samples.framework.clients.StockQuoteSampleClient)

Example 79 with StockQuoteSampleClient

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

the class Sample380 method testCustomMediator.

public void testCustomMediator() {
    String addUrl = "http://localhost:8280/";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: Demonstrate the use of Class mediator to extend the mediation functionality");
    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 80 with StockQuoteSampleClient

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

the class Sample391 method testExternalXQuery.

public void testExternalXQuery() {
    String addUrl = "http://localhost:8280/services/StockQuoteProxy";
    StockQuoteSampleClient client = getStockQuoteClient();
    log.info("Running test: How to use the data from an external XML document with in XQuery ");
    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