Added the instance id to the ZookeeperServiceInstance (#178)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user