Search in sources :

Example 6 with Slobrok

use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.

the class RoutingTestCase method setUp.

@Before
public void setUp() throws ListenFailedException, UnknownHostException {
    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()));
    retryPolicy = new RetryTransientErrorsPolicy();
    retryPolicy.setBaseDelay(0);
    srcServer = new TestServer(new MessageBusParams().setRetryPolicy(retryPolicy).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) Before(org.junit.Before)

Example 7 with Slobrok

use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.

the class TraceTripTestCase method setUp.

public void setUp() throws ListenFailedException, UnknownHostException {
    RoutingTableSpec table = new RoutingTableSpec(SimpleProtocol.NAME).addHop("pxy", "test/pxy/session", Arrays.asList("test/pxy/session")).addHop("dst", "test/dst/session", Arrays.asList("test/dst/session")).addRoute("test", Arrays.asList("pxy", "dst"));
    slobrok = new Slobrok();
    src = new TestServer("test/src", table, slobrok, null);
    pxy = new TestServer("test/pxy", table, slobrok, null);
    dst = new TestServer("test/dst", table, slobrok, null);
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer)

Example 8 with Slobrok

use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.

the class LoadBalanceTestCase method testLoadBalance.

public void testLoadBalance() throws ListenFailedException, UnknownHostException {
    Slobrok slobrok = new Slobrok();
    TestServer src = new TestServer("src", null, slobrok, null);
    TestServer dst1 = new TestServer("dst/1", null, slobrok, null);
    TestServer dst2 = new TestServer("dst/2", null, slobrok, null);
    TestServer dst3 = new TestServer("dst/3", null, slobrok, null);
    // set up handlers
    final QueueAdapter sq = new QueueAdapter();
    SourceSession ss = src.mb.createSourceSession(new SourceSessionParams().setTimeout(600.0).setThrottlePolicy(null).setReplyHandler(new ReplyHandler() {

        @Override
        public void handleReply(Reply reply) {
            System.out.println(Thread.currentThread().getName() + ": Reply '" + ((SimpleMessage) reply.getMessage()).getValue() + "' received at source.");
            sq.handleReply(reply);
        }
    }));
    SimpleDestination h1 = new SimpleDestination(dst1.mb, dst1.net.getIdentity());
    SimpleDestination h2 = new SimpleDestination(dst2.mb, dst2.net.getIdentity());
    SimpleDestination h3 = new SimpleDestination(dst3.mb, dst3.net.getIdentity());
    assertTrue(src.waitSlobrok("dst/*/session", 3));
    // send messages
    // should be divisible by 3
    int msgCnt = 30;
    for (int i = 0; i < msgCnt; ++i) {
        ss.send(new SimpleMessage("msg" + i), Route.parse("dst/*/session"));
    }
    // wait for replies
    assertTrue(sq.waitSize(msgCnt, 60));
    // check handler message distribution
    assertEquals(msgCnt / 3, h1.getCount());
    assertEquals(msgCnt / 3, h2.getCount());
    assertEquals(msgCnt / 3, h3.getCount());
    ss.destroy();
    h1.session.destroy();
    h2.session.destroy();
    h3.session.destroy();
    dst3.destroy();
    dst2.destroy();
    dst1.destroy();
    src.destroy();
    slobrok.stop();
}
Also used : SimpleMessage(com.yahoo.messagebus.test.SimpleMessage) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) QueueAdapter(com.yahoo.messagebus.test.QueueAdapter) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer)

Example 9 with Slobrok

use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.

the class TargetPoolTestCase method setUp.

@Override
public void setUp() throws ListenFailedException {
    slobrok = new Slobrok();
    servers = new ArrayList<>();
    orb = new Supervisor(new Transport());
}
Also used : Supervisor(com.yahoo.jrt.Supervisor) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Transport(com.yahoo.jrt.Transport)

Example 10 with Slobrok

use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.

the class ResenderTestCase method setUp.

@Override
public void setUp() throws ListenFailedException, UnknownHostException {
    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()));
    retryPolicy = new RetryTransientErrorsPolicy();
    retryPolicy.setBaseDelay(0);
    srcServer = new TestServer(new MessageBusParams().setRetryPolicy(retryPolicy).addProtocol(new SimpleProtocol()), new RPCNetworkParams().setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
    srcSession = srcServer.mb.createSourceSession(new SourceSessionParams().setTimeout(600.0).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)

Aggregations

Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)43 TestServer (com.yahoo.messagebus.network.rpc.test.TestServer)23 Test (org.junit.Test)20 Receptor (com.yahoo.messagebus.test.Receptor)17 RPCNetworkParams (com.yahoo.messagebus.network.rpc.RPCNetworkParams)15 Identity (com.yahoo.messagebus.network.Identity)12 SimpleProtocol (com.yahoo.messagebus.test.SimpleProtocol)11 SimpleMessage (com.yahoo.messagebus.test.SimpleMessage)6 RoutingTableSpec (com.yahoo.messagebus.routing.RoutingTableSpec)4 Before (org.junit.Before)4 ListenFailedException (com.yahoo.jrt.ListenFailedException)3 Spec (com.yahoo.jrt.Spec)3 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)2 DocumentProtocol (com.yahoo.documentapi.messagebus.protocol.DocumentProtocol)2 MessageBusParams (com.yahoo.messagebus.MessageBusParams)2 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)2 SimpleReply (com.yahoo.messagebus.test.SimpleReply)2 MessageBusDocumentAccess (com.yahoo.documentapi.messagebus.MessageBusDocumentAccess)1 MessageBusParams (com.yahoo.documentapi.messagebus.MessageBusParams)1 NonWorkingRequestHandler (com.yahoo.jdisc.test.NonWorkingRequestHandler)1