ARTEMIS-2813: add JUnit assumption check, in case class runs within manually -Dtest=<foo> set
This commit is contained in:
parent
50bf1efeef
commit
ccc01ac4e5
|
@ -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"));
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue