From d4331b47170303d36300151724064e10b5986f3d Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 4 Jun 2020 16:02:51 +0200 Subject: [PATCH 1/3] Migrated to docs.spring.io & updated sc-build --- README.adoc | 8 +++++++- docs/pom.xml | 8 ++++---- docs/src/main/asciidoc/_configprops.adoc | 4 +++- pom.xml | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.adoc b/README.adoc index 26dda61a..dc107582 100644 --- a/README.adoc +++ b/README.adoc @@ -4,6 +4,7 @@ Manual changes to this file will be lost when it is generated again. Edit the files in the src/main/asciidoc/ directory instead. //// + image::https://travis-ci.org/spring-cloud/spring-cloud-zookeeper.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-zookeeper] @@ -143,6 +144,11 @@ https://eclipse.org[Eclipse] when working with the code. We use the https://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools should also work without issue as long as they use Maven 3.3.3 or better. +==== Activate the Spring Maven profile +Spring Cloud projects require the 'spring' Maven profile to be activated to resolve +the spring milestone and snapshot repositories. Use your preferred IDE to set this +profile to be active, or you may experience build errors. + ==== Importing into eclipse with m2eclipse We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with eclipse. If you don't already have m2eclipse installed it is available from the "eclipse @@ -350,4 +356,4 @@ Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on t - `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL. - `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`. -IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. \ No newline at end of file +IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. diff --git a/docs/pom.xml b/docs/pom.xml index 2d166de2..3bd7b143 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -15,9 +15,9 @@ spring-cloud-zookeeper ${basedir}/.. - 2.1.x,2.2.x spring.cloud.zookeeper.*| + deploy @@ -35,11 +35,9 @@ git-commit-id-plugin - org.apache.maven.plugins maven-dependency-plugin - org.apache.maven.plugins maven-resources-plugin @@ -51,9 +49,11 @@ asciidoctor-maven-plugin - org.apache.maven.plugins maven-antrun-plugin + + maven-deploy-plugin + diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index 5496309e..db1b8dc2 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -5,6 +5,7 @@ |spring.cloud.zookeeper.block-until-connected-unit | | The unit of time related to blocking on connection to Zookeeper. |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.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 | | @@ -24,5 +25,6 @@ |spring.cloud.zookeeper.max-retries | 10 | Max number of times to retry. |spring.cloud.zookeeper.max-sleep-ms | 500 | Max time in ms to sleep on each retry. |spring.cloud.zookeeper.prefix | | Common prefix that will be applied to all Zookeeper dependencies' paths. +|spring.cloud.zookeeper.session-timeout | | The configured/negotiated session timeout in milliseconds. Please refer to Curator's Tech Note 14 to understand how Curator implements connection sessions. @see Curator's Tech Note 14 -|=== +|=== \ No newline at end of file diff --git a/pom.xml b/pom.xml index 01750b3f..414efa73 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.springframework.cloud spring-cloud-build - 2.3.0.RELEASE + 2.3.1.BUILD-SNAPSHOT @@ -177,7 +177,7 @@ - 2.3.0.RELEASE + 2.3.1.BUILD-SNAPSHOT 2.2.4.BUILD-SNAPSHOT 2.2.4.BUILD-SNAPSHOT 2.2.4.BUILD-SNAPSHOT From 5b35a4928124e17d1025f6181083e6ac9ead1f4b Mon Sep 17 00:00:00 2001 From: Thomas Vitale Date: Mon, 6 Jul 2020 22:28:03 +0200 Subject: [PATCH 2/3] Use initial status configured for Zookeeper discovery (#250) Use value defined in "spring.cloud.zookeeper.discovery.initial-status" when autoconfiguring a ZookeeperInstance. Fixes gh-247 --- .../ZookeeperAutoServiceRegistrationAutoConfiguration.java | 3 +++ .../ZookeeperAutoServiceRegistrationTests.java | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java index e8a97881..4723ede9 100644 --- a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java +++ b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java @@ -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) diff --git a/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java b/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java index f3ba7af5..b87df39c 100644 --- a/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java +++ b/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java @@ -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 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> response = consul.getAgentServices(); * Map services = response.getValue(); Service service = From 4f92ff73d78d8865a891f38ced7cc4f7db75b031 Mon Sep 17 00:00:00 2001 From: u-dogFF <55744600+u-dogFF@users.noreply.github.com> Date: Mon, 11 May 2020 22:06:57 -0700 Subject: [PATCH 3/3] Fix Zookeeper link in documentation Fixes gh-238 Fixes gh-246 --- docs/src/main/asciidoc/sagan-index.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/sagan-index.adoc b/docs/src/main/asciidoc/sagan-index.adoc index 72d3e264..08a4a58f 100644 --- a/docs/src/main/asciidoc/sagan-index.adoc +++ b/docs/src/main/asciidoc/sagan-index.adoc @@ -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.