diff --git a/ambari-infra-manager-it/pom.xml b/ambari-infra-manager-it/pom.xml index b4a2c8f7..634a71b6 100644 --- a/ambari-infra-manager-it/pom.xml +++ b/ambari-infra-manager-it/pom.xml @@ -33,7 +33,7 @@ 4.0.5 - 3.0.0-M1 + 3.2.5 localhost NONE 2.7.5 diff --git a/ambari-infra-manager/pom.xml b/ambari-infra-manager/pom.xml index 3f20545f..8f338c17 100644 --- a/ambari-infra-manager/pom.xml +++ b/ambari-infra-manager/pom.xml @@ -498,7 +498,7 @@ cglib cglib - 3.2.4 + 3.3.0 io.swagger @@ -574,7 +574,7 @@ guava com.google.guava - 28.0-jre + 32.1.3-jre org.apache.commons diff --git a/ambari-infra-manager/src/test/java/org/apache/ambari/infra/JDK17CompatibilityTest.java b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/JDK17CompatibilityTest.java new file mode 100644 index 00000000..2157946b --- /dev/null +++ b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/JDK17CompatibilityTest.java @@ -0,0 +1,187 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.infra; + +import org.junit.Test; + +import javax.xml.bind.annotation.XmlRootElement; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import static org.junit.Assert.*; + +/** + * Tests to validate JDK 17 compatibility for the ambari-infra-manager module. + * Covers: strong encapsulation (--add-opens), JAXB availability, CGLib bytecode generation, + * Guava 32 availability, and reflection access. + * + * @see AMBARI-26142 + */ +public class JDK17CompatibilityTest { + + /** + * Verify the runtime JDK version is 17+. + */ + @Test + public void testJDKVersionIs17OrHigher() { + String specVersion = System.getProperty("java.specification.version"); + int version = Integer.parseInt(specVersion); + assertTrue("Expected JDK 17+, but running on JDK " + version, version >= 17); + } + + /** + * JAXB was removed from the JDK in Java 11. + * Verify that javax.xml.bind annotations are available via the explicit jaxb-api dependency. + */ + @Test + public void testJaxbAnnotationsAvailable() { + assertNotNull("XmlRootElement annotation class should be loadable", + XmlRootElement.class); + } + + /** + * Verify that --add-opens flags are present in JVM args (required for reflection-heavy frameworks). + */ + @Test + public void testAddOpensPresent() { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + boolean hasAddOpens = runtimeMxBean.getInputArguments().stream() + .anyMatch(arg -> arg.startsWith("--add-opens")); + assertTrue("Expected --add-opens JVM args for JDK 17 strong encapsulation", hasAddOpens); + } + + /** + * JDK 17 enforces strong encapsulation. Verify that reflection on java.lang.String + * works when --add-opens java.base/java.lang=ALL-UNNAMED is set. + */ + @Test + public void testReflectionAccessToJavaLang() throws Exception { + Field valueField = String.class.getDeclaredField("value"); + valueField.setAccessible(true); + Object value = valueField.get("test"); + assertNotNull("Should be able to reflectively access String.value with --add-opens", value); + } + + /** + * Verify reflection on java.util classes works (required by Spring/Hadoop). + */ + @Test + public void testReflectionAccessToJavaUtil() throws Exception { + Method sizeMethod = java.util.HashMap.class.getDeclaredMethod("size"); + sizeMethod.setAccessible(true); + java.util.HashMap map = new java.util.HashMap<>(); + Object result = sizeMethod.invoke(map); + assertEquals("HashMap.size() via reflection should return 0", 0, result); + } + + /** + * Verify reflection on java.io classes works (--add-opens java.base/java.io). + */ + @Test + public void testJavaIOReflection() throws Exception { + Field pathField = java.io.File.class.getDeclaredField("path"); + pathField.setAccessible(true); + java.io.File testFile = new java.io.File("/tmp/test"); + Object pathValue = pathField.get(testFile); + assertEquals("/tmp/test", pathValue); + } + + /** + * Verify that Guava 32.x classes are available (upgraded from 28.x for JDK 17 compat). + */ + @Test + public void testGuava32Available() { + com.google.common.collect.ImmutableList list = + com.google.common.collect.ImmutableList.of("a", "b", "c"); + assertNotNull("Guava ImmutableList should be available", list); + assertEquals(3, list.size()); + } + + /** + * Verify that CGLib 3.3.0 can create enhanced classes under JDK 17. + * CGLib needs access to internal class file format which changed in newer JDKs. + */ + @Test + public void testCGLibCompatibility() { + net.sf.cglib.proxy.Enhancer enhancer = new net.sf.cglib.proxy.Enhancer(); + enhancer.setSuperclass(Object.class); + enhancer.setCallback(new net.sf.cglib.proxy.NoOp() {}); + Object proxy = enhancer.create(); + assertNotNull("CGLib should be able to create enhanced proxy under JDK 17", proxy); + } + + /** + * Verify java.net reflection works (needed by Hadoop networking code). + */ + @Test + public void testJavaNetReflection() throws Exception { + Class inetAddressClass = Class.forName("java.net.InetAddress"); + assertNotNull(inetAddressClass); + Method[] methods = inetAddressClass.getDeclaredMethods(); + assertTrue("InetAddress should have methods", methods.length > 0); + } + + /** + * Verify java.util.concurrent reflection works (needed by Solr internals). + */ + @Test + public void testConcurrentReflection() throws Exception { + java.util.concurrent.ConcurrentHashMap map = + new java.util.concurrent.ConcurrentHashMap<>(); + map.put("key", "value"); + + Field tableField = java.util.concurrent.ConcurrentHashMap.class.getDeclaredField("table"); + tableField.setAccessible(true); + Object table = tableField.get(map); + assertNotNull("Should access ConcurrentHashMap internals with --add-opens", table); + } + + /** + * Verify that javax.annotation-api is available (needed for JDK 9+ where javax.annotation was removed). + */ + @Test + public void testJavaxAnnotationAvailable() throws Exception { + Class clazz = Class.forName("javax.annotation.PostConstruct"); + assertNotNull("javax.annotation.PostConstruct should be available", clazz); + } + + /** + * Verify that Spring's reflection utilities work under JDK 17. + */ + @Test + public void testSpringReflectionWorks() throws Exception { + Class springReflectionUtils = Class.forName("org.springframework.util.ReflectionUtils"); + assertNotNull("Spring ReflectionUtils should be loadable", springReflectionUtils); + Method findMethod = springReflectionUtils.getMethod("findMethod", Class.class, String.class, Class[].class); + assertNotNull("findMethod should be accessible", findMethod); + } + + /** + * Verify JMX/management access works (--add-opens java.management). + */ + @Test + public void testJavaManagementAccess() { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + assertNotNull(runtimeMxBean.getUptime()); + assertTrue("JVM uptime should be > 0", runtimeMxBean.getUptime() > 0); + assertNotNull(runtimeMxBean.getVmName()); + } +} diff --git a/ambari-infra-manager/src/test/java/org/apache/ambari/infra/conf/security/EnvironmentalSecretTest.java b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/conf/security/EnvironmentalSecretTest.java new file mode 100644 index 00000000..ce970a04 --- /dev/null +++ b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/conf/security/EnvironmentalSecretTest.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.infra.conf.security; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.util.Optional; + +import org.junit.Test; + +public class EnvironmentalSecretTest { + + @Test + public void testGetReturnsEmptyWhenEnvVarNotSet() { + EnvironmentalSecret secret = new EnvironmentalSecret("AMBARI_INFRA_NONEXISTENT_VAR_12345"); + Optional result = secret.get(); + assertThat(result.isPresent(), is(false)); + } + + @Test + public void testGetReturnsValueWhenEnvVarExists() { + // PATH is always set on all systems + EnvironmentalSecret secret = new EnvironmentalSecret("PATH"); + Optional result = secret.get(); + assertThat(result.isPresent(), is(true)); + assertTrue(result.get().length() > 0); + } + + @Test + public void testGetReturnsValueForHomeEnvVar() { + // HOME is always set on Unix systems + EnvironmentalSecret secret = new EnvironmentalSecret("HOME"); + Optional result = secret.get(); + assertThat(result.isPresent(), is(true)); + assertTrue(result.get().length() > 0); + } + + @Test + public void testGetReturnsEmptyForEmptyVarName() { + EnvironmentalSecret secret = new EnvironmentalSecret(""); + Optional result = secret.get(); + assertThat(result.isPresent(), is(false)); + } +} diff --git a/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/SchedulingPropertiesTest.java b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/SchedulingPropertiesTest.java new file mode 100644 index 00000000..00461601 --- /dev/null +++ b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/SchedulingPropertiesTest.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.infra.job; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.nullValue; +import static org.junit.Assert.assertThat; + +import org.junit.Test; + +public class SchedulingPropertiesTest { + + @Test + public void testDefaultValues() { + SchedulingProperties properties = new SchedulingProperties(); + assertThat(properties.isEnabled(), is(false)); + assertThat(properties.getCron(), is(nullValue())); + } + + @Test + public void testSetEnabled() { + SchedulingProperties properties = new SchedulingProperties(); + properties.setEnabled(true); + assertThat(properties.isEnabled(), is(true)); + } + + @Test + public void testSetCron() { + SchedulingProperties properties = new SchedulingProperties(); + properties.setCron("0 0 * * * ?"); + assertThat(properties.getCron(), is("0 0 * * * ?")); + } + + @Test + public void testSetAndGetAllProperties() { + SchedulingProperties properties = new SchedulingProperties(); + properties.setEnabled(true); + properties.setCron("*/5 * * * * ?"); + + assertThat(properties.isEnabled(), is(true)); + assertThat(properties.getCron(), is("*/5 * * * * ?")); + } + + @Test + public void testDisableAfterEnable() { + SchedulingProperties properties = new SchedulingProperties(); + properties.setEnabled(true); + assertThat(properties.isEnabled(), is(true)); + + properties.setEnabled(false); + assertThat(properties.isEnabled(), is(false)); + } +} diff --git a/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/CompositeFileActionTest.java b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/CompositeFileActionTest.java new file mode 100644 index 00000000..1121797a --- /dev/null +++ b/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/CompositeFileActionTest.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.infra.job.archive; + +import static org.easymock.EasyMock.expect; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + +import java.io.File; + +import org.easymock.EasyMockRunner; +import org.easymock.EasyMockSupport; +import org.easymock.Mock; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(EasyMockRunner.class) +public class CompositeFileActionTest extends EasyMockSupport { + + @Mock + private FileAction action1; + @Mock + private FileAction action2; + @Mock + private FileAction action3; + + @After + public void tearDown() { + verifyAll(); + } + + @Test + public void testPerformWithNoActions() { + replayAll(); + CompositeFileAction compositeAction = new CompositeFileAction(); + File inputFile = new File("/tmp/input.json"); + File result = compositeAction.perform(inputFile); + assertThat(result, is(inputFile)); + } + + @Test + public void testPerformWithSingleAction() { + File inputFile = new File("/tmp/input.json"); + File outputFile = new File("/tmp/output.json.gz"); + + expect(action1.perform(inputFile)).andReturn(outputFile); + replayAll(); + + CompositeFileAction compositeAction = new CompositeFileAction(action1); + File result = compositeAction.perform(inputFile); + assertThat(result, is(outputFile)); + } + + @Test + public void testPerformChainsMultipleActions() { + File inputFile = new File("/tmp/input.json"); + File intermediateFile = new File("/tmp/input.json.gz"); + File finalFile = new File("/tmp/uploaded.json.gz"); + + expect(action1.perform(inputFile)).andReturn(intermediateFile); + expect(action2.perform(intermediateFile)).andReturn(finalFile); + replayAll(); + + CompositeFileAction compositeAction = new CompositeFileAction(action1, action2); + File result = compositeAction.perform(inputFile); + assertThat(result, is(finalFile)); + } + + @Test + public void testAddActionAppendToChain() { + File inputFile = new File("/tmp/input.json"); + File file2 = new File("/tmp/step2.json"); + File file3 = new File("/tmp/step3.json"); + + expect(action1.perform(inputFile)).andReturn(file2); + expect(action2.perform(file2)).andReturn(file3); + replayAll(); + + CompositeFileAction compositeAction = new CompositeFileAction(action1); + compositeAction.add(action2); + File result = compositeAction.perform(inputFile); + assertThat(result, is(file3)); + } + + @Test + public void testPerformThreeActionsInSequence() { + File inputFile = new File("/tmp/raw.json"); + File compressed = new File("/tmp/raw.json.bz2"); + File uploaded = new File("/hdfs/raw.json.bz2"); + File cleaned = new File("/tmp/done"); + + expect(action1.perform(inputFile)).andReturn(compressed); + expect(action2.perform(compressed)).andReturn(uploaded); + expect(action3.perform(uploaded)).andReturn(cleaned); + replayAll(); + + CompositeFileAction compositeAction = new CompositeFileAction(action1, action2, action3); + File result = compositeAction.perform(inputFile); + assertThat(result, is(cleaned)); + } +} diff --git a/ambari-infra-solr-plugin/src/test/java/org/apache/ambari/infra/solr/metrics/reporters/MetricsUtilsTest.java b/ambari-infra-solr-plugin/src/test/java/org/apache/ambari/infra/solr/metrics/reporters/MetricsUtilsTest.java new file mode 100644 index 00000000..010c7be9 --- /dev/null +++ b/ambari-infra-solr-plugin/src/test/java/org/apache/ambari/infra/solr/metrics/reporters/MetricsUtilsTest.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ambari.infra.solr.metrics.reporters; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.TreeMap; + +import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric; +import org.junit.Test; + +public class MetricsUtilsTest { + + @Test + public void testGetHostNameReturnsNonNull() { + String hostName = MetricsUtils.getHostName(); + assertNotNull("getHostName() should not return null", hostName); + assertTrue("hostName should not be empty", hostName.length() > 0); + } + + @Test + public void testToTimelineMetricCreatesValidMetric() { + long currentMillis = System.currentTimeMillis(); + TimelineMetric metric = MetricsUtils.toTimelineMetric("infra.solr.requests", 100.0, currentMillis); + + assertNotNull(metric); + assertEquals("infra.solr.requests", metric.getMetricName()); + assertEquals("ambari-infra-solr", metric.getAppId()); + assertEquals(currentMillis, metric.getStartTime()); + assertEquals("Long", metric.getType()); + } + + @Test + public void testToTimelineMetricHasCorrectValues() { + long currentMillis = 1700000000000L; + double value = 42.5; + TimelineMetric metric = MetricsUtils.toTimelineMetric("infra.solr.docs", value, currentMillis); + + TreeMap metricValues = metric.getMetricValues(); + assertNotNull(metricValues); + assertEquals(1, metricValues.size()); + assertEquals(Double.valueOf(value), metricValues.get(currentMillis)); + } + + @Test + public void testToTimelineMetricWithZeroValue() { + long currentMillis = System.currentTimeMillis(); + TimelineMetric metric = MetricsUtils.toTimelineMetric("infra.solr.errors", 0.0, currentMillis); + + assertNotNull(metric); + assertEquals("infra.solr.errors", metric.getMetricName()); + TreeMap metricValues = metric.getMetricValues(); + assertEquals(Double.valueOf(0.0), metricValues.get(currentMillis)); + } + + @Test + public void testToTimelineMetricSetsHostName() { + long currentMillis = System.currentTimeMillis(); + TimelineMetric metric = MetricsUtils.toTimelineMetric("infra.solr.test", 1.0, currentMillis); + + assertNotNull(metric.getHostName()); + assertEquals(MetricsUtils.getHostName(), metric.getHostName()); + } + + @Test + public void testNamePrefixConstant() { + assertEquals("infra.", MetricsUtils.NAME_PREFIX); + } +} diff --git a/ambari-infra-solr-plugin/src/test/java/org/apache/solr/security/JDK17SolrPluginCompatibilityTest.java b/ambari-infra-solr-plugin/src/test/java/org/apache/solr/security/JDK17SolrPluginCompatibilityTest.java new file mode 100644 index 00000000..933de075 --- /dev/null +++ b/ambari-infra-solr-plugin/src/test/java/org/apache/solr/security/JDK17SolrPluginCompatibilityTest.java @@ -0,0 +1,122 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.security; + +import org.junit.Test; + +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.lang.reflect.Field; + +import static org.junit.Assert.*; + +/** + * Tests to validate JDK 17 compatibility for the ambari-infra-solr-plugin module. + * Solr 8.11.x uses extensive reflection and needs --add-opens for JDK 17. + * + * @see AMBARI-26142 + */ +public class JDK17SolrPluginCompatibilityTest { + + /** + * Verify the runtime JDK version is 17+. + */ + @Test + public void testJDKVersionIs17OrHigher() { + String specVersion = System.getProperty("java.specification.version"); + int version = Integer.parseInt(specVersion); + assertTrue("Expected JDK 17+, but running on JDK " + version, version >= 17); + } + + /** + * Verify that --add-opens flags are present (required by Solr test framework). + */ + @Test + public void testAddOpensPresent() { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + boolean hasAddOpens = runtimeMxBean.getInputArguments().stream() + .anyMatch(arg -> arg.startsWith("--add-opens")); + assertTrue("Expected --add-opens JVM args for JDK 17 strong encapsulation", hasAddOpens); + } + + /** + * Verify reflection on java.lang works (Solr/Lucene internals use this). + */ + @Test + public void testJavaLangReflection() throws Exception { + Field valueField = String.class.getDeclaredField("value"); + valueField.setAccessible(true); + Object value = valueField.get("solr-test"); + assertNotNull("Should access String.value with --add-opens", value); + } + + /** + * Verify NIO reflection works (Lucene uses sun.nio.ch for MMap). + */ + @Test + public void testNIOReflection() throws Exception { + java.nio.ByteBuffer buffer = java.nio.ByteBuffer.allocateDirect(1024); + assertNotNull("ByteBuffer.allocateDirect should work on JDK 17", buffer); + assertEquals(1024, buffer.capacity()); + } + + /** + * Verify java.util.concurrent reflection works (Solr executor services). + */ + @Test + public void testConcurrentReflection() throws Exception { + java.util.concurrent.ConcurrentHashMap map = + new java.util.concurrent.ConcurrentHashMap<>(); + map.put("collection", "audit_logs"); + + Field tableField = java.util.concurrent.ConcurrentHashMap.class.getDeclaredField("table"); + tableField.setAccessible(true); + Object table = tableField.get(map); + assertNotNull("ConcurrentHashMap internal access should work", table); + } + + /** + * Verify that the InfraRuleBasedAuthorizationPlugin can be instantiated under JDK 17. + */ + @Test + public void testInfraAuthorizationPluginInstantiation() { + InfraRuleBasedAuthorizationPlugin plugin = new InfraRuleBasedAuthorizationPlugin(); + assertNotNull("InfraRuleBasedAuthorizationPlugin should instantiate under JDK 17", plugin); + } + + /** + * Verify that the InfraKerberosHostValidator can be instantiated under JDK 17. + */ + @Test + public void testInfraKerberosHostValidatorInstantiation() { + InfraKerberosHostValidator validator = new InfraKerberosHostValidator(); + assertNotNull("InfraKerberosHostValidator should instantiate under JDK 17", validator); + } + + /** + * Verify the Solr security model classes load under JDK 17. + */ + @Test + public void testSolrSecurityClassesLoad() throws Exception { + Class authPlugin = Class.forName("org.apache.solr.security.InfraRuleBasedAuthorizationPlugin"); + assertNotNull(authPlugin); + Class hostValidator = Class.forName("org.apache.solr.security.InfraKerberosHostValidator"); + assertNotNull(hostValidator); + } +} diff --git a/pom.xml b/pom.xml index 9dfc3a41..d57f2c98 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ 3.0.0.0-SNAPSHOT - 1.8 + 17 8.11.2 UTF-8 python >= 2.6 @@ -33,7 +33,7 @@ amd64 ${deb.python.ver} 3.3.4 - -Xmx1024m -Xms512m + -Xmx1024m -Xms512m --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/java.lang.management=ALL-UNNAMED 3.5.9 2.7.0.0.0 false @@ -163,7 +163,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 2.20 + 3.2.5 io.fabric8 @@ -213,14 +213,15 @@ org.apache.maven.plugins maven-surefire-plugin - 2.20 + 3.2.5 ${skipSurefireTests} + ${surefire.argLine} maven-compiler-plugin - 3.3 + 3.5 ${jdk.version} ${jdk.version} @@ -390,6 +391,11 @@ + + org.aspectj + aspectjweaver + 1.9.21 + org.hamcrest hamcrest-all