hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject hbase git commit: HBASE-15365 Do not write to '/tmp' in TestHBaseConfiguration
Date Wed, 02 Mar 2016 03:28:24 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 2ce516b0f -> c4c50a565


HBASE-15365 Do not write to '/tmp' in TestHBaseConfiguration

Conflicts:
	hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c4c50a56
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c4c50a56
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c4c50a56

Branch: refs/heads/branch-1.0
Commit: c4c50a565b84fee5bd5149bab9d5fb9df48d76ba
Parents: 2ce516b
Author: zhangduo <zhangduo@apache.org>
Authored: Wed Mar 2 09:37:07 2016 +0800
Committer: zhangduo <zhangduo@apache.org>
Committed: Wed Mar 2 11:21:30 2016 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/TestHBaseConfiguration.java    | 27 ++++++++++++--------
 1 file changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c4c50a56/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
index b739f36..8973fdc 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
@@ -21,6 +21,7 @@ package org.apache.hadoop.hbase;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -30,6 +31,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.junit.AfterClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -38,6 +40,13 @@ public class TestHBaseConfiguration {
 
   private static final Log LOG = LogFactory.getLog(TestHBaseConfiguration.class);
 
+  private static HBaseCommonTestingUtility UTIL = new HBaseCommonTestingUtility();
+
+  @AfterClass
+  public static void tearDown() throws IOException {
+    UTIL.cleanupTestDir();
+  }
+
   @Test
   public void testGetIntDeprecated() {
     int VAL = 1, VAL2 = 2;
@@ -66,22 +75,19 @@ public class TestHBaseConfiguration {
   @Test
   public void testGetPassword() throws Exception {
     Configuration conf = HBaseConfiguration.create();
-    conf.set(ReflectiveCredentialProviderClient.CREDENTIAL_PROVIDER_PATH,
-        "jceks://file/tmp/foo.jks");
-    ReflectiveCredentialProviderClient client =
-        new ReflectiveCredentialProviderClient();
+    conf.set(ReflectiveCredentialProviderClient.CREDENTIAL_PROVIDER_PATH, "jceks://file"
+        + new File(UTIL.getDataTestDir().toUri().getPath(), "foo.jks").getCanonicalPath());
+    ReflectiveCredentialProviderClient client = new ReflectiveCredentialProviderClient();
     if (client.isHadoopCredentialProviderAvailable()) {
-      char[] keyPass = {'k', 'e', 'y', 'p', 'a', 's', 's'};
-      char[] storePass = {'s', 't', 'o', 'r', 'e', 'p', 'a', 's', 's'};
+      char[] keyPass = { 'k', 'e', 'y', 'p', 'a', 's', 's' };
+      char[] storePass = { 's', 't', 'o', 'r', 'e', 'p', 'a', 's', 's' };
       client.createEntry(conf, "ssl.keypass.alias", keyPass);
       client.createEntry(conf, "ssl.storepass.alias", storePass);
 
-      String keypass = HBaseConfiguration.getPassword(
-          conf, "ssl.keypass.alias", null);
+      String keypass = HBaseConfiguration.getPassword(conf, "ssl.keypass.alias", null);
       assertEquals(keypass, new String(keyPass));
 
-      String storepass = HBaseConfiguration.getPassword(
-          conf, "ssl.storepass.alias", null);
+      String storepass = HBaseConfiguration.getPassword(conf, "ssl.storepass.alias", null);
       assertEquals(storepass, new String(storePass));
     }
   }
@@ -165,7 +171,6 @@ public class TestHBaseConfiguration {
         getProvidersMethod = loadMethod(hadoopCredProviderFactoryClz,
             HADOOP_CRED_PROVIDER_FACTORY_GET_PROVIDERS_METHOD_NAME,
             Configuration.class);
-
         // Load Hadoop CredentialProvider
         Class<?> hadoopCredProviderClz = null;
         hadoopCredProviderClz = Class.forName(HADOOP_CRED_PROVIDER_CLASS_NAME);


Mime
View raw message