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));
}
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);
}
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();
}
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());
}
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));
}
Aggregations