org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient Java Examples

The following examples show how to use org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigServerEurekaApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void discoveryClientIsEureka() {
	assertTrue("discoveryClient is wrong type", discoveryClient instanceof CompositeDiscoveryClient);
	assertTrue("composite discovery client should have a Eureka client with higher precendence",
			((CompositeDiscoveryClient) discoveryClient).getDiscoveryClients()
					.get(0) instanceof EurekaDiscoveryClient);
}
 
Example #2
Source File: ZuulProxyEurekaApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void discoveryClientIsEureka() {
	assertTrue("discoveryClient is wrong type", discoveryClient instanceof CompositeDiscoveryClient);
	assertTrue("composite discovery client should compose Eureka Discovery Client with highest precedence",
			((CompositeDiscoveryClient) discoveryClient).getDiscoveryClients()
					.get(0) instanceof EurekaDiscoveryClient);
}
 
Example #3
Source File: EurekaFirstApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void discoveryClientIsEureka() {
	assertTrue("discoveryClient is wrong type: " + discoveryClient,
			discoveryClient instanceof CompositeDiscoveryClient);
	assertTrue("composite discovery client should have a Eureka client with higher precendence",
			((CompositeDiscoveryClient) discoveryClient).getDiscoveryClients()
					.get(0) instanceof EurekaDiscoveryClient);
}
 
Example #4
Source File: StandaloneClientApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void testDiscoveryClientIsEureka() {
	assertTrue("discoveryClient is wrong instance type", discoveryClient instanceof CompositeDiscoveryClient);
	assertTrue("composite discovery client should have a Eureka client with higher precendence",
			((CompositeDiscoveryClient) discoveryClient).getDiscoveryClients()
					.get(0) instanceof EurekaDiscoveryClient);
}
 
Example #5
Source File: EurekaServerApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void discoveryClientIsEureka() {
	assertTrue("discoveryClient is wrong type " + discoveryClient.getClass(),
			discoveryClient instanceof CompositeDiscoveryClient);
	CompositeDiscoveryClient compositeDiscoveryClient = (CompositeDiscoveryClient) discoveryClient;
	assertTrue("composite discovery client should be composed of Eureka and Simple Discovery client's",
			compositeDiscoveryClient.getDiscoveryClients().size() == 2);

	assertTrue("the composed discovery client should have a EurekaDiscoveryClient with a higher precedence ",
			compositeDiscoveryClient.getDiscoveryClients().get(0) instanceof EurekaDiscoveryClient);
}
 
Example #6
Source File: TurbineStreamApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void discoveryClientIsEureka() {
	assertTrue("discoveryClient is wrong type " + discoveryClient.getClass(),
			discoveryClient instanceof CompositeDiscoveryClient);
	CompositeDiscoveryClient compositeDiscoveryClient = (CompositeDiscoveryClient) discoveryClient;
	assertTrue("composite discovery client should be composed of Eureka and Simple Discovery client's",
			compositeDiscoveryClient.getDiscoveryClients().size() == 2);

	assertTrue("the composed discovery client should have a EurekaDiscoveryClient with a higher precedence ",
			compositeDiscoveryClient.getDiscoveryClients().get(0) instanceof EurekaDiscoveryClient);

	assertTrue("the composed discovery client should have a SimpleDiscoveryClient with a lower precedence ",
			compositeDiscoveryClient.getDiscoveryClients().get(1) instanceof SimpleDiscoveryClient);
}
 
Example #7
Source File: KubernetesDiscoveryClientAutoConfigurationTests.java    From spring-cloud-kubernetes with Apache License 2.0 5 votes vote down vote up
@Test
public void kubernetesDiscoveryClientCreated() {
	assertThat(this.discoveryClient).isNotNull()
			.isInstanceOf(CompositeDiscoveryClient.class);

	CompositeDiscoveryClient composite = (CompositeDiscoveryClient) this.discoveryClient;
	assertThat(composite.getDiscoveryClients().stream()
			.anyMatch(dc -> dc instanceof KubernetesDiscoveryClient)).isTrue();
}
 
Example #8
Source File: ZookeeperDiscoveryAutoRegistrationFalseTests.java    From spring-cloud-zookeeper with Apache License 2.0 5 votes vote down vote up
@Test
public void discovery_client_is_zookeeper() {
	// given: this.discoveryClient
	// expect:
	then(discoveryClient).isInstanceOf(CompositeDiscoveryClient.class);
	CompositeDiscoveryClient composite = (CompositeDiscoveryClient) discoveryClient;
	List<DiscoveryClient> discoveryClients = composite.getDiscoveryClients();
	DiscoveryClient first = discoveryClients.get(0);
	then(first).isInstanceOf(ZookeeperDiscoveryClient.class);
}
 
Example #9
Source File: NoWebApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
@Test
public void testDiscoveryClientIsSimple() {
	assertTrue("discoveryClient is wrong instance type", discoveryClient instanceof CompositeDiscoveryClient);
}
 
Example #10
Source File: ZuulApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
@Test
public void discoveryClientIsComposite() {
	assertTrue("discoveryClient is wrong type", this.discoveryClient instanceof CompositeDiscoveryClient);
}
 
Example #11
Source File: TurbineApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
@Test
public void discoveryClientIsEureka() {
	assertTrue("discoveryClient is wrong type", discoveryClient instanceof CompositeDiscoveryClient);
}
 
Example #12
Source File: DefaultStandaloneClientApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
@Test
public void testDiscoveryClientIsSimple() {
	assertTrue("discoveryClient is wrong instance type", discoveryClient instanceof CompositeDiscoveryClient);
}
 
Example #13
Source File: DiscoveryNotWebApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
@Test
public void testDiscoveryClientIsSimple() {
	assertTrue("discoveryClient is wrong instance type", discoveryClient instanceof CompositeDiscoveryClient);
}
 
Example #14
Source File: ZuulProxyApplicationTests.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
@Test
public void discoveryClientIsComposite() {
	assertTrue("discoveryClient is wrong type", this.discoveryClient instanceof CompositeDiscoveryClient);
}
 
Example #15
Source File: DiscoveryClientAutoConfigurationDefaultTests.java    From spring-cloud-commons with Apache License 2.0 4 votes vote down vote up
@Test
public void simpleDiscoveryClientShouldBeTheDefault() {
	then(this.discoveryClient).isInstanceOf(CompositeDiscoveryClient.class);
}