From 9742432150acd873ac26f28777152eef566b72b3 Mon Sep 17 00:00:00 2001 From: Sandesh Kumar Date: Mon, 21 Oct 2024 20:34:11 +0530 Subject: [PATCH] delete tests added accidentally Signed-off-by: Sandesh Kumar --- .../opensearch/common/util/FeatureFlags.java | 2 +- .../startree/StarTreeQueryContextTests.java | 122 ------------------ 2 files changed, 1 insertion(+), 123 deletions(-) delete mode 100644 server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeQueryContextTests.java diff --git a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java index e663d8429da13..6df68013a8119 100644 --- a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java +++ b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java @@ -100,7 +100,7 @@ public class FeatureFlags { * aggregations. */ public static final String STAR_TREE_INDEX = "opensearch.experimental.feature.composite_index.star_tree.enabled"; - public static final Setting STAR_TREE_INDEX_SETTING = Setting.boolSetting(STAR_TREE_INDEX, true, Property.NodeScope); + public static final Setting STAR_TREE_INDEX_SETTING = Setting.boolSetting(STAR_TREE_INDEX, false, Property.NodeScope); /** * Gates the functionality of application based configuration templates. diff --git a/server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeQueryContextTests.java b/server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeQueryContextTests.java deleted file mode 100644 index 3d4b4719a09fa..0000000000000 --- a/server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeQueryContextTests.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.search.aggregations.startree; - -import org.apache.lucene.index.LeafReaderContext; -import org.apache.lucene.util.FixedBitSet; -import org.opensearch.index.codec.composite.CompositeIndexFieldInfo; -import org.opensearch.search.startree.StarTreeQueryContext; -import org.opensearch.test.OpenSearchTestCase; -import org.junit.Before; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class StarTreeQueryContextTests extends OpenSearchTestCase { - - private CompositeIndexFieldInfo mockStarTree; - private LeafReaderContext mockLeafReaderContext; - private StarTreeQueryContext context; - private Map queryMap; - - @Before - public void setUp() { - // Mock dependencies - mockStarTree = mock(CompositeIndexFieldInfo.class); - mockLeafReaderContext = mock(LeafReaderContext.class); - - // Prepare queryMap - queryMap = new HashMap<>(); - queryMap.put("field1", 123L); - queryMap.put("field2", 456L); - - // Simulate leaf reader context ord - when(mockLeafReaderContext.ord).thenReturn(1); - } - - public void testConstructorWithValidNumSegmentsCache() { - // Initialize context with valid numSegmentsCache - int numSegmentsCache = 3; - context = new StarTreeQueryContext(mockStarTree, queryMap, numSegmentsCache); - - // Verify that the star tree and query map are set correctly - assertEquals(mockStarTree, context.getStarTree()); - assertEquals(queryMap, context.getQueryMap()); - - // Verify that the starTreeValues array is initialized correctly - assertNotNull(context.getStarTreeValues()); - assertEquals(numSegmentsCache, context.getStarTreeValues().length); - } - - public void testConstructorWithNegativeNumSegmentsCache() { - // Initialize context with invalid numSegmentsCache (-1) - context = new StarTreeQueryContext(mockStarTree, queryMap, -1); - - // Verify that the starTreeValues array is not initialized - assertNull(context.getStarTreeValues()); - } - - public void testGetStarTreeValues_WithValidContext() { - // Initialize context with a cache of size 3 - context = new StarTreeQueryContext(mockStarTree, queryMap, 3); - - // Create a FixedBitSet and assign it to the context - FixedBitSet fixedBitSet = new FixedBitSet(10); - context.setStarTreeValues(mockLeafReaderContext, fixedBitSet); - - // Retrieve the FixedBitSet for the given context - FixedBitSet result = context.getStarTreeValues(mockLeafReaderContext); - - // Verify that the correct FixedBitSet is returned - assertNotNull(result); - assertEquals(fixedBitSet, result); - } - - public void testGetStarTreeValues_WithNullCache() { - // Initialize context with no cache (numSegmentsCache is -1) - context = new StarTreeQueryContext(mockStarTree, queryMap, -1); - - // Retrieve the FixedBitSet for the given context - FixedBitSet result = context.getStarTreeValues(mockLeafReaderContext); - - // Verify that the result is null since there's no cache - assertNull(result); - } - - public void testSetStarTreeValues() { - // Initialize context with a cache of size 3 - context = new StarTreeQueryContext(mockStarTree, queryMap, 3); - - // Create a FixedBitSet and assign it to the context - FixedBitSet fixedBitSet = new FixedBitSet(10); - context.setStarTreeValues(mockLeafReaderContext, fixedBitSet); - - // Retrieve the FixedBitSet for the given context and verify the update - FixedBitSet result = context.getStarTreeValues(mockLeafReaderContext); - assertEquals(fixedBitSet, result); - } - - public void testSetStarTreeValues_WithNullCache() { - // Initialize context with no cache (numSegmentsCache is -1) - context = new StarTreeQueryContext(mockStarTree, queryMap, -1); - - // Try setting a FixedBitSet and ensure no exception is thrown - FixedBitSet fixedBitSet = new FixedBitSet(10); - context.setStarTreeValues(mockLeafReaderContext, fixedBitSet); - - // Since the cache is null, getStarTreeValues should return null - assertNull(context.getStarTreeValues(mockLeafReaderContext)); - } -}