diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/AbstractTestTlsRejectPlainText.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/AbstractTestTlsRejectPlainText.java index 9e69e92f1658..9586fde5f2f2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/AbstractTestTlsRejectPlainText.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/AbstractTestTlsRejectPlainText.java @@ -59,7 +59,7 @@ public abstract class AbstractTestTlsRejectPlainText { - protected static final HBaseCommonTestingUtil UTIL = new HBaseCommonTestingUtil(); + protected static HBaseCommonTestingUtil UTIL; protected static File DIR; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestNettyTlsIPCRejectPlainText.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestNettyTlsIPCRejectPlainText.java index d9a14131c302..378101f76f30 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestNettyTlsIPCRejectPlainText.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestNettyTlsIPCRejectPlainText.java @@ -19,6 +19,7 @@ import java.io.IOException; import org.apache.hadoop.hbase.HBaseClassTestRule; +import org.apache.hadoop.hbase.HBaseCommonTestingUtil; import org.apache.hadoop.hbase.ipc.TestProtobufRpcServiceImpl; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.RPCTests; @@ -41,6 +42,7 @@ public class TestNettyTlsIPCRejectPlainText extends AbstractTestTlsRejectPlainTe @BeforeClass public static void setUpBeforeClass() throws IOException { + UTIL = new HBaseCommonTestingUtil(); initialize(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestSaslTlsIPCRejectPlainText.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestSaslTlsIPCRejectPlainText.java index 8c0d45921b74..a6984fcdf3a8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestSaslTlsIPCRejectPlainText.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestSaslTlsIPCRejectPlainText.java @@ -46,9 +46,7 @@ public class TestSaslTlsIPCRejectPlainText extends AbstractTestTlsRejectPlainTex public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestSaslTlsIPCRejectPlainText.class); - private static final HBaseTestingUtil UTIL = new HBaseTestingUtil(); - - private static final File KEYTAB_FILE = new File(UTIL.getDataTestDir("keytab").toUri().getPath()); + private static File KEYTAB_FILE; private static MiniKdc KDC; private static String HOST = "localhost"; @@ -57,13 +55,16 @@ public class TestSaslTlsIPCRejectPlainText extends AbstractTestTlsRejectPlainTex @BeforeClass public static void setUpBeforeClass() throws Exception { + HBaseTestingUtil util = new HBaseTestingUtil(); + UTIL = util; initialize(); - KDC = UTIL.setupMiniKdc(KEYTAB_FILE); + KEYTAB_FILE = new File(util.getDataTestDir("keytab").toUri().getPath()); + KDC = util.setupMiniKdc(KEYTAB_FILE); PRINCIPAL = "hbase/" + HOST; KDC.createPrincipal(KEYTAB_FILE, PRINCIPAL); HBaseKerberosUtils.setPrincipalForTesting(PRINCIPAL + "@" + KDC.getRealm()); UGI = loginKerberosPrincipal(KEYTAB_FILE.getCanonicalPath(), PRINCIPAL); - setSecuredConfiguration(UTIL.getConfiguration()); + setSecuredConfiguration(util.getConfiguration()); SecurityInfo securityInfoMock = Mockito.mock(SecurityInfo.class); Mockito.when(securityInfoMock.getServerPrincipal()) .thenReturn(HBaseKerberosUtils.KRB_PRINCIPAL);