diff --git a/src/main/java/com/contentstack/cms/stack/Workflow.java b/src/main/java/com/contentstack/cms/stack/Workflow.java
index 8a2d66c9..c43fde9e 100644
--- a/src/main/java/com/contentstack/cms/stack/Workflow.java
+++ b/src/main/java/com/contentstack/cms/stack/Workflow.java
@@ -21,7 +21,7 @@
* Note: You cannot create workflows in a stack that supports branches
* when using the classic Contentstack interface.
*
- * @author ishaileshmishra
+ * @author ***REMOVED***
* @version v01.0
* @since 2022-10-22
*/
diff --git a/src/main/java/com/contentstack/cms/user/User.java b/src/main/java/com/contentstack/cms/user/User.java
index fd9120d8..53b05b8f 100644
--- a/src/main/java/com/contentstack/cms/user/User.java
+++ b/src/main/java/com/contentstack/cms/user/User.java
@@ -19,7 +19,7 @@
* can have many users with varying
* permissions and roles.
*
- * @author ishaileshmishra
+ * @author ***REMOVED***
* @version v0.1.0
* @since 2022-10-22
*/
@@ -45,7 +45,7 @@ public class User implements BaseImplementation {
* contentstack.user().execute();
*
*
- * @author ishaileshmishra
+ * @author ***REMOVED***
*/
public User(Retrofit client) {
this.params = new HashMap<>();
diff --git a/src/main/overview.html b/src/main/overview.html
index 51879411..4c49cdb9 100644
--- a/src/main/overview.html
+++ b/src/main/overview.html
@@ -91,7 +91,7 @@ Helpful Links
Content Management API Docs
The MIT License (MIT)
-Copyright © 2012-2023 Contentstack. All Rights Reserved
+Copyright © 2012-2024 Contentstack. All Rights Reserved
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/test/java/com/contentstack/cms/ContentstackAPITest.java b/src/test/java/com/contentstack/cms/ContentstackAPITest.java
index d2c0032a..6f1ca163 100644
--- a/src/test/java/com/contentstack/cms/ContentstackAPITest.java
+++ b/src/test/java/com/contentstack/cms/ContentstackAPITest.java
@@ -11,7 +11,7 @@
import java.io.IOException;
/*
- @author ishaileshmishra@gmail.com
+ @author ***REMOVED***@gmail.com
@since CMS v0.0.1
*/
public class ContentstackAPITest {
diff --git a/src/test/java/com/contentstack/cms/ContentstackUnitTest.java b/src/test/java/com/contentstack/cms/ContentstackUnitTest.java
index eaca866e..6386cf22 100644
--- a/src/test/java/com/contentstack/cms/ContentstackUnitTest.java
+++ b/src/test/java/com/contentstack/cms/ContentstackUnitTest.java
@@ -1,9 +1,15 @@
package com.contentstack.cms;
+import com.contentstack.cms.core.AuthInterceptor;
import com.contentstack.cms.organization.Organization;
import com.contentstack.cms.stack.Stack;
import okhttp3.Headers;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
import okhttp3.ResponseBody;
+import okhttp3.mockwebserver.MockResponse;
+import okhttp3.mockwebserver.MockWebServer;
+import okhttp3.mockwebserver.RecordedRequest;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import retrofit2.Response;
@@ -262,5 +268,66 @@ public void testEmptyOrganizationUid() {
Assertions.assertThrows(IllegalStateException.class, () -> client.organization(emptyOrganizationUid));
}
+ @Test
+ public void testEarlyAccessHeader() throws IOException, InterruptedException {
+ MockWebServer mockWebServer = new MockWebServer();
+ mockWebServer.enqueue(new MockResponse().setBody("{}"));
+
+ AuthInterceptor authInterceptor = new AuthInterceptor();
+ authInterceptor.setEarlyAccess(new String[]{"Taxonomy"});
+
+ OkHttpClient client = new OkHttpClient.Builder()
+ .addInterceptor(authInterceptor)
+ .build();
+
+ Request request = new Request.Builder()
+ .url(mockWebServer.url("/"))
+ .build();
+
+ client.newCall(request).execute();
+ RecordedRequest recordedRequest = mockWebServer.takeRequest();
+ String earlyAccessHeader = recordedRequest.getHeader("x-header-ea");
+
+ Assertions.assertNotNull(earlyAccessHeader);
+ Assertions.assertEquals("Taxonomy", earlyAccessHeader);
+
+ mockWebServer.shutdown();
+ }
+ @Test
+ public void testEarlyAccessMultipleHeader() throws IOException, InterruptedException {
+ MockWebServer mockWebServer = new MockWebServer();
+ mockWebServer.enqueue(new MockResponse().setBody("{}"));
+
+ AuthInterceptor authInterceptor = new AuthInterceptor();
+ authInterceptor.setEarlyAccess(new String[]{"Taxonomy","Teams"});
+
+ OkHttpClient client = new OkHttpClient.Builder()
+ .addInterceptor(authInterceptor)
+ .build();
+
+ Request request = new Request.Builder()
+ .url(mockWebServer.url("/"))
+ .build();
+
+ client.newCall(request).execute();
+ RecordedRequest recordedRequest = mockWebServer.takeRequest();
+ String earlyAccessHeader = recordedRequest.getHeader("x-header-ea");
+
+ Assertions.assertNotNull(earlyAccessHeader);
+ Assertions.assertEquals("Taxonomy, Teams", earlyAccessHeader);
+
+ mockWebServer.shutdown();
+ }
+
+ @Test
+ public void testEarlyAccessHeaderEmpty() {
+ String[] emptyEarlyAccessFeatures = {};
+ Contentstack client = new Contentstack.Builder()
+ .earlyAccess(emptyEarlyAccessFeatures)
+ .build();
+
+ Assertions.assertNotNull(client.earlyAccess);
+ Assertions.assertEquals(0, client.earlyAccess.length);
+ }
}
diff --git a/src/test/java/com/contentstack/cms/TestClient.java b/src/test/java/com/contentstack/cms/TestClient.java
index c30f7e99..37444610 100644
--- a/src/test/java/com/contentstack/cms/TestClient.java
+++ b/src/test/java/com/contentstack/cms/TestClient.java
@@ -48,7 +48,7 @@ public static Contentstack getCustomClient() {
instance = new Contentstack.Builder()
.setAuthtoken(AUTHTOKEN)
.setConnectionPool(5, 400, TimeUnit.MILLISECONDS)
- .setHost("kpm.ishaileshmishra.io/path/another").build();
+ .setHost("kpm.***REMOVED***.io/path/another").build();
}
}
}
diff --git a/src/test/java/com/contentstack/cms/models/LoginDetailTest.java b/src/test/java/com/contentstack/cms/models/LoginDetailTest.java
index 115ab438..b73ec23f 100644
--- a/src/test/java/com/contentstack/cms/models/LoginDetailTest.java
+++ b/src/test/java/com/contentstack/cms/models/LoginDetailTest.java
@@ -86,24 +86,24 @@ void getterSetterUserModelFailedAttempts() {
@Test
void getterSetterUserModelFirstName() {
UserModel userModel = new UserModel();
- userModel.setFirstName("ishaileshmishra");
- Assertions.assertEquals("ishaileshmishra",
+ userModel.setFirstName("***REMOVED***");
+ Assertions.assertEquals("***REMOVED***",
userModel.getFirstName());
}
@Test
void getterSetterUserModelLastName() {
UserModel userModel = new UserModel();
- userModel.setLastName("ishaileshmishra");
- Assertions.assertEquals("ishaileshmishra",
+ userModel.setLastName("***REMOVED***");
+ Assertions.assertEquals("***REMOVED***",
userModel.getLastName());
}
@Test
void getterSetterUserModelUsername() {
UserModel userModel = new UserModel();
- userModel.setUsername("ishaileshmishra");
- Assertions.assertEquals("ishaileshmishra",
+ userModel.setUsername("***REMOVED***");
+ Assertions.assertEquals("***REMOVED***",
userModel.getUsername());
}
diff --git a/src/test/java/com/contentstack/cms/organization/OrgUnitTests.java b/src/test/java/com/contentstack/cms/organization/OrgUnitTests.java
index df697565..33687684 100644
--- a/src/test/java/com/contentstack/cms/organization/OrgUnitTests.java
+++ b/src/test/java/com/contentstack/cms/organization/OrgUnitTests.java
@@ -457,7 +457,7 @@ void testGetAllInvitationsRequestParam() {
@Test
@Order(38)
void testTransferOwnershipMethod() {
- //String transferToEmail = "ishaileshmishra@gmail.com";
+ //String transferToEmail = "***REMOVED***@gmail.com";
Request requestInfo = organization.transferOwnership(new JSONObject()).request();
Assertions.assertEquals("POST",
requestInfo.method());
@@ -466,7 +466,7 @@ void testTransferOwnershipMethod() {
@Test
@Order(39)
void testTransferOwnershipEncodedPath() {
- // String transferToEmail = "ishaileshmishra@gmail.com";
+ // String transferToEmail = "***REMOVED***@gmail.com";
Request requestInfo = organization.transferOwnership(new JSONObject()).request();
Assertions.assertEquals("/v3/organizations/" + organizationUid + "/transfer-ownership",
requestInfo.url().encodedPath());
@@ -481,7 +481,7 @@ void testTransferOwnershipHeaders() {
@Test
@Order(41)
void testTransferOwnershipRequestBody() {
- //String transferToEmail = "ishaileshmishra@gmail.com";
+ //String transferToEmail = "***REMOVED***@gmail.com";
Request requestInfo = organization.transferOwnership(new JSONObject()).request();
assertNull(
requestInfo.url().encodedQuery());
diff --git a/src/test/java/com/contentstack/cms/stack/AssetAPITest.java b/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
index c64b1a8b..6c38a297 100644
--- a/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/AssetAPITest.java
@@ -174,7 +174,7 @@ void testAssetReplace() throws IOException {
asset.addHeader("authorization", MANAGEMENT_TOKEN);
// Create Asset Instance to find all assets
String filePath = "/Users/shaileshmishra/Downloads/calendar.png";
- Response resp = asset.replace(filePath, "Assets created by ishaileshmishra").execute();
+ Response resp = asset.replace(filePath, "Assets created by ***REMOVED***").execute();
// The assertions
Assertions.assertEquals(6, resp.raw().request().headers().size());
Assertions.assertTrue(resp.raw().request().headers().names().contains("api_key"));
@@ -248,7 +248,7 @@ void testAssetDownloadPermanentUrl() throws IOException {
@Test
void testAssetUploadWithMultipleParams() throws IOException {
- String description = "The calender has been placed to assets by ishaileshmishra";
+ String description = "The calender has been placed to assets by ***REMOVED***";
String filePath = "/Users/shaileshmishra/Documents/workspace/GitHub/contentstack-management-java/src/test/resources/asset.png";
Contentstack client = new Contentstack.Builder().build();
Stack stack = client.stack("Your-api-key", "authorization");
diff --git a/src/test/java/com/contentstack/cms/stack/AssetUnitTest.java b/src/test/java/com/contentstack/cms/stack/AssetUnitTest.java
index e642347b..8abfb6aa 100644
--- a/src/test/java/com/contentstack/cms/stack/AssetUnitTest.java
+++ b/src/test/java/com/contentstack/cms/stack/AssetUnitTest.java
@@ -168,7 +168,7 @@ void testAssetReplace() {
asset.addParam("include_dimension", true);
String filePath = "/Users/shaileshmishra/Downloads/calendar.png";
- Request resp = asset.replace(filePath, "The calender has been placed to assets by ishaileshmishra")
+ Request resp = asset.replace(filePath, "The calender has been placed to assets by ***REMOVED***")
.request();
Assertions.assertTrue(resp.isHttps());
Assertions.assertEquals("PUT", resp.method());
diff --git a/src/test/java/com/contentstack/cms/stack/EntryFieldUnitTests.java b/src/test/java/com/contentstack/cms/stack/EntryFieldUnitTests.java
index f9701a5a..1b2f1909 100644
--- a/src/test/java/com/contentstack/cms/stack/EntryFieldUnitTests.java
+++ b/src/test/java/com/contentstack/cms/stack/EntryFieldUnitTests.java
@@ -2,13 +2,20 @@
import com.contentstack.cms.Contentstack;
import com.contentstack.cms.TestClient;
+import com.google.gson.JsonArray;
+
import okhttp3.Request;
+
import okhttp3.ResponseBody;
+import retrofit2.Response;
+
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.junit.jupiter.api.*;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -93,6 +100,29 @@ void testSingleEntryQuery() {
Request resp = entryInstance.fetch().request();
Assertions.assertEquals("include_publish_details=true&locale=en-us&include_workflow=false", resp.url().query());
}
+ @Test
+ void testIncludeReferenceSingleReference(){
+ Request request = entryInstance.includeReference("reference").request();
+ Assertions.assertEquals("include[]=reference", request.url().query());
+ }
+ @Test
+ void testIncludeReferenceMultipleReferences() {
+ String[] array = {"reference","navigation_menu.page_reference"};
+ Request req = entryInstance.includeReference(array).request();
+ Assertions.assertEquals("include[]1=reference&include[]2=navigation_menu.page_reference", req.url().query());
+ }
+
+ @Test
+ void testIncludeReferenceMultipleReferencesWithParams() throws IOException {
+ entryInstance.clearParams();
+ entryInstance.addParam("locale", "en-us");
+ String[] array = {"reference","navigation_menu.page_reference"};
+ entryInstance.addParam("include_workflow", false);
+ entryInstance.addParam("include_publish_details", true);
+ Request req = entryInstance.includeReference(array).request();
+ Assertions.assertEquals("include[]1=reference&include_publish_details=true&include[]2=navigation_menu.page_reference&locale=en-us&include_workflow=false", req.url().query());
+
+ }
@Test
void testSingleEntryEncodedPath() {
diff --git a/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java b/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
index 8e4753fa..ec99a09f 100644
--- a/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
+++ b/src/test/java/com/contentstack/cms/stack/EntryFieldsAPITest.java
@@ -62,7 +62,7 @@ void testEntryFetch() {
void testEntryCreate() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryCreate = new JSONObject();
entryCreate.put("entry", body);
Request request = entry.create(entryCreate).request();
@@ -82,7 +82,7 @@ void testEntryCreate() {
void testUpdate() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryUpdate = new JSONObject();
entryUpdate.put("entry", body);
@@ -105,7 +105,7 @@ void testUpdate() {
void testAtomicOperation() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryBody = new JSONObject();
entryBody.put("entry", body);
@@ -145,7 +145,7 @@ void testEntryDelete() {
void testEntryVersionName() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryBody = new JSONObject();
entryBody.put("entry", body);
@@ -187,7 +187,7 @@ void testEntryDetailOfAllVersion() {
void testEntryDeleteVersionName() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryBody = new JSONObject();
entryBody.put("entry", body);
@@ -229,7 +229,7 @@ void testEntryGetReference() {
void testEntryLocalise() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryBody = new JSONObject();
entryBody.put("entry", body);
@@ -303,7 +303,7 @@ void testEntryImportExisting() {
void testEntryPublish() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryBody = new JSONObject();
entryBody.put("entry", body);
@@ -326,7 +326,7 @@ void testEntryPublish() {
void testEntryPublishWithReference() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryBody = new JSONObject();
entryBody.put("entry", body);
Request request = entry.publishWithReference(entryBody).request();
@@ -347,7 +347,7 @@ void testEntryPublishWithReference() {
void testPublishWithReference() {
JSONObject body = new JSONObject();
body.put("title", "The Create an entry call creates a new entry for the selected content type for testing");
- body.put("url", "www.ishaileshmishra.in/stack/content_type/entry/fakeuid/code");
+ body.put("url", "www.***REMOVED***.in/stack/content_type/entry/fakeuid/code");
JSONObject entryBody = new JSONObject();
entryBody.put("entry", body);
diff --git a/src/test/resources/entry.json b/src/test/resources/entry.json
index d2f2d452..a7fd86c3 100644
--- a/src/test/resources/entry.json
+++ b/src/test/resources/entry.json
@@ -10,7 +10,7 @@
"tags": [
"abdn",
"shailesh",
- "ishaileshmishra",
+ "***REMOVED***",
"nature",
"loves"
],
diff --git a/src/test/resources/mockstack/setting.json b/src/test/resources/mockstack/setting.json
index 6b934c20..1ed9f2e2 100644
--- a/src/test/resources/mockstack/setting.json
+++ b/src/test/resources/mockstack/setting.json
@@ -5,7 +5,7 @@
"sys_rte_allowed_tags":"style, figure, script"
},
"rte":{
- "ishaileshmishra":true
+ "***REMOVED***":true
}
}
}
\ No newline at end of file
diff --git a/src/test/resources/mockstack/share_stack.json b/src/test/resources/mockstack/share_stack.json
index ffdf7862..b22145ce 100644
--- a/src/test/resources/mockstack/share_stack.json
+++ b/src/test/resources/mockstack/share_stack.json
@@ -1,10 +1,10 @@
{
"emails": [
- "ishaileshmishra@contentstack.com"
+ "***REMOVED***@contentstack.com"
],
"roles": {
"manager@example.com": [
- "ishaileshmishra8176367267626"
+ "***REMOVED***8176367267626"
]
}
}
\ No newline at end of file
diff --git a/src/test/resources/mockstack/unshare.json b/src/test/resources/mockstack/unshare.json
index 5cd89d83..437c8054 100644
--- a/src/test/resources/mockstack/unshare.json
+++ b/src/test/resources/mockstack/unshare.json
@@ -1,3 +1,3 @@
{
- "email": "ishaileshmishra@manager.com"
+ "email": "***REMOVED***@manager.com"
}
\ No newline at end of file