@Test public void testLookupWithNonMatchingQuery() throws UnsupportedEncodingException { HelloService svc = new HelloServiceImpl("stuff"); ProxyHelper.registerService(HelloService.class, vertx, svc, "address"); Record record1 = EventBusService.createRecord("Hello", "address", HelloService.class, new JsonObject().put("key", "foo")); Record record2 = EventBusService.createRecord("Hello-2", "address", HelloService.class, new JsonObject().put("key", "bar")); discovery.publish(record1, (r) -> { }); discovery.publish(record2, (r) -> { }); await().until(() -> record1.getRegistration() != null); await().until(() -> record2.getRegistration() != null); JsonArray services = given() .param("query", "{\"stuff\":\"*\"}") .get("/discovery") .asJsonArray(); assertThat(services.size()).isEqualTo(0); }
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; }