Merge branch '2.2.x'
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<properties>
|
||||
<docs.main>spring-cloud-consul</docs.main>
|
||||
<main.basedir>${basedir}/..</main.basedir>
|
||||
<docs.whitelisted.branches>1.1.x,1.2.x,1.3.x,2.1.x</docs.whitelisted.branches>
|
||||
<docs.whitelisted.branches>2.1.x,2.2.x</docs.whitelisted.branches>
|
||||
<configprops.inclusionPattern>spring.cloud.consul.*</configprops.inclusionPattern>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
@@ -78,14 +78,6 @@
|
||||
<artifactId>httpcore</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
||||
@@ -82,16 +82,24 @@ public class ConsulServiceRegistryCheckTtlTests {
|
||||
@Test
|
||||
public void contextLoads() throws NoSuchFieldException, IllegalAccessException {
|
||||
ConsulRegistration httpRegistration = createHttpRegistration();
|
||||
this.consulServiceRegistry.register(httpRegistration);
|
||||
Field serviceHeartbeatsField = TtlScheduler.class
|
||||
.getDeclaredField("serviceHeartbeats");
|
||||
serviceHeartbeatsField.setAccessible(true);
|
||||
Map serviceHeartbeats = (Map) serviceHeartbeatsField.get(this.ttlScheduler);
|
||||
assertThat(serviceHeartbeats.keySet().contains(this.registration.getInstanceId()))
|
||||
.as("Service with heartbeat check not registered in TTL scheduler")
|
||||
.isTrue();
|
||||
assertThat(serviceHeartbeats.keySet().contains(httpRegistration.getInstanceId()))
|
||||
.as("Service with HTTP check registered in TTL scheduler").isFalse();
|
||||
try {
|
||||
this.consulServiceRegistry.register(httpRegistration);
|
||||
Field serviceHeartbeatsField = TtlScheduler.class
|
||||
.getDeclaredField("serviceHeartbeats");
|
||||
serviceHeartbeatsField.setAccessible(true);
|
||||
Map serviceHeartbeats = (Map) serviceHeartbeatsField.get(this.ttlScheduler);
|
||||
assertThat(serviceHeartbeats.keySet()
|
||||
.contains(this.registration.getInstanceId())).as(
|
||||
"Service with heartbeat check not registered in TTL scheduler")
|
||||
.isTrue();
|
||||
assertThat(
|
||||
serviceHeartbeats.keySet().contains(httpRegistration.getInstanceId()))
|
||||
.as("Service with HTTP check registered in TTL scheduler")
|
||||
.isFalse();
|
||||
}
|
||||
finally {
|
||||
this.consulServiceRegistry.deregister(httpRegistration);
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
Reference in New Issue
Block a user