/** * Returns the configuration and member information of the local agent * @param resultHandler will be provided with the configuration and member information of the local agent * @return reference to this, for fluency */ public io.vertx.rxjava.ext.consul.ConsulClient agentInfo(Handler<AsyncResult<JsonObject>> resultHandler) { delegate.agentInfo(resultHandler); return this; }
@Override public ConsulService agentInfo(Handler<AsyncResult<JsonObject>> resultHandler) { consulClient.agentInfo(resultHandler); return this; }
/** * Returns the configuration and member information of the local agent * @param resultHandler will be provided with the configuration and member information of the local agent * @return reference to this, for fluency */ public io.vertx.rxjava.ext.consul.ConsulClient agentInfo(Handler<AsyncResult<JsonObject>> resultHandler) { delegate.agentInfo(resultHandler); return this; }
public static io.vertx.ext.consul.ConsulClient agentInfo(io.vertx.ext.consul.ConsulClient j_receiver, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.agentInfo(resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { resultHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null)); return j_receiver; } public static io.vertx.ext.consul.ConsulClient coordinateNodes(io.vertx.ext.consul.ConsulClient j_receiver, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
private void tryClient(TestContext tc, ConsulClient client, String expectedExceptionMessageSubstring) { client.agentInfo(tc.asyncAssertFailure(t -> { tc.assertTrue(t.getMessage().contains(expectedExceptionMessageSubstring)); ctx.closeClient(client); })); } }
@Test public void info(TestContext tc) { ctx.readClient().agentInfo(tc.asyncAssertSuccess(info -> { JsonObject config = info.getJsonObject("Config"); tc.assertEquals(config.getString("Datacenter"), ctx.dc().getName()); })); } }
@Test public void closedConnection(TestContext tc) { BrokenHttpServer brokenConsul = new BrokenHttpServer(vertx); ConsulClient client = ctx.createClient(new ConsulClientOptions().setPort(brokenConsul.port())); client.agentInfo(tc.asyncAssertFailure(t -> { ctx.closeClient(client); brokenConsul.close(); tc.assertTrue(t.getMessage().contains("Connection was closed")); })); }
@Test public void timeout(TestContext tc) { SlowHttpServer slowConsul = new SlowHttpServer(vertx, 10000); ConsulClient client = ctx.createClient(new ConsulClientOptions().setPort(slowConsul.port()).setTimeout(1000)); client.agentInfo(tc.asyncAssertFailure(t -> { ctx.closeClient(client); slowConsul.close(); tc.assertTrue(t.getMessage().contains("The timeout period of 1000ms")); })); }