Adjust to changes in commons.

This commit is contained in:
Olga Maciaszek-Sharma
2020-12-10 12:51:06 +01:00
parent d69e025dc6
commit bb2188b4ed
4 changed files with 11 additions and 11 deletions

View File

@@ -67,7 +67,7 @@ public class CloudFoundryAppServiceDiscoveryClient extends CloudFoundryDiscovery
HashMap<String, String> metadata = new HashMap<>();
metadata.put("applicationId", applicationId);
metadata.put("instanceId", applicationIndex);
return (ServiceInstance) new DefaultServiceInstance(name, url, 8080, false, metadata);
return (ServiceInstance) new DefaultServiceInstance(null, name, url, 8080, false, metadata);
}).collectList().block();
}

View File

@@ -66,7 +66,7 @@ public class SimpleDnsBasedDiscoveryClient implements DiscoveryClient {
InetAddress[] addresses = InetAddress.getAllByName(hostname);
if (addresses != null) {
for (InetAddress address : addresses) {
DefaultServiceInstance serviceInstance = new DefaultServiceInstance(serviceId,
DefaultServiceInstance serviceInstance = new DefaultServiceInstance(null, serviceId,
address.getHostAddress(), 8080, false);
serviceInstances.add(serviceInstance);
}

View File

@@ -62,7 +62,7 @@ public class SimpleDnsBasedReactiveDiscoveryClient implements ReactiveDiscoveryC
@Override
public Flux<ServiceInstance> getInstances(String serviceId) {
return Mono.justOrEmpty(serviceIdToHostnameConverter.toHostname(serviceId)).flatMapMany(getInetAddresses())
.map(address -> new DefaultServiceInstance(serviceId, address.getHostAddress(), 8080, false));
.map(address -> new DefaultServiceInstance(null, serviceId, address.getHostAddress(), 8080, false));
}
private Function<String, Publisher<? extends InetAddress>> getInetAddresses() {

View File

@@ -65,8 +65,8 @@ public class CloudFoundryAppServiceDiscoveryClientTest {
List<ServiceInstance> instances = this.discoveryClient.getInstances(serviceId);
assertThat(instances).hasSize(1);
assertThat(instances.get(0)).isEqualTo(new DefaultServiceInstance(serviceId, "0.billing.apps.internal", 8080,
false, new HashMap<String, String>() {
assertThat(instances.get(0)).isEqualTo(new DefaultServiceInstance(null, serviceId, "0.billing.apps.internal",
8080, false, new HashMap<String, String>() {
{
put("applicationId", "billing1");
put("instanceId", "0");
@@ -87,22 +87,22 @@ public class CloudFoundryAppServiceDiscoveryClientTest {
List<ServiceInstance> instances = this.discoveryClient.getInstances(serviceId);
assertThat(instances).hasSize(3);
assertThat(instances.get(0)).isEqualTo(new DefaultServiceInstance(serviceId, "0.billing.apps.internal", 8080,
false, new HashMap<String, String>() {
assertThat(instances.get(0)).isEqualTo(new DefaultServiceInstance(null, serviceId, "0.billing.apps.internal",
8080, false, new HashMap<String, String>() {
{
put("applicationId", "billing-id");
put("instanceId", "0");
}
}));
assertThat(instances.get(1)).isEqualTo(new DefaultServiceInstance(serviceId, "1.billing.apps.internal", 8080,
false, new HashMap<String, String>() {
assertThat(instances.get(1)).isEqualTo(new DefaultServiceInstance(null, serviceId, "1.billing.apps.internal",
8080, false, new HashMap<String, String>() {
{
put("applicationId", "billing-id");
put("instanceId", "1");
}
}));
assertThat(instances.get(2)).isEqualTo(new DefaultServiceInstance(serviceId, "2.billing.apps.internal", 8080,
false, new HashMap<String, String>() {
assertThat(instances.get(2)).isEqualTo(new DefaultServiceInstance(null, serviceId, "2.billing.apps.internal",
8080, false, new HashMap<String, String>() {
{
put("applicationId", "billing-id");
put("instanceId", "2");