You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2015/10/28 13:11:19 UTC
[26/55] [abbrv] hive git commit: HIVE-12039 : Fix
TestSSL#testSSLVersion (Vaibhav Gumashta via Ashutosh Chauhan)
HIVE-12039 : Fix TestSSL#testSSLVersion (Vaibhav Gumashta via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/e8f71f4d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/e8f71f4d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/e8f71f4d
Branch: refs/heads/spark
Commit: e8f71f4d2bfcf6534fbbf3413a8b3c80698fcc46
Parents: ee2d318
Author: Vaibhav Gumashta <vg...@apache.org>
Authored: Thu Oct 8 12:43:00 2015 -0800
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Sat Oct 24 14:41:06 2015 -0700
----------------------------------------------------------------------
.../test/java/org/apache/hive/jdbc/TestSSL.java | 44 +++++++++-----------
1 file changed, 20 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/e8f71f4d/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestSSL.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestSSL.java b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestSSL.java
index 28a3777..b66ffda 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestSSL.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestSSL.java
@@ -55,15 +55,15 @@ public class TestSSL {
private static final String HS2_HTTP_MODE = "http";
private static final String HS2_HTTP_ENDPOINT = "cliservice";
private static final String HS2_BINARY_AUTH_MODE = "NONE";
- private static final String HS2_HTTP_AUTH_MODE = "NOSASL";
private MiniHS2 miniHS2 = null;
private static HiveConf conf = new HiveConf();
private Connection hs2Conn = null;
private String dataFileDir = conf.get("test.data.files");
private Map<String, String> confOverlay;
- private final String SSL_CONN_PARAMS = ";ssl=true;sslTrustStore=" + URLEncoder.encode(dataFileDir + File.separator +
- TRUST_STORE_NAME) + ";trustStorePassword=" + KEY_STORE_PASSWORD;
+ private final String SSL_CONN_PARAMS = ";ssl=true;sslTrustStore="
+ + URLEncoder.encode(dataFileDir + File.separator + TRUST_STORE_NAME) + ";trustStorePassword="
+ + KEY_STORE_PASSWORD;
@BeforeClass
public static void beforeTest() throws Exception {
@@ -111,9 +111,10 @@ public class TestSSL {
*/
@Test
public void testSSLVersion() throws Exception {
- Assume.assumeTrue(execCommand("which openssl") == 0); // we need openssl
- Assume.assumeTrue(System.getProperty("os.name").toLowerCase()
- .contains("linux")); // we depend on linux openssl exit codes
+ // we need openssl
+ Assume.assumeTrue(execCommand("which openssl") == 0);
+ // we depend on linux openssl exit codes
+ Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("linux"));
setSslConfOverlay(confOverlay);
// Test in binary mode
@@ -122,16 +123,15 @@ public class TestSSL {
miniHS2.start(confOverlay);
// make SSL connection
- hs2Conn = DriverManager.getConnection(miniHS2.getJdbcURL() + ";ssl=true;sslTrustStore=" +
- dataFileDir + File.separator + TRUST_STORE_NAME + ";trustStorePassword=" +
- KEY_STORE_PASSWORD, System.getProperty("user.name"), "bar");
+ hs2Conn =
+ DriverManager.getConnection(miniHS2.getJdbcURL() + ";ssl=true;sslTrustStore=" + dataFileDir
+ + File.separator + TRUST_STORE_NAME + ";trustStorePassword=" + KEY_STORE_PASSWORD,
+ System.getProperty("user.name"), "bar");
hs2Conn.close();
- Assert.assertEquals("Expected exit code of 1", 1,
- execCommand("openssl s_client -connect " + miniHS2.getHost() + ":" + miniHS2.getBinaryPort()
- + " -ssl2 < /dev/null"));
- Assert.assertEquals("Expected exit code of 1", 1,
- execCommand("openssl s_client -connect " + miniHS2.getHost() + ":" + miniHS2.getBinaryPort()
- + " -ssl3 < /dev/null"));
+ Assert.assertEquals("Expected exit code of 1", 1, execCommand("openssl s_client -connect "
+ + miniHS2.getHost() + ":" + miniHS2.getBinaryPort() + " -ssl2 < /dev/null"));
+ Assert.assertEquals("Expected exit code of 1", 1, execCommand("openssl s_client -connect "
+ + miniHS2.getHost() + ":" + miniHS2.getBinaryPort() + " -ssl3 < /dev/null"));
miniHS2.stop();
// Test in http mode
@@ -139,12 +139,10 @@ public class TestSSL {
miniHS2.start(confOverlay);
// make SSL connection
try {
- hs2Conn = DriverManager.getConnection(miniHS2.getJdbcURL() +
- ";ssl=true;sslTrustStore=" + dataFileDir + File.separator +
- TRUST_STORE_NAME + ";trustStorePassword=" + KEY_STORE_PASSWORD +
- "?hive.server2.transport.mode=" + HS2_HTTP_MODE +
- ";hive.server2.thrift.http.path=" + HS2_HTTP_ENDPOINT,
- System.getProperty("user.name"), "bar");
+ hs2Conn =
+ DriverManager.getConnection(miniHS2.getJdbcURL() + ";ssl=true;sslTrustStore="
+ + dataFileDir + File.separator + TRUST_STORE_NAME + ";trustStorePassword="
+ + KEY_STORE_PASSWORD, System.getProperty("user.name"), "bar");
Assert.fail("Expected SQLException during connect");
} catch (SQLException e) {
LOG.info("Expected exception: " + e, e);
@@ -402,12 +400,10 @@ public class TestSSL {
confOverlay.put(ConfVars.HIVE_SERVER2_USE_SSL.varname, "false");
}
- // Currently http mode works with server in NOSASL auth mode & doesn't support doAs
private void setHttpConfOverlay(Map<String, String> confOverlay) {
confOverlay.put(ConfVars.HIVE_SERVER2_TRANSPORT_MODE.varname, HS2_HTTP_MODE);
confOverlay.put(ConfVars.HIVE_SERVER2_THRIFT_HTTP_PATH.varname, HS2_HTTP_ENDPOINT);
- confOverlay.put(ConfVars.HIVE_SERVER2_AUTHENTICATION.varname, HS2_HTTP_AUTH_MODE);
- confOverlay.put(ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, "false");
+ confOverlay.put(ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, "true");
}
private void setBinaryConfOverlay(Map<String, String> confOverlay) {