Java Code Examples for org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment#PLATFORM

The following examples show how to use org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment#PLATFORM . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Sample364TestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.PLATFORM })
@Test(groups = {"wso2.esb"}, description = "testDBMediator ")
public void testDBMediator() throws Exception {

    LogViewerClient logViewerClient =
            new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    logViewerClient.clearLogs();

    AxisServiceClient client = new AxisServiceClient();

    client.sendRobust(Utils.getStockQuoteRequest("IBM")
            , getMainSequenceURL(), "getQuote");

    LogEvent[] getLogsInfo = logViewerClient.getAllRemoteSystemLogs();
    boolean assertValue = false;
    for (LogEvent event : getLogsInfo) {
        if (event.getMessage().contains("Stock Prize")) {
            assertValue = true;
            break;
        }
    }
    Assert.assertTrue(assertValue,
            "db lookup failed");

}
 
Example 2
Source File: ConditionalRouterIntegrationTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Test for conditional router mediator with multiple conditional routes
 * Test Artifact: Sample 157 - Conditional Router for Routing Messages based on HTTP URL, HTTP Headers and Query Parameters
 * Note: since toUrl is not given, it will take "/services/StockQuoteProxy" (from transport address) as To address by default
 *
 * @throws Exception
 */
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.PLATFORM, ExecutionEnvironment.PLATFORM })
@Test(groups = { "wso2.esb" })
public void conditionalRouterMediatorWithMultiRoutesTest() throws Exception {
    loadSampleESBConfiguration(157);
    StockQuoteClient client1 = new StockQuoteClient();
    StockQuoteClient client2 = new StockQuoteClient();
    StockQuoteClient client3 = new StockQuoteClient();

    client1.addHttpHeader("foo", "bar");

    client2.addHttpHeader("my_custom_header1", "foo1");

    client3.addHttpHeader("my_custom_header2", "bar");
    client3.addHttpHeader("my_custom_header3", "foo");

    OMElement response1 = client1
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("StockQuoteProxy"), null, "WSO2");

    Assert.assertTrue(response1.toString().contains("GetQuoteResponse"));
    Assert.assertTrue(response1.toString().contains("WSO2 Company"));

    OMElement response2 = client2
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("StockQuoteProxy"), null, "WSO2");

    Assert.assertTrue(response2.toString().contains("GetQuoteResponse"));
    Assert.assertTrue(response2.toString().contains("WSO2 Company"));

    OMElement response3 = client3.sendSimpleStockQuoteRequest(
            getProxyServiceURLHttp("StockQuoteProxy") + "?qparam1=qpv_foo&qparam2=qpv_foo2", null, "WSO2");

    Assert.assertTrue(response3.toString().contains("GetQuoteResponse"));
    Assert.assertTrue(response3.toString().contains("WSO2 Company"));

}
 
Example 3
Source File: IterateLargeMessageTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE, ExecutionEnvironment.PLATFORM })
@Test(groups = "wso2.esb", description = "Tests large message in small number 5")
public void testSmallNumbers() throws Exception {
    OMElement response;
    for (int i = 0; i < 5; i++) {
        response = axis2Client
                .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("iterateWithHttpEndPointTestProxy"), null,
                        symbol);
        Assert.assertNotNull(response);
        Assert.assertTrue(response.toString().contains("WSO2"));
    }
}
 
Example 4
Source File: ConditionalRouterIntegrationTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Test for conditional router mediator with multiple conditional routes
 * Test Artifact: Sample 157 - Conditional Router for Routing Messages based on HTTP URL, HTTP Headers and Query Parameters
 * Note: since toUrl is not given, it will take "/services/StockQuoteProxy" (from transport address) as To address by default
 *
 * @throws Exception
 */
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.PLATFORM, ExecutionEnvironment.PLATFORM })
@Test(groups = { "wso2.esb" })
public void conditionalRouterMediatorWithMultiRoutesTest() throws Exception {
    loadSampleESBConfiguration(157);
    StockQuoteClient client1 = new StockQuoteClient();
    StockQuoteClient client2 = new StockQuoteClient();
    StockQuoteClient client3 = new StockQuoteClient();

    client1.addHttpHeader("foo", "bar");

    client2.addHttpHeader("my_custom_header1", "foo1");

    client3.addHttpHeader("my_custom_header2", "bar");
    client3.addHttpHeader("my_custom_header3", "foo");

    OMElement response1 = client1
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("StockQuoteProxy"), null, "WSO2");

    Assert.assertTrue(response1.toString().contains("GetQuoteResponse"));
    Assert.assertTrue(response1.toString().contains("WSO2 Company"));

    OMElement response2 = client2
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("StockQuoteProxy"), null, "WSO2");

    Assert.assertTrue(response2.toString().contains("GetQuoteResponse"));
    Assert.assertTrue(response2.toString().contains("WSO2 Company"));

    OMElement response3 = client3.sendSimpleStockQuoteRequest(
            getProxyServiceURLHttp("StockQuoteProxy") + "?qparam1=qpv_foo&qparam2=qpv_foo2", null, "WSO2");

    Assert.assertTrue(response3.toString().contains("GetQuoteResponse"));
    Assert.assertTrue(response3.toString().contains("WSO2 Company"));

}
 
Example 5
Source File: IterateLargeMessageTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE
, ExecutionEnvironment.PLATFORM})
    @Test(groups = "wso2.esb", description = "Tests large message in small number 5")
    public void testSmallNumbers() throws Exception {
        OMElement response;
        for (int i = 0; i < 5; i++) {
            response = axis2Client.sendSimpleStockQuoteRequest(
                    getProxyServiceURLHttp("iterateWithHttpEndPointTestProxy"), null, symbol);
            Assert.assertNotNull(response);
            Assert.assertTrue(response.toString().contains("WSO2"));
        }
    }