From 31b9d5695d8db387f6422a4e334b43dba4cee6e1 Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Thu, 22 Jun 2023 02:31:50 -0700 Subject: [PATCH] Extend InitializedNullHandlingTest instead of NullHandlingTest (#14467) NullHandlingTest is an actual test, it shouldn't be used as a base class --- .../druid/indexing/input/DruidSegmentReaderTest.java | 4 ++-- .../druid/indexing/input/InputRowSchemasTest.java | 4 ++-- .../apache/druid/common/config/NullHandlingTest.java | 10 ++-------- .../druid/query/scan/MultiSegmentScanQueryTest.java | 4 ++-- .../druid/segment/join/JoinableFactoryWrapperTest.java | 4 ++-- .../druid/segment/join/lookup/LookupJoinableTest.java | 4 ++-- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java index e2bae93e675..5580bfc5cc0 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import org.apache.commons.lang.mutable.MutableBoolean; -import org.apache.druid.common.config.NullHandlingTest; import org.apache.druid.data.input.BytesCountingInputEntity; import org.apache.druid.data.input.ColumnsFilter; import org.apache.druid.data.input.InputEntity; @@ -60,6 +59,7 @@ import org.apache.druid.segment.incremental.IncrementalIndex; import org.apache.druid.segment.incremental.IncrementalIndexSchema; import org.apache.druid.segment.loading.NoopSegmentCacheManager; import org.apache.druid.segment.writeout.OnHeapMemorySegmentWriteOutMediumFactory; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.apache.druid.timeline.DataSegment; import org.apache.druid.timeline.partition.TombstoneShardSpec; import org.joda.time.Interval; @@ -80,7 +80,7 @@ import java.util.Map; import static org.junit.Assert.assertThrows; -public class DruidSegmentReaderTest extends NullHandlingTest +public class DruidSegmentReaderTest extends InitializedNullHandlingTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/input/InputRowSchemasTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/input/InputRowSchemasTest.java index 991a5950f9a..44850ad0558 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/input/InputRowSchemasTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/input/InputRowSchemasTest.java @@ -21,7 +21,6 @@ package org.apache.druid.indexing.input; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import org.apache.druid.common.config.NullHandlingTest; import org.apache.druid.data.input.ColumnsFilter; import org.apache.druid.data.input.InputRowSchema; import org.apache.druid.data.input.impl.DimensionsSpec; @@ -40,12 +39,13 @@ import org.apache.druid.segment.indexing.DataSchema; import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec; import org.apache.druid.segment.transform.ExpressionTransform; import org.apache.druid.segment.transform.TransformSpec; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.junit.Assert; import org.junit.Test; import java.util.Arrays; -public class InputRowSchemasTest extends NullHandlingTest +public class InputRowSchemasTest extends InitializedNullHandlingTest { @Test public void test_createColumnsFilter_normal() diff --git a/processing/src/test/java/org/apache/druid/common/config/NullHandlingTest.java b/processing/src/test/java/org/apache/druid/common/config/NullHandlingTest.java index 3e1a1a87c3d..8bfb36d25d3 100644 --- a/processing/src/test/java/org/apache/druid/common/config/NullHandlingTest.java +++ b/processing/src/test/java/org/apache/druid/common/config/NullHandlingTest.java @@ -19,21 +19,15 @@ package org.apache.druid.common.config; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.junit.Assert; -import org.junit.BeforeClass; import org.junit.Test; import static org.apache.druid.common.config.NullHandling.replaceWithDefault; import static org.junit.Assert.assertEquals; -public class NullHandlingTest +public final class NullHandlingTest extends InitializedNullHandlingTest { - @BeforeClass - public static void setUpClass() - { - NullHandling.initializeForTests(); - } - @Test public void test_defaultValueForClass_float() { diff --git a/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java b/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java index fe8ff7a90d1..cc276c66328 100644 --- a/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java +++ b/processing/src/test/java/org/apache/druid/query/scan/MultiSegmentScanQueryTest.java @@ -24,7 +24,6 @@ import com.google.common.collect.Lists; import com.google.common.io.CharSource; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.apache.druid.common.config.NullHandlingTest; import org.apache.druid.java.util.common.DateTimes; import org.apache.druid.java.util.common.Intervals; import org.apache.druid.java.util.common.concurrent.Execs; @@ -47,6 +46,7 @@ import org.apache.druid.segment.TestIndex; import org.apache.druid.segment.incremental.IncrementalIndex; import org.apache.druid.segment.incremental.IncrementalIndexSchema; import org.apache.druid.segment.incremental.OnheapIncrementalIndex; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.apache.druid.timeline.SegmentId; import org.apache.druid.timeline.partition.NoneShardSpec; import org.joda.time.Interval; @@ -66,7 +66,7 @@ import java.util.List; * */ @RunWith(Parameterized.class) -public class MultiSegmentScanQueryTest extends NullHandlingTest +public class MultiSegmentScanQueryTest extends InitializedNullHandlingTest { private static final ScanQueryQueryToolChest TOOL_CHEST = new ScanQueryQueryToolChest( new ScanQueryConfig(), diff --git a/processing/src/test/java/org/apache/druid/segment/join/JoinableFactoryWrapperTest.java b/processing/src/test/java/org/apache/druid/segment/join/JoinableFactoryWrapperTest.java index f4ee1676b59..0516287d33a 100644 --- a/processing/src/test/java/org/apache/druid/segment/join/JoinableFactoryWrapperTest.java +++ b/processing/src/test/java/org/apache/druid/segment/join/JoinableFactoryWrapperTest.java @@ -24,7 +24,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import org.apache.druid.common.config.NullHandling; -import org.apache.druid.common.config.NullHandlingTest; import org.apache.druid.java.util.common.DateTimes; import org.apache.druid.java.util.common.IAE; import org.apache.druid.java.util.common.Pair; @@ -41,6 +40,7 @@ import org.apache.druid.segment.join.lookup.LookupJoinable; import org.apache.druid.segment.join.table.IndexedTable; import org.apache.druid.segment.join.table.IndexedTableJoinable; import org.apache.druid.segment.join.table.RowBasedIndexedTable; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -54,7 +54,7 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -public class JoinableFactoryWrapperTest extends NullHandlingTest +public class JoinableFactoryWrapperTest extends InitializedNullHandlingTest { public static final JoinableFactoryWrapper NOOP_JOINABLE_FACTORY_WRAPPER = new JoinableFactoryWrapper( NoopJoinableFactory.INSTANCE diff --git a/processing/src/test/java/org/apache/druid/segment/join/lookup/LookupJoinableTest.java b/processing/src/test/java/org/apache/druid/segment/join/lookup/LookupJoinableTest.java index 4261494ef55..ce1dc7fc8b4 100644 --- a/processing/src/test/java/org/apache/druid/segment/join/lookup/LookupJoinableTest.java +++ b/processing/src/test/java/org/apache/druid/segment/join/lookup/LookupJoinableTest.java @@ -22,11 +22,11 @@ package org.apache.druid.segment.join.lookup; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import org.apache.druid.common.config.NullHandling; -import org.apache.druid.common.config.NullHandlingTest; import org.apache.druid.query.lookup.LookupExtractor; import org.apache.druid.segment.column.ColumnCapabilities; import org.apache.druid.segment.column.ValueType; import org.apache.druid.segment.join.Joinable; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; @@ -43,7 +43,7 @@ import java.util.Optional; import java.util.Set; @RunWith(MockitoJUnitRunner.class) -public class LookupJoinableTest extends NullHandlingTest +public class LookupJoinableTest extends InitializedNullHandlingTest { private static final String UNKNOWN_COLUMN = "UNKNOWN_COLUMN"; private static final String SEARCH_KEY_VALUE = "SEARCH_KEY_VALUE";