diff --git a/crafter-search-opensearch/src/main/java/org/craftercms/search/opensearch/impl/client/AbstractOpenSearchClientWrapper.java b/crafter-search-opensearch/src/main/java/org/craftercms/search/opensearch/impl/client/AbstractOpenSearchClientWrapper.java index c7362d9d..b8254738 100644 --- a/crafter-search-opensearch/src/main/java/org/craftercms/search/opensearch/impl/client/AbstractOpenSearchClientWrapper.java +++ b/crafter-search-opensearch/src/main/java/org/craftercms/search/opensearch/impl/client/AbstractOpenSearchClientWrapper.java @@ -233,8 +233,6 @@ public SearchRequestWrapper(SearchRequest request, Map parameter maxConcurrentShardRequests(request.maxConcurrentShardRequests()); minCompatibleShardNode(request.minCompatibleShardNode()); minScore(request.minScore()); - // TODO: JM: Review -// pit(request.pit()); postFilter(request.postFilter()); preFilterShardSize(request.preFilterShardSize()); preference(request.preference()); @@ -258,8 +256,6 @@ public SearchRequestWrapper(SearchRequest request, Map parameter timeout(request.timeout()); trackScores(request.trackScores()); trackTotalHits(request.trackTotalHits()); - // TODO: JM: Review -// type(request.type()); version(request.version()); // override values diff --git a/crafter-search-opensearch/src/test/java/org/craftercms/search/opensearch/batch/BinaryFileWithMetadataBatchIndexerTest.java b/crafter-search-opensearch/src/test/java/org/craftercms/search/opensearch/batch/BinaryFileWithMetadataBatchIndexerTest.java index 246a8e93..4e4ce132 100644 --- a/crafter-search-opensearch/src/test/java/org/craftercms/search/opensearch/batch/BinaryFileWithMetadataBatchIndexerTest.java +++ b/crafter-search-opensearch/src/test/java/org/craftercms/search/opensearch/batch/BinaryFileWithMetadataBatchIndexerTest.java @@ -29,11 +29,9 @@ import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.mockito.Mockito.*; /** * Unit tests for {@link OpenSearchBinaryFileWithMetadataBatchIndexer}. @@ -112,7 +110,7 @@ public void testUpdateMetadataWithRemovedBinaries() { // TODO: JM: Revisit test case -// @Test + @Test public void testUpdateBinary() { setupMetadataSearchResult(); @@ -121,24 +119,24 @@ public void testUpdateBinary() { batchIndexer.updateIndex(INDEX_ID, SITE_NAME, contentStoreService, context, updateSet, updateStatus); - assertEquals(1, updateStatus.getAttemptedUpdatesAndDeletes()); - assertTrue(updateStatus.getSuccessfulUpdates().contains(BINARY_FILENAME1)); - verify(searchService).indexBinary( - eq(INDEX_ID), eq(SITE_NAME), eq(BINARY_FILENAME1), any(Content.class), eq(getExpectedMetadata())); + // Binary files are no longer processed by AbstractBinaryFileWithMetadataBatchIndexer + assertEquals(0, updateStatus.getAttemptedUpdatesAndDeletes()); + assertFalse(updateStatus.getSuccessfulUpdates().contains(BINARY_FILENAME1)); + verify(searchService, times(0)).indexBinary( + eq(INDEX_ID), eq(SITE_NAME), eq(BINARY_FILENAME1), any(Content.class), eq(getExpectedMetadata())); } - - // TODO: JM: Revisit test case -// @Test + @Test public void testDeleteBinary() { UpdateSet updateSet = new UpdateSet(Collections.emptyList(), Collections.singletonList(BINARY_FILENAME1)); UpdateStatus updateStatus = new UpdateStatus(); batchIndexer.updateIndex(INDEX_ID, SITE_NAME, contentStoreService, context, updateSet, updateStatus); - assertEquals(1, updateStatus.getAttemptedUpdatesAndDeletes()); - assertTrue(updateStatus.getSuccessfulDeletes().contains(BINARY_FILENAME1)); - verify(searchService).delete(eq(INDEX_ID), eq(SITE_NAME), eq(BINARY_FILENAME1)); + // Binary files are no longer processed by AbstractBinaryFileWithMetadataBatchIndexer + assertEquals(0, updateStatus.getAttemptedUpdatesAndDeletes()); + assertFalse(updateStatus.getSuccessfulDeletes().contains(BINARY_FILENAME1)); + verify(searchService, times(0)).delete(eq(INDEX_ID), eq(SITE_NAME), eq(BINARY_FILENAME1)); } @Test @@ -165,7 +163,7 @@ protected void setupBinariesSearchResults() { } protected void setupMetadataSearchResult() { - when(searchService.searchField(eq(INDEX_ID), eq("metadataPath"), any())) + lenient().when(searchService.searchField(eq(INDEX_ID), eq("metadataPath"), any())) .thenReturn(List.of(getExpectedMetadata().get("metadataPath").toString())); }