list.add((String)item); }); obj.setTags(list);
@Override String createCheck(CheckOptions opts) { String serviceId = "serviceId"; ServiceOptions service = new ServiceOptions() .setName("serviceName") .setId(serviceId) .setTags(Arrays.asList("tag1", "tag2")) .setCheckOptions(opts) .setAddress("10.0.0.1") .setPort(8080); runAsync(h -> ctx.writeClient().registerService(service, h)); return "service:" + serviceId; }
serviceOptions.setTags(tags.stream().map(String::valueOf).collect(Collectors.toList())); return serviceOptions;
@Test public void healthServices() throws InterruptedException { runAsync(h -> ctx.writeClient().registerService(new ServiceOptions() .setName("service").setId("id1").setTags(Collections.singletonList("tag1")) .setCheckOptions(new CheckOptions().setTtl("5s").setStatus(CheckStatus.PASSING)), h)); runAsync(h -> ctx.writeClient().registerService(new ServiceOptions() .setName("service").setId("id2").setTags(Collections.singletonList("tag2")) .setCheckOptions(new CheckOptions().setTtl("5s").setStatus(CheckStatus.PASSING)), h));
.setName("serviceName") .setId("serviceId") .setTags(Collections.singletonList("tag1")); runAsync(h -> ctx.writeClient().registerService(opts, h)); runAsync(h -> ctx.writeClient().registerCheck(new CheckOptions()
public static ServiceOptions randomServiceOptions() { return new ServiceOptions() .setId(randomAlphaString(10)) .setName(randomAlphaString(10)) .setTags(randomStringList(2)) .setCheckOptions(randomCheckOptions()) .setAddress(randomAlphaString(10)) .setMeta(randomMeta()) .setPort(randomPortInt()); }