@Test public void testRetrievingMissingRecord() { HelloService svc = new HelloServiceImpl("stuff"); ProxyHelper.registerService(HelloService.class, vertx, svc, "address"); Record record = new Record() .setName("Hello") .setLocation(new JsonObject().put(Record.ENDPOINT, "address")); discovery.publish(record, (r) -> { }); await().until(() -> record.getRegistration() != null); Record retrieved = retrieve(record.getRegistration()); assertThat(retrieved.getStatus()).isEqualTo(Status.UP); Restafari.Response response2 = delete("/discovery/" + record.getRegistration()); assertThat(response2.getStatusCode()).isEqualTo(204); Restafari.Response response = get("/discovery/" + record.getRegistration()); assertThat(response.getStatusCode()).isEqualTo(404); }
private void publish(RoutingContext routingContext) { JsonObject json = routingContext.getBodyAsJson(); Record record = new Record(json); discovery.publish(record, ar -> { if (ar.failed()) { routingContext.fail(ar.cause()); } else { routingContext.response().setStatusCode(201) .putHeader("Content-Type", "application/json") .end(ar.result().toJson().toString()); } }); }
ServiceDiscoveryRestEndpoint { private void publish(RoutingContext routingContext) { JsonObject json = routingContext.getBodyAsJson(); Record record = new Record(json); discovery.publish(record, ar -> { if (ar.failed()) { routingContext.fail(ar.cause()); } else { routingContext.response().setStatusCode(201) .putHeader("Content-Type", "application/json") .end(ar.result().toJson().toString()); } }); } }
ServiceDiscoveryRestEndpoint { private void publish(RoutingContext routingContext) { JsonObject json = routingContext.getBodyAsJson(); Record record = new Record(json); discovery.publish(record, ar -> { if (ar.failed()) { routingContext.fail(ar.cause()); } else { routingContext.response().setStatusCode(201) .putHeader("Content-Type", "application/json") .end(ar.result().toJson().toString()); } }); } private  ServiceDiscoveryRestEndpoint(Router router, ServiceDiscovery discovery, String root); }
ServiceDiscoveryRestEndpoint { private void publish(RoutingContext routingContext) { JsonObject json = routingContext.getBodyAsJson(); Record record = new Record(json); discovery.publish(record, ar -> { if (ar.failed()) { routingContext.fail(ar.cause()); } else { routingContext.response().setStatusCode(201) .putHeader("Content-Type", "application/json") .end(ar.result().toJson().toString()); } }); } private  ServiceDiscoveryRestEndpoint(Router router, ServiceDiscovery discovery, String root); static ServiceDiscoveryRestEndpoint create(Router router, ServiceDiscovery discovery); static ServiceDiscoveryRestEndpoint create(Router router, ServiceDiscovery discovery, String root); }
ServiceDiscoveryRestEndpoint { private void publish(RoutingContext routingContext) { JsonObject json = routingContext.getBodyAsJson(); Record record = new Record(json); discovery.publish(record, ar -> { if (ar.failed()) { routingContext.fail(ar.cause()); } else { routingContext.response().setStatusCode(201) .putHeader("Content-Type", "application/json") .end(ar.result().toJson().toString()); } }); } private  ServiceDiscoveryRestEndpoint(Router router, ServiceDiscovery discovery, String root); static ServiceDiscoveryRestEndpoint create(Router router, ServiceDiscovery discovery); static ServiceDiscoveryRestEndpoint create(Router router, ServiceDiscovery discovery, String root); static final String DEFAULT_ROOT; }