Search in sources :

Example 1 with JMSSampleClient

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

the class Sample250 method testPlaceOrder.

public void testPlaceOrder() throws Exception {
    System.setProperty("java.naming.provider.url", "tcp://localhost:62626");
    Axis2BackEndServerController axis2Server = getAxis2Server();
    if (axis2Server == null) {
        fail("Failed to load the Axis2BackEndServerController");
    }
    assertEquals(0, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder"));
    JMSSampleClient client = new JMSSampleClient();
    client.connect("dynamicQueues/StockQuoteProxy");
    client.sendAsPox("IBM");
    Thread.sleep(2000);
    assertEquals(1, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder"));
    client.shutdown();
}
Also used : Axis2BackEndServerController(org.apache.synapse.samples.framework.Axis2BackEndServerController) JMSSampleClient(org.apache.synapse.samples.framework.clients.JMSSampleClient)

Example 2 with JMSSampleClient

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

the class Sample252 method testPlaceOrderTypePOX.

public void testPlaceOrderTypePOX() throws Exception {
    JMSSampleClient client = new JMSSampleClient();
    Axis2BackEndServerController axis2Server = getAxis2Server();
    if (axis2Server == null) {
        fail("Failed to load the Axis2BackEndServerController");
    }
    assertEquals(0, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder"));
    try {
        client.connect("dynamicQueues/JMSPoxProxy");
        client.sendAsPox("MSFT");
        boolean expectedMessageCountReceived = SynapseTestUtils.waitForMessageCount(axis2Server, "SimpleStockQuoteService", "placeOrder", 1, 2000);
        assertTrue("Backend service not received the expected message count", expectedMessageCountReceived);
    } finally {
        client.shutdown();
    }
}
Also used : Axis2BackEndServerController(org.apache.synapse.samples.framework.Axis2BackEndServerController) JMSSampleClient(org.apache.synapse.samples.framework.clients.JMSSampleClient)

Example 3 with JMSSampleClient

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

the class Sample252 method testPlaceOrderTypeText.

public void testPlaceOrderTypeText() throws Exception {
    JMSSampleClient client = new JMSSampleClient();
    Axis2BackEndServerController axis2Server = getAxis2Server();
    if (axis2Server == null) {
        fail("Failed to load the Axis2BackEndServerController");
    }
    assertEquals(0, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder"));
    try {
        client.connect("dynamicQueues/JMSTextProxy");
        client.sendTextMessage("12.33 1000 ACP");
        boolean expectedMessageCountReceived = SynapseTestUtils.waitForMessageCount(axis2Server, "SimpleStockQuoteService", "placeOrder", 1, 2000);
        assertTrue("Backend service not received the expected message count", expectedMessageCountReceived);
    } finally {
        client.shutdown();
    }
}
Also used : Axis2BackEndServerController(org.apache.synapse.samples.framework.Axis2BackEndServerController) JMSSampleClient(org.apache.synapse.samples.framework.clients.JMSSampleClient)

Aggregations

Axis2BackEndServerController (org.apache.synapse.samples.framework.Axis2BackEndServerController)3 JMSSampleClient (org.apache.synapse.samples.framework.clients.JMSSampleClient)3