Merge branch '2.2.x'

This commit is contained in:
spencergibb
2020-07-06 16:36:08 -04:00
5 changed files with 12 additions and 6 deletions

View File

@@ -38,11 +38,9 @@
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
@@ -54,7 +52,6 @@
<artifactId>asciidoctor-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>

View File

@@ -6,7 +6,8 @@
|spring.cloud.zookeeper.block-until-connected-wait | 10 | Wait time to block on connection to Zookeeper.
|spring.cloud.zookeeper.connect-string | localhost:2181 | Connection string to the Zookeeper cluster.
|spring.cloud.zookeeper.connection-timeout | | The configured connection timeout in milliseconds.
|spring.cloud.zookeeper.dependencies | | Mapping of alias to ZookeeperDependency. From LoadBalancer perspective the alias is actually serviceID since SC LoadBalancer can't accept nested structures in serviceID.
|spring.cloud.zookeeper.default-health-endpoint | | Default health endpoint that will be checked to verify that a dependency is alive.
|spring.cloud.zookeeper.dependencies | | Mapping of alias to ZookeeperDependency. From Ribbon perspective the alias is actually serviceID since Ribbon can't accept nested structures in serviceID.
|spring.cloud.zookeeper.dependency-configurations | |
|spring.cloud.zookeeper.dependency-names | |
|spring.cloud.zookeeper.discovery.enabled | true |

View File

@@ -36,4 +36,4 @@ public class Application {
}
```
A local Zookeeper server must be running. See the http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html[Zookeeper documentation] on how to run a Zookeeper server.
A local Zookeeper server must be running. See the http://zookeeper.apache.org/[Zookeeper documentation] on how to run a Zookeeper server.

View File

@@ -26,6 +26,7 @@ import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryAutoConfi
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties;
import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance;
import org.springframework.cloud.zookeeper.serviceregistry.ServiceInstanceRegistration.RegistrationBuilder;
import org.springframework.cloud.zookeeper.support.StatusConstants;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -61,6 +62,8 @@ public class ZookeeperAutoServiceRegistrationAutoConfiguration {
throw new IllegalStateException("instanceHost must not be empty");
}
properties.getMetadata().put(StatusConstants.INSTANCE_STATUS_KEY, properties.getInitialStatus());
ZookeeperInstance zookeeperInstance = new ZookeeperInstance(context.getId(),
appName, properties.getMetadata());
RegistrationBuilder builder = ServiceInstanceRegistration.builder().address(host)

View File

@@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties;
import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance;
import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig;
import org.springframework.cloud.zookeeper.support.StatusConstants;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
@@ -41,7 +42,9 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
*/
@RunWith(SpringRunner.class)
@SpringBootTest(properties = {
"spring.application.name=myTestService1-F" }, webEnvironment = RANDOM_PORT)
"spring.application.name=myTestService1-F",
"spring.cloud.zookeeper.discovery.initial-status=OUT_OF_SERVICE"
}, webEnvironment = RANDOM_PORT)
public class ZookeeperAutoServiceRegistrationTests {
@Autowired
@@ -62,6 +65,8 @@ public class ZookeeperAutoServiceRegistrationTests {
ServiceInstance<ZookeeperInstance> instance = instances.iterator().next();
assertThat(instance).isNotNull();
assertThat(instance.getName()).isEqualTo("myTestService1-F");
assertThat(instance.getPayload().getMetadata().get(StatusConstants.INSTANCE_STATUS_KEY))
.isEqualTo(StatusConstants.STATUS_OUT_OF_SERVICE);
/*
* Response<Map<String, Service>> response = consul.getAgentServices();
* Map<String, Service> services = response.getValue(); Service service =