use of com.yahoo.messagebus.network.rpc.test.TestServer in project vespa by vespa-engine.
the class SendProxyTestCase method setUp.
@Override
public void setUp() throws UnknownHostException, ListenFailedException {
slobrok = new Slobrok();
dstServer = new TestServer(new MessageBusParams().addProtocol(new SimpleProtocol()), new RPCNetworkParams().setIdentity(new Identity("dst")).setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
dstSession = dstServer.mb.createDestinationSession(new DestinationSessionParams().setName("session").setMessageHandler(new Receptor()));
srcServer = new TestServer(new MessageBusParams().addProtocol(new SimpleProtocol()), new RPCNetworkParams().setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
srcSession = srcServer.mb.createSourceSession(new SourceSessionParams().setTimeout(600.0).setThrottlePolicy(null).setReplyHandler(new Receptor()));
assertTrue(srcServer.waitSlobrok("dst/session", 1));
}
use of com.yahoo.messagebus.network.rpc.test.TestServer in project vespa by vespa-engine.
the class SimpleTripTestCase method testSimpleTrip.
public void testSimpleTrip() throws ListenFailedException, UnknownHostException {
Slobrok slobrok = new Slobrok();
TestServer server = new TestServer(new MessageBusParams().addProtocol(new SimpleProtocol()), new RPCNetworkParams().setIdentity(new Identity("srv")).setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
DestinationSession dst = server.mb.createDestinationSession(new DestinationSessionParams().setName("session").setMessageHandler(new Receptor()));
SourceSession src = server.mb.createSourceSession(new SourceSessionParams().setTimeout(600.0).setReplyHandler(new Receptor()));
assertTrue(server.waitSlobrok("srv/session", 1));
assertTrue(src.send(new SimpleMessage("msg"), Route.parse("srv/session")).isAccepted());
Message msg = ((Receptor) dst.getMessageHandler()).getMessage(60);
assertNotNull(msg);
assertEquals(SimpleProtocol.NAME, msg.getProtocol());
assertEquals(SimpleProtocol.MESSAGE, msg.getType());
assertEquals("msg", ((SimpleMessage) msg).getValue());
Reply reply = new SimpleReply("reply");
reply.swapState(msg);
dst.reply(reply);
assertNotNull(reply = ((Receptor) src.getReplyHandler()).getReply(60));
assertEquals(SimpleProtocol.NAME, reply.getProtocol());
assertEquals(SimpleProtocol.REPLY, reply.getType());
assertEquals("reply", ((SimpleReply) reply).getValue());
src.destroy();
dst.destroy();
server.destroy();
}
use of com.yahoo.messagebus.network.rpc.test.TestServer in project vespa by vespa-engine.
the class PolicyFactoryTestCase method setUp.
@Override
public void setUp() throws ListenFailedException {
slobrok = new Slobrok();
srv = new TestServer(new MessageBusParams().addProtocol(new DocumentProtocol(new DocumentTypeManager())), new RPCNetworkParams().setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
src = srv.mb.createSourceSession(new SourceSessionParams().setReplyHandler(new Receptor()));
}
use of com.yahoo.messagebus.network.rpc.test.TestServer in project vespa by vespa-engine.
the class RoutableFactoryTestCase method setUp.
@Override
public void setUp() throws ListenFailedException {
slobrok = new Slobrok();
DocumentTypeManager docMan = new DocumentTypeManager();
dstProtocol = new DocumentProtocol(docMan);
dstServer = new TestServer(new MessageBusParams().addProtocol(dstProtocol), new RPCNetworkParams().setIdentity(new Identity("dst")).setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
dstSession = dstServer.mb.createDestinationSession(new DestinationSessionParams().setName("session").setMessageHandler(new Receptor()));
srcProtocol = new DocumentProtocol(docMan);
srcServer = new TestServer(new MessageBusParams().addProtocol(srcProtocol), new RPCNetworkParams().setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
srcSession = srcServer.mb.createSourceSession(new SourceSessionParams().setReplyHandler(new Receptor()));
assertTrue(srcServer.waitSlobrok("dst/session", 1));
}
Aggregations