From cef5195ce57f6b4e81868d50994f4173381fb2f5 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Sun, 26 Aug 2018 08:51:22 -0700 Subject: [PATCH 1/4] Fix all inspection errors currently reported. TeamCity builds on master are reporting inspection errors, possibly because there was a while where it was not running due to the Apache migration, and there was some drift. --- .../io/druid/timeline/DataSegmentTest.java | 3 +-- .../timecompare/TimeCompareBenchmark.java | 11 ++++------ .../parallel/ParallelIndexSupervisorTask.java | 2 +- .../autoscaling/EC2AutoScalerTest.java | 20 +++++++------------ .../query/topn/TopNNumericResultBuilder.java | 4 ++-- .../collections/bitmap/BitmapBenchmark.java | 16 +++++++-------- .../aggregation/AggregationTestHelper.java | 2 +- .../first/StringFirstTimeseriesQueryTest.java | 8 ++++---- .../last/StringLastTimeseriesQueryTest.java | 10 +++++----- .../druid/segment/filter/BoundFilterTest.java | 4 ++-- .../filter/ColumnComparisonFilterTest.java | 10 +++++----- .../segment/filter/SearchQueryFilterTest.java | 2 +- .../helper/DruidCoordinatorBalancer.java | 1 + .../selector/TierSelectorStrategyTest.java | 2 +- .../SegmentLoadDropHandlerTest.java | 18 +++++------------ .../helper/NewestSegmentFirstPolicyTest.java | 4 ++-- 16 files changed, 50 insertions(+), 67 deletions(-) diff --git a/api/src/test/java/io/druid/timeline/DataSegmentTest.java b/api/src/test/java/io/druid/timeline/DataSegmentTest.java index fc5bd282d8ea..aa34471a53d5 100644 --- a/api/src/test/java/io/druid/timeline/DataSegmentTest.java +++ b/api/src/test/java/io/druid/timeline/DataSegmentTest.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; import com.google.common.collect.RangeSet; import com.google.common.collect.Sets; import io.druid.TestObjectMapper; @@ -238,7 +237,7 @@ public void testBucketMonthComparator() makeDataSegment("test2", "2011-02-02/2011-02-03", "a"), }; - List shuffled = Lists.newArrayList(sortedOrder); + List shuffled = Arrays.asList(sortedOrder); Collections.shuffle(shuffled); Set theSet = Sets.newTreeSet(DataSegment.bucketMonthComparator()); diff --git a/benchmarks/src/main/java/io/druid/benchmark/query/timecompare/TimeCompareBenchmark.java b/benchmarks/src/main/java/io/druid/benchmark/query/timecompare/TimeCompareBenchmark.java index 97522d5d9210..ccf8e3f6fc0b 100644 --- a/benchmarks/src/main/java/io/druid/benchmark/query/timecompare/TimeCompareBenchmark.java +++ b/benchmarks/src/main/java/io/druid/benchmark/query/timecompare/TimeCompareBenchmark.java @@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.InjectableValues; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.io.Files; import io.druid.benchmark.datagen.BenchmarkDataGenerator; import io.druid.benchmark.datagen.BenchmarkSchemaInfo; @@ -96,6 +95,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -117,7 +117,7 @@ public class TimeCompareBenchmark @Param({"100"}) private int threshold; - protected static final Map scriptDoubleSum = Maps.newHashMap(); + protected static final Map scriptDoubleSum = new HashMap<>(); static { scriptDoubleSum.put("fnAggregate", "function aggregate(current, a) { return current + a }"); scriptDoubleSum.put("fnReset", "function reset() { return 0 }"); @@ -427,10 +427,7 @@ private IncrementalIndex makeIncIndex() @OutputTimeUnit(TimeUnit.MICROSECONDS) public void queryMultiQueryableIndexTopN(Blackhole blackhole) { - Sequence> queryResult = topNRunner.run( - QueryPlus.wrap(topNQuery), - Maps.newHashMap() - ); + Sequence> queryResult = topNRunner.run(QueryPlus.wrap(topNQuery), new HashMap<>()); List> results = queryResult.toList(); for (Result result : results) { @@ -446,7 +443,7 @@ public void queryMultiQueryableIndexTimeseries(Blackhole blackhole) { Sequence> queryResult = timeseriesRunner.run( QueryPlus.wrap(timeseriesQuery), - Maps.newHashMap() + new HashMap<>() ); List> results = queryResult.toList(); diff --git a/indexing-service/src/main/java/io/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java b/indexing-service/src/main/java/io/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java index 438e0f1d81ff..b0e0ed247145 100644 --- a/indexing-service/src/main/java/io/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java +++ b/indexing-service/src/main/java/io/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java @@ -268,7 +268,7 @@ private TaskStatus runParallel(TaskToolbox toolbox) throws Exception return TaskStatus.fromCode(getId(), runner.run()); } - private TaskStatus runSequential(TaskToolbox toolbox) throws Exception + private TaskStatus runSequential(TaskToolbox toolbox) { return new IndexTask( getId(), diff --git a/indexing-service/src/test/java/io/druid/indexing/overlord/autoscaling/EC2AutoScalerTest.java b/indexing-service/src/test/java/io/druid/indexing/overlord/autoscaling/EC2AutoScalerTest.java index d34c96606329..68daf7f762b1 100644 --- a/indexing-service/src/test/java/io/druid/indexing/overlord/autoscaling/EC2AutoScalerTest.java +++ b/indexing-service/src/test/java/io/druid/indexing/overlord/autoscaling/EC2AutoScalerTest.java @@ -117,7 +117,9 @@ public void testScale() EasyMock.expect(runInstancesResult.getReservation()).andReturn(reservation).atLeastOnce(); EasyMock.replay(runInstancesResult); - EasyMock.expect(describeInstancesResult.getReservations()).andReturn(Collections.singletonList(reservation)).atLeastOnce(); + EasyMock.expect(describeInstancesResult.getReservations()) + .andReturn(Collections.singletonList(reservation)) + .atLeastOnce(); EasyMock.replay(describeInstancesResult); EasyMock.expect(reservation.getInstances()).andReturn(Collections.singletonList(instance)).atLeastOnce(); @@ -177,12 +179,8 @@ public void testIptoIdLookup() Arrays.fill(chunk1, reservation); final Reservation[] chunk2 = new Reservation[n - EC2AutoScaler.MAX_AWS_FILTER_VALUES]; Arrays.fill(chunk2, reservation); - EasyMock.expect(describeInstancesResult.getReservations()).andReturn( - Lists.newArrayList(chunk1) - ); - EasyMock.expect(describeInstancesResult.getReservations()).andReturn( - Lists.newArrayList(chunk2) - ); + EasyMock.expect(describeInstancesResult.getReservations()).andReturn(Arrays.asList(chunk1)); + EasyMock.expect(describeInstancesResult.getReservations()).andReturn(Arrays.asList(chunk2)); EasyMock.replay(describeInstancesResult); EasyMock.expect(reservation.getInstances()).andReturn(Collections.singletonList(instance)).times(n); @@ -234,12 +232,8 @@ public void testIdToIpLookup() Arrays.fill(chunk1, reservation); final Reservation[] chunk2 = new Reservation[n - EC2AutoScaler.MAX_AWS_FILTER_VALUES]; Arrays.fill(chunk2, reservation); - EasyMock.expect(describeInstancesResult.getReservations()).andReturn( - Lists.newArrayList(chunk1) - ); - EasyMock.expect(describeInstancesResult.getReservations()).andReturn( - Lists.newArrayList(chunk2) - ); + EasyMock.expect(describeInstancesResult.getReservations()).andReturn(Arrays.asList(chunk1)); + EasyMock.expect(describeInstancesResult.getReservations()).andReturn(Arrays.asList(chunk2)); EasyMock.replay(describeInstancesResult); EasyMock.expect(reservation.getInstances()).andReturn(Collections.singletonList(instance)).times(n); diff --git a/processing/src/main/java/io/druid/query/topn/TopNNumericResultBuilder.java b/processing/src/main/java/io/druid/query/topn/TopNNumericResultBuilder.java index f1a35725e3fc..503e090a3494 100644 --- a/processing/src/main/java/io/druid/query/topn/TopNNumericResultBuilder.java +++ b/processing/src/main/java/io/druid/query/topn/TopNNumericResultBuilder.java @@ -47,7 +47,6 @@ public class TopNNumericResultBuilder implements TopNResultBuilder private final String metricName; private final List postAggs; private final PriorityQueue pQueue; - private final Comparator dimValHolderComparator; private final String[] aggFactoryNames; private static final Comparator dimValueComparator = new Comparator() { @@ -91,7 +90,8 @@ public TopNNumericResultBuilder( this.postAggs = AggregatorUtil.pruneDependentPostAgg(postAggs, this.metricName); this.threshold = threshold; this.metricComparator = comparator; - this.dimValHolderComparator = (d1, d2) -> { + + final Comparator dimValHolderComparator = (d1, d2) -> { //noinspection unchecked int retVal = metricComparator.compare(d1.getTopNMetricVal(), d2.getTopNMetricVal()); diff --git a/processing/src/test/java/io/druid/collections/bitmap/BitmapBenchmark.java b/processing/src/test/java/io/druid/collections/bitmap/BitmapBenchmark.java index 2088a8cb70e5..c20d534161b8 100644 --- a/processing/src/test/java/io/druid/collections/bitmap/BitmapBenchmark.java +++ b/processing/src/test/java/io/druid/collections/bitmap/BitmapBenchmark.java @@ -22,7 +22,6 @@ import com.carrotsearch.junitbenchmarks.BenchmarkOptions; import com.carrotsearch.junitbenchmarks.BenchmarkRule; import com.carrotsearch.junitbenchmarks.Clock; -import com.google.common.collect.Lists; import io.druid.extendedset.intset.ImmutableConciseSet; import org.junit.Assert; import org.junit.Rule; @@ -36,6 +35,7 @@ import java.io.DataOutputStream; import java.io.IOException; import java.nio.ByteBuffer; +import java.util.Arrays; import java.util.Locale; import java.util.Random; @@ -152,7 +152,7 @@ public void timeOffheapConciseUnion() @BenchmarkOptions(warmupRounds = 1, benchmarkRounds = 2) public void timeGenericConciseUnion() { - ImmutableBitmap union = conciseFactory.union(Lists.newArrayList(genericConcise)); + ImmutableBitmap union = conciseFactory.union(Arrays.asList(genericConcise)); Assert.assertEquals(unionCount, union.size()); } @@ -160,42 +160,42 @@ public void timeGenericConciseUnion() @BenchmarkOptions(warmupRounds = 1, benchmarkRounds = 5) public void timeGenericConciseIntersection() { - ImmutableBitmap intersection = conciseFactory.intersection(Lists.newArrayList(genericConcise)); + ImmutableBitmap intersection = conciseFactory.intersection(Arrays.asList(genericConcise)); Assert.assertTrue(intersection.size() >= minIntersection); } @Test public void timeRoaringUnion() { - ImmutableRoaringBitmap union = BufferFastAggregation.horizontal_or(Lists.newArrayList(roaring).iterator()); + ImmutableRoaringBitmap union = BufferFastAggregation.horizontal_or(Arrays.asList(roaring).iterator()); Assert.assertEquals(unionCount, union.getCardinality()); } @Test public void timeImmutableRoaringUnion() { - ImmutableRoaringBitmap union = BufferFastAggregation.horizontal_or(Lists.newArrayList(immutableRoaring).iterator()); + ImmutableRoaringBitmap union = BufferFastAggregation.horizontal_or(Arrays.asList(immutableRoaring).iterator()); Assert.assertEquals(unionCount, union.getCardinality()); } @Test public void timeOffheapRoaringUnion() { - ImmutableRoaringBitmap union = BufferFastAggregation.horizontal_or(Lists.newArrayList(offheapRoaring).iterator()); + ImmutableRoaringBitmap union = BufferFastAggregation.horizontal_or(Arrays.asList(offheapRoaring).iterator()); Assert.assertEquals(unionCount, union.getCardinality()); } @Test public void timeGenericRoaringUnion() { - ImmutableBitmap union = roaringFactory.union(Lists.newArrayList(genericRoaring)); + ImmutableBitmap union = roaringFactory.union(Arrays.asList(genericRoaring)); Assert.assertEquals(unionCount, union.size()); } @Test public void timeGenericRoaringIntersection() { - ImmutableBitmap intersection = roaringFactory.intersection(Lists.newArrayList(genericRoaring)); + ImmutableBitmap intersection = roaringFactory.intersection(Arrays.asList(genericRoaring)); Assert.assertTrue(intersection.size() >= minIntersection); } } diff --git a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java index 9ab3b5fb47bc..0fb199771822 100644 --- a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java +++ b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java @@ -344,7 +344,7 @@ public Sequence createIndexAndRunQueryOnSegment( { File segmentDir = tempFolder.newFolder(); createIndex(inputDataFile, parserJson, aggregators, segmentDir, minTimestamp, gran, maxRowCount, true); - return runQueryOnSegments(Lists.newArrayList(segmentDir), groupByQueryJson); + return runQueryOnSegments(Collections.singletonList(segmentDir), groupByQueryJson); } public Sequence createIndexAndRunQueryOnSegment( diff --git a/processing/src/test/java/io/druid/query/aggregation/first/StringFirstTimeseriesQueryTest.java b/processing/src/test/java/io/druid/query/aggregation/first/StringFirstTimeseriesQueryTest.java index 8a0d9ea8772a..0a61b27e6fa7 100644 --- a/processing/src/test/java/io/druid/query/aggregation/first/StringFirstTimeseriesQueryTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/first/StringFirstTimeseriesQueryTest.java @@ -76,21 +76,21 @@ public void testTopNWithDistinctCountAgg() throws Exception new MapBasedInputRow( timestamp, Lists.newArrayList(visitor_id, client_type), - ImmutableMap.of(visitor_id, "0", client_type, "iphone") + ImmutableMap.of(visitor_id, "0", client_type, "iphone") ) ); index.add( new MapBasedInputRow( timestamp, Lists.newArrayList(visitor_id, client_type), - ImmutableMap.of(visitor_id, "1", client_type, "iphone") + ImmutableMap.of(visitor_id, "1", client_type, "iphone") ) ); index.add( new MapBasedInputRow( timestamp1, Lists.newArrayList(visitor_id, client_type), - ImmutableMap.of(visitor_id, "0", client_type, "android") + ImmutableMap.of(visitor_id, "0", client_type, "android") ) ); @@ -114,7 +114,7 @@ public void testTopNWithDistinctCountAgg() throws Exception new Result<>( time, new TimeseriesResultValue( - ImmutableMap.of("last_client_type", new SerializablePairLongString(timestamp, "iphone")) + ImmutableMap.of("last_client_type", new SerializablePairLongString(timestamp, "iphone")) ) ) ); diff --git a/processing/src/test/java/io/druid/query/aggregation/last/StringLastTimeseriesQueryTest.java b/processing/src/test/java/io/druid/query/aggregation/last/StringLastTimeseriesQueryTest.java index a68798e64be0..f407f5bdca64 100644 --- a/processing/src/test/java/io/druid/query/aggregation/last/StringLastTimeseriesQueryTest.java +++ b/processing/src/test/java/io/druid/query/aggregation/last/StringLastTimeseriesQueryTest.java @@ -76,21 +76,21 @@ public void testTopNWithDistinctCountAgg() throws Exception new MapBasedInputRow( timestamp, Lists.newArrayList(visitor_id, client_type), - ImmutableMap.of(visitor_id, "0", client_type, "iphone") + ImmutableMap.of(visitor_id, "0", client_type, "iphone") ) ); index.add( new MapBasedInputRow( timestamp, Lists.newArrayList(visitor_id, client_type), - ImmutableMap.of(visitor_id, "1", client_type, "iphone") + ImmutableMap.of(visitor_id, "1", client_type, "iphone") ) ); index.add( new MapBasedInputRow( timestamp1, Lists.newArrayList(visitor_id, client_type), - ImmutableMap.of(visitor_id, "0", client_type, "android") + ImmutableMap.of(visitor_id, "0", client_type, "android") ) ); @@ -99,7 +99,7 @@ public void testTopNWithDistinctCountAgg() throws Exception .granularity(QueryRunnerTestHelper.allGran) .intervals(QueryRunnerTestHelper.fullOnInterval) .aggregators( - Lists.newArrayList( + Collections.singletonList( new StringLastAggregatorFactory( "last_client_type", client_type, 1024 ) @@ -114,7 +114,7 @@ public void testTopNWithDistinctCountAgg() throws Exception new Result<>( time, new TimeseriesResultValue( - ImmutableMap.of( + ImmutableMap.of( "last_client_type", new SerializablePairLongString(timestamp1, "android") ) diff --git a/processing/src/test/java/io/druid/segment/filter/BoundFilterTest.java b/processing/src/test/java/io/druid/segment/filter/BoundFilterTest.java index 541886a373f3..2406588cfd43 100644 --- a/processing/src/test/java/io/druid/segment/filter/BoundFilterTest.java +++ b/processing/src/test/java/io/druid/segment/filter/BoundFilterTest.java @@ -161,7 +161,7 @@ public void testLexicographicMatchMissingColumn() ); assertFilterMatches( new BoundDimFilter("dim3", null, "", false, true, false, null, StringComparators.LEXICOGRAPHIC), - ImmutableList.of() + ImmutableList.of() ); } else { assertFilterMatches( @@ -174,7 +174,7 @@ public void testLexicographicMatchMissingColumn() ); assertFilterMatches( new BoundDimFilter("dim3", null, "", false, true, false, null, StringComparators.LEXICOGRAPHIC), - ImmutableList.of("0", "1", "2", "3", "4", "5", "6", "7") + ImmutableList.of("0", "1", "2", "3", "4", "5", "6", "7") ); } assertFilterMatches( diff --git a/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java b/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java index 4fbfcefec74d..6e7352700beb 100644 --- a/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java +++ b/processing/src/test/java/io/druid/segment/filter/ColumnComparisonFilterTest.java @@ -123,35 +123,35 @@ public void testMissingColumnNotSpecifiedInDimensionList() new ColumnComparisonDimFilter( ImmutableList.of(DefaultDimensionSpec.of("dim6"), DefaultDimensionSpec.of("dim7")) ), - ImmutableList.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9") + ImmutableList.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9") ); if (NullHandling.replaceWithDefault()) { assertFilterMatches( new ColumnComparisonDimFilter( ImmutableList.of(DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim6")) ), - ImmutableList.of("0") + ImmutableList.of("0") ); assertFilterMatches( new ColumnComparisonDimFilter( ImmutableList.of(DefaultDimensionSpec.of("dim2"), DefaultDimensionSpec.of("dim6")) ), - ImmutableList.of("1", "2", "6", "7", "8") + ImmutableList.of("1", "2", "6", "7", "8") ); } else { assertFilterMatches( new ColumnComparisonDimFilter( ImmutableList.of(DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim6")) ), - ImmutableList.of() + ImmutableList.of() ); assertFilterMatches( new ColumnComparisonDimFilter( ImmutableList.of(DefaultDimensionSpec.of("dim2"), DefaultDimensionSpec.of("dim6")) ), - ImmutableList.of("1", "6", "7", "8") + ImmutableList.of("1", "6", "7", "8") ); } } diff --git a/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java b/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java index 791f8e8f0a24..239c1b295fdc 100644 --- a/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java +++ b/processing/src/test/java/io/druid/segment/filter/SearchQueryFilterTest.java @@ -192,7 +192,7 @@ public void testSearchQueryWithExtractionFn() assertFilterMatches( new SearchQueryDimFilter("dim1", specForValue("ab"), changeNullFn), - ImmutableList.of("4", "5") + ImmutableList.of("4", "5") ); assertFilterMatches(new SearchQueryDimFilter("dim1", specForValue("ab"), changeNullFn), ImmutableList.of("4", "5")); diff --git a/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java b/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java index b4db2a9fa3d6..b5bc8d1f0b03 100644 --- a/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java +++ b/server/src/main/java/io/druid/server/coordinator/helper/DruidCoordinatorBalancer.java @@ -131,6 +131,7 @@ private void balanceTier( final int maxToLoad = params.getCoordinatorDynamicConfig().getMaxSegmentsInNodeLoadingQueue(); int moved = 0, unmoved = 0; + //noinspection ForLoopThatDoesntUseLoopVariable for (int iter = 0; (moved + unmoved) < maxSegmentsToMove; ++iter) { final BalancerSegmentHolder segmentToMoveHolder = strategy.pickSegmentToMove(toMoveFrom); diff --git a/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java b/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java index c9c71b363017..f8dc52cf49ba 100644 --- a/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java +++ b/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java @@ -131,7 +131,7 @@ private void testTierSelectorStrategy( tierSelectorStrategy ); - List servers = Lists.newArrayList(expectedSelection); + List servers = Arrays.asList(expectedSelection); List expectedCandidates = Lists.newArrayList(); for (QueryableDruidServer server : servers) { diff --git a/server/src/test/java/io/druid/server/coordination/SegmentLoadDropHandlerTest.java b/server/src/test/java/io/druid/server/coordination/SegmentLoadDropHandlerTest.java index fac59c52d682..cc500f22d783 100644 --- a/server/src/test/java/io/druid/server/coordination/SegmentLoadDropHandlerTest.java +++ b/server/src/test/java/io/druid/server/coordination/SegmentLoadDropHandlerTest.java @@ -34,7 +34,6 @@ import io.druid.segment.loading.CacheTestSegmentLoader; import io.druid.segment.loading.SegmentLoaderConfig; import io.druid.server.SegmentManager; -import io.druid.server.initialization.ZkPathsConfig; import io.druid.timeline.DataSegment; import io.druid.timeline.partition.NoneShardSpec; import org.easymock.EasyMock; @@ -45,6 +44,7 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -98,19 +98,10 @@ public void setUp() throw new RuntimeException(e); } - scheduledRunnable = Lists.newArrayList(); + scheduledRunnable = new ArrayList<>(); segmentLoader = new CacheTestSegmentLoader(); segmentManager = new SegmentManager(segmentLoader); - final ZkPathsConfig zkPaths = new ZkPathsConfig() - { - @Override - public String getBase() - { - return "/druid"; - } - }; - segmentsAnnouncedByMe = new ConcurrentSkipListSet<>(); announceCount = new AtomicInteger(0); @@ -377,7 +368,7 @@ private void checkCache(List segments) throws IOException Assert.assertTrue(infoDir.exists()); File[] files = infoDir.listFiles(); - List sortedFiles = Lists.newArrayList(files); + List sortedFiles = Arrays.asList(files); Collections.sort(sortedFiles); Assert.assertEquals(segments.size(), sortedFiles.size()); @@ -478,7 +469,8 @@ public void testProcessBatch() throws Exception Assert.assertEquals(SegmentLoadDropHandler.Status.SUCCESS, result.get(1).getStatus()); - for (SegmentLoadDropHandler.DataSegmentChangeRequestAndStatus e : segmentLoadDropHandler.processBatch(batch).get()) { + for (SegmentLoadDropHandler.DataSegmentChangeRequestAndStatus e : segmentLoadDropHandler.processBatch(batch) + .get()) { Assert.assertEquals(SegmentLoadDropHandler.Status.SUCCESS, e.getStatus()); } diff --git a/server/src/test/java/io/druid/server/coordinator/helper/NewestSegmentFirstPolicyTest.java b/server/src/test/java/io/druid/server/coordinator/helper/NewestSegmentFirstPolicyTest.java index 42682eef06b0..876043207478 100644 --- a/server/src/test/java/io/druid/server/coordinator/helper/NewestSegmentFirstPolicyTest.java +++ b/server/src/test/java/io/druid/server/coordinator/helper/NewestSegmentFirstPolicyTest.java @@ -22,7 +22,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; import io.druid.java.util.common.DateTimes; import io.druid.java.util.common.Intervals; import io.druid.java.util.common.guava.Comparators; @@ -37,6 +36,7 @@ import org.junit.Test; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -405,7 +405,7 @@ private static VersionedIntervalTimeline createTimeline( final String version = DateTimes.nowUtc().toString(); - final List orderedSpecs = Lists.newArrayList(specs); + final List orderedSpecs = Arrays.asList(specs); orderedSpecs.sort((s1, s2) -> Comparators.intervalsByStartThenEnd().compare(s1.totalInterval, s2.totalInterval)); Collections.reverse(orderedSpecs); From 20421ae63ea3525b32465c9e52b304b70ae382ca Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Sun, 26 Aug 2018 10:04:58 -0700 Subject: [PATCH 2/4] Fix one more location. --- server/src/test/java/io/druid/timeline/DataSegmentTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/src/test/java/io/druid/timeline/DataSegmentTest.java b/server/src/test/java/io/druid/timeline/DataSegmentTest.java index c9070e7f80d3..7049f5f91709 100644 --- a/server/src/test/java/io/druid/timeline/DataSegmentTest.java +++ b/server/src/test/java/io/druid/timeline/DataSegmentTest.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; import com.google.common.collect.Sets; import io.druid.jackson.DefaultObjectMapper; import io.druid.java.util.common.DateTimes; @@ -192,7 +191,7 @@ public void testBucketMonthComparator() makeDataSegment("test2", "2011-02-02/2011-02-03", "a"), }; - List shuffled = Lists.newArrayList(sortedOrder); + List shuffled = Arrays.asList(sortedOrder); Collections.shuffle(shuffled); Set theSet = Sets.newTreeSet(DataSegment.bucketMonthComparator()); From d61b1b1519f1ee0df66350ad872724bb45d66cbb Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Sun, 26 Aug 2018 12:19:34 -0700 Subject: [PATCH 3/4] Fix tests. --- .../io/druid/client/selector/TierSelectorStrategyTest.java | 3 ++- server/src/test/java/io/druid/timeline/DataSegmentTest.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java b/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java index f8dc52cf49ba..ffe6d473aa0f 100644 --- a/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java +++ b/server/src/test/java/io/druid/client/selector/TierSelectorStrategyTest.java @@ -33,6 +33,7 @@ import org.junit.Assert; import org.junit.Test; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -131,7 +132,7 @@ private void testTierSelectorStrategy( tierSelectorStrategy ); - List servers = Arrays.asList(expectedSelection); + List servers = new ArrayList<>(Arrays.asList(expectedSelection)); List expectedCandidates = Lists.newArrayList(); for (QueryableDruidServer server : servers) { diff --git a/server/src/test/java/io/druid/timeline/DataSegmentTest.java b/server/src/test/java/io/druid/timeline/DataSegmentTest.java index 7049f5f91709..9f31bda9a6b7 100644 --- a/server/src/test/java/io/druid/timeline/DataSegmentTest.java +++ b/server/src/test/java/io/druid/timeline/DataSegmentTest.java @@ -36,6 +36,7 @@ import org.junit.Before; import org.junit.Test; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -191,7 +192,7 @@ public void testBucketMonthComparator() makeDataSegment("test2", "2011-02-02/2011-02-03", "a"), }; - List shuffled = Arrays.asList(sortedOrder); + List shuffled = new ArrayList<>(Arrays.asList(sortedOrder)); Collections.shuffle(shuffled); Set theSet = Sets.newTreeSet(DataSegment.bucketMonthComparator()); From b06c76d93310e876b2b2f6799513f230c1ae4a44 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Sun, 26 Aug 2018 14:30:55 -0700 Subject: [PATCH 4/4] Another fix. --- api/src/test/java/io/druid/timeline/DataSegmentTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/src/test/java/io/druid/timeline/DataSegmentTest.java b/api/src/test/java/io/druid/timeline/DataSegmentTest.java index aa34471a53d5..43b95598c258 100644 --- a/api/src/test/java/io/druid/timeline/DataSegmentTest.java +++ b/api/src/test/java/io/druid/timeline/DataSegmentTest.java @@ -39,6 +39,7 @@ import org.junit.Before; import org.junit.Test; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -237,7 +238,7 @@ public void testBucketMonthComparator() makeDataSegment("test2", "2011-02-02/2011-02-03", "a"), }; - List shuffled = Arrays.asList(sortedOrder); + List shuffled = new ArrayList<>(Arrays.asList(sortedOrder)); Collections.shuffle(shuffled); Set theSet = Sets.newTreeSet(DataSegment.bucketMonthComparator());