use of org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection in project activemq-artemis by apache.
the class StompV11Test method testSendAndReceive.
@Test
public void testSendAndReceive() throws Exception {
conn.connect(defUser, defPass);
ClientStompFrame response = send(conn, getQueuePrefix() + getQueueName(), "text/plain", "Hello World 1!");
assertNull(response);
String uuid = UUID.randomUUID().toString();
response = send(conn, getQueuePrefix() + getQueueName(), "text/plain", "Hello World 2!", true);
// subscribe
StompClientConnection newConn = StompClientConnectionFactory.createClientConnection(uri);
newConn.connect(defUser, defPass);
subscribe(newConn, "a-sub");
ClientStompFrame frame = newConn.receiveFrame();
IntegrationTestLogger.LOGGER.info("received " + frame);
assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
assertEquals("a-sub", frame.getHeader(Stomp.Headers.Ack.SUBSCRIPTION));
assertNotNull(frame.getHeader(Stomp.Headers.Message.MESSAGE_ID));
assertEquals(getQueuePrefix() + getQueueName(), frame.getHeader(Stomp.Headers.Message.DESTINATION));
assertEquals("Hello World 1!", frame.getBody());
frame = newConn.receiveFrame();
IntegrationTestLogger.LOGGER.info("received " + frame);
unsubscribe(newConn, "a-sub");
newConn.disconnect();
}
use of org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection in project activemq-artemis by apache.
the class StompV11Test method testSendAndReceiveOnDifferentConnections.
@Test
public void testSendAndReceiveOnDifferentConnections() throws Exception {
conn.connect(defUser, defPass);
send(conn, getQueuePrefix() + getQueueName(), null, "Hello World");
StompClientConnection connV11_2 = StompClientConnectionFactory.createClientConnection(uri);
connV11_2.connect(defUser, defPass);
subscribe(connV11_2, "sub1", Stomp.Headers.Subscribe.AckModeValues.AUTO);
ClientStompFrame frame = connV11_2.receiveFrame(2000);
assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
assertEquals("Hello World", frame.getBody());
conn.disconnect();
connV11_2.disconnect();
}
use of org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection in project activemq-artemis by apache.
the class StompPluginTest method testStompAutoCreateAddress.
@Test
public void testStompAutoCreateAddress() throws Exception {
URI uri = new URI(scheme + "://localhost:61613");
StompClientConnection newConn = StompClientConnectionFactory.createClientConnection(uri);
newConn.connect(defUser, defPass);
subscribeQueue(newConn, "a-sub", "autoCreated");
// unsub
unsubscribe(newConn, "a-sub");
newConn.disconnect();
verifier.validatePluginMethodsAtLeast(1, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_REMOVE_ADDRESS, AFTER_REMOVE_ADDRESS);
}
use of org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection in project activemq-artemis by apache.
the class StompPluginTest method testConnect.
@Test
public void testConnect() throws Exception {
URI uri = new URI(scheme + "://localhost:61613");
StompClientConnection newConn = StompClientConnectionFactory.createClientConnection(uri);
newConn.connect(defUser, defPass);
// Make sure session is created on connect
assertTrue(stompBeforeCreateSession.get());
newConn.disconnect();
Thread.sleep(500);
// Make sure session is removed on disconnect
assertTrue(stompBeforeRemoveSession.get());
}
use of org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection in project activemq-artemis by apache.
the class StompPluginTest method testSendAndReceive.
@Test
public void testSendAndReceive() throws Exception {
URI uri = new URI(scheme + "://localhost:61613");
StompClientConnection newConn = StompClientConnectionFactory.createClientConnection(uri);
newConn.connect(defUser, defPass);
subscribe(newConn, "a-sub");
send(newConn, getQueuePrefix() + getQueueName(), "text/plain", "Hello World 1!");
ClientStompFrame frame = newConn.receiveFrame();
System.out.println("received " + frame);
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
verifier.validatePluginMethodsAtLeast(1, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, AFTER_MESSAGE_ROUTE, BEFORE_DELIVER, AFTER_DELIVER);
// unsub
unsubscribe(newConn, "a-sub");
newConn.disconnect();
verifier.validatePluginMethodsEquals(0, MESSAGE_EXPIRED, BEFORE_DEPLOY_BRIDGE, AFTER_DEPLOY_BRIDGE, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING);
verifier.validatePluginMethodsAtLeast(1, AFTER_CREATE_CONNECTION, AFTER_DESTROY_CONNECTION, BEFORE_CREATE_SESSION, AFTER_CREATE_SESSION, BEFORE_CLOSE_SESSION, AFTER_CLOSE_SESSION, BEFORE_CREATE_CONSUMER, AFTER_CREATE_CONSUMER, BEFORE_CLOSE_CONSUMER, AFTER_CLOSE_CONSUMER, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, MESSAGE_ACKED, BEFORE_SEND, AFTER_SEND, BEFORE_MESSAGE_ROUTE, AFTER_MESSAGE_ROUTE, BEFORE_DELIVER, AFTER_DELIVER, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS, BEFORE_ADD_BINDING, AFTER_ADD_BINDING);
}
Aggregations