Search in sources :

Example 1 with RestMessageContext

use of org.apache.activemq.artemis.tests.integration.rest.util.RestMessageContext in project activemq-artemis by apache.

the class RestDeserializationTest method testBlackWhiteListTopicPull.

@Test
public void testBlackWhiteListTopicPull() throws Exception {
    deployAndconfigureRESTService("rest-test-bwlist.war");
    RestMessageContext topicContext = restConnection.createTopicContext("ordersTopic");
    topicContext.initPullConsumers();
    Order order = new Order();
    order.setName("Bill");
    order.setItem("iPhone4");
    order.setAmount("$199.99");
    jmsSendMessage(order, "ordersTopic", false);
    try {
        String received = topicContext.pullMessage();
        fail("object should have been rejected but: " + received);
    } catch (IllegalStateException e) {
        String error = e.getMessage();
        assertTrue(error, error.contains("ClassNotFoundException"));
    }
}
Also used : RestMessageContext(org.apache.activemq.artemis.tests.integration.rest.util.RestMessageContext) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Test(org.junit.Test)

Example 2 with RestMessageContext

use of org.apache.activemq.artemis.tests.integration.rest.util.RestMessageContext in project activemq-artemis by apache.

the class RestDeserializationTest method testWithoutBlackWhiteListTopic.

@Test
public void testWithoutBlackWhiteListTopic() throws Exception {
    jmsServer.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("ordersTopic"), RoutingType.MULTICAST));
    deployAndconfigureRESTService("rest-test.war");
    RestMessageContext topicContext = restConnection.createTopicContext("ordersTopic");
    topicContext.initPullConsumers();
    Order order = new Order();
    order.setName("Bill");
    order.setItem("iPhone4");
    order.setAmount("$199.99");
    jmsSendMessage(order, "ordersTopic", false);
    String received = topicContext.pullMessage();
    Object object = xmlToObject(received);
    assertEquals(order, object);
}
Also used : RestMessageContext(org.apache.activemq.artemis.tests.integration.rest.util.RestMessageContext) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) AddressInfo(org.apache.activemq.artemis.core.server.impl.AddressInfo) Test(org.junit.Test)

Example 3 with RestMessageContext

use of org.apache.activemq.artemis.tests.integration.rest.util.RestMessageContext in project activemq-artemis by apache.

the class RestDeserializationTest method restReceiveQueueMessage.

private String restReceiveQueueMessage(String destName) throws Exception {
    RestMessageContext restContext = restConnection.createQueueContext(destName);
    String val = restContext.pullMessage();
    return val;
}
Also used : RestMessageContext(org.apache.activemq.artemis.tests.integration.rest.util.RestMessageContext) SimpleString(org.apache.activemq.artemis.api.core.SimpleString)

Aggregations

SimpleString (org.apache.activemq.artemis.api.core.SimpleString)3 RestMessageContext (org.apache.activemq.artemis.tests.integration.rest.util.RestMessageContext)3 Test (org.junit.Test)2 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)1