|
|
@@ -80,7 +80,7 @@ from beeswax.server.hive_server2_lib import HiveServerClient,\
|
|
|
PartitionKeyCompatible, PartitionValueCompatible, HiveServerTable,\
|
|
|
HiveServerTColumnValue2
|
|
|
from beeswax.test_base import BeeswaxSampleProvider, is_hive_on_spark
|
|
|
-from beeswax.hive_site import get_metastore
|
|
|
+from beeswax.hive_site import get_metastore, hiveserver2_jdbc_url
|
|
|
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
@@ -3378,3 +3378,29 @@ def test_apply_natural_sort():
|
|
|
{'name': 'test_2', 'comment': 'Test'},
|
|
|
{'name': 'test_100', 'comment': 'Test'},
|
|
|
{'name': 'test_200', 'comment': 'Test'}])
|
|
|
+
|
|
|
+def test_hiveserver2_jdbc_url():
|
|
|
+ try:
|
|
|
+ url = hiveserver2_jdbc_url()
|
|
|
+ assert_equal(url, 'jdbc:hive2://localhost:10000/default')
|
|
|
+
|
|
|
+ beeswax.conf.HIVE_SERVER_HOST.set_for_testing('server-with-ssl-enabled.com')
|
|
|
+ beeswax.conf.HIVE_SERVER_PORT.set_for_testing('10000')
|
|
|
+ url = hiveserver2_jdbc_url()
|
|
|
+ assert_equal(url, 'jdbc:hive2://server-with-ssl-enabled.com:10000/default')
|
|
|
+
|
|
|
+ beeswax.hive_site.reset()
|
|
|
+ beeswax.hive_site.get_conf()[hive_site._CNF_HIVESERVER2_USE_SSL] = 'TRUE'
|
|
|
+ beeswax.hive_site.get_conf()[hive_site._CNF_HIVESERVER2_TRUSTSTORE_PATH] = '/path/to/truststore.jks'
|
|
|
+ beeswax.hive_site.get_conf()[hive_site._CNF_HIVESERVER2_TRUSTSTORE_PASSWORD] = 'password'
|
|
|
+ url = hiveserver2_jdbc_url()
|
|
|
+ assert_equal(url, 'jdbc:hive2://server-with-ssl-enabled.com:10000/default;ssl=true;sslTrustStore=/path/to/truststore.jks;trustStorePassword=password')
|
|
|
+
|
|
|
+ beeswax.hive_site.get_conf()[hive_site._CNF_HIVESERVER2_USE_SSL] = 'FALSE'
|
|
|
+ url = hiveserver2_jdbc_url()
|
|
|
+ assert_equal(url, 'jdbc:hive2://server-with-ssl-enabled.com:10000/default')
|
|
|
+ finally:
|
|
|
+ beeswax.hive_site.reset()
|
|
|
+
|
|
|
+
|
|
|
+
|