Skip to content

Commit a482ee8

Browse files
committed
fix tests
1 parent f501a0a commit a482ee8

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchBulkSink.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,11 @@ public void updateConcurrentRequests(int concurrentRequests) {
434434
* Checks if vector embeddings are enabled for a specific entity type.
435435
* This combines SearchRepository capability check with job configuration.
436436
*/
437-
private boolean isVectorEmbeddingEnabledForEntity(String entityType) {
437+
boolean isVectorEmbeddingEnabledForEntity(String entityType) {
438438
return false;
439439
}
440440

441-
private void addEntitiesToVectorIndexBatch(
441+
void addEntitiesToVectorIndexBatch(
442442
CustomBulkProcessor bulkProcessor, List<EntityInterface> entities, boolean recreateIndex) {
443443
// TODO: Implement Elasticsearch vector embedding support
444444
}

openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchBulkSink.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,13 @@ public void updateConcurrentRequests(int concurrentRequests) {
489489
LOG.info("Concurrent requests updated to: {}", concurrentRequests);
490490
}
491491

492-
private boolean isVectorEmbeddingEnabledForEntity(String entityType) {
492+
boolean isVectorEmbeddingEnabledForEntity(String entityType) {
493493
return searchRepository.isVectorEmbeddingEnabled()
494494
&& OpenSearchVectorService.getInstance() != null
495495
&& AvailableEntityTypes.isVectorIndexable(entityType);
496496
}
497497

498-
private void addEntitiesToVectorIndexBatch(
498+
void addEntitiesToVectorIndexBatch(
499499
CustomBulkProcessor bulkProcessor,
500500
List<EntityInterface> entities,
501501
boolean recreateIndex,

openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchBulkSinkSimpleTest.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import static org.mockito.Mockito.lenient;
66

77
import es.co.elastic.clients.elasticsearch.ElasticsearchClient;
8+
import java.util.Collections;
89
import java.util.HashMap;
910
import java.util.Map;
1011
import org.junit.jupiter.api.BeforeEach;
@@ -83,21 +84,13 @@ void testContextDataHandling() {
8384

8485
@Test
8586
void testIsVectorEmbeddingEnabledForEntity() {
86-
// Test default implementation returns false
87-
boolean result = elasticSearchBulkSink.isVectorEmbeddingEnabledForEntity("table");
88-
assertEquals(false, result);
89-
90-
result = elasticSearchBulkSink.isVectorEmbeddingEnabledForEntity("user");
91-
assertEquals(false, result);
92-
93-
result = elasticSearchBulkSink.isVectorEmbeddingEnabledForEntity("dashboard");
94-
assertEquals(false, result);
87+
assertEquals(false, elasticSearchBulkSink.isVectorEmbeddingEnabledForEntity("table"));
88+
assertEquals(false, elasticSearchBulkSink.isVectorEmbeddingEnabledForEntity("user"));
89+
assertEquals(false, elasticSearchBulkSink.isVectorEmbeddingEnabledForEntity("dashboard"));
9590
}
9691

9792
@Test
98-
void testAddEntityToVectorIndex() {
99-
// Test default implementation does nothing (no exception thrown)
100-
// This should not throw any exception as the default implementation is empty
101-
elasticSearchBulkSink.addEntityToVectorIndex(null, null, true);
93+
void testAddEntitiesToVectorIndexBatch() {
94+
elasticSearchBulkSink.addEntitiesToVectorIndexBatch(null, Collections.emptyList(), true);
10295
}
10396
}

openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchBulkSinkSimpleTest.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.junit.jupiter.api.Assertions.assertNotNull;
55
import static org.mockito.Mockito.lenient;
66

7+
import java.util.Collections;
78
import java.util.HashMap;
89
import java.util.Map;
910
import org.junit.jupiter.api.BeforeEach;
@@ -83,21 +84,13 @@ void testContextDataHandling() {
8384

8485
@Test
8586
void testIsVectorEmbeddingEnabledForEntity() {
86-
// Test default implementation returns false
87-
boolean result = openSearchBulkSink.isVectorEmbeddingEnabledForEntity("table");
88-
assertEquals(false, result);
89-
90-
result = openSearchBulkSink.isVectorEmbeddingEnabledForEntity("user");
91-
assertEquals(false, result);
92-
93-
result = openSearchBulkSink.isVectorEmbeddingEnabledForEntity("dashboard");
94-
assertEquals(false, result);
87+
assertEquals(false, openSearchBulkSink.isVectorEmbeddingEnabledForEntity("table"));
88+
assertEquals(false, openSearchBulkSink.isVectorEmbeddingEnabledForEntity("user"));
89+
assertEquals(false, openSearchBulkSink.isVectorEmbeddingEnabledForEntity("dashboard"));
9590
}
9691

9792
@Test
98-
void testAddEntityToVectorIndex() {
99-
// Test default implementation does nothing (no exception thrown)
100-
// This should not throw any exception as the default implementation is empty
101-
openSearchBulkSink.addEntityToVectorIndex(null, null, true, null);
93+
void testAddEntitiesToVectorIndexBatch() {
94+
openSearchBulkSink.addEntitiesToVectorIndexBatch(null, Collections.emptyList(), true, null);
10295
}
10396
}

0 commit comments

Comments
 (0)