diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSaslGssapiTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSaslGssapiTest.java index a7af43d78e..7b6e220a66 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSaslGssapiTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSaslGssapiTest.java @@ -47,6 +47,7 @@ import org.apache.activemq.artemis.protocol.amqp.proton.handler.ProtonHandler; import org.apache.activemq.artemis.protocol.amqp.sasl.ClientSASL; import org.apache.activemq.artemis.protocol.amqp.sasl.ClientSASLFactory; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; +import org.apache.activemq.artemis.tests.util.JavaVersionUtil; import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.hadoop.minikdc.MiniKdc; @@ -54,7 +55,9 @@ import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.sasl.GssapiMechanism; import org.apache.qpid.proton.amqp.Symbol; import org.junit.After; +import org.junit.Assume; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class JMSSaslGssapiTest extends JMSClientTestSupport { @@ -72,6 +75,11 @@ public class JMSSaslGssapiTest extends JMSClientTestSupport { MiniKdc kdc = null; private final boolean debug = false; + @BeforeClass + public static void checkAssumptions() throws Exception { + Assume.assumeTrue("Test only runs on JDK 8", JavaVersionUtil.isJava8()); + } + @Before public void setUpKerberos() throws Exception { kdc = new MiniKdc(MiniKdc.createConf(), temporaryFolder.newFolder("kdc")); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/SaslKrb5LDAPSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/SaslKrb5LDAPSecurityTest.java index d16a4b4a54..3b7dcd8635 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/SaslKrb5LDAPSecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/SaslKrb5LDAPSecurityTest.java @@ -58,6 +58,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; +import org.apache.activemq.artemis.tests.util.JavaVersionUtil; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -94,7 +95,9 @@ import org.apache.directory.shared.kerberos.components.EncryptionKey; import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.After; import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -152,6 +155,11 @@ public class SaslKrb5LDAPSecurityTest extends AbstractLdapTestUnit { public TemporaryFolder temporaryFolder; private String testDir; + @BeforeClass + public static void checkAssumptions() throws Exception { + Assume.assumeTrue("Test only runs on JDK 8", JavaVersionUtil.isJava8()); + } + @Before public void setUp() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JavaVersionUtil.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JavaVersionUtil.java new file mode 100644 index 0000000000..be45ed45ab --- /dev/null +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JavaVersionUtil.java @@ -0,0 +1,33 @@ +/* + * 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.activemq.artemis.tests.util; + +public class JavaVersionUtil { + + private static boolean isJdk8; + + static { + String version = System.getProperty("java.version"); + if (version != null && version.startsWith("1.8.")) { + isJdk8 = true; + } + } + + public static boolean isJava8() { + return isJdk8; + } +}