Search in sources :

Example 6 with Response

use of org.apache.activemq.command.Response in project activemq-artemis by apache.

the class NetworkRouteTest method addAndRemoveOppositeOrder.

@Test
public void addAndRemoveOppositeOrder() throws Exception {
    // from (1)
    localBroker.request(EasyMock.isA(ConsumerInfo.class));
    ArgHolder localConsumer = ArgHolder.holdArgsForLastObjectCall();
    // from (2a)
    remoteBroker.asyncRequest(EasyMock.isA(ActiveMQMessage.class), EasyMock.isA(ResponseCallback.class));
    ArgHolder firstMessageFuture = ArgHolder.holdArgsForLastFutureRequestCall();
    localBroker.oneway(EasyMock.isA(MessageAck.class));
    // from (2b)
    remoteBroker.asyncRequest(EasyMock.isA(ActiveMQMessage.class), EasyMock.isA(ResponseCallback.class));
    ArgHolder secondMessageFuture = ArgHolder.holdArgsForLastFutureRequestCall();
    localBroker.oneway(EasyMock.isA(MessageAck.class));
    // from (3)
    localBroker.oneway(EasyMock.isA(RemoveInfo.class));
    ExpectationWaiter waitForRemove = ExpectationWaiter.waiterForLastVoidCall();
    control.replay();
    // (1) send advisory of path 1
    remoteListener.onCommand(path1Msg);
    msgDispatch.setConsumerId(((ConsumerInfo) localConsumer.arguments[0]).getConsumerId());
    // send advisory of path 2, doesn't send a ConsumerInfo to localBroker
    remoteListener.onCommand(path2Msg);
    // (2a) send a message
    localListener.onCommand(msgDispatch);
    ResponseCallback callback = (ResponseCallback) firstMessageFuture.arguments[1];
    FutureResponse response = new FutureResponse(callback);
    response.set(new Response());
    // send advisory of path 2 remove, doesn't send a RemoveInfo to localBroker
    remoteListener.onCommand(removePath2Msg);
    // (2b) send a message
    localListener.onCommand(msgDispatch);
    callback = (ResponseCallback) secondMessageFuture.arguments[1];
    response = new FutureResponse(callback);
    response.set(new Response());
    // (3) send advisory of path 1 remove, sends a RemoveInfo to localBroker
    remoteListener.onCommand(removePath1Msg);
    waitForRemove.assertHappens(5, TimeUnit.SECONDS);
    // send a message, does not send message as in 2a and 2b
    localListener.onCommand(msgDispatch);
    control.verify();
}
Also used : Response(org.apache.activemq.command.Response) FutureResponse(org.apache.activemq.transport.FutureResponse) ConsumerInfo(org.apache.activemq.command.ConsumerInfo) RemoveInfo(org.apache.activemq.command.RemoveInfo) FutureResponse(org.apache.activemq.transport.FutureResponse) ResponseCallback(org.apache.activemq.transport.ResponseCallback) MessageAck(org.apache.activemq.command.MessageAck) ActiveMQMessage(org.apache.activemq.command.ActiveMQMessage) Test(org.junit.Test)

Example 7 with Response

use of org.apache.activemq.command.Response in project activemq-artemis by apache.

the class ResponseTest method createObject.

@Override
public Object createObject() throws Exception {
    Response info = new Response();
    populateObject(info);
    return info;
}
Also used : Response(org.apache.activemq.command.Response)

Example 8 with Response

use of org.apache.activemq.command.Response in project activemq-artemis by apache.

the class ResponseTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    Response info = (Response) object;
    info.setCorrelationId(1);
}
Also used : Response(org.apache.activemq.command.Response)

Example 9 with Response

use of org.apache.activemq.command.Response in project activemq-artemis by apache.

the class ResponseTest method createObject.

@Override
public Object createObject() throws Exception {
    Response info = new Response();
    populateObject(info);
    return info;
}
Also used : Response(org.apache.activemq.command.Response)

Example 10 with Response

use of org.apache.activemq.command.Response in project activemq-artemis by apache.

the class ResponseTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    Response info = (Response) object;
    info.setCorrelationId(1);
}
Also used : Response(org.apache.activemq.command.Response)

Aggregations

Response (org.apache.activemq.command.Response)32 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)7 Message (org.apache.activemq.command.Message)7 DataArrayResponse (org.apache.activemq.command.DataArrayResponse)6 ConnectionInfo (org.apache.activemq.command.ConnectionInfo)5 ProducerInfo (org.apache.activemq.command.ProducerInfo)5 IOException (java.io.IOException)4 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)4 ExceptionResponse (org.apache.activemq.command.ExceptionResponse)4 SessionInfo (org.apache.activemq.command.SessionInfo)4 TransactionId (org.apache.activemq.command.TransactionId)4 TransactionInfo (org.apache.activemq.command.TransactionInfo)4 XATransactionId (org.apache.activemq.command.XATransactionId)4 Command (org.apache.activemq.command.Command)3 Test (org.junit.Test)3 InvalidDestinationException (javax.jms.InvalidDestinationException)2 ActiveMQQueueExistsException (org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException)2 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)2 ControlCommand (org.apache.activemq.command.ControlCommand)2 FlushCommand (org.apache.activemq.command.FlushCommand)2