diff --git a/bom/application/pom.xml b/bom/application/pom.xml
index eaeeda916d95..ad8f2200e10e 100644
--- a/bom/application/pom.xml
+++ b/bom/application/pom.xml
@@ -26,6 +26,7 @@
2.28
22.3.3
1.13.10
+ 3.3.0
@@ -839,6 +840,41 @@
4.4.6
+
+
+ org.opensearch.client
+ opensearch-java
+ ${opensearch.version}
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+
+
+ org.apache.httpcomponents.core5
+ httpcore5
+
+
+
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+ 5.5
+
+
+
+ org.apache.httpcomponents.core5
+ httpcore5
+ 5.3.4
+
+
+
+ org.apache.httpcomponents.core5
+ httpcore5-h2
+ 5.3.4
+
+
org.elasticsearch.client
elasticsearch-rest-high-level-client
diff --git a/dotCMS/pom.xml b/dotCMS/pom.xml
index 2c1acbf8eee4..f1ebaa643510 100644
--- a/dotCMS/pom.xml
+++ b/dotCMS/pom.xml
@@ -727,6 +727,36 @@
jedis
+
+ org.opensearch.client
+ opensearch-java
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+
+
+ org.apache.httpcomponents.core5
+ httpcore5
+
+
+
+
+
+ org.apache.httpcomponents.core5
+ httpcore5
+
+
+
+ org.apache.httpcomponents.core5
+ httpcore5-h2
+
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+
+
org.elasticsearch.client
elasticsearch-rest-high-level-client
diff --git a/dotCMS/src/enterprise/java/com/dotcms/enterprise/priv/ESSearchAPIImpl.java b/dotCMS/src/enterprise/java/com/dotcms/enterprise/priv/ESSearchAPIImpl.java
index 69806fdad2bb..99f66c9152c0 100644
--- a/dotCMS/src/enterprise/java/com/dotcms/enterprise/priv/ESSearchAPIImpl.java
+++ b/dotCMS/src/enterprise/java/com/dotcms/enterprise/priv/ESSearchAPIImpl.java
@@ -9,9 +9,11 @@
package com.dotcms.enterprise.priv;
+import static com.dotcms.content.elasticsearch.business.ESIndexAPI.INDEX_OPERATIONS_TIMEOUT_IN_MS;
+
import com.dotcms.content.elasticsearch.business.ESContentFactoryImpl;
import com.dotcms.content.elasticsearch.business.ESSearchResults;
-import com.dotcms.content.elasticsearch.business.IndiciesInfo;
+import com.dotcms.content.elasticsearch.business.IndicesInfo;
import com.dotcms.content.elasticsearch.util.RestHighLevelClientProvider;
import com.dotcms.enterprise.ESSeachAPI;
import com.dotcms.enterprise.priv.util.SearchSourceBuilderUtil;
@@ -29,6 +31,10 @@
import com.dotmarketing.util.json.JSONException;
import com.dotmarketing.util.json.JSONObject;
import com.liferay.portal.model.User;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
@@ -37,13 +43,6 @@
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static com.dotcms.content.elasticsearch.business.ESIndexAPI.INDEX_OPERATIONS_TIMEOUT_IN_MS;
-
/**
* Implementation class for the {@link ESSeachAPI}.
*
@@ -200,9 +199,9 @@ private SearchResponse esSearchRaw(JSONObject jsonObject, boolean live, User use
throws DotSecurityException, DotDataException {
String indexToHit;
- IndiciesInfo info;
+ IndicesInfo info;
try {
- info = APILocator.getIndiciesAPI().loadIndicies();
+ info = APILocator.getIndiciesAPI().loadLegacyIndices();
if (live) {
indexToHit = info.getLive();
} else {
diff --git a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/sitesearch/ESSiteSearchAPI.java b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/sitesearch/ESSiteSearchAPI.java
index 44100ee0491d..83b2a235e941 100644
--- a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/sitesearch/ESSiteSearchAPI.java
+++ b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/sitesearch/ESSiteSearchAPI.java
@@ -73,17 +73,17 @@ public class ESSiteSearchAPI implements SiteSearchAPI{
private final ESIndexAPI indexApi;
private final ESMappingAPIImpl mappingAPI;
- private final IndiciesAPI indiciesAPI;
+ private final IndicesAPI indicesAPI;
private ArrayList
+
+
+ org.opensearch.client
+ opensearch-java
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+
+
+ org.apache.httpcomponents.core5
+ httpcore5
+
+
+ test
+
+
+
+ org.apache.httpcomponents.core5
+ httpcore5
+ test
+
+
+
+ org.apache.httpcomponents.core5
+ httpcore5-h2
+ test
+
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+ test
+
+
diff --git a/dotcms-integration/src/test/java/com/dotcms/MainSuite1b.java b/dotcms-integration/src/test/java/com/dotcms/MainSuite1b.java
index 5e2c346a8c3e..c18e52f9abd4 100644
--- a/dotcms-integration/src/test/java/com/dotcms/MainSuite1b.java
+++ b/dotcms-integration/src/test/java/com/dotcms/MainSuite1b.java
@@ -1,5 +1,6 @@
package com.dotcms;
+import com.dotcms.content.elasticsearch.business.IndicesFactoryTest;
import com.dotcms.graphql.DotGraphQLHttpServletTest;
import com.dotcms.junit.MainBaseSuite;
import com.dotcms.storage.Chainable404StorageCacheTest;
@@ -83,7 +84,7 @@
DotConnectTest.class,
com.dotcms.contenttype.model.field.layout.FieldUtilTest.class,
com.dotmarketing.portlets.contentlet.business.HostAPITest.class,
- com.dotcms.content.elasticsearch.business.IndiciesFactoryTest.class,
+ IndicesFactoryTest.class,
com.dotcms.content.elasticsearch.business.ESIndexSpeedTest.class,
com.dotcms.content.elasticsearch.business.ESSiteSearchAPITest.class,
com.dotcms.content.elasticsearch.business.ContentletIndexAPIImplTest.class,
diff --git a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImplTest.java b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImplTest.java
index e593be8e7411..3329511ae4fb 100644
--- a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImplTest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImplTest.java
@@ -45,7 +45,6 @@
import com.dotmarketing.portlets.structure.model.Structure;
import com.dotmarketing.portlets.templates.model.Template;
import com.dotmarketing.sitesearch.business.SiteSearchAPI;
-import com.dotmarketing.util.Config;
import com.dotmarketing.util.Logger;
import com.dotmarketing.util.UUIDGenerator;
import com.dotmarketing.util.UtilMethods;
@@ -273,7 +272,7 @@ public void test_indexContentList_with_diff_refresh_strategies() throws Exceptio
/**
- * Testing the {@link ContentletIndexAPI#createContentIndex(String)},
+ * Testing the {@link ContentletIndexAPI#createContentIndexLegacy(String)},
* {@link ContentletIndexAPI#delete(String)} and {@link ContentletIndexAPI#listDotCMSIndices()}
* methods
*
@@ -297,12 +296,12 @@ public void createContentIndexAndDelete() throws Exception {
int oldIndices = indices.size();
//Creates the working index
- boolean result = indexAPI.createContentIndex(workingIndex);
+ boolean result = indexAPI.createContentIndexLegacy(workingIndex);
//Validate
assertTrue(result);
//Creates the live index
- result = indexAPI.createContentIndex(liveIndex);
+ result = indexAPI.createContentIndexLegacy(liveIndex);
//Validate
assertTrue(result);
@@ -385,13 +384,13 @@ public void activateDeactivateIndex() throws Exception {
String oldActiveWorking = indexAPI.getActiveIndexName(IndexType.WORKING.getPrefix());
//Creates the working index
- boolean result = indexAPI.createContentIndex(workingIndex);
+ boolean result = indexAPI.createContentIndexLegacy(workingIndex);
assertTrue(result);
//Activate this working index
indexAPI.activateIndex(workingIndex);
//Creates the live index
- result = indexAPI.createContentIndex(liveIndex);
+ result = indexAPI.createContentIndexLegacy(liveIndex);
assertTrue(result);
//Activate this live index
indexAPI.activateIndex(liveIndex);
@@ -455,12 +454,12 @@ public void optimize() throws Exception {
String liveIndex = IndexType.LIVE.getPrefix() + "_" + timeStamp;
//Creates the working index
- boolean result = indexAPI.createContentIndex(workingIndex);
+ boolean result = indexAPI.createContentIndexLegacy(workingIndex);
//Validate
assertTrue(result);
//Creates the live index
- result = indexAPI.createContentIndex(liveIndex);
+ result = indexAPI.createContentIndexLegacy(liveIndex);
//Validate
assertTrue(result);
@@ -1103,9 +1102,9 @@ private SearchHits indexSearch(String indexName, String query) throws Exception
@Nullable
private static String getSiteSearchIndex() {
String indexToHit;
- IndiciesInfo info;
+ IndicesInfo info;
try {
- info = APILocator.getIndiciesAPI().loadIndicies();
+ info = APILocator.getIndiciesAPI().loadLegacyIndices();
} catch (DotDataException ee) {
Logger.fatal(ContentletIndexAPIImpl.class, "Can't get indicies information", ee);
return null;
@@ -1207,9 +1206,9 @@ public void testRemoveContentFromIndex() throws DotDataException, DotSecurityExc
Map entries = APILocator.getReindexQueueAPI().findContentToReindex();
- final BulkRequest bulk = indexAPI.createBulkRequest();
+ final BulkRequest bulk = indexAPI.createBulkRequestLegacy();
bulk.setRefreshPolicy(RefreshPolicy.IMMEDIATE);
- indexAPI.appendBulkRequest(bulk, entries.values());
+ indexAPI.appendBulkRequestLegacy(bulk, entries.values());
indexAPI.putToIndex(bulk);
assertEquals(0, contentletAPI
diff --git a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESIndexAPITest.java b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESIndexAPITest.java
index 005fb8cd4c08..10ecaaa279dc 100644
--- a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESIndexAPITest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESIndexAPITest.java
@@ -1,6 +1,6 @@
package com.dotcms.content.elasticsearch.business;
-import static com.dotcms.content.elasticsearch.business.IndiciesInfo.CLUSTER_PREFIX;
+import static com.dotcms.content.elasticsearch.business.LegacyIndicesInfo.CLUSTER_PREFIX;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -86,7 +86,7 @@ public void index_exists_should_resolve_even_with_cluster_id() throws Exception
@Test
- public void testGetIndicesStatsWhenStatsTypeIsLongShouldPass() {
+ public void testGetIndicesLegacyStatsWhenStatsTypeIsLongShouldPass() {
final Map jsonMap = new HashMap<>();
@@ -121,7 +121,7 @@ public void testGetIndicesStatsWhenStatsTypeIsLongShouldPass() {
}
@Test
- public void testGetIndicesStatsWhenStatsTypeIsIntegerShouldPass() {
+ public void testGetIndicesLegacyStatsWhenStatsTypeIsIntegerShouldPass() {
final Map jsonMap = new HashMap<>();
@@ -267,7 +267,7 @@ public static Object[] testDeleteOldIndicesDP() {
@UseDataProvider("testDeleteOldIndicesDP")
public void testDeleteOldIndices(final int inactiveLiveWorkingSetsToKeep) throws DotIndexException, IOException, InterruptedException {
// get live and working active indices
- final IndiciesInfo info = Try.of(()->APILocator.getIndiciesAPI().loadIndicies())
+ final LegacyIndicesInfo info = Try.of(()->(LegacyIndicesInfo)APILocator.getIndiciesAPI().loadLegacyIndices())
.getOrNull();
final String liveIndex = info.getLive();
@@ -280,9 +280,9 @@ public void testDeleteOldIndices(final int inactiveLiveWorkingSetsToKeep) throws
List indicesThatShouldStay = new ArrayList<>();
for(int i=0; i<6; i++) {
- info.createNewIndiciesName(IndexType.REINDEX_WORKING, IndexType.REINDEX_LIVE);
- contentletIndexAPI.createContentIndex(info.getReindexWorking(), 0);
- contentletIndexAPI.createContentIndex(info.getReindexLive(), 0);
+ info.createNewIndicesName(IndexType.REINDEX_WORKING, IndexType.REINDEX_LIVE);
+ contentletIndexAPI.createContentIndexLegacy(info.getReindexWorking(), 0);
+ contentletIndexAPI.createContentIndexLegacy(info.getReindexLive(), 0);
if(i>=6-inactiveLiveWorkingSetsToKeep) {
indicesThatShouldStay.add(esIndexAPI.removeClusterIdFromName(info.getReindexWorking()));
diff --git a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESSiteSearchAPITest.java b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESSiteSearchAPITest.java
index 4bcc115ac3d8..14188f4fa358 100644
--- a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESSiteSearchAPITest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/ESSiteSearchAPITest.java
@@ -4,7 +4,6 @@
import static org.junit.Assert.*;
import com.dotcms.LicenseTestUtil;
-import com.dotcms.rest.api.v1.menu.MenuResource;
import com.dotcms.util.IntegrationTestInitService;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.business.CacheLocator;
@@ -12,9 +11,7 @@
import com.dotmarketing.sitesearch.business.SiteSearchAPI;
import java.io.IOException;
import java.util.Date;
-import java.util.Set;
-import com.liferay.portal.model.User;
import java.util.List;
import org.junit.BeforeClass;
@@ -27,7 +24,7 @@ public class ESSiteSearchAPITest {
private static SiteSearchAPI siteSearchAPI;
private static ESIndexAPI indexAPI;
- private static IndiciesAPI indiciesAPI;
+ private static IndicesAPI indicesAPI;
private static ContentletIndexAPI contentletIndexAPI;
@BeforeClass
@@ -38,7 +35,7 @@ public static void prepare() throws Exception {
siteSearchAPI = APILocator.getSiteSearchAPI();
indexAPI = APILocator.getESIndexAPI();
- indiciesAPI = APILocator.getIndiciesAPI();
+ indicesAPI = APILocator.getIndiciesAPI();
contentletIndexAPI = APILocator.getContentletIndexAPI();
}
@@ -79,14 +76,14 @@ public void testCreateSiteSearchIndexAndMakeItDefault() throws IOException, DotD
assertTrue(indexAPI.listIndices().contains(indexName));
//verifies that there is no a default site search index
- assertTrue(indiciesAPI.loadIndicies().getSiteSearch() == null || !indiciesAPI
- .loadIndicies().getSiteSearch().equals(indexName));
+ assertTrue(indicesAPI.loadLegacyIndices().getSiteSearch() == null || !indicesAPI
+ .loadLegacyIndices().getSiteSearch().equals(indexName));
siteSearchAPI.activateIndex(indexName);
try {
CacheLocator.getIndiciesCache().clearCache();
- assertNotNull(indiciesAPI.loadIndicies().getSiteSearch());
- assertTrue(indiciesAPI.loadIndicies().getSiteSearch().equals(indexName));
+ assertNotNull(indicesAPI.loadLegacyIndices().getSiteSearch());
+ assertTrue(indicesAPI.loadLegacyIndices().getSiteSearch().equals(indexName));
assertEquals(aliasName, indexAPI.getIndexAlias(indexName));
} finally {
siteSearchAPI.deactivateIndex(indexName);
@@ -112,8 +109,8 @@ public void testFullReindexKeepsDefaultSiteSearchIndex()
try {
indexTimestamp = contentletIndexAPI.fullReindexStart();
CacheLocator.getIndiciesCache().clearCache();
- assertNotNull(indiciesAPI.loadIndicies().getSiteSearch());
- assertTrue(indiciesAPI.loadIndicies().getSiteSearch().equals(indexName));
+ assertNotNull(indicesAPI.loadLegacyIndices().getSiteSearch());
+ assertTrue(indicesAPI.loadLegacyIndices().getSiteSearch().equals(indexName));
assertEquals(aliasName, indexAPI.getIndexAlias(indexName));
} finally {
contentletIndexAPI.stopFullReindexation();
@@ -146,8 +143,8 @@ public void testReindexAbortKeepsDefaultSiteSearchIndex()
indexTimestamp = contentletIndexAPI.fullReindexStart();
contentletIndexAPI.fullReindexAbort();
CacheLocator.getIndiciesCache().clearCache();
- assertNotNull(indiciesAPI.loadIndicies().getSiteSearch());
- assertTrue(indiciesAPI.loadIndicies().getSiteSearch().equals(indexName));
+ assertNotNull(indicesAPI.loadLegacyIndices().getSiteSearch());
+ assertTrue(indicesAPI.loadLegacyIndices().getSiteSearch().equals(indexName));
assertEquals(aliasName, indexAPI.getIndexAlias(indexName));
} finally {
contentletIndexAPI.stopFullReindexation();
@@ -190,7 +187,7 @@ public void test_listIndices_defaultIndicesShouldFirst() throws IOException, Dot
//get the list of indices
final List indices =siteSearchAPI.listIndices();
//validate if the new default index is the first in list
- assertTrue(indiciesAPI.loadIndicies().getSiteSearch().equals(defIndex));
+ assertTrue(indicesAPI.loadLegacyIndices().getSiteSearch().equals(defIndex));
assertEquals(defIndex, indices.get(0));
}
diff --git a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/IndiciesFactoryTest.java b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/IndicesFactoryTest.java
similarity index 80%
rename from dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/IndiciesFactoryTest.java
rename to dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/IndicesFactoryTest.java
index 3c2dbc3707dc..4600d24f2711 100644
--- a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/IndiciesFactoryTest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/business/IndicesFactoryTest.java
@@ -1,19 +1,19 @@
package com.dotcms.content.elasticsearch.business;
-import static org.junit.Assert.*;
-
-import com.dotcms.content.elasticsearch.business.IndiciesInfo.Builder;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import com.dotcms.content.elasticsearch.business.LegacyIndicesInfo.Builder;
import com.dotcms.util.IntegrationTestInitService;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.business.CacheLocator;
import com.dotmarketing.business.FactoryLocator;
import com.dotmarketing.common.db.DotConnect;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
-public class IndiciesFactoryTest {
+public class IndicesFactoryTest {
private static final String INFO_REINDEX_WORKING = "info.reindex_working";
private static final String INFO_WORKING = "info.working";
@@ -21,26 +21,26 @@ public class IndiciesFactoryTest {
private static final String INFO_REINDEX_LIVE = "info.reindex_live";
private static String ORIGINAL_WORKING_INDEX;
private static String ORIGINAL_LIVE_INDEX;
- static IndiciesFactory indiciesFactory;
- static IndiciesAPI indiciesAPI;
+ static IndicesFactory indiciesFactory;
+ static IndicesAPI indicesAPI;
@BeforeClass
public static void prepare() throws Exception {
//Setting web app environment
IntegrationTestInitService.getInstance().init();
indiciesFactory = FactoryLocator.getIndiciesFactory();
- indiciesAPI = APILocator.getIndiciesAPI();
+ indicesAPI = APILocator.getIndiciesAPI();
- IndiciesInfo indiciesInfo = indiciesAPI.loadIndicies();
- ORIGINAL_WORKING_INDEX = indiciesInfo.getWorking();
- ORIGINAL_LIVE_INDEX = indiciesInfo.getLive();
+ IndicesInfo legacyIndicesInfo = indicesAPI.loadLegacyIndices();
+ ORIGINAL_WORKING_INDEX = legacyIndicesInfo.getWorking();
+ ORIGINAL_LIVE_INDEX = legacyIndicesInfo.getLive();
}
@Test
public void test_index_pointing_when_previously_null() throws Exception{
new DotConnect().setSQL("delete from indicies").loadResult();
CacheLocator.getIndiciesCache().clearCache();
- IndiciesInfo nullInfo = indiciesAPI.loadIndicies();
+ IndicesInfo nullInfo = indicesAPI.loadLegacyIndices();
assert(nullInfo.getLive()==null);
assert(nullInfo.getWorking()==null);
assert(nullInfo.getReindexLive()==null);
@@ -52,7 +52,7 @@ public void test_index_pointing_when_previously_null() throws Exception{
indiciesFactory.point(builder.build());
- final IndiciesInfo cachedInfo = indiciesAPI.loadIndicies();
+ final IndicesInfo cachedInfo = indicesAPI.loadLegacyIndices();
assertEquals(cachedInfo.getLive(), INFO_LIVE);
assertEquals(cachedInfo.getWorking(), INFO_WORKING);
assertEquals(cachedInfo.getReindexLive(), INFO_REINDEX_LIVE);
@@ -70,7 +70,7 @@ public void test_index_repointing_when_previously_set() throws Exception{
builder.setWorking(INFO_WORKING).setLive(INFO_LIVE);
indiciesFactory.point(builder.build());
- IndiciesInfo cachedInfo = indiciesAPI.loadIndicies();
+ IndicesInfo cachedInfo = indicesAPI.loadLegacyIndices();
assertEquals(cachedInfo.getLive(), INFO_LIVE);
assertEquals(cachedInfo.getWorking(), INFO_WORKING);
assertNull(cachedInfo.getReindexLive());
@@ -80,7 +80,7 @@ public void test_index_repointing_when_previously_set() throws Exception{
builder.setReindexLive(INFO_REINDEX_LIVE).setReindexWorking(INFO_REINDEX_WORKING);
indiciesFactory.point(builder.build());
- cachedInfo = indiciesAPI.loadIndicies();
+ cachedInfo = indicesAPI.loadLegacyIndices();
assertNull(cachedInfo.getLive());
assertNull(cachedInfo.getWorking());
assertEquals(cachedInfo.getReindexLive(), INFO_REINDEX_LIVE);
diff --git a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/util/ESMappingUtilHelperTest.java b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/util/ESMappingUtilHelperTest.java
index b4776dc3f940..4bbe33e23741 100644
--- a/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/util/ESMappingUtilHelperTest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/content/elasticsearch/util/ESMappingUtilHelperTest.java
@@ -329,7 +329,7 @@ public void testAddMappingForFields()
Config.setProperty("CREATE_TEXT_INDEX_FIELD_FOR_NON_TEXT_FIELDS", true);
//Create a working index
- boolean result = contentletIndexAPI.createContentIndex(workingIndex);
+ boolean result = contentletIndexAPI.createContentIndexLegacy(workingIndex);
//Validate
assertTrue(result);
@@ -422,7 +422,7 @@ public void testMappingForDateFields()
workingIndex = IndexType.WORKING.getPrefix() + "_" + System.currentTimeMillis();
//Create a working index
- boolean result = contentletIndexAPI.createContentIndex(workingIndex);
+ boolean result = contentletIndexAPI.createContentIndexLegacy(workingIndex);
assertTrue(result);
contentletIndexAPI.activateIndex(workingIndex);
@@ -437,7 +437,7 @@ public void testMappingForDateFields()
//verifies mapping type for common text fields
Map mapping = (Map) esMappingAPI
- .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadIndicies().getWorking(),
+ .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadLegacyIndices().getWorking(),
contentType.variable().toLowerCase() + "." + dateField.variable()
.toLowerCase()).entrySet()
.iterator()
@@ -447,7 +447,7 @@ public void testMappingForDateFields()
assertEquals(formatExpected, mapping.get("format"));
mapping = (Map) esMappingAPI
- .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadIndicies().getWorking(),
+ .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadLegacyIndices().getWorking(),
contentType.variable().toLowerCase() + "." + dateTimeField.variable()
.toLowerCase()).entrySet()
.iterator()
@@ -457,7 +457,7 @@ public void testMappingForDateFields()
assertEquals(formatExpected, mapping.get("format"));
mapping = (Map) esMappingAPI
- .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadIndicies().getWorking(),
+ .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadLegacyIndices().getWorking(),
"moddate").entrySet().iterator().next().getValue();
assertTrue(UtilMethods.isSet(mapping.get("type")));
assertEquals("date", mapping.get("type"));
@@ -546,7 +546,7 @@ public void testCreateContentIndexWithCustomMappings() throws Exception {
workingIndex = new ESIndexAPI().getNameWithClusterIDPrefix(IndexType.WORKING.getPrefix() + "_" + timestamp);
//Create a working index
- boolean result = contentletIndexAPI.createContentIndex(workingIndex);
+ boolean result = contentletIndexAPI.createContentIndexLegacy(workingIndex);
//Validate
assertTrue(result);
@@ -728,7 +728,7 @@ public void testValidateEventMapping(final String testCase, final String[] field
//verifies analyzer for common text fields
final Map mapping = (Map) esMappingAPI
- .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadIndicies().getWorking(),
+ .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadLegacyIndices().getWorking(),
"calendarevent.title").entrySet().iterator()
.next().getValue();
assertTrue(UtilMethods.isSet(mapping.get("type")));
@@ -760,7 +760,7 @@ private void validateMappingForFields(final String testCase, final String conten
Logger.info(this,
"Validating mapping for case: " + testCase + ". Field Name: " + field);
mapping = (Map) esMappingAPI
- .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadIndicies().getWorking(),
+ .getFieldMappingAsMap(APILocator.getIndiciesAPI().loadLegacyIndices().getWorking(),
expectedResult.equals("geo_point") ? contentTypeVarName
+ StringPool.PERIOD + field : field).entrySet().iterator()
.next().getValue();
diff --git a/dotcms-integration/src/test/java/com/dotcms/content/opensearch/util/DotOpenSearchClientProviderIntegrationTest.java b/dotcms-integration/src/test/java/com/dotcms/content/opensearch/util/DotOpenSearchClientProviderIntegrationTest.java
new file mode 100644
index 000000000000..0369274f016b
--- /dev/null
+++ b/dotcms-integration/src/test/java/com/dotcms/content/opensearch/util/DotOpenSearchClientProviderIntegrationTest.java
@@ -0,0 +1,435 @@
+package com.dotcms.content.opensearch.util;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import com.dotcms.DataProviderWeldRunner;
+import com.dotcms.IntegrationTestBase;
+import com.dotcms.util.IntegrationTestInitService;
+import com.dotmarketing.exception.DotRuntimeException;
+import com.dotmarketing.util.Config;
+import java.io.IOException;
+import java.time.Duration;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opensearch.client.opensearch.OpenSearchClient;
+import org.opensearch.client.opensearch._types.OpenSearchException;
+import org.opensearch.client.opensearch._types.Time;
+import org.opensearch.client.opensearch.cluster.HealthRequest;
+import org.opensearch.client.opensearch.cluster.HealthResponse;
+import org.opensearch.client.opensearch.indices.CreateIndexRequest;
+import org.opensearch.client.opensearch.indices.DeleteIndexRequest;
+import org.opensearch.client.opensearch.indices.ExistsRequest;
+
+/**
+ * Integration test for ConfigurableOpenSearchProvider.
+ * Tests the provider's ability to create and configure OpenSearch clients.
+ *
+ * @author fabrizio
+ */
+@ApplicationScoped
+@RunWith(DataProviderWeldRunner.class)
+public class DotOpenSearchClientProviderIntegrationTest extends IntegrationTestBase {
+
+ private static final String TEST_INDEX = "test-dotcms-opensearch-" + System.currentTimeMillis();
+
+ @Inject
+ OpenSearchDefaultClientProvider singleton;
+
+ @BeforeClass
+ public static void prepare() throws Exception {
+ // Setting web app environment
+ IntegrationTestInitService.getInstance().init();
+
+ }
+
+ /**
+ * Test direct provider with custom configuration
+ * This demonstrates how tests should use ConfigurableOpenSearchProvider directly for custom configs
+ */
+ @Test
+ public void test_directProvider_withCustomConfiguration_shouldWork() {
+ ConfigurableOpenSearchProvider provider = null;
+ try {
+ // Arrange - Create test configuration
+ OpenSearchClientConfig testConfig = OpenSearchClientConfig.builder()
+ .addEndpoints("http://localhost:9201") // Local OpenSearch port
+ .tlsEnabled(false)
+ .maxConnections(200) // Different configuration for testing
+ .maxConnectionsPerRoute(100)
+ .build();
+
+ // Act - Create provider with custom configuration
+ provider = new ConfigurableOpenSearchProvider(testConfig);
+ OpenSearchClient client = provider.getClient();
+
+ // Assert
+ assertNotNull("Provider should not be null", provider);
+ assertNotNull("Client should not be null", client);
+
+ // Verify the singleton still works independently
+ OpenSearchClient singletonClient = singleton.getClient();
+ assertNotNull("Singleton client should not be null", singletonClient);
+
+ // They should be different instances (custom vs default config)
+ assertTrue("Should be different client instances", client != singletonClient);
+
+ } finally {
+ closeProvider(provider);
+ }
+ }
+
+ /**
+ * Test direct provider with convenience configurations
+ * Shows how to use the convenience configuration methods with ConfigurableOpenSearchProvider
+ */
+ @Test
+ public void test_directProvider_withConvenienceConfigurations_shouldWork() {
+ ConfigurableOpenSearchProvider localProvider = null;
+ ConfigurableOpenSearchProvider prodProvider = null;
+ try {
+ // Test 1: Local test configuration
+ OpenSearchClientConfig localConfig = OpenSearchDefaultClientProvider.createLocalTestConfig();
+ localProvider = new ConfigurableOpenSearchProvider(localConfig);
+
+ assertEquals("Should use local port", "http://localhost:9201", localConfig.endpoints().get(0));
+ assertFalse("Should have TLS disabled", localConfig.tlsEnabled());
+
+ // Test client creation
+ OpenSearchClient localClient = localProvider.getClient();
+ assertNotNull("Local test client should not be null", localClient);
+
+ // Test 2: Production-like test configuration
+ OpenSearchClientConfig prodConfig = OpenSearchDefaultClientProvider.createProductionTestConfig();
+ prodProvider = new ConfigurableOpenSearchProvider(prodConfig);
+
+ assertEquals("Should use production endpoint", "https://opensearch.prod.com:9200", prodConfig.endpoints().get(0));
+ assertTrue("Should have TLS enabled", prodConfig.tlsEnabled());
+ assertTrue("Should have username", prodConfig.username().isPresent());
+
+ // Test client creation
+ OpenSearchClient prodClient = prodProvider.getClient();
+ assertNotNull("Production test client should not be null", prodClient);
+
+ // Verify they are different instances
+ assertTrue("Should be different client instances", localClient != prodClient);
+
+ } finally {
+ // Cleanup
+ closeProvider(localProvider);
+ closeProvider(prodProvider);
+ }
+ }
+
+ /**
+ * Test configuration from properties
+ * This tests the properties loading mechanism using local OpenSearch
+ */
+ @Test
+ public void test_loadConfiguration_fromProperties_shouldCreateValidConfig() {
+ // Arrange - Set some test properties for local OpenSearch
+ String originalEndpoints = Config.getStringProperty("OS_ENDPOINTS", null);
+ String originalTlsEnabled = Config.getStringProperty("OS_TLS_ENABLED", null);
+
+ try {
+ // Set test properties for local OpenSearch (no auth, security disabled)
+ Config.setProperty("OS_ENDPOINTS", "http://localhost:9201");
+ Config.setProperty("OS_TLS_ENABLED", false);
+
+ // Act
+ ConfigurableOpenSearchProvider provider = new ConfigurableOpenSearchProvider();
+ OpenSearchClient client = provider.getClient();
+
+ // Assert
+ assertNotNull("Provider should not be null", provider);
+ assertNotNull("Client should not be null", client);
+
+ // Cleanup
+ closeProvider(provider);
+
+ } finally {
+ // Reset properties
+ resetProperty("OS_ENDPOINTS", originalEndpoints);
+ resetProperty("OS_TLS_ENABLED", originalTlsEnabled);
+ }
+ }
+
+ /**
+ * Test client functionality with cluster health check
+ * This test connects to the local OpenSearch instance on port 9201
+ */
+ @Test
+ public void test_clientFunctionality_clusterHealth_shouldReturnValidResponse() {
+ // This test connects to local OpenSearch (opensearch-3x container on port 9201)
+ ConfigurableOpenSearchProvider provider = null;
+ try {
+ // Arrange - Configure for local OpenSearch container
+ OpenSearchClientConfig config = OpenSearchClientConfig.builder()
+ .addEndpoints("http://localhost:9201") // Local OpenSearch port
+ .tlsEnabled(false) // Security disabled
+ .trustSelfSigned(true)
+ .connectionTimeout(Duration.ofSeconds(10)) // Increased timeout
+ .socketTimeout(Duration.ofSeconds(10))
+ .build();
+
+ provider = new ConfigurableOpenSearchProvider(config);
+ OpenSearchClient client = provider.getClient();
+
+ // Act - Try to get cluster health
+
+ HealthResponse healthResponse = client.cluster().health();
+
+ // Assert
+ assertNotNull("Health response should not be null", healthResponse);
+ assertNotNull("Cluster name should not be null", healthResponse.clusterName());
+
+ System.out.println("✅ OpenSearch cluster health: " + healthResponse.status());
+ System.out.println("✅ Cluster name: " + healthResponse.clusterName());
+ System.out.println("✅ Number of nodes: " + healthResponse.numberOfNodes());
+ System.out.println("✅ Active shards: " + healthResponse.activeShards());
+
+ // Additional assertions for the specific container configuration
+ assertTrue("Should have at least one node", healthResponse.numberOfNodes() >= 1);
+ assertEquals("Should be single-node cluster", "opensearch-3x-cluster", healthResponse.clusterName());
+
+ } catch (OpenSearchException | IOException e) {
+ // OpenSearch is not available - provide helpful message
+ System.out.println("⚠️ Local OpenSearch not available for integration test: " + e.getMessage());
+ System.out.println("⚠️ Make sure OpenSearch container is running with:");
+ System.out.println("⚠️ docker-compose up opensearch-3x");
+ System.out.println("⚠️ Expected container on http://localhost:9201");
+ System.out.println("⚠️ Skipping cluster health test");
+ } catch (Exception e) {
+ System.out.println("❌ Unexpected error during cluster health test: " + e.getMessage());
+ e.printStackTrace();
+ // Don't fail the test for unexpected errors in case OpenSearch is not available
+ } finally {
+ closeProvider(provider);
+ }
+ }
+
+ /**
+ * Test index operations using local OpenSearch
+ */
+ @Test
+ public void test_clientFunctionality_indexOperations_shouldWorkCorrectly() {
+ ConfigurableOpenSearchProvider provider = null;
+ try {
+ // Arrange - Configure for local OpenSearch container
+ OpenSearchClientConfig config = OpenSearchClientConfig.builder()
+ .addEndpoints("http://localhost:9201") // Local OpenSearch port
+ .tlsEnabled(false) // Security disabled
+ .trustSelfSigned(true)
+ .connectionTimeout(Duration.ofSeconds(10))
+ .socketTimeout(Duration.ofSeconds(10))
+ .build();
+
+ provider = new ConfigurableOpenSearchProvider(config);
+ OpenSearchClient client = provider.getClient();
+
+ // Act & Assert - Try basic index operations
+
+ // 1. Check if test index exists (should not)
+ ExistsRequest existsRequest = ExistsRequest.of(e -> e.index(TEST_INDEX));
+ boolean existsBefore = client.indices().exists(existsRequest).value();
+ assertFalse("Test index should not exist initially", existsBefore);
+ System.out.println("✅ Verified test index does not exist initially: " + TEST_INDEX);
+
+ // 2. Create test index
+ CreateIndexRequest createRequest = CreateIndexRequest.of(c -> c.index(TEST_INDEX));
+ client.indices().create(createRequest);
+ System.out.println("✅ Created test index: " + TEST_INDEX);
+
+ // 3. Check if test index exists now (should exist)
+ boolean existsAfter = client.indices().exists(existsRequest).value();
+ assertTrue("Test index should exist after creation", existsAfter);
+ System.out.println("✅ Verified test index exists after creation");
+
+ // 4. Delete test index
+ DeleteIndexRequest deleteRequest = DeleteIndexRequest.of(d -> d.index(TEST_INDEX));
+ client.indices().delete(deleteRequest);
+ System.out.println("✅ Deleted test index: " + TEST_INDEX);
+
+ // 5. Verify index is deleted
+ boolean existsAfterDelete = client.indices().exists(existsRequest).value();
+ assertFalse("Test index should not exist after deletion", existsAfterDelete);
+ System.out.println("✅ Verified test index does not exist after deletion");
+
+ System.out.println("✅ All OpenSearch index operations completed successfully!");
+
+ } catch (OpenSearchException | IOException e) {
+ // OpenSearch is not available - provide helpful message
+ System.out.println("⚠️ Local OpenSearch not available for index operations test: " + e.getMessage());
+ System.out.println("⚠️ Make sure OpenSearch container is running with:");
+ System.out.println("⚠️ docker-compose up opensearch-3x");
+ System.out.println("⚠️ Expected container on http://localhost:9201");
+ System.out.println("⚠️ Skipping index operations test");
+ } catch (Exception e) {
+ System.out.println("❌ Unexpected error during index operations test: " + e.getMessage());
+ e.printStackTrace();
+ // Don't fail the test for unexpected errors in case OpenSearch is not available
+ } finally {
+ closeProvider(provider);
+ }
+ }
+
+ /**
+ * Comprehensive connectivity test for local OpenSearch container
+ * This test provides detailed information about the OpenSearch cluster
+ */
+ @Test
+ public void test_localOpenSearchConnectivity_shouldProvideDetailedInfo() {
+ ConfigurableOpenSearchProvider provider = null;
+ try {
+ // Arrange - Configure specifically for the opensearch-3x container
+ OpenSearchClientConfig config = OpenSearchClientConfig.builder()
+ .addEndpoints("http://localhost:9201") // Container mapped port
+ .tlsEnabled(false) // DISABLE_SECURITY_PLUGIN=true
+ .connectionTimeout(Duration.ofSeconds(15))
+ .socketTimeout(Duration.ofSeconds(15))
+ .maxConnections(10)
+ .maxConnectionsPerRoute(5)
+ .build();
+
+ System.out.println("🔍 Testing connectivity to local OpenSearch container...");
+ System.out.println("🔍 Endpoint: http://localhost:9201");
+ System.out.println("🔍 Expected cluster: opensearch-3x-cluster");
+
+ provider = new ConfigurableOpenSearchProvider(config);
+ OpenSearchClient client = provider.getClient();
+
+ // Test 1: Basic cluster health
+ System.out.println("\n📊 Getting cluster health...");
+ HealthRequest healthRequest = HealthRequest.of(h ->
+ h.timeout(new Time.Builder().time("15s").build())
+ );
+ HealthResponse healthResponse = client.cluster().health(healthRequest);
+
+ // Detailed assertions and logging
+ assertNotNull("Health response should not be null", healthResponse);
+ System.out.println("✅ Health Status: " + healthResponse.status());
+ System.out.println("✅ Cluster Name: " + healthResponse.clusterName());
+ System.out.println("✅ Number of Nodes: " + healthResponse.numberOfNodes());
+ System.out.println("✅ Active Shards: " + healthResponse.activeShards());
+ System.out.println("✅ Initializing Shards: " + healthResponse.initializingShards());
+ System.out.println("✅ Relocating Shards: " + healthResponse.relocatingShards());
+ System.out.println("✅ Unassigned Shards: " + healthResponse.unassignedShards());
+
+ // Verify expected container configuration
+ assertEquals("Should match container cluster name",
+ "opensearch-3x-cluster", healthResponse.clusterName());
+ assertEquals("Should have exactly one node (single-node setup)",
+ 1, healthResponse.numberOfNodes());
+
+ // Test 2: Get cluster info
+ System.out.println("\n🏗️ Getting cluster information...");
+ try {
+ var infoResponse = client.info();
+ System.out.println("✅ OpenSearch Version: " + infoResponse.version().number());
+ System.out.println("✅ Lucene Version: " + infoResponse.version().luceneVersion());
+ System.out.println("✅ Build Date: " + infoResponse.version().buildDate());
+ System.out.println("✅ Build Hash: " + infoResponse.version().buildHash().substring(0, 8) + "...");
+
+ assertNotNull("Info response should not be null", infoResponse);
+ assertTrue("Should be OpenSearch 3.x",
+ infoResponse.version().number().startsWith("3."));
+ } catch (Exception e) {
+ System.out.println("⚠️ Could not get cluster info: " + e.getMessage());
+ }
+
+ System.out.println("\n✅ Local OpenSearch connectivity test PASSED!");
+ System.out.println("✅ Container opensearch-3x is running and accessible");
+
+ } catch (OpenSearchException e) {
+ System.out.println("\n❌ OpenSearch API Error:");
+ System.out.println("❌ Error: " + e.getMessage());
+ System.out.println("❌ Status: " + e.status());
+ System.out.println("\n🔧 Troubleshooting steps:");
+ System.out.println("🔧 1. Check if container is running: docker ps | grep opensearch");
+ System.out.println("🔧 2. Check container logs: docker logs opensearch-3x");
+ System.out.println("🔧 3. Verify port mapping: curl http://localhost:9201");
+ fail("OpenSearch API error: " + e.getMessage());
+
+ } catch (IOException e) {
+ System.out.println("\n❌ Connection Error:");
+ System.out.println("❌ " + e.getMessage());
+ System.out.println("\n🔧 Troubleshooting steps:");
+ System.out.println("🔧 1. Start OpenSearch container: docker-compose up -d opensearch-3x");
+ System.out.println("🔧 2. Wait for startup: docker logs -f opensearch-3x");
+ System.out.println("🔧 3. Test direct access: curl http://localhost:9201");
+ System.out.println("🔧 4. Check network: docker network ls");
+
+ // Don't fail the test - just report the issue
+ System.out.println("\n⚠️ Skipping connectivity test - OpenSearch not available");
+
+ } catch (Exception e) {
+ System.out.println("\n❌ Unexpected error: " + e.getClass().getSimpleName());
+ System.out.println("❌ Message: " + e.getMessage());
+ e.printStackTrace();
+ fail("Unexpected error during connectivity test: " + e.getMessage());
+
+ } finally {
+ closeProvider(provider);
+ }
+ }
+
+ /**
+ * Test provider close functionality
+ */
+ @Test
+ public void test_closeProvider_shouldNotThrowException() {
+ // Arrange
+ ConfigurableOpenSearchProvider provider = new ConfigurableOpenSearchProvider();
+
+ // Act & Assert - Should not throw exception
+ try {
+ provider.close();
+ } catch (Exception e) {
+ fail("Close should not throw exception: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Test invalid configuration scenarios
+ */
+ @Test(expected = DotRuntimeException.class)
+ public void test_createProvider_withInvalidEndpoint_shouldThrowException() {
+ // Arrange
+ OpenSearchClientConfig config = OpenSearchClientConfig.builder()
+ .addEndpoints("invalid-url-format")
+ .build();
+
+ // Act & Assert - Should throw DotRuntimeException due to invalid URL
+ new ConfigurableOpenSearchProvider(config);
+ }
+
+ /**
+ * Helper method to close provider safely
+ */
+ private void closeProvider(ConfigurableOpenSearchProvider provider) {
+ if (provider != null) {
+ try {
+ provider.close();
+ } catch (IOException e) {
+ System.err.println("Warning: Error closing provider: " + e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Helper method to reset properties
+ */
+ private void resetProperty(String key, String originalValue) {
+ if (originalValue != null) {
+ Config.setProperty(key, originalValue);
+ } else {
+ Config.setProperty(key, "");
+ }
+ }
+}
\ No newline at end of file
diff --git a/dotcms-integration/src/test/java/com/dotcms/contenttype/business/FieldAPITest.java b/dotcms-integration/src/test/java/com/dotcms/contenttype/business/FieldAPITest.java
index 162fcb4780cc..670c84efbfe7 100644
--- a/dotcms-integration/src/test/java/com/dotcms/contenttype/business/FieldAPITest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/contenttype/business/FieldAPITest.java
@@ -1,8 +1,33 @@
package com.dotcms.contenttype.business;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.BASE_TYPE;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.CONTENT_TYPE;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.IDENTIFIER;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.INODE;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.LIVE;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.MOD_DATE;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.TITLE;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.URL_MAP;
+import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.WORKING;
+import static com.dotcms.contenttype.business.ContentTypeAPIImpl.TYPES_AND_FIELDS_VALID_VARIABLE_REGEX;
+import static com.dotmarketing.portlets.contentlet.model.Contentlet.ARCHIVED_KEY;
+import static com.dotmarketing.portlets.contentlet.model.Contentlet.FOLDER_KEY;
+import static com.dotmarketing.portlets.contentlet.model.Contentlet.HOST_KEY;
+import static com.dotmarketing.portlets.contentlet.model.Contentlet.LOCKED_KEY;
+import static com.dotmarketing.portlets.contentlet.model.Contentlet.MOD_USER_KEY;
+import static com.dotmarketing.portlets.contentlet.model.Contentlet.OWNER_KEY;
+import static com.dotmarketing.portlets.contentlet.model.Contentlet.TITLE_IMAGE_KEY;
+import static com.dotmarketing.util.WebKeys.Relationship.RELATIONSHIP_CARDINALITY.MANY_TO_ONE;
+import static com.dotmarketing.util.WebKeys.Relationship.RELATIONSHIP_CARDINALITY.ONE_TO_MANY;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import com.dotcms.IntegrationTestBase;
import com.dotcms.content.elasticsearch.business.ESMappingAPIImpl;
-import com.dotcms.content.elasticsearch.business.IndiciesInfo;
+import com.dotcms.content.elasticsearch.business.IndicesInfo;
import com.dotcms.contenttype.business.FieldAPITest.UniqueConstraintTestCase.DuplicateType;
import com.dotcms.contenttype.model.field.BinaryField;
import com.dotcms.contenttype.model.field.DateField;
@@ -37,7 +62,6 @@
import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.exception.DotDataValidationException;
import com.dotmarketing.exception.DotSecurityException;
-import com.dotmarketing.portlets.contentlet.business.HostAPI;
import com.dotmarketing.portlets.folders.business.FolderAPI;
import com.dotmarketing.portlets.structure.model.Relationship;
import com.dotmarketing.util.Config;
@@ -51,42 +75,16 @@
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import io.vavr.Tuple2;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
-
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.BASE_TYPE;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.CONTENT_TYPE;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.IDENTIFIER;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.INODE;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.LIVE;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.MOD_DATE;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.TITLE;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.URL_MAP;
-import static com.dotcms.content.elasticsearch.constants.ESMappingConstants.WORKING;
-import static com.dotcms.contenttype.business.ContentTypeAPIImpl.TYPES_AND_FIELDS_VALID_VARIABLE_REGEX;
-import static com.dotmarketing.portlets.contentlet.model.Contentlet.ARCHIVED_KEY;
-import static com.dotmarketing.portlets.contentlet.model.Contentlet.FOLDER_KEY;
-import static com.dotmarketing.portlets.contentlet.model.Contentlet.HOST_KEY;
-import static com.dotmarketing.portlets.contentlet.model.Contentlet.LOCKED_KEY;
-import static com.dotmarketing.portlets.contentlet.model.Contentlet.MOD_USER_KEY;
-import static com.dotmarketing.portlets.contentlet.model.Contentlet.OWNER_KEY;
-import static com.dotmarketing.portlets.contentlet.model.Contentlet.TITLE_IMAGE_KEY;
-import static com.dotmarketing.util.WebKeys.Relationship.RELATIONSHIP_CARDINALITY.MANY_TO_ONE;
-import static com.dotmarketing.util.WebKeys.Relationship.RELATIONSHIP_CARDINALITY.ONE_TO_MANY;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
@RunWith(DataProviderRunner.class)
public class FieldAPITest extends IntegrationTestBase {
@@ -1433,18 +1431,18 @@ public void test_SaveNewNoIndexedField_ShouldNotAddESMapping()
.build();
field = fieldAPI.save(field, user);
- final IndiciesInfo indiciesInfo = APILocator.getIndiciesAPI().loadIndicies();
+ final IndicesInfo legacyIndicesInfo = APILocator.getIndiciesAPI().loadLegacyIndices();
final ESMappingAPIImpl mappingAPI = new ESMappingAPIImpl();
//verify mapping on working index
Map mapping = mappingAPI
- .getFieldMappingAsMap(indiciesInfo.getWorking(),
+ .getFieldMappingAsMap(legacyIndicesInfo.getWorking(),
(type.variable() + StringPool.PERIOD + field.variable()));
assertFalse(UtilMethods.isSet(mapping));
//verify mapping on live index
mapping = mappingAPI
- .getFieldMappingAsMap(indiciesInfo.getLive(),
+ .getFieldMappingAsMap(legacyIndicesInfo.getLive(),
(type.variable() + StringPool.PERIOD + field.variable()));
assertFalse(UtilMethods.isSet(mapping));
}finally{
@@ -1473,12 +1471,12 @@ public void test_SaveNewIndexedField_ShouldAddESMapping()
.build();
field = fieldAPI.save(field, user);
- final IndiciesInfo indiciesInfo = APILocator.getIndiciesAPI().loadIndicies();
+ final IndicesInfo legacyIndicesInfo = APILocator.getIndiciesAPI().loadLegacyIndices();
final ESMappingAPIImpl mappingAPI = new ESMappingAPIImpl();
//verify mapping on working index
Map mapping = (Map) mappingAPI
- .getFieldMappingAsMap(indiciesInfo.getWorking(),
+ .getFieldMappingAsMap(legacyIndicesInfo.getWorking(),
(type.variable() + StringPool.PERIOD + field.variable())
.toLowerCase()).get(field.variable());
assertTrue(UtilMethods.isSet(mapping.get("type")));
@@ -1486,7 +1484,7 @@ public void test_SaveNewIndexedField_ShouldAddESMapping()
//verify mapping on live index
mapping = (Map) mappingAPI
- .getFieldMappingAsMap(indiciesInfo.getLive(),
+ .getFieldMappingAsMap(legacyIndicesInfo.getLive(),
(type.variable() + StringPool.PERIOD + field.variable())
.toLowerCase()).get(field.variable());
assertTrue(UtilMethods.isSet(mapping.get("type")));
@@ -1494,7 +1492,7 @@ public void test_SaveNewIndexedField_ShouldAddESMapping()
//validate _dotraw fields
mapping = (Map) mappingAPI
- .getFieldMappingAsMap(indiciesInfo.getLive(),
+ .getFieldMappingAsMap(legacyIndicesInfo.getLive(),
(type.variable() + StringPool.PERIOD + field.variable() + "_dotraw")
.toLowerCase()).get(field.variable() + "_dotraw");
assertTrue(UtilMethods.isSet(mapping.get("type")));
@@ -1521,12 +1519,12 @@ public void test_SaveNewRelationshipField_ShouldAddESMapping()
final Field field = createAndSaveRelationshipField("newRel",
type.id(), type.variable(), CARDINALITY);
- final IndiciesInfo indiciesInfo = APILocator.getIndiciesAPI().loadIndicies();
+ final IndicesInfo legacyIndicesInfo = APILocator.getIndiciesAPI().loadLegacyIndices();
final ESMappingAPIImpl mappingAPI = new ESMappingAPIImpl();
//verify mapping on working index
Map mapping = (Map) mappingAPI
- .getFieldMappingAsMap(indiciesInfo.getWorking(),
+ .getFieldMappingAsMap(legacyIndicesInfo.getWorking(),
(type.variable() + StringPool.PERIOD + field.variable())
.toLowerCase()).get(field.variable().toLowerCase());
assertTrue(UtilMethods.isSet(mapping.get("type")));
@@ -1534,7 +1532,7 @@ public void test_SaveNewRelationshipField_ShouldAddESMapping()
//verify mapping on live index
mapping = (Map) mappingAPI
- .getFieldMappingAsMap(indiciesInfo.getLive(),
+ .getFieldMappingAsMap(legacyIndicesInfo.getLive(),
(type.variable() + StringPool.PERIOD + field.variable())
.toLowerCase()).get(field.variable().toLowerCase());
assertTrue(UtilMethods.isSet(mapping.get("type")));
diff --git a/dotcms-integration/src/test/java/com/dotcms/security/apps/AppsAPIImplTest.java b/dotcms-integration/src/test/java/com/dotcms/security/apps/AppsAPIImplTest.java
index d95a91cab111..ac37ac4cb569 100644
--- a/dotcms-integration/src/test/java/com/dotcms/security/apps/AppsAPIImplTest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/security/apps/AppsAPIImplTest.java
@@ -9,8 +9,8 @@
import static org.mockito.Mockito.when;
import com.dotcms.content.elasticsearch.business.ContentletIndexAPI;
-import com.dotcms.content.elasticsearch.business.IndiciesAPI;
-import com.dotcms.content.elasticsearch.business.IndiciesInfo;
+import com.dotcms.content.elasticsearch.business.IndicesAPI;
+import com.dotcms.content.elasticsearch.business.IndicesInfo;
import com.dotcms.datagen.AppDescriptorDataGen;
import com.dotcms.datagen.LayoutDataGen;
import com.dotcms.datagen.PortletDataGen;
@@ -1525,8 +1525,8 @@ public void Test_NPE_Free_ToString(){
public void Test_AppKeyByHost_On_Index_Deactivation()
throws DotDataException, IOException, DotSecurityException {
final ContentletIndexAPI contentletIndexAPI = APILocator.getContentletIndexAPI();
- final IndiciesAPI indiciesAPI = APILocator.getIndiciesAPI();
- final IndiciesInfo indiciesInfo = indiciesAPI.loadIndicies();
+ final IndicesAPI indicesAPI = APILocator.getIndiciesAPI();
+ final IndicesInfo legacyIndicesInfo = indicesAPI.loadLegacyIndices();
try {
AppSecrets.Builder builder = new AppSecrets.Builder();
@@ -1540,8 +1540,8 @@ public void Test_AppKeyByHost_On_Index_Deactivation()
final Host host = new SiteDataGen().nextPersisted();
- contentletIndexAPI.deactivateIndex(indiciesInfo.getWorking());
- contentletIndexAPI.deactivateIndex(indiciesInfo.getLive());
+ contentletIndexAPI.deactivateIndex(legacyIndicesInfo.getWorking());
+ contentletIndexAPI.deactivateIndex(legacyIndicesInfo.getLive());
final AppsAPI api = APILocator.getAppsAPI();
api.saveSecrets(bean,host,APILocator.systemUser());
@@ -1550,8 +1550,8 @@ public void Test_AppKeyByHost_On_Index_Deactivation()
assertTrue(keysByHost.get(host.getIdentifier()).contains(appKey.toLowerCase()));
} finally {
- contentletIndexAPI.activateIndex(indiciesInfo.getWorking());
- contentletIndexAPI.activateIndex(indiciesInfo.getLive());
+ contentletIndexAPI.activateIndex(legacyIndicesInfo.getWorking());
+ contentletIndexAPI.activateIndex(legacyIndicesInfo.getLive());
}
}
diff --git a/dotcms-integration/src/test/java/com/dotcms/util/pagination/ContentTypesPaginatorTest.java b/dotcms-integration/src/test/java/com/dotcms/util/pagination/ContentTypesPaginatorTest.java
index 2cb14139e4a6..d3b4932fd96e 100644
--- a/dotcms-integration/src/test/java/com/dotcms/util/pagination/ContentTypesPaginatorTest.java
+++ b/dotcms-integration/src/test/java/com/dotcms/util/pagination/ContentTypesPaginatorTest.java
@@ -1,18 +1,18 @@
package com.dotcms.util.pagination;
-import com.dotcms.content.elasticsearch.business.IndiciesInfo;
+import static com.liferay.util.StringPool.COMMA;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.dotcms.content.elasticsearch.business.IndicesInfo;
import com.dotcms.contenttype.business.ContentTypeAPI;
import com.dotcms.contenttype.model.type.BaseContentType;
import com.dotcms.contenttype.model.type.ContentType;
import com.dotcms.contenttype.model.type.ContentTypeBuilder;
import com.dotcms.languagevariable.business.LanguageVariableAPI;
-import com.dotcms.util.CollectionsUtils;
import com.dotcms.util.IntegrationTestInitService;
import com.dotmarketing.beans.Host;
-import com.dotmarketing.beans.Permission;
import com.dotmarketing.business.APILocator;
-import com.dotmarketing.business.PermissionAPI;
-import com.dotmarketing.business.Role;
import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.exception.DotSecurityException;
import com.dotmarketing.portlets.folders.business.FolderAPI;
@@ -24,23 +24,17 @@
import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
-import java.util.Objects;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import java.util.stream.Collectors;
-
-import static com.liferay.util.StringPool.COMMA;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* This Integration Test verifies that the {@link ContentTypesPaginator} class performs as expected.
@@ -207,10 +201,10 @@ public void test_getItems_WhenFilterContainsContentTypeName_ReturnsTheContentTyp
*/
@Test
public void whenTheIndicesAreDeactivateShouldReturnNAInEntries() throws DotDataException, IOException {
- final IndiciesInfo indiciesInfo = APILocator.getIndiciesAPI().loadIndicies();
+ final IndicesInfo legacyIndicesInfo = APILocator.getIndiciesAPI().loadLegacyIndices();
- final String live = APILocator.getESIndexAPI().removeClusterIdFromName(indiciesInfo.getLive());
- final String working = APILocator.getESIndexAPI().removeClusterIdFromName(indiciesInfo.getWorking());
+ final String live = APILocator.getESIndexAPI().removeClusterIdFromName(legacyIndicesInfo.getLive());
+ final String working = APILocator.getESIndexAPI().removeClusterIdFromName(legacyIndicesInfo.getWorking());
try {
if (live != null) {
APILocator.getContentletIndexAPI().deactivateIndex(live);