Added the instance id to the ZookeeperServiceInstance (#178)

This commit is contained in:
Tim Ysewyn
2018-12-06 20:33:17 +00:00
committed by Ryan Baxter
parent 9c9fc65386
commit dddec977ef
2 changed files with 8 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ import org.springframework.cloud.client.ServiceInstance;
* A specific {@link ServiceInstance} describing a zookeeper service instance
*
* @author Reda.Housni-Alaoui
* @author Tim Ysewyn
* @since 1.1.0
*/
public class ZookeeperServiceInstance implements ServiceInstance {
@@ -60,6 +61,11 @@ public class ZookeeperServiceInstance implements ServiceInstance {
}
}
@Override
public String getInstanceId() {
return this.serviceInstance.getId();
}
@Override
public String getServiceId() {
return this.serviceId;

View File

@@ -39,6 +39,7 @@ import static org.springframework.cloud.zookeeper.discovery.test.TestRibbonClien
/**
* @author Marcin Grzejszczak
* @author Tim Ysewyn
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ZookeeperDiscoveryTests.Config.class,
@@ -70,6 +71,7 @@ public class ZookeeperDiscoveryTests {
ServiceInstance instance = instances.get(0);
//expect:
then(registeredServiceStatus(instance)).isEqualTo("UP");
then(instance.getInstanceId()).isEqualTo("ribbon-instance-id-123");
then(instance.getMetadata().get("testMetadataKey")).isEqualTo("testMetadataValue");
then(instance).isInstanceOf(ZookeeperServiceInstance.class);
ZookeeperServiceInstance zkInstance = (ZookeeperServiceInstance) instance;