use of com.yahoo.jrt.Supervisor 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.Supervisor in project vespa by vespa-engine.
the class ExternalSlobrokPolicy method init.
@Override
public void init() {
if (slobroks != null) {
orb = new Supervisor(new Transport());
mirror = new Mirror(orb, slobroks);
}
if (configSources != null) {
if (mirror == null) {
orb = new Supervisor(new Transport());
subscriber = subscribe(slobrokConfigId, new ConfigSourceSet(configSources));
}
}
}
use of com.yahoo.jrt.Supervisor in project vespa by vespa-engine.
the class FleetControllerTest method setWantedState.
protected void setWantedState(DummyVdsNode node, State state, String reason) {
if (supervisor == null) {
supervisor = new Supervisor(new Transport());
}
NodeState ns = new NodeState(node.getType(), state);
if (reason != null)
ns.setDescription(reason);
Target connection = supervisor.connect(new Spec("localhost", fleetController.getRpcPort()));
Request req = new Request("setNodeState");
req.parameters().add(new StringValue(node.getSlobrokName()));
req.parameters().add(new StringValue(ns.serialize()));
connection.invokeSync(req, timeoutS);
if (req.isError()) {
assertTrue("Failed to invoke setNodeState(): " + req.errorCode() + ": " + req.errorMessage(), false);
}
if (!req.checkReturnTypes("s")) {
assertTrue("Failed to invoke setNodeState(): Invalid return types.", false);
}
}
use of com.yahoo.jrt.Supervisor in project vespa by vespa-engine.
the class DatabaseTest method setWantedState.
// Note: different semantics than FleetControllerTest.setWantedState
protected void setWantedState(Node n, NodeState ns, Map<Node, NodeState> wantedStates) {
int rpcPort = fleetController.getRpcPort();
if (supervisor == null) {
supervisor = new Supervisor(new Transport());
}
Target connection = supervisor.connect(new Spec("localhost", rpcPort));
assertTrue(connection.isValid());
Request req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/" + n.getType().toString() + "/" + n.getIndex()));
req.parameters().add(new StringValue(ns.serialize(true)));
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
assertTrue(req.toString(), req.checkReturnTypes("s"));
wantedStates.put(n, ns);
}
use of com.yahoo.jrt.Supervisor in project vespa by vespa-engine.
the class RpcServerTest method testGetNodeList.
@Test
public void testGetNodeList() throws Exception {
startingTest("RpcServerTest::testGetNodeList");
setUpFleetController(true, new FleetControllerOptions("mycluster"));
setUpVdsNodes(true, new DummyVdsNodeOptions());
waitForStableSystem();
assertEquals(true, nodes.get(0).isDistributor());
nodes.get(0).disconnect();
waitForState("version:\\d+ distributor:10 .0.s:d storage:10");
int rpcPort = fleetController.getRpcPort();
supervisor = new Supervisor(new Transport());
Target connection = supervisor.connect(new Spec("localhost", rpcPort));
assertTrue(connection.isValid());
// Possibly do request multiple times if we haven't lost slobrok contact first times yet.
for (int j = 0; j <= 10; ++j) {
Request req = new Request("getNodeList");
connection.invokeSync(req, timeoutS);
assertEquals(req.errorMessage(), ErrorCode.NONE, req.errorCode());
assertTrue(req.toString(), req.checkReturnTypes("SS"));
String[] slobrok = req.returnValues().get(0).asStringArray().clone();
String[] rpc = req.returnValues().get(1).asStringArray().clone();
assertEquals(20, slobrok.length);
assertEquals(20, rpc.length);
// Verify that we can connect to all addresses returned.
for (int i = 0; i < 20; ++i) {
if (slobrok[i].equals("storage/cluster.mycluster/distributor/0")) {
if (j < 10 && !"".equals(rpc[i])) {
continue;
}
assertEquals(slobrok[i], "", rpc[i]);
continue;
}
assertTrue(slobrok[i], !rpc[i].equals(""));
Request req2 = new Request("getnodestate2");
req2.parameters().add(new StringValue("unknown"));
Target connection2 = supervisor.connect(new Spec(rpc[i]));
connection2.invokeSync(req2, timeoutS);
assertEquals(req2.toString(), ErrorCode.NONE, req.errorCode());
}
break;
}
}
Aggregations