Merge branch '2.2.x'

This commit is contained in:
Spencer Gibb
2020-03-18 18:37:35 -04:00
3 changed files with 19 additions and 19 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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)