SENTRY-2332: Load hadoop default configuration when starting sentry service (Arjun Mishra reviewed by Lina Li)

Change-Id: I61896ad01b49271202e3857b13f7e0faa6fd1ac0
diff --git a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryService.java b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryService.java
index 7c827ca..b3a4934 100644
--- a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryService.java
+++ b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryService.java
@@ -572,7 +572,7 @@
       throw new IllegalArgumentException("Cannot read configuration file "
           + configFile);
     }
-    Configuration conf = new Configuration(false);
+    Configuration conf = new Configuration(true);
     conf.addResource(configFile.toURI().toURL(), true);
     return conf;
   }
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java
index 92f3f8b..20948ed 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestNotificationHandlerInvoker.java
@@ -33,7 +33,7 @@
 
   @Before
   public void setup() throws Exception {
-    conf = new Configuration(false);
+    conf = new Configuration(true);
     handler = Mockito.spy(new NotificationHandler(conf) {});
     invoker = new NotificationHandlerInvoker(conf,
         Lists.newArrayList(new ThrowingNotificationHandler(conf), handler));
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
index 3475624..ee9442b 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
@@ -79,7 +79,7 @@
 
   @Before
   public void setup() throws Exception{
-    conf = new Configuration(false);
+    conf = new Configuration(true);
     //Check behaviour when DB name is not set
     conf.setBoolean(ServiceConstants.ServerConfig.SENTRY_ENABLE_OWNER_PRIVILEGES, true);
     conf.set(ServerConfig.ADMIN_GROUPS, ADMIN_GROUP);
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java
index 3fe5b6a..f32ac2d 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/SentryStoreIntegrationBase.java
@@ -39,7 +39,7 @@
 
   @BeforeClass
   public static void setup() throws Exception {
-    conf = new Configuration(false);
+    conf = new Configuration(true);
     setup(conf);
     sentryStore = new DelegateSentryStore(conf);
   }
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
index 6a84b05..12efb2d 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollowerSentryStoreIntegration.java
@@ -73,7 +73,7 @@
   // SentryStore related
   @BeforeClass
   public static void setup() throws Exception {
-    conf = new Configuration(false);
+    conf = new Configuration(true);
     final String ourUrl = UserProvider.SCHEME_NAME + ":///";
     conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl);
 
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
index d33ae26..07a5069 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
@@ -111,7 +111,7 @@
 
   @BeforeClass
   public static void setup() throws Exception {
-    conf = new Configuration(false);
+    conf = new Configuration(true);
     final String ourUrl = UserProvider.SCHEME_NAME + ":///";
     conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl);
 
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java
index 40ac994..df9299c 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java
@@ -71,7 +71,7 @@
   @BeforeClass
   public static void setupEnv() throws Exception {
     dataDir = new File(Files.createTempDir(), "sentry_policy_db");
-    Configuration conf = new Configuration(false);
+    Configuration conf = new Configuration(true);
     conf.set(ServerConfig.SENTRY_VERIFY_SCHEM_VERSION, "false");
     conf.set(ServerConfig.SENTRY_STORE_JDBC_URL, "jdbc:derby:;databaseName=" + dataDir.getPath()
         + ";create=true");
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java
index 21aa7f9..f61b520 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryVersion.java
@@ -39,7 +39,7 @@
   @Before
   public void setup() throws Exception {
     dataDir = new File(Files.createTempDir(), "sentry_policy_db");
-    conf = new Configuration(false);
+    conf = new Configuration(true);
     conf.set(ServerConfig.SENTRY_STORE_JDBC_URL, "jdbc:derby:;databaseName="
         + dataDir.getPath() + ";create=true");
     conf.set(ServerConfig.SENTRY_STORE_JDBC_PASS, "dummy");
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
index c5caa13..ff0374e 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
@@ -71,7 +71,7 @@
   protected static File clientKeytab;
   protected static UserGroupInformation clientUgi;
   protected static boolean kerberos;
-  protected final static Configuration conf = new Configuration(false);
+  protected final static Configuration conf = new Configuration(true);
   protected PolicyFile policyFile;
   protected File policyFilePath;
   protected static Properties kdcConfOverlay = new Properties();
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
index 1c44b26..76669a9 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
@@ -64,7 +64,7 @@
   }
 
   public static void createContext() throws Exception {
-    conf = new Configuration(false);
+    conf = new Configuration(true);
     policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP);
     properties.put(HiveServerFactory.AUTHZ_PROVIDER_BACKEND, SimpleDBProviderBackend.class.getName());
     properties.put(ConfVars.HIVE_AUTHORIZATION_TASK_FACTORY.varname,
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
index 9b4f4da..4588963 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
@@ -206,7 +206,7 @@
   protected static Boolean ownerPrivilegeGrantEnabled = false;
   protected static Configuration hadoopConf;
   protected static final Map<String, String> sentryProperties = Maps.newHashMap();
-  protected static Configuration sentryConf = new Configuration(false);
+  protected static Configuration sentryConf = new Configuration(true);
 
   protected static File assertCreateDir(File dir) {
     if(!dir.isDirectory()) {
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
index e0b584c..8bf486e 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
@@ -475,7 +475,7 @@
 
   private static void setupSentryService() throws Exception {
 
-    sentryConf = new Configuration(false);
+    sentryConf = new Configuration(true);
 
     properties.put(HiveServerFactory.AUTHZ_PROVIDER_BACKEND,
         SimpleDBProviderBackend.class.getName());
@@ -551,7 +551,7 @@
 
     if (clientKerberos) {
       if (sentryConf == null ) {
-        sentryConf = new Configuration(false);
+        sentryConf = new Configuration(true);
       }
       final String SENTRY_HOST = System.getProperty("sentry.host", SERVER_HOST);
       final String SERVER_KERBEROS_PRINCIPAL = "sentry/" + SENTRY_HOST + "@" + REALM;
diff --git a/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestSentryServer.java b/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestSentryServer.java
index 28c3102..aefb2e7 100644
--- a/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestSentryServer.java
+++ b/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestSentryServer.java
@@ -112,7 +112,7 @@
   }
 
   private Configuration getServerConfig () {
-    Configuration conf = new Configuration(false);
+    Configuration conf = new Configuration(true);
     conf.set(ServerConfig.SECURITY_MODE, ServerConfig.SECURITY_MODE_NONE);
     conf.set(ServerConfig.SENTRY_VERIFY_SCHEM_VERSION, "false");
     conf.set(ServerConfig.ADMIN_GROUPS, ADMIN_GROUP + ",solr");
@@ -129,7 +129,7 @@
   }
 
   private Configuration getClientConfig() {
-    Configuration conf = new Configuration(false);
+    Configuration conf = new Configuration(true);
     conf.set(ServerConfig.SECURITY_MODE, ServerConfig.SECURITY_MODE_NONE);
     conf.set(ApiConstants.ClientConfig.SERVER_RPC_ADDRESS, sentryService.getAddress().getHostName());
     conf.set(ApiConstants.ClientConfig.SERVER_RPC_PORT, String.valueOf(sentryService.getAddress().getPort()));