|
|
@ -1,5 +1,10 @@ |
|
|
|
package org.springframework.cloud.client.discovery.composite; |
|
|
|
package org.springframework.cloud.client.discovery.composite; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.URI; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.runner.RunWith; |
|
|
|
import org.junit.runner.RunWith; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -13,11 +18,6 @@ import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.core.annotation.Order; |
|
|
|
import org.springframework.core.annotation.Order; |
|
|
|
import org.springframework.test.context.junit4.SpringRunner; |
|
|
|
import org.springframework.test.context.junit4.SpringRunner; |
|
|
|
|
|
|
|
|
|
|
|
import java.net.URI; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -72,12 +72,6 @@ public class CompositeDiscoveryClientTests { |
|
|
|
assertThat(this.discoveryClient.getInstances("unknown")).hasSize(0); |
|
|
|
assertThat(this.discoveryClient.getInstances("unknown")).hasSize(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void localServiceInstanceShouldReturnTheFirstMatch() { |
|
|
|
|
|
|
|
assertThat(this.discoveryClient.getLocalServiceInstance().getServiceId()).isEqualTo("service0"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EnableAutoConfiguration |
|
|
|
@EnableAutoConfiguration |
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
public static class Config { |
|
|
|
public static class Config { |
|
|
@ -91,11 +85,6 @@ public class CompositeDiscoveryClientTests { |
|
|
|
return "A custom discovery client"; |
|
|
|
return "A custom discovery client"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public ServiceInstance getLocalServiceInstance() { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<ServiceInstance> getInstances(String serviceId) { |
|
|
|
public List<ServiceInstance> getInstances(String serviceId) { |
|
|
|
if (serviceId.equals("custom")) { |
|
|
|
if (serviceId.equals("custom")) { |
|
|
|