Skip to content

Commit

Permalink
[ACS-9069] Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cezary-witkowski committed Dec 13, 2024
1 parent b990864 commit 6b1b534
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.alfresco.elasticsearch.initialReindex;

import static org.alfresco.elasticsearch.SearchQueryService.req;
import static org.alfresco.tas.AlfrescoStackInitializer.*;
import static org.alfresco.tas.AlfrescoStackInitializer.reindex;
import static org.alfresco.utility.model.FileType.TEXT_PLAIN;

import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*/
@ContextConfiguration(locations = "classpath:alfresco-elasticsearch-context.xml",
initializers = AlfrescoStackInitializer.class)
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation") // these are testng tests
@SuppressWarnings({"PMD.JUnit4TestShouldUseTestAnnotation", "PMD.JUnitTestsShouldIncludeAssert"}) // these are testng tests
public class ElasticsearchReindexingTests extends AbstractTestNGSpringContextTests
{
@Autowired
Expand Down Expand Up @@ -97,7 +97,8 @@ public void testReindexerFixesBrokenIndex()

// WHEN
// Run reindexer (leaving ALFRESCO_REINDEX_TO_TIME as default).
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime));
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate"));

// THEN
// Check document indexed.
Expand All @@ -116,7 +117,8 @@ public void testRecreateIndex()

// WHEN
// Run reindexer (with default dates to reindex everything).
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime));
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate"));

// THEN
// Check document indexed.
Expand All @@ -139,6 +141,7 @@ public void testRecreateIndexWithMetadataAndContent()
// WHEN
// Run reindexer leaving ALFRESCO_REINDEX_TO_TIME as default
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate",
"ALFRESCO_REINDEX_METADATAINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_CONTENTINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_PATHINDEXINGENABLED", "false"));
Expand All @@ -161,6 +164,7 @@ public void testRecreateIndexWithMetadataAndNoContent()
// WHEN
// Run reindexer leaving ALFRESCO_REINDEX_TO_TIME as default
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate",
"ALFRESCO_REINDEX_METADATAINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_CONTENTINDEXINGENABLED", "false",
"ALFRESCO_REINDEX_PATHINDEXINGENABLED", "false"));
Expand All @@ -184,6 +188,7 @@ public void testRecreateIndexWithNoMetadataAndContent()
// WHEN
// Run reindexer leaving ALFRESCO_REINDEX_TO_TIME as default
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate",
"ALFRESCO_REINDEX_METADATAINDEXINGENABLED", "false",
"ALFRESCO_REINDEX_CONTENTINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_PATHINDEXINGENABLED", "false"));
Expand All @@ -207,6 +212,7 @@ public void testRecreateIndexWithMetadataAndNoContentAndPath()
// WHEN
// Run reindexer leaving ALFRESCO_REINDEX_TO_TIME as default
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate",
"ALFRESCO_REINDEX_METADATAINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_CONTENTINDEXINGENABLED", "false",
"ALFRESCO_REINDEX_PATHINDEXINGENABLED", "true"));
Expand All @@ -230,6 +236,7 @@ public void testRecreateIndexWithMetadataAndContentAndPath()
// WHEN
// Run reindexer leaving ALFRESCO_REINDEX_TO_TIME as default
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate",
"ALFRESCO_REINDEX_METADATAINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_CONTENTINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_PATHINDEXINGENABLED", "true"));
Expand All @@ -251,6 +258,7 @@ public void testRecreateIndexWithNoMetadataAndPath()
// WHEN
// Run reindexer leaving ALFRESCO_REINDEX_TO_TIME as default
reindex(Map.of("ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate",
"ALFRESCO_REINDEX_METADATAINDEXINGENABLED", "false",
"ALFRESCO_REINDEX_CONTENTINDEXINGENABLED", "false",
"ALFRESCO_REINDEX_PATHINDEXINGENABLED", "true"));
Expand All @@ -274,8 +282,9 @@ public void testPathReindex()

// WHEN
// Run reindexer with path indexing enabled (and with default dates to reindex everything).
reindex(Map.of("ALFRESCO_REINDEX_PATHINDEXINGENABLED",
"true", "ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime));
reindex(Map.of("ALFRESCO_REINDEX_PATHINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate"));

// THEN
// Check path indexed.
Expand All @@ -300,7 +309,8 @@ public void testPathReindexQueryWithNamespaces()
// WHEN
// Run reindexer with path indexing enabled (and with default dates to reindex everything).
reindex(Map.of("ALFRESCO_REINDEX_PATHINDEXINGENABLED", "true",
"ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime));
"ALFRESCO_REINDEX_FROM_TIME", reindexerStartTime,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate"));

// THEN
// Check path indexed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ public void configureSecuritySettings(GenericContainer searchEngineContainer)
*/
public static void reindexEverything()
{
reindex(Map.of("ALFRESCO_REINDEX_PATHINDEXINGENABLED", "true")); // Ensure path reindexing is enabled.
reindex(Map.of("ALFRESCO_REINDEX_PATHINDEXINGENABLED", "true", // Ensure path reindexing is enabled.
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate"));
}

/**
Expand Down Expand Up @@ -183,7 +184,6 @@ public static Map<String, String> getReindexEnvBasic()
"SPRING_DATASOURCE_USERNAME", databaseType.getUsername(),
"SPRING_DATASOURCE_PASSWORD", databaseType.getPassword(),
"ELASTICSEARCH_INDEX_NAME", CUSTOM_ALFRESCO_INDEX,
"ALFRESCO_REINDEX_JOB_NAME", "reindexByDate",
"SPRING_ACTIVEMQ_BROKER-URL", "nio://activemq:61616",
"JAVA_TOOL_OPTIONS", "-Xmx1g",
"ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL", "http://transform-core-aio:8090/transform/config"));
Expand Down

0 comments on commit 6b1b534

Please sign in to comment.