diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae4cb63c..e7f8657d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,11 @@
# CHANGELOG
+
+## v1.14.0
+
+### Date: 13-May-2024
+
+-GCP support implementation
+
## v1.13.1
### Date: 16-Apr-2024
diff --git a/pom.xml b/pom.xml
index 7ac20116..42eaa863 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
com.contentstack.sdk
java
- 1.13.1
+ 1.14.0
jar
contentstack-java
Java SDK for Contentstack Content Delivery API
@@ -21,10 +21,10 @@
3.4.1
3.0.0
3.1.8
- 2.10.0
+ 2.11.0
5.0.0-alpha.11
0.8.5
- 1.18.30
+ 1.18.32
5.10.1
5.8.0-M1
2.8.8
@@ -36,7 +36,7 @@
20240303
0.8.7
2.5.3
- 1.2.6
+ 1.2.7
diff --git a/src/main/java/com/contentstack/sdk/Config.java b/src/main/java/com/contentstack/sdk/Config.java
index 5fec119d..e4567afc 100644
--- a/src/main/java/com/contentstack/sdk/Config.java
+++ b/src/main/java/com/contentstack/sdk/Config.java
@@ -196,7 +196,7 @@ public Config setManagementToken(@NotNull String managementToken) {
* The enum Contentstack region. for now contentstack supports [US, EU, AZURE_NA]
*/
public enum ContentstackRegion {
- US, EU, AZURE_NA, AZURE_EU
+ US, EU, AZURE_NA, AZURE_EU, GCP_NA
}
}
diff --git a/src/main/java/com/contentstack/sdk/Stack.java b/src/main/java/com/contentstack/sdk/Stack.java
index 512d9a92..8e54ff0a 100644
--- a/src/main/java/com/contentstack/sdk/Stack.java
+++ b/src/main/java/com/contentstack/sdk/Stack.java
@@ -63,6 +63,11 @@ protected void setConfig(Config config) {
urlDomain = "cdn.contentstack.com";
}
config.host = "azure-eu" + "-" + urlDomain;
+ } else if (region.equalsIgnoreCase("gcp_na")) {
+ if (urlDomain.equalsIgnoreCase("cdn.contentstack.io")) {
+ urlDomain = "cdn.contentstack.com";
+ }
+ config.host = "gcp-na" + "-" + urlDomain;
}
}
diff --git a/src/test/java/com/contentstack/sdk/TestAsset.java b/src/test/java/com/contentstack/sdk/TestAsset.java
index 0991b583..259efe83 100644
--- a/src/test/java/com/contentstack/sdk/TestAsset.java
+++ b/src/test/java/com/contentstack/sdk/TestAsset.java
@@ -39,13 +39,13 @@ public void onCompletion(ResponseType responseType, List assets, Error er
assetUid = model.getAssetUid();
Assertions.assertTrue(model.getAssetUid().startsWith("blt"));
Assertions.assertEquals("image/jpeg", model.getFileType());
- Assertions.assertEquals("482141", model.getFileSize());
+ Assertions.assertEquals("1775299", model.getFileSize());
Assertions.assertEquals("phoenix2.jpg", model.getFileName());
Assertions.assertTrue(model.getUrl().endsWith("phoenix2.jpg"));
Assertions.assertTrue(model.toJSON().has("created_at"));
Assertions.assertTrue(model.getCreatedBy().startsWith("blt"));
Assertions.assertEquals("gregory", model.getUpdateAt().getCalendarType());
- Assertions.assertTrue(model.getUpdatedBy().startsWith("sys"));
+ Assertions.assertTrue(model.getUpdatedBy().startsWith("blt"));
Assertions.assertEquals("", model.getDeletedBy());
}
});
@@ -61,13 +61,13 @@ void testNewAssetZOnlyForOrderByUid() {
public void onCompletion(ResponseType responseType, Error error) {
Assertions.assertTrue(asset.getAssetUid().startsWith("blt"));
Assertions.assertEquals("image/jpeg", asset.getFileType());
- Assertions.assertEquals("482141", asset.getFileSize());
+ Assertions.assertEquals("1775299", asset.getFileSize());
Assertions.assertEquals("phoenix2.jpg", asset.getFileName());
Assertions.assertTrue(asset.getUrl().endsWith("phoenix2.jpg"));
Assertions.assertTrue(asset.toJSON().has("created_at"));
Assertions.assertTrue(asset.getCreatedBy().startsWith("blt"));
Assertions.assertEquals("gregory", asset.getUpdateAt().getCalendarType());
- Assertions.assertTrue(asset.getUpdatedBy().startsWith("sys"));
+ Assertions.assertTrue(asset.getUpdatedBy().startsWith("blt"));
Assertions.assertNull(asset.getDeleteAt());
Assertions.assertEquals("gregory", asset.getCreateAt().getCalendarType());
Assertions.assertEquals("", asset.getDeletedBy());
diff --git a/src/test/java/com/contentstack/sdk/TestAssetLibrary.java b/src/test/java/com/contentstack/sdk/TestAssetLibrary.java
index 6e49a061..937e82c0 100644
--- a/src/test/java/com/contentstack/sdk/TestAssetLibrary.java
+++ b/src/test/java/com/contentstack/sdk/TestAssetLibrary.java
@@ -24,13 +24,13 @@ public void onCompletion(ResponseType responseType, List assets, Error er
Asset model = assets.get(0);
Assertions.assertTrue(model.getAssetUid().startsWith("blt"));
assertEquals("image/jpeg", model.getFileType());
- assertEquals("482141", model.getFileSize());
+ assertEquals("1775299", model.getFileSize());
assertEquals("phoenix2.jpg", model.getFileName());
Assertions.assertTrue(model.getUrl().endsWith("phoenix2.jpg"));
Assertions.assertTrue(model.toJSON().has("created_at"));
Assertions.assertTrue(model.getCreatedBy().startsWith("blt"));
assertEquals("gregory", model.getUpdateAt().getCalendarType());
- Assertions.assertTrue(model.getUpdatedBy().startsWith("sys"));
+ Assertions.assertTrue(model.getUpdatedBy().startsWith("blt"));
assertEquals("", model.getDeletedBy());
logger.info("passed...");
}
diff --git a/src/test/java/com/contentstack/sdk/TestEntry.java b/src/test/java/com/contentstack/sdk/TestEntry.java
index 3cd0f4ff..d0fb1089 100644
--- a/src/test/java/com/contentstack/sdk/TestEntry.java
+++ b/src/test/java/com/contentstack/sdk/TestEntry.java
@@ -178,7 +178,7 @@ void entryGetBoolean() {
@Test
@Order(19)
void entryGetJSONArray() {
- Object image = entry.getJSONArray("image");
+ Object image = entry.getJSONObject("image");
Assertions.assertNotNull(image);
logger.info("passed...");
}
diff --git a/src/test/java/com/contentstack/sdk/TestGcpRegion.java b/src/test/java/com/contentstack/sdk/TestGcpRegion.java
new file mode 100644
index 00000000..faa1b0b5
--- /dev/null
+++ b/src/test/java/com/contentstack/sdk/TestGcpRegion.java
@@ -0,0 +1,36 @@
+package com.contentstack.sdk;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class TestGcpRegion {
+ @Test
+ void testGcpRegionBehaviourGcpNA() {
+ Config config = new Config();
+ Config.ContentstackRegion region = Config.ContentstackRegion.GCP_NA;
+ config.setRegion(region);
+ Assertions.assertFalse(config.region.name().isEmpty());
+ Assertions.assertEquals("GCP_NA", config.region.name());
+ }
+
+ @Test
+ void testGcpNaRegionBehaviourGcpStack() throws IllegalAccessException {
+ Config config = new Config();
+ Config.ContentstackRegion region = Config.ContentstackRegion.GCP_NA;
+ config.setRegion(region);
+ Stack stack = Contentstack.stack("fakeApiKey", "fakeDeliveryToken", "fakeEnvironment", config);
+ Assertions.assertFalse(config.region.name().isEmpty());
+ Assertions.assertEquals("GCP_NA", stack.config.region.name());
+ }
+
+ @Test
+ void testGcpNARegionBehaviourGcpStackHost() throws IllegalAccessException {
+ Config config = new Config();
+ Config.ContentstackRegion region = Config.ContentstackRegion.GCP_NA;
+ config.setRegion(region);
+ Stack stack = Contentstack.stack("fakeApiKey", "fakeDeliveryToken", "fakeEnvironment", config);
+ Assertions.assertFalse(config.region.name().isEmpty());
+ Assertions.assertEquals("gcp-na-cdn.contentstack.com", stack.config.host);
+
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/contentstack/sdk/TestQueryCase.java b/src/test/java/com/contentstack/sdk/TestQueryCase.java
index 05bdbf13..427bb187 100644
--- a/src/test/java/com/contentstack/sdk/TestQueryCase.java
+++ b/src/test/java/com/contentstack/sdk/TestQueryCase.java
@@ -557,7 +557,7 @@ protected void doSomeBackgroundTask(Group group) {
Object titleObj = group.get("title");
String titleStr = group.getString("title");
Boolean titleBool = group.getBoolean("in_stock");
- JSONArray titleJSONArray = group.getJSONArray("image");
+ JSONObject titleImageJSONArray = group.getJSONObject("image");
JSONObject titleJSONObject = group.getJSONObject("publish_details");
Object versionNum = group.getNumber("_version");
Object versionInt = group.getInt("_version");
@@ -568,7 +568,7 @@ protected void doSomeBackgroundTask(Group group) {
Assertions.assertNotNull(titleObj);
Assertions.assertNotNull(titleStr);
Assertions.assertNotNull(titleBool);
- Assertions.assertNotNull(titleJSONArray);
+ Assertions.assertNotNull(titleImageJSONArray);
Assertions.assertNotNull(titleJSONObject);
Assertions.assertNotNull(versionNum);
Assertions.assertNotNull(versionInt);