use of io.scalecube.cluster.ClusterConfig.Builder in project scalecube by scalecube.
the class ServiceTest method test_services_contribute_to_cluster_metadata.
@Test
public void test_services_contribute_to_cluster_metadata() {
Map<String, String> metadata = new HashMap<>();
metadata.put("HOSTNAME", "host1");
Builder clusterConfig = ClusterConfig.builder().metadata(metadata);
Microservices ms = Microservices.builder().clusterConfig(clusterConfig).services(new GreetingServiceImpl()).build();
assertTrue(ms.cluster().member().metadata().containsKey("HOSTNAME"));
assertTrue(ServiceInfo.from(ms.cluster().member().metadata().entrySet().stream().filter(item -> item.getValue().equals("service")).findFirst().get().getKey()).getServiceName().equals("io.scalecube.services.GreetingService"));
}
Aggregations