Search in sources :

Example 11 with Identity

use of com.yahoo.messagebus.network.Identity 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));
}
Also used : SimpleProtocol(com.yahoo.messagebus.test.SimpleProtocol) Receptor(com.yahoo.messagebus.test.Receptor) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Identity(com.yahoo.messagebus.network.Identity) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer)

Example 12 with Identity

use of com.yahoo.messagebus.network.Identity 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();
}
Also used : SimpleReply(com.yahoo.messagebus.test.SimpleReply) SimpleMessage(com.yahoo.messagebus.test.SimpleMessage) SimpleMessage(com.yahoo.messagebus.test.SimpleMessage) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer) SimpleProtocol(com.yahoo.messagebus.test.SimpleProtocol) Receptor(com.yahoo.messagebus.test.Receptor) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) SimpleReply(com.yahoo.messagebus.test.SimpleReply) Identity(com.yahoo.messagebus.network.Identity)

Example 13 with Identity

use of com.yahoo.messagebus.network.Identity in project vespa by vespa-engine.

the class ServiceAddressTestCase method setUp.

public void setUp() throws ListenFailedException, UnknownHostException {
    slobrok = new Slobrok();
    network = new RPCNetwork(new RPCNetworkParams().setIdentity(new Identity("foo")).setSlobrokConfigId("raw:slobrok[1]\nslobrok[0].connectionspec \"" + new Spec("localhost", slobrok.port()).toString() + "\"\n"));
}
Also used : Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Identity(com.yahoo.messagebus.network.Identity) Spec(com.yahoo.jrt.Spec)

Example 14 with Identity

use of com.yahoo.messagebus.network.Identity in project vespa by vespa-engine.

the class SlobrokTestCase method setUp.

public void setUp() throws ListenFailedException, UnknownHostException {
    slobrok = new Slobrok();
    String slobrokCfgId = "raw:slobrok[1]\nslobrok[0].connectionspec \"" + new Spec("localhost", slobrok.port()).toString() + "\"\n";
    net1 = new RPCNetwork(new RPCNetworkParams().setIdentity(new Identity("net/a")).setSlobrokConfigId(slobrokCfgId));
    net2 = new RPCNetwork(new RPCNetworkParams().setIdentity(new Identity("net/b")).setSlobrokConfigId(slobrokCfgId));
    net3 = new RPCNetwork(new RPCNetworkParams().setIdentity(new Identity("net/c")).setSlobrokConfigId(slobrokCfgId));
    port1 = net1.getPort();
    port2 = net2.getPort();
    port3 = net3.getPort();
}
Also used : Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Spec(com.yahoo.jrt.Spec) Identity(com.yahoo.messagebus.network.Identity)

Example 15 with Identity

use of com.yahoo.messagebus.network.Identity 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));
}
Also used : Receptor(com.yahoo.messagebus.test.Receptor) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) DocumentTypeManager(com.yahoo.document.DocumentTypeManager) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Identity(com.yahoo.messagebus.network.Identity) DocumentProtocol(com.yahoo.documentapi.messagebus.protocol.DocumentProtocol) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer)

Aggregations

Identity (com.yahoo.messagebus.network.Identity)15 Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)12 RPCNetworkParams (com.yahoo.messagebus.network.rpc.RPCNetworkParams)10 TestServer (com.yahoo.messagebus.network.rpc.test.TestServer)9 Receptor (com.yahoo.messagebus.test.Receptor)9 SimpleProtocol (com.yahoo.messagebus.test.SimpleProtocol)7 Before (org.junit.Before)4 MessageBusDocumentAccess (com.yahoo.documentapi.messagebus.MessageBusDocumentAccess)3 MessageBusParams (com.yahoo.documentapi.messagebus.MessageBusParams)3 LoadTypeSet (com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet)2 Spec (com.yahoo.jrt.Spec)2 DaemonThreadFactory (com.yahoo.concurrent.DaemonThreadFactory)1 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)1 ThroughputLimitQueue (com.yahoo.documentapi.ThroughputLimitQueue)1 VisitorControlHandler (com.yahoo.documentapi.VisitorControlHandler)1 VisitorDataHandler (com.yahoo.documentapi.VisitorDataHandler)1 VisitorDestinationParameters (com.yahoo.documentapi.VisitorDestinationParameters)1 DocumentProtocol (com.yahoo.documentapi.messagebus.protocol.DocumentProtocol)1 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)1 SimpleMessage (com.yahoo.messagebus.test.SimpleMessage)1