Search in sources :

Example 1 with RemoteServer

use of com.yahoo.messagebus.jdisc.test.RemoteServer in project vespa by vespa-engine.

the class SharedSourceSessionTestCase method requireThatSessionCanSendMessage.

@Test
public void requireThatSessionCanSendMessage() throws InterruptedException {
    RemoteServer server = RemoteServer.newInstanceWithInternSlobrok();
    SharedSourceSession session = newSourceSession(server.slobrokId(), new SourceSessionParams());
    ReplyQueue queue = new ReplyQueue();
    Message msg = new SimpleMessage("foo").setRoute(Route.parse(server.connectionSpec()));
    msg.pushHandler(queue);
    assertTrue(session.sendMessage(msg).isAccepted());
    assertNotNull(msg = server.awaitMessage(60, TimeUnit.SECONDS));
    server.ackMessage(msg);
    assertNotNull(queue.awaitReply(60, TimeUnit.SECONDS));
    session.release();
    server.close();
}
Also used : SimpleMessage(com.yahoo.messagebus.test.SimpleMessage) Message(com.yahoo.messagebus.Message) ReplyQueue(com.yahoo.messagebus.jdisc.test.ReplyQueue) SimpleMessage(com.yahoo.messagebus.test.SimpleMessage) SourceSessionParams(com.yahoo.messagebus.SourceSessionParams) RemoteServer(com.yahoo.messagebus.jdisc.test.RemoteServer) Test(org.junit.Test)

Example 2 with RemoteServer

use of com.yahoo.messagebus.jdisc.test.RemoteServer in project vespa by vespa-engine.

the class SharedIntermediateSessionTestCase method requireThatSessionCanSendMessage.

@Test
public void requireThatSessionCanSendMessage() throws InterruptedException {
    RemoteServer server = RemoteServer.newInstanceWithInternSlobrok();
    SharedIntermediateSession session = newIntermediateSession(server.slobrokId(), new IntermediateSessionParams());
    ReplyQueue queue = new ReplyQueue();
    Message msg = new SimpleMessage("foo").setRoute(Route.parse(server.connectionSpec()));
    msg.setTimeReceivedNow();
    msg.setTimeRemaining(60000);
    msg.getTrace().setLevel(9);
    msg.pushHandler(queue);
    assertTrue(session.sendMessage(msg).isAccepted());
    assertNotNull(msg = server.awaitMessage(60, TimeUnit.SECONDS));
    server.ackMessage(msg);
    assertNotNull(queue.awaitReply(60, TimeUnit.SECONDS));
    session.release();
    server.close();
}
Also used : SimpleMessage(com.yahoo.messagebus.test.SimpleMessage) ReplyQueue(com.yahoo.messagebus.jdisc.test.ReplyQueue) SimpleMessage(com.yahoo.messagebus.test.SimpleMessage) RemoteServer(com.yahoo.messagebus.jdisc.test.RemoteServer) Test(org.junit.Test)

Aggregations

RemoteServer (com.yahoo.messagebus.jdisc.test.RemoteServer)2 ReplyQueue (com.yahoo.messagebus.jdisc.test.ReplyQueue)2 SimpleMessage (com.yahoo.messagebus.test.SimpleMessage)2 Test (org.junit.Test)2 Message (com.yahoo.messagebus.Message)1 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)1