diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/FlattenJSONBenchmarkUtilTest.java b/benchmarks/src/test/java/org/apache/druid/benchmark/FlattenJSONBenchmarkUtilTest.java index a81e07cfde1..f4b79108f40 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/FlattenJSONBenchmarkUtilTest.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/FlattenJSONBenchmarkUtilTest.java @@ -20,6 +20,7 @@ package org.apache.druid.benchmark; import org.apache.druid.java.util.common.parsers.Parser; +import org.apache.druid.utils.JvmUtils; import org.junit.Assert; import org.junit.Test; @@ -64,15 +65,31 @@ public class FlattenJSONBenchmarkUtilTest Assert.assertEquals("129047958", event.get("e2.ad1[0]").toString()); Assert.assertEquals("1658972185", event.get("e2.ad1[1]").toString()); Assert.assertEquals("-997010830", event.get("e2.ad1[2]").toString()); - Assert.assertEquals("-5.8772014847368817E18", event.get("e3.m1").toString()); + + // Java 19 changes some floating point string representation + // https://bugs.openjdk.org/browse/JDK-8291475 + if (JvmUtils.majorVersion() < 19) { + Assert.assertEquals("-5.8772014847368817E18", event.get("e3.m1").toString()); + } else { + Assert.assertEquals("-5.877201484736882E18", event.get("e3.m1").toString()); + } + Assert.assertEquals("0.4375433369079904", event.get("e3.m2").toString()); Assert.assertEquals("0.8510482953607659", event.get("e3.m3").toString()); Assert.assertEquals("-2.3832626488759337E18", event.get("e3.m4").toString()); - Assert.assertEquals("7.9789762132607068E18", event.get("e3.am1[0]").toString()); - Assert.assertEquals("-7.8634787235005573E18", event.get("e3.am1[1]").toString()); - Assert.assertEquals("8.7372945568982446E18", event.get("e3.am1[2]").toString()); - Assert.assertEquals("3.1928124802414899E18", event.get("e3.am1[3]").toString()); - Assert.assertEquals("-3.9806631713718011E18", event.get("e4.e4.m4").toString()); + if (JvmUtils.majorVersion() < 19) { + Assert.assertEquals("7.9789762132607068E18", event.get("e3.am1[0]").toString()); + Assert.assertEquals("-7.8634787235005573E18", event.get("e3.am1[1]").toString()); + Assert.assertEquals("8.7372945568982446E18", event.get("e3.am1[2]").toString()); + Assert.assertEquals("3.1928124802414899E18", event.get("e3.am1[3]").toString()); + Assert.assertEquals("-3.9806631713718011E18", event.get("e4.e4.m4").toString()); + } else { + Assert.assertEquals("7.978976213260707E18", event.get("e3.am1[0]").toString()); + Assert.assertEquals("-7.863478723500557E18", event.get("e3.am1[1]").toString()); + Assert.assertEquals("8.737294556898245E18", event.get("e3.am1[2]").toString()); + Assert.assertEquals("3.19281248024149E18", event.get("e3.am1[3]").toString()); + Assert.assertEquals("-3.980663171371801E18", event.get("e4.e4.m4").toString()); + } Assert.assertEquals("-1915243040", event.get("ae1[0].d1").toString()); Assert.assertEquals("-2020543641", event.get("ae1[1].d1").toString()); Assert.assertEquals("1414285347", event.get("ae1[2].e1.d2").toString()); diff --git a/extensions-contrib/kubernetes-overlord-extensions/pom.xml b/extensions-contrib/kubernetes-overlord-extensions/pom.xml index eacd69ed629..f231521dfa7 100644 --- a/extensions-contrib/kubernetes-overlord-extensions/pom.xml +++ b/extensions-contrib/kubernetes-overlord-extensions/pom.xml @@ -214,7 +214,6 @@ org.mockito mockito-core - ${mockito.version} test diff --git a/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/MaterializedViewQueryQueryToolChestTest.java b/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/MaterializedViewQueryQueryToolChestTest.java index 3b230d706bf..36c43ef475d 100644 --- a/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/MaterializedViewQueryQueryToolChestTest.java +++ b/extensions-contrib/materialized-view-selection/src/test/java/org/apache/druid/query/materializedview/MaterializedViewQueryQueryToolChestTest.java @@ -45,6 +45,7 @@ import org.apache.druid.query.groupby.ResultRow; import org.apache.druid.query.timeseries.TimeseriesQuery; import org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest; import org.apache.druid.query.timeseries.TimeseriesResultValue; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.junit.Assert; import org.junit.Test; @@ -54,7 +55,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -public class MaterializedViewQueryQueryToolChestTest +public class MaterializedViewQueryQueryToolChestTest extends InitializedNullHandlingTest { static { NullHandling.initializeForTests(); diff --git a/extensions-core/azure-extensions/pom.xml b/extensions-core/azure-extensions/pom.xml index 2e91c4bd930..362c9f43b6a 100644 --- a/extensions-core/azure-extensions/pom.xml +++ b/extensions-core/azure-extensions/pom.xml @@ -154,13 +154,14 @@ org.mockito - mockito-core + mockito-${mockito.inline.artifact} ${mockito.version} test + org.mockito - mockito-inline + mockito-core test diff --git a/extensions-core/druid-pac4j/pom.xml b/extensions-core/druid-pac4j/pom.xml index 65bb678596d..a8cb8b3a08b 100644 --- a/extensions-core/druid-pac4j/pom.xml +++ b/extensions-core/druid-pac4j/pom.xml @@ -64,6 +64,13 @@ org.pac4j pac4j-oidc ${pac4j.version} + + + + org.mockito + mockito-core + + diff --git a/extensions-core/lookups-cached-global/pom.xml b/extensions-core/lookups-cached-global/pom.xml index 092e8f87d96..3aca23fc9ec 100644 --- a/extensions-core/lookups-cached-global/pom.xml +++ b/extensions-core/lookups-cached-global/pom.xml @@ -140,14 +140,16 @@ easymock test + org.mockito - mockito-inline + mockito-core + ${mockito.version} test org.mockito - mockito-core + mockito-${mockito.inline.artifact} test diff --git a/extensions-core/protobuf-extensions/pom.xml b/extensions-core/protobuf-extensions/pom.xml index 1f267b51754..cc39430b96f 100644 --- a/extensions-core/protobuf-extensions/pom.xml +++ b/extensions-core/protobuf-extensions/pom.xml @@ -187,7 +187,6 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 true diff --git a/indexing-hadoop/pom.xml b/indexing-hadoop/pom.xml index 95a7f0c0528..9481b78cc51 100644 --- a/indexing-hadoop/pom.xml +++ b/indexing-hadoop/pom.xml @@ -140,17 +140,20 @@ hamcrest-core test - - org.mockito - mockito-inline - test - + org.mockito mockito-core + ${mockito.version} + test + + + org.mockito + mockito-${mockito.inline.artifact} test + hadoop3 @@ -197,6 +200,12 @@ shade + + false ${project.build.directory}/${project.artifactId}-${project.version}-selfcontained.jar diff --git a/indexing-service/pom.xml b/indexing-service/pom.xml index 067abfdb0fb..7aacd1b5f43 100644 --- a/indexing-service/pom.xml +++ b/indexing-service/pom.xml @@ -265,7 +265,6 @@ org.mockito mockito-core - ${mockito.version} test diff --git a/licenses.yaml b/licenses.yaml index f213152a4ee..3b42871419a 100644 --- a/licenses.yaml +++ b/licenses.yaml @@ -857,27 +857,6 @@ libraries: --- -name: net.bytebuddy byte-buddy -license_category: binary -module: extensions/druid-pac4j -license_name: Apache License version 2.0 -version: 1.12.7 -libraries: - - net.bytebuddy: byte-buddy - - net.bytebuddy: byte-buddy-agent - ---- - -name: org.mockito mockito-core -license_category: binary -module: extensions/druid-pac4j -license_name: MIT License -version: 4.3.1 -libraries: - - org.mockito: mockito-core - ---- - name: javax.activation activation license_category: binary module: extensions/druid-pac4j diff --git a/pom.xml b/pom.xml index 8fb99191ad0..fcd4cca3003 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,11 @@ 5.13.0 5.13.0 3.3.6 - 4.3.1 + 5.5.0 + + core 1.12.497 2.8.0 0.8.7 @@ -125,6 +129,7 @@ v1-rev20230606-2.0.0 v1-rev20230301-2.0.0 + maven.org Maven Central Repository https://repo1.maven.org/maven2/ @@ -1039,7 +1044,7 @@ org.easymock easymock - 4.3 + 5.2.0 test @@ -1049,11 +1054,11 @@ test - org.mockito - mockito-bom - ${mockito.version} - import - pom + org.mockito + mockito-bom + ${mockito.version} + import + pom com.github.docker-java @@ -1103,6 +1108,13 @@ assertj-core 3.24.2 test + + + + net.bytebuddy + byte-buddy + + com.ircclouds.irc @@ -1240,7 +1252,7 @@ nl.jqno.equalsverifier equalsverifier - 3.10.1 + 3.15.1 test @@ -1480,7 +1492,7 @@ org.codehaus.mojo animal-sniffer-maven-plugin - 1.17 + 1.23 check-java-api @@ -1663,6 +1675,7 @@ @{jacocoArgLine} ${jdk.strong.encapsulation.argLine} + ${jdk.security.manager.allow.argLine} -Xmx1500m -XX:MaxDirectMemorySize=2500m -XX:+ExitOnOutOfMemoryError @@ -1730,10 +1743,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 - - false - + 3.5.0 org.apache.maven.plugins @@ -1763,7 +1773,7 @@ org.codehaus.mojo exec-maven-plugin - 1.6.0 + 3.1.0 org.codehaus.mojo @@ -1806,6 +1816,31 @@ + + + pre-java-11 + + (,11) + + + + 4.11.0 + inline + + + + java-12+ + + [12,) + + + + + + -Djava.security.manager=allow + + + java-9+ diff --git a/processing/pom.xml b/processing/pom.xml index 492980cc592..3401a248f50 100644 --- a/processing/pom.xml +++ b/processing/pom.xml @@ -364,9 +364,16 @@ caliper test + org.mockito mockito-core + ${mockito.version} + test + + + org.mockito + mockito-${mockito.inline.artifact} test @@ -426,11 +433,6 @@ jetty-util test - - org.mockito - mockito-inline - test - mysql mysql-connector-java diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantBufferAggregatorTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantBufferAggregatorTest.java index 0608fca85b7..845d2c825b8 100644 --- a/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantBufferAggregatorTest.java +++ b/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantBufferAggregatorTest.java @@ -20,7 +20,6 @@ package org.apache.druid.query.aggregation.constant; import org.apache.commons.lang.math.RandomUtils; -import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -38,9 +37,8 @@ public class LongConstantBufferAggregatorTest { randomVal = RandomUtils.nextLong(); aggregator = new LongConstantBufferAggregator(randomVal); - byteBuffer = EasyMock.mock(ByteBuffer.class); - EasyMock.replay(byteBuffer); - EasyMock.verifyUnexpectedCalls(byteBuffer); + // mark byteBuffer null to verify no methods ever get called on it. + byteBuffer = null; } @Test diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantVectorAggregatorTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantVectorAggregatorTest.java index f62dd0369c6..6159ea6a28b 100644 --- a/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantVectorAggregatorTest.java +++ b/processing/src/test/java/org/apache/druid/query/aggregation/constant/LongConstantVectorAggregatorTest.java @@ -20,7 +20,6 @@ package org.apache.druid.query.aggregation.constant; import org.apache.commons.lang.math.RandomUtils; -import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -38,9 +37,8 @@ public class LongConstantVectorAggregatorTest { randomVal = RandomUtils.nextLong(); aggregator = new LongConstantVectorAggregator(randomVal); - byteBuffer = EasyMock.mock(ByteBuffer.class); - EasyMock.replay(byteBuffer); - EasyMock.verifyUnexpectedCalls(byteBuffer); + // mark byteBuffer null to verify no methods ever get called on it. + byteBuffer = null; } @Test diff --git a/services/pom.xml b/services/pom.xml index 42dadd57aa2..3556c8c849e 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -282,6 +282,12 @@ shade + + false ${project.build.directory}/${project.artifactId}-${project.version}-selfcontained.jar diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/rule/DruidLogicalValuesRuleTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/rule/DruidLogicalValuesRuleTest.java index 73054f506a2..ee2e4273f83 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/rule/DruidLogicalValuesRuleTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/rule/DruidLogicalValuesRuleTest.java @@ -20,7 +20,6 @@ package org.apache.druid.sql.calcite.rule; import com.google.common.collect.ImmutableList; -import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeFactory; import org.apache.calcite.rex.RexBuilder; import org.apache.calcite.rex.RexLiteral; @@ -33,6 +32,7 @@ import org.apache.druid.error.DruidExceptionMatcher; import org.apache.druid.java.util.common.DateTimes; import org.apache.druid.sql.calcite.planner.DruidTypeSystem; import org.apache.druid.sql.calcite.planner.PlannerContext; +import org.apache.druid.testing.InitializedNullHandlingTest; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.junit.Assert; @@ -44,10 +44,8 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import org.mockito.ArgumentMatchers; import org.mockito.Mockito; -import java.lang.reflect.Field; import java.math.BigDecimal; @RunWith(Enclosed.class) @@ -56,7 +54,7 @@ public class DruidLogicalValuesRuleTest private static final PlannerContext DEFAULT_CONTEXT = Mockito.mock(PlannerContext.class); @RunWith(Parameterized.class) - public static class GetValueFromLiteralSimpleTypesTest + public static class GetValueFromLiteralSimpleTypesTest extends InitializedNullHandlingTest { @Parameters(name = "{1}, {2}") public static Iterable constructorFeeder() @@ -88,7 +86,7 @@ public class DruidLogicalValuesRuleTest @Test public void testGetValueFromLiteral() { - final RexLiteral literal = makeLiteral(val, sqlTypeName, javaType); + final RexLiteral literal = Mockito.spy(makeLiteral(val, sqlTypeName, javaType)); final Object fromLiteral = DruidLogicalValuesRule.getValueFromLiteral(literal, DEFAULT_CONTEXT); Assert.assertSame(javaType, fromLiteral.getClass()); Assert.assertEquals(val, fromLiteral); @@ -97,20 +95,11 @@ public class DruidLogicalValuesRuleTest private static RexLiteral makeLiteral(Comparable val, SqlTypeName typeName, Class javaType) { - RelDataType dataType = Mockito.mock(RelDataType.class); - Mockito.when(dataType.getSqlTypeName()).thenReturn(typeName); - RexLiteral literal = Mockito.mock(RexLiteral.class); - try { - Field field = literal.getClass().getSuperclass().getDeclaredField("value"); - field.setAccessible(true); - field.set(literal, val); - } - catch (Exception e) { - Assert.fail("Unable to mock the literal for test.\nException: " + e); - } - Mockito.when(literal.getType()).thenReturn(dataType); - Mockito.when(literal.getValueAs(ArgumentMatchers.any())).thenReturn(javaType.cast(val)); - return literal; + return (RexLiteral) new RexBuilder(DruidTypeSystem.TYPE_FACTORY).makeLiteral( + typeName == SqlTypeName.DECIMAL && val != null ? new BigDecimal(String.valueOf(val)) : val, + DruidTypeSystem.TYPE_FACTORY.createSqlType(typeName), + false + ); } }