use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class ServerTestDriverTestCase method requireThatFactoryMethodsWork.
@Test
public void requireThatFactoryMethodsWork() throws ListenFailedException {
ServerTestDriver driver = ServerTestDriver.newInstance(new NonWorkingRequestHandler());
assertNotNull(driver);
assertTrue(driver.close());
driver = ServerTestDriver.newInstanceWithProtocol(new SimpleProtocol(), new NonWorkingRequestHandler());
assertNotNull(driver);
assertTrue(driver.close());
Slobrok slobrok = new Slobrok();
driver = ServerTestDriver.newInstanceWithExternSlobrok(slobrok.configId(), new NonWorkingRequestHandler());
assertNotNull(driver);
assertTrue(driver.close());
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class SharedIntermediateSessionTestCase method requireThatReplyHandlerCanNotBeSet.
@Test
public void requireThatReplyHandlerCanNotBeSet() throws ListenFailedException {
Slobrok slobrok = new Slobrok();
try {
newIntermediateSession(slobrok.configId(), new IntermediateSessionParams().setReplyHandler(new ReplyQueue()));
fail();
} catch (IllegalArgumentException e) {
assertEquals("Reply handler must be null.", e.getMessage());
}
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class PolicyTestCase method requireThatExternPolicyWithIllegalParamIsAnErrorPolicy.
@Test
public void requireThatExternPolicyWithIllegalParamIsAnErrorPolicy() throws ListenFailedException {
Slobrok slobrok = new Slobrok();
String spec = "tcp/localhost:" + slobrok.port();
assertTrue(new DocumentProtocol(manager).createPolicy("Extern", null) instanceof ErrorPolicy);
assertTrue(new DocumentProtocol(manager).createPolicy("Extern", "") instanceof ErrorPolicy);
assertTrue(new DocumentProtocol(manager).createPolicy("Extern", spec) instanceof ErrorPolicy);
assertTrue(new DocumentProtocol(manager).createPolicy("Extern", spec + ";") instanceof ErrorPolicy);
assertTrue(new DocumentProtocol(manager).createPolicy("Extern", spec + ";bar") instanceof ErrorPolicy);
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class PolicyTestCase method testExternSend.
@Test
public void testExternSend() throws Exception {
// Setup local source node.
Slobrok local = new Slobrok();
TestServer src = new TestServer("src", null, local, new DocumentProtocol(manager));
SourceSession ss = src.mb.createSourceSession(new Receptor(), new SourceSessionParams().setTimeout(TIMEOUT));
// Setup remote cluster with routing config.
Slobrok slobrok = new Slobrok();
TestServer itr = new TestServer("itr", new RoutingTableSpec(DocumentProtocol.NAME).addRoute(new RouteSpec("default").addHop("dst")).addHop(new HopSpec("dst", "dst/session")), slobrok, new DocumentProtocol(manager));
IntermediateSession is = itr.mb.createIntermediateSession("session", true, new Receptor(), new Receptor());
TestServer dst = new TestServer("dst", null, slobrok, new DocumentProtocol(manager));
DestinationSession ds = dst.mb.createDestinationSession("session", true, new Receptor());
// Send message from local node to remote cluster and resolve route there.
Message msg = new RemoveDocumentMessage(new DocumentId("doc:scheme:"));
msg.getTrace().setLevel(9);
msg.setRoute(Route.parse("[Extern:tcp/localhost:" + slobrok.port() + ";itr/session] default"));
assertTrue(ss.send(msg).isAccepted());
assertNotNull(msg = ((Receptor) is.getMessageHandler()).getMessage(TIMEOUT));
is.forward(msg);
assertNotNull(msg = ((Receptor) ds.getMessageHandler()).getMessage(TIMEOUT));
ds.acknowledge(msg);
Reply reply = ((Receptor) is.getReplyHandler()).getReply(TIMEOUT);
assertNotNull(reply);
is.forward(reply);
assertNotNull(reply = ((Receptor) ss.getReplyHandler()).getReply(TIMEOUT));
System.out.println(reply.getTrace().toString());
// Perform necessary cleanup.
src.destroy();
itr.destroy();
dst.destroy();
slobrok.stop();
local.stop();
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class PolicyTestCase method requireThatExternPolicyMergesOneReplyAsProtocol.
@Test
public void requireThatExternPolicyMergesOneReplyAsProtocol() throws Exception {
PolicyTestFrame frame = newPutDocumentFrame("doc:scheme:");
Slobrok slobrok = new Slobrok();
TestServer server = new TestServer("docproc/cluster.default/0", null, slobrok, new DocumentProtocol(manager));
server.net.registerSession("chain.default");
setupExternPolicy(frame, slobrok, "docproc/cluster.default/*/chain.default", 1);
frame.assertMergeOneReply(server.net.getConnectionSpec() + "/chain.default");
server.destroy();
frame.destroy();
}
Aggregations