You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ro...@apache.org on 2020/06/22 12:18:08 UTC
[activemq-artemis] branch master updated: ARTEMIS-2813: add JUnit
assumption check, in case class runs within manually -Dtest= set
This is an automated email from the ASF dual-hosted git repository.
robbie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new ccc01ac ARTEMIS-2813: add JUnit assumption check, in case class runs within manually -Dtest=<foo> set
ccc01ac is described below
commit ccc01ac4e557cfd367e140228fc6e1a7a400bec9
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Mon Jun 22 13:08:13 2020 +0100
ARTEMIS-2813: add JUnit assumption check, in case class runs within manually -Dtest=<foo> set
---
.../tests/integration/amqp/JMSSaslGssapiTest.java | 8 ++++++
.../integration/amqp/SaslKrb5LDAPSecurityTest.java | 8 ++++++
.../artemis/tests/util/JavaVersionUtil.java | 33 ++++++++++++++++++++++
3 files changed, 49 insertions(+)
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 a7af43d..7b6e220 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 d16a4b4..3b7dcd8 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 0000000..be45ed4
--- /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;
+ }
+}