use of com.yahoo.jrt.Request in project vespa by vespa-engine.
the class ConfigProxyRpcServerTest method testRpcMethodListCachedConfigFull.
/**
* Tests listCachedConfig RPC command
*/
@Test
public void testRpcMethodListCachedConfigFull() {
Request req = new Request("listCachedConfigFull");
rpcServer.listCachedConfigFull(req);
assertFalse(req.errorMessage(), req.isError());
assertThat(req.returnValues().size(), is(1));
String[] ret = req.returnValues().get(0).asStringArray();
assertThat(ret.length, is(0));
final RawConfig config = ProxyServerTest.fooConfig;
proxyServer.getMemoryCache().put(config);
req = new Request("listCachedConfigFull");
rpcServer.listCachedConfigFull(req);
assertFalse(req.errorMessage(), req.isError());
ret = req.returnValues().get(0).asStringArray();
assertThat(ret.length, is(1));
assertThat(ret[0], is(config.getNamespace() + "." + config.getName() + "," + config.getConfigId() + "," + config.getGeneration() + "," + config.getConfigMd5() + "," + config.getPayload().getData()));
}
use of com.yahoo.jrt.Request in project vespa by vespa-engine.
the class ConfigProxyRpcServerTest method testRpcMethodDumpCache.
/**
* Tests dumpCache RPC command
*/
@Test
public void testRpcMethodDumpCache() {
Request req = new Request("dumpCache");
String path = "/tmp";
req.parameters().add(new StringValue(path));
rpcServer.dumpCache(req);
assertFalse(req.errorMessage(), req.isError());
assertThat(req.returnValues().size(), is(1));
assertThat(req.returnValues().get(0).asString(), is("success"));
}
use of com.yahoo.jrt.Request in project vespa by vespa-engine.
the class ConfigProxyRpcServerTest method testRpcMethodInvalidateCache.
/**
* Tests invalidateCache RPC command
*/
@Test
public void testRpcMethodInvalidateCache() {
Request req = new Request("invalidateCache");
rpcServer.invalidateCache(req);
assertFalse(req.errorMessage(), req.isError());
assertThat(req.returnValues().size(), is(1));
final String[] ret = req.returnValues().get(0).asStringArray();
assertThat(ret.length, is(2));
assertThat(ret[0], is("0"));
assertThat(ret[1], is("success"));
}
use of com.yahoo.jrt.Request in project vespa by vespa-engine.
the class ConfigProxyRpcServerTest method testRpcMethodPing.
/**
* Tests ping RPC command
*/
@Test
public void testRpcMethodPing() {
Request req = new Request("ping");
rpcServer.ping(req);
assertFalse(req.errorMessage(), req.isError());
assertThat(req.returnValues().size(), is(1));
assertThat(req.returnValues().get(0).asInt32(), is(0));
}
use of com.yahoo.jrt.Request in project vespa by vespa-engine.
the class RpcConfigSourceClient method checkConfigSources.
/**
* Checks if config sources are available
*/
private void checkConfigSources() {
if (configSourceSet == null || configSourceSet.getSources() == null || configSourceSet.getSources().size() == 0) {
log.log(LogLevel.WARNING, "No config sources defined, could not check connection");
} else {
Request req = new Request("ping");
for (String configSource : configSourceSet.getSources()) {
Spec spec = new Spec(configSource);
Target target = supervisor.connect(spec);
target.invokeSync(req, 30.0);
if (target.isValid()) {
log.log(LogLevel.DEBUG, () -> "Created connection to config source at " + spec.toString());
return;
} else {
log.log(LogLevel.INFO, "Could not connect to config source at " + spec.toString());
}
target.close();
}
String extra = "";
log.log(LogLevel.INFO, "Could not connect to any config source in set " + configSourceSet.toString() + ", please make sure config server(s) are running. " + extra);
}
}
Aggregations