From efea331481897a91b1e7c70a72bd9cbd2b6bcf5a Mon Sep 17 00:00:00 2001
From: rebekah-lawrence <142301480+rebekah-lawrence@users.noreply.github.com>
Date: Fri, 16 Feb 2024 16:41:54 +0000
Subject: [PATCH 1/2] Viridian -> Cloud
This tutorial also need to be updated to use clusterId instead of clusterName
---
README.adoc | 8 +++----
.../ROOT/pages/spring-boot-client.adoc | 20 +++++++++-------
pom.xml | 6 ++---
.../HzCloudDemoApplication.java} | 24 +++++++++----------
.../demo/{viridian => cloud}/MapService.java | 2 +-
src/main/resources/application.properties | 14 +++++------
6 files changed, 38 insertions(+), 36 deletions(-)
rename src/main/java/sample/com/hazelcast/demo/{viridian/HzViridianDemoApplication.java => cloud/HzCloudDemoApplication.java} (68%)
rename src/main/java/sample/com/hazelcast/demo/{viridian => cloud}/MapService.java (96%)
diff --git a/README.adoc b/README.adoc
index d49e305..e465124 100644
--- a/README.adoc
+++ b/README.adoc
@@ -1,7 +1,7 @@
-= Spring Boot Application for Hazelcast Viridian
+= Spring Boot Application for Hazelcast Cloud
:experimental: true
-This is an example of how to use Spring Boot with Hazelcast Viridian.
+This is an example of how to use Spring Boot with Hazelcast {hazelcast-cloud}.
TIP: For step-by-step instructions of how to run this app, see the link:https://docs.hazelcast.com/tutorials/spring-boot-client[tutorial].
@@ -9,7 +9,7 @@ TIP: For step-by-step instructions of how to run this app, see the link:https://
. Add the required properties to `spring-sample/src/main/resources/application.properties`:
-- `clusterName`
+- `clusterId`
- `discoveryToken`
- `keyStorePassword`
- `trustStorePassword` (same as `keyStorePassword`)
@@ -24,7 +24,7 @@ TIP: For step-by-step instructions of how to run this app, see the link:https://
== Internal Hazelcast Developers
-If you want to try this application in the UAT or DEV environment, edit the `src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java` file to include the environment URL:
+If you want to try this application in the UAT or DEV environment, edit the `src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java` file to include the environment URL:
```java
// For DEV, use https://test.dev.hazelcast.cloud
diff --git a/docs/modules/ROOT/pages/spring-boot-client.adoc b/docs/modules/ROOT/pages/spring-boot-client.adoc
index 83514dd..88af7be 100644
--- a/docs/modules/ROOT/pages/spring-boot-client.adoc
+++ b/docs/modules/ROOT/pages/spring-boot-client.adoc
@@ -26,7 +26,7 @@ You need the following:
- A xref:cloud:ROOT:create-serverless-cluster.adoc[{hazelcast-cloud} Standard cluster].
- link:https://git-scm.com/book/en/v2/Getting-Started-Installing-Git[Git]
- link:https://maven.apache.org/install.html[Maven]
-- JDK 8
+- JDK 11, or higher
- `JAVA_HOME` environment variable set to the path of the JDK
@@ -61,9 +61,11 @@ cd spring-boot-sample
. Open the `src/main/resources/application.properties` file.
-. Add connection credentials for your cluster to the `application.properties` file. You can find these credentials in the {hazelcast-cloud} dashboard for your cluster under *Connect Client* > *Advanced Setup*.
+. Add connection credentials for your cluster to the `application.properties` file.
+
-- `clusterName`
+NOTE: You can find these credentials in the {hazelcast-cloud} dashboard for your cluster; clusterID is provided in the *Cluster details*, and the other credentials in the *Advanced* option under *Connect Client*.
++
+- `clusterID`
- `discoveryToken`
- `keyStorePassword`
- `trustStorePassword` (same as `keyStorePassword`)
@@ -83,17 +85,17 @@ include::spring-boot-sample:example$pom.xml[tag=client]
link:{github-directory}/pom.xml[View source]
====
-.`HzViridianDemoApplication.java`
+.`HzCloudDemoApplication.java`
[%collapsible]
====
Spring Boot first attempts to create a Hazelcast client by checking the presence of a `com.hazelcast.client.config.ClientConfig` bean. This bean is configured using the information in the `application.properties` file.
[source,java]
----
-include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java[tag=class]
+include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java[tag=class]
----
-link:{github-directory}/src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java[View source]
+link:{github-directory}/src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java[View source]
====
.`MapService.java`
@@ -103,10 +105,10 @@ When the `com.hazelcast.client.config.ClientConfig` bean is present, a `Hazelcas
[source,java]
----
-include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/viridian/MapService.java[tag=class]
+include::spring-boot-sample:example$src/main/java/sample/com/hazelcast/demo/cloud/MapService.java[tag=class]
----
-link:{github-directory}/src/main/java/sample/com/hazelcast/demo/viridian/MapService.java[View source]
+link:{github-directory}/src/main/java/sample/com/hazelcast/demo/cloud/MapService.java[View source]
====
== Step 2. Connect the Client
@@ -131,7 +133,7 @@ mvnw.cmd spring-boot:run
--
====
-The client connects to the cluster and adds 10 random entries to a map called `MyMap`.
+The client connects to the cluster and adds ten random entries to a map called `MyMap`.
```
...
diff --git a/pom.xml b/pom.xml
index 79ffb91..4fcaef0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,10 +9,10 @@
com.hz.demos
- hz-viridian-demo
+ hz-cloud-demo
0.0.1-SNAPSHOT
- hz-viridian-demo
- hz-viridian-demo
+ hz-cloud-demo
+ hz-cloud-demo
11
diff --git a/src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java b/src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java
similarity index 68%
rename from src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java
rename to src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java
index 0ce9046..bcbd8c5 100644
--- a/src/main/java/sample/com/hazelcast/demo/viridian/HzViridianDemoApplication.java
+++ b/src/main/java/sample/com/hazelcast/demo/cloud/HzCloudDemoApplication.java
@@ -1,4 +1,4 @@
-package sample.com.hazelcast.demo.viridian;
+package sample.com.hazelcast.demo.cloud;
import java.io.IOException;
import java.util.Properties;
@@ -15,24 +15,24 @@
// tag::class[]
@SpringBootApplication
-public class HzViridianDemoApplication {
+public class HzCloudDemoApplication {
public static void main(String[] args) {
- SpringApplication.run(HzViridianDemoApplication.class, args);
+ SpringApplication.run(HzCloudDemoApplication.class, args);
}
@ConditionalOnProperty(
- name = "hazelcast.viridian.tlsEnabled",
+ name = "hazelcast.cloud.tlsEnabled",
havingValue = "true"
)
@Bean
ClientConfig hazelcastClientConfig(
- @Value("${hazelcast.viridian.discoveryToken}") String discoveryToken,
- @Value("${hazelcast.viridian.clusterName}") String clusterName,
- @Value("${hazelcast.viridian.keyStore}") Resource keyStore,
- @Value("${hazelcast.viridian.keyStorePassword}") String keyStorePassword,
- @Value("${hazelcast.viridian.trustStore}") Resource trustStore,
- @Value("${hazelcast.viridian.trustStorePassword}") String trustStorePassword
+ @Value("${hazelcast.cloud.discoveryToken}") String discoveryToken,
+ @Value("${hazelcast.cloud.clusterId}") String clusterId,
+ @Value("${hazelcast.cloud.keyStore}") Resource keyStore,
+ @Value("${hazelcast.cloud.keyStorePassword}") String keyStorePassword,
+ @Value("${hazelcast.cloud.trustStore}") Resource trustStore,
+ @Value("${hazelcast.cloud.trustStorePassword}") String trustStorePassword
) throws IOException {
Properties props = new Properties();
props.setProperty("javax.net.ssl.keyStore", keyStore.getURI().getPath());
@@ -46,8 +46,8 @@ ClientConfig hazelcastClientConfig(
.getCloudConfig()
.setDiscoveryToken(discoveryToken)
.setEnabled(true);
- config.setClusterName(clusterName);
- config.setProperty("hazelcast.client.cloud.url", "https://api.viridian.hazelcast.com");
+ config.setClusterId(clusterId);
+ config.setProperty("hazelcast.client.cloud.url", "https://api.cloud.hazelcast.com");
return config;
}
diff --git a/src/main/java/sample/com/hazelcast/demo/viridian/MapService.java b/src/main/java/sample/com/hazelcast/demo/cloud/MapService.java
similarity index 96%
rename from src/main/java/sample/com/hazelcast/demo/viridian/MapService.java
rename to src/main/java/sample/com/hazelcast/demo/cloud/MapService.java
index 537e965..ac4d071 100644
--- a/src/main/java/sample/com/hazelcast/demo/viridian/MapService.java
+++ b/src/main/java/sample/com/hazelcast/demo/cloud/MapService.java
@@ -1,4 +1,4 @@
-package sample.com.hazelcast.demo.viridian;
+package sample.com.hazelcast.demo.cloud;
import java.util.Map;
import java.util.UUID;
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index f6294d6..7122a6b 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,7 +1,7 @@
-hazelcast.viridian.clusterName=
-hazelcast.viridian.discoveryToken=
-hazelcast.viridian.tlsEnabled=true
-hazelcast.viridian.keyStore=classpath:/client.keystore
-hazelcast.viridian.keyStorePassword=
-hazelcast.viridian.trustStore=classpath:/client.truststore
-hazelcast.viridian.trustStorePassword=
+hazelcast.cloud.clusterId=
+hazelcast.cloud.discoveryToken=
+hazelcast.cloud.tlsEnabled=true
+hazelcast.cloud.keyStore=classpath:/client.keystore
+hazelcast.cloud.keyStorePassword=
+hazelcast.cloud.trustStore=classpath:/client.truststore
+hazelcast.cloud.trustStorePassword=
From 698a742c513658bd72bfea6994d55ab8ab6f692a Mon Sep 17 00:00:00 2001
From: rebekah-lawrence <142301480+rebekah-lawrence@users.noreply.github.com>
Date: Tue, 20 Feb 2024 11:05:21 +0000
Subject: [PATCH 2/2] Updated minimum JDK version
---
docs/modules/ROOT/pages/spring-boot-client.adoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/modules/ROOT/pages/spring-boot-client.adoc b/docs/modules/ROOT/pages/spring-boot-client.adoc
index 88af7be..8c5bb8b 100644
--- a/docs/modules/ROOT/pages/spring-boot-client.adoc
+++ b/docs/modules/ROOT/pages/spring-boot-client.adoc
@@ -26,7 +26,7 @@ You need the following:
- A xref:cloud:ROOT:create-serverless-cluster.adoc[{hazelcast-cloud} Standard cluster].
- link:https://git-scm.com/book/en/v2/Getting-Started-Installing-Git[Git]
- link:https://maven.apache.org/install.html[Maven]
-- JDK 11, or higher
+- JDK 17 or later
- `JAVA_HOME` environment variable set to the path of the JDK