Repository: sentry Updated Branches: refs/heads/master 748420809 -> 9caa0d1d0
http://git-wip-us.apache.org/repos/asf/sentry/blob/9caa0d1d/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java index b9a0563..9d1a92f 100644 --- a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java +++ b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryHMSClient.java @@ -31,8 +31,8 @@ import org.apache.hadoop.hive.metastore.api.NotificationEvent; import org.apache.hadoop.hive.metastore.api.NotificationEventResponse; import org.apache.hadoop.hive.metastore.messaging.MessageDeserializer; import org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageDeserializer; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.provider.db.service.persistent.PathsImage; -import org.apache.sentry.provider.db.service.persistent.SentryStore; import org.apache.sentry.api.service.thrift.SentryMetrics; import org.apache.thrift.TException; import org.slf4j.Logger; @@ -143,7 +143,7 @@ public class SentryHMSClient implements AutoCloseable { if (client == null) { LOGGER.error(NOT_CONNECTED_MSG); return new PathsImage(Collections.<String, Collection<String>>emptyMap(), - SentryStore.EMPTY_NOTIFICATION_ID, SentryStore.EMPTY_PATHS_SNAPSHOT_ID); + SentryConstants.EMPTY_NOTIFICATION_ID, SentryConstants.EMPTY_PATHS_SNAPSHOT_ID); } try { @@ -151,8 +151,8 @@ public class SentryHMSClient implements AutoCloseable { Map<String, Collection<String>> pathsFullSnapshot = fetchFullUpdate(); if (pathsFullSnapshot.isEmpty()) { LOGGER.info("Received empty paths when getting full snapshot. NotificationID Before Snapshot: {}", eventIdBefore.getEventId()); - return new PathsImage(pathsFullSnapshot, SentryStore.EMPTY_NOTIFICATION_ID, - SentryStore.EMPTY_PATHS_SNAPSHOT_ID); + return new PathsImage(pathsFullSnapshot, SentryConstants.EMPTY_NOTIFICATION_ID, + SentryConstants.EMPTY_PATHS_SNAPSHOT_ID); } CurrentNotificationEventId eventIdAfter = client.getCurrentNotificationEventId(); @@ -165,7 +165,7 @@ public class SentryHMSClient implements AutoCloseable { // As eventIDAfter is the last event that was processed, eventIDAfter is used to update // lastProcessedNotificationID instead of getting it from persistent store. return new PathsImage(pathsFullSnapshot, eventIdAfter.getEventId(), - SentryStore.EMPTY_PATHS_SNAPSHOT_ID); + SentryConstants.EMPTY_PATHS_SNAPSHOT_ID); } LOGGER.info("Reconciling full snapshot - applying {} changes", @@ -183,7 +183,7 @@ public class SentryHMSClient implements AutoCloseable { LOGGER.error("Snapshot discarded, updates to HMS data while shapshot is being taken." + "ID Before: {}. ID After: {}", eventIdBefore.getEventId(), eventIdAfter.getEventId()); return new PathsImage(Collections.<String, Collection<String>>emptyMap(), - SentryStore.EMPTY_NOTIFICATION_ID, SentryStore.EMPTY_PATHS_SNAPSHOT_ID); + SentryConstants.EMPTY_NOTIFICATION_ID, SentryConstants.EMPTY_PATHS_SNAPSHOT_ID); } for (NotificationEvent event : response.getEvents()) { @@ -217,13 +217,13 @@ public class SentryHMSClient implements AutoCloseable { // As eventIDAfter is the last event that was processed, eventIDAfter is used to update // lastProcessedNotificationID instead of getting it from persistent store. return new PathsImage(pathsFullSnapshot, currentEventId, - SentryStore.EMPTY_PATHS_SNAPSHOT_ID); + SentryConstants.EMPTY_PATHS_SNAPSHOT_ID); } catch (TException failure) { LOGGER.error("Fetching a new HMS snapshot cannot continue because an error occurred during " + "the HMS communication: ", failure); LOGGER.error("Root Exception", ExceptionUtils.getRootCause(failure)); return new PathsImage(Collections.<String, Collection<String>>emptyMap(), - SentryStore.EMPTY_NOTIFICATION_ID, SentryStore.EMPTY_PATHS_SNAPSHOT_ID); + SentryConstants.EMPTY_NOTIFICATION_ID, SentryConstants.EMPTY_PATHS_SNAPSHOT_ID); } } http://git-wip-us.apache.org/repos/asf/sentry/blob/9caa0d1d/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/service/thrift/SentryService.java ---------------------------------------------------------------------- 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 d92ec21..7c827ca 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 @@ -51,7 +51,7 @@ import org.apache.sentry.api.common.SentryServiceUtil; import org.apache.sentry.core.common.utils.SigUtils; import org.apache.sentry.provider.db.service.persistent.HMSFollower; import org.apache.sentry.provider.db.service.persistent.LeaderStatusMonitor; -import org.apache.sentry.provider.db.service.persistent.SentryStore; +import org.apache.sentry.provider.db.service.persistent.SentryStoreInterface; import org.apache.sentry.api.service.thrift.SentryHealthCheckServletContextListener; import org.apache.sentry.api.service.thrift.SentryMetrics; import org.apache.sentry.api.service.thrift.SentryMetricsServletContextListener; @@ -114,7 +114,7 @@ public class SentryService implements Callable, SigUtils.SigListener { between various {@link SentryPolicyService}, i.e., {@link SentryPolicyStoreProcessor} and {@link HMSFollower}. */ - private final SentryStore sentryStore; + private final SentryStoreInterface sentryStore; private ScheduledExecutorService sentryStoreCleanService; private final LeaderStatusMonitor leaderMonitor; @@ -165,7 +165,7 @@ public class SentryService implements Callable, SigUtils.SigListener { .setNameFormat(SENTRY_SERVICE_THREAD_NAME) .build(); serviceExecutor = Executors.newSingleThreadExecutor(sentryServiceThreadFactory); - this.sentryStore = new SentryStore(conf); + this.sentryStore = getSentryStore(conf); sentryStore.setPersistUpdateDeltas(SentryServiceUtil.isHDFSSyncEnabled(conf)); this.leaderMonitor = LeaderStatusMonitor.getLeaderStatusMonitor(conf); webServerPort = conf.getInt(ServerConfig.SENTRY_WEB_PORT, ServerConfig.SENTRY_WEB_PORT_DEFAULT); @@ -184,6 +184,34 @@ public class SentryService implements Callable, SigUtils.SigListener { } } + private SentryStoreInterface getSentryStore(Configuration conf) { + String sentryStoreClass = conf.get(ServerConfig.SENTRY_STORE, + ServerConfig.SENTRY_STORE_DEFAULT); + try { + Class<?> sentryClazz = conf.getClassByName(sentryStoreClass); + Constructor<?> sentryConstructor = sentryClazz + .getConstructor(Configuration.class); + Object sentryObj = sentryConstructor.newInstance(conf); + if (sentryObj instanceof SentryStoreInterface) { + LOGGER.info("Instantiating sentry store class: " + sentryStoreClass); + return (SentryStoreInterface) sentryConstructor.newInstance(conf); + } + // The supplied class doesn't implement SentryStoreIface. Let's try to use a proxy + // instance. + // In practice, the following should only be used in development phase, as there are + // cases where using a proxy can fail, and result in runtime errors. + LOGGER.warn( + String.format("Trying to use a proxy instance (duck-typing) for the " + + "supplied SentryStore, since the specified class %s does not implement " + + "SentryStoreIface.", sentryStoreClass)); + return + new DynamicProxy<>(sentryObj, SentryStoreInterface.class, sentryStoreClass).createProxy(); + } catch (Exception e) { + throw new IllegalStateException("Could not create " + + sentryStoreClass, e); + } + } + @Override public String call() throws Exception { SentryKerberosContext kerberosContext = null; http://git-wip-us.apache.org/repos/asf/sentry/blob/9caa0d1d/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java index a9e8230..3b58de3 100644 --- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java +++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/generic/service/persistent/TestSentryRole.java @@ -33,11 +33,11 @@ import javax.jdo.Query; import javax.jdo.Transaction; import org.apache.commons.io.FileUtils; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.core.model.solr.Collection; import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege; import org.apache.sentry.provider.db.service.model.MSentryPrivilege; import org.apache.sentry.provider.db.service.model.MSentryRole; -import org.apache.sentry.provider.db.service.persistent.SentryStore; import org.apache.sentry.service.common.ServiceConstants.ServerConfig; import org.junit.After; import org.junit.Before; @@ -138,8 +138,8 @@ public class TestSentryRole { hivePrivilege.setTableName("tb1"); hivePrivilege.setPrivilegeScope("table"); hivePrivilege.setAction("select"); - hivePrivilege.setURI(SentryStore.NULL_COL); - hivePrivilege.setColumnName(SentryStore.NULL_COL); + hivePrivilege.setURI(SentryConstants.NULL_COL); + hivePrivilege.setColumnName(SentryConstants.NULL_COL); hivePrivilege.setGrantOption(true); //The same hivePrivilege MSentryPrivilege hivePrivilege2 = new MSentryPrivilege(hivePrivilege); @@ -200,8 +200,8 @@ public class TestSentryRole { hivePrivilege.setTableName("tb1"); hivePrivilege.setPrivilegeScope("table"); hivePrivilege.setAction("select"); - hivePrivilege.setURI(SentryStore.NULL_COL); - hivePrivilege.setColumnName(SentryStore.NULL_COL); + hivePrivilege.setURI(SentryConstants.NULL_COL); + hivePrivilege.setColumnName(SentryConstants.NULL_COL); hivePrivilege.setGrantOption(true); //solr privilege @@ -279,8 +279,8 @@ public class TestSentryRole { hivePrivilege.setTableName("tb1"); hivePrivilege.setPrivilegeScope("table"); hivePrivilege.setAction("select"); - hivePrivilege.setURI(SentryStore.NULL_COL); - hivePrivilege.setColumnName(SentryStore.NULL_COL); + hivePrivilege.setURI(SentryConstants.NULL_COL); + hivePrivilege.setColumnName(SentryConstants.NULL_COL); hivePrivilege.setGrantOption(true); //solr privilege @@ -358,8 +358,8 @@ public class TestSentryRole { hivePrivilege.setTableName("tb1"); hivePrivilege.setPrivilegeScope("table"); hivePrivilege.setAction("select"); - hivePrivilege.setURI(SentryStore.NULL_COL); - hivePrivilege.setColumnName(SentryStore.NULL_COL); + hivePrivilege.setURI(SentryConstants.NULL_COL); + hivePrivilege.setColumnName(SentryConstants.NULL_COL); hivePrivilege.setGrantOption(true); //solr privilege @@ -438,8 +438,8 @@ public class TestSentryRole { hivePrivilege.setTableName("tb1"); hivePrivilege.setPrivilegeScope("table"); hivePrivilege.setAction("select"); - hivePrivilege.setURI(SentryStore.NULL_COL); - hivePrivilege.setColumnName(SentryStore.NULL_COL); + hivePrivilege.setURI(SentryConstants.NULL_COL); + hivePrivilege.setColumnName(SentryConstants.NULL_COL); hivePrivilege.setGrantOption(true); //solr privilege http://git-wip-us.apache.org/repos/asf/sentry/blob/9caa0d1d/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java ---------------------------------------------------------------------- diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java index 0c66dd2..1b4fa47 100644 --- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java +++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java @@ -50,6 +50,7 @@ import org.apache.sentry.binding.hive.conf.HiveAuthzConf; import org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars; import org.apache.sentry.binding.metastore.messaging.json.SentryJSONMessageFactory; import org.apache.sentry.core.common.utils.PubSub; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.hdfs.UniquePathsUpdate; import org.apache.sentry.service.thrift.SentryHMSClient; import org.apache.sentry.service.thrift.HiveConnectionFactory; @@ -125,7 +126,7 @@ public class TestHMSFollower { * should trigger a new full HMS snapshot request with the eventId = 1 */ - final long SENTRY_PROCESSED_EVENT_ID = SentryStore.EMPTY_NOTIFICATION_ID; + final long SENTRY_PROCESSED_EVENT_ID = SentryConstants.EMPTY_NOTIFICATION_ID; final long HMS_PROCESSED_EVENT_ID = 1L; // Mock that returns a full snapshot @@ -195,7 +196,7 @@ public class TestHMSFollower { * */ - final long SENTRY_PROCESSED_EVENT_ID = SentryStore.EMPTY_NOTIFICATION_ID; + final long SENTRY_PROCESSED_EVENT_ID = SentryConstants.EMPTY_NOTIFICATION_ID; final long HMS_PROCESSED_EVENT_ID = 1L; // Mock that returns a full snapshot @@ -282,7 +283,7 @@ public class TestHMSFollower { disableHdfsSyncInSentry(configuration); - final long SENTRY_PROCESSED_EVENT_ID = SentryStore.EMPTY_NOTIFICATION_ID; + final long SENTRY_PROCESSED_EVENT_ID = SentryConstants.EMPTY_NOTIFICATION_ID; final long HMS_PROCESSED_EVENT_ID = 1L; // Mock that returns a full snapshot @@ -381,7 +382,7 @@ public class TestHMSFollower { disableHdfsSyncInSentry(configuration); - final long SENTRY_PROCESSED_EVENT_ID = SentryStore.EMPTY_NOTIFICATION_ID; + final long SENTRY_PROCESSED_EVENT_ID = SentryConstants.EMPTY_NOTIFICATION_ID; final long HMS_PROCESSED_EVENT_ID = 1L; // Mock that returns a full snapshot @@ -1142,7 +1143,7 @@ public class TestHMSFollower { // HMSFollower tries to fetch all notifications from HMS. - final long SENTRY_PROCESSED_EVENT_ID = SentryStore.EMPTY_NOTIFICATION_ID; + final long SENTRY_PROCESSED_EVENT_ID = SentryConstants.EMPTY_NOTIFICATION_ID; final long HMS_PROCESSED_EVENT_ID = 1L; NotificationEventResponse response = new NotificationEventResponse(); @@ -1191,7 +1192,7 @@ public class TestHMSFollower { // // Simulates (by using mocks) that Sentry is out-of-sync with sentry - final long SENTRY_PROCESSED_EVENT_ID = SentryStore.EMPTY_NOTIFICATION_ID; + final long SENTRY_PROCESSED_EVENT_ID = SentryConstants.EMPTY_NOTIFICATION_ID; NotificationEventResponse response = new NotificationEventResponse(); http://git-wip-us.apache.org/repos/asf/sentry/blob/9caa0d1d/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java ---------------------------------------------------------------------- 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 475fc4e..5849e7d 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 @@ -46,6 +46,7 @@ import org.apache.hadoop.security.alias.UserProvider; import org.apache.sentry.SentryOwnerInfo; import org.apache.sentry.core.common.exception.SentryAccessDeniedException; import org.apache.sentry.core.common.exception.SentryInvalidInputException; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.core.model.db.AccessConstants; import org.apache.sentry.core.common.exception.SentryAlreadyExistsException; import org.apache.sentry.core.common.exception.SentryGrantDeniedException; @@ -3764,7 +3765,7 @@ public class TestSentryStore extends org.junit.Assert { assertEquals(2, pathsImage.size()); if (lastNotificationId == null) { - lastNotificationId = SentryStore.EMPTY_NOTIFICATION_ID; + lastNotificationId = SentryConstants.EMPTY_NOTIFICATION_ID; } // Rename path of 'db1.table1' from 'db1.table1' to 'db1.newTable1' http://git-wip-us.apache.org/repos/asf/sentry/blob/9caa0d1d/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStoreImportExport.java ---------------------------------------------------------------------- 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 ebc8c31..40ac994 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 @@ -28,6 +28,7 @@ import java.util.Set; import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; +import org.apache.sentry.core.common.utils.SentryConstants; import org.apache.sentry.core.model.db.AccessConstants; import org.apache.sentry.provider.db.service.model.MSentryGroup; import org.apache.sentry.provider.db.service.model.MSentryPrivilege; @@ -197,7 +198,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2", "role3")); @@ -278,7 +279,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role2", "role3")); @@ -364,7 +365,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2", "role3")); @@ -435,7 +436,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1", "role2")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role2")); @@ -481,7 +482,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1", "role2")); verifyUserGroupRolesMap(actualGroupRolesMap, exceptedGroupRolesMap); @@ -525,7 +526,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); verifyUserGroupRolesMap(actualGroupRolesMap, exceptedGroupRolesMap); @@ -587,7 +588,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role2", "role3")); @@ -669,7 +670,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2", "role3")); @@ -742,7 +743,7 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1", "role2")); verifyUserGroupRolesMap(actualGroupRolesMap, exceptedGroupRolesMap); @@ -801,7 +802,7 @@ public class TestSentryStoreImportExport { List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList( actualRolePrivilegesMap.keySet()); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2")); @@ -817,7 +818,7 @@ public class TestSentryStoreImportExport { verifyRolePrivilegesMap(actualRolePrivilegesMap, exceptedRolePrivilegesMap); mapList = sentryStore.getGroupUserRoleMapList(actualRolePrivilegesMap.keySet()); - actualGroupRolesMap = mapList.get(SentryStore.INDEX_GROUP_ROLES_MAP); + actualGroupRolesMap = mapList.get(SentryConstants.INDEX_GROUP_ROLES_MAP); exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2")); @@ -834,7 +835,7 @@ public class TestSentryStoreImportExport { verifyRolePrivilegesMap(actualRolePrivilegesMap, exceptedRolePrivilegesMap); mapList = sentryStore.getGroupUserRoleMapList(actualRolePrivilegesMap.keySet()); - actualGroupRolesMap = mapList.get(SentryStore.INDEX_GROUP_ROLES_MAP); + actualGroupRolesMap = mapList.get(SentryConstants.INDEX_GROUP_ROLES_MAP); exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2")); @@ -850,7 +851,7 @@ public class TestSentryStoreImportExport { verifyRolePrivilegesMap(actualRolePrivilegesMap, exceptedRolePrivilegesMap); mapList = sentryStore.getGroupUserRoleMapList(actualRolePrivilegesMap.keySet()); - actualGroupRolesMap = mapList.get(SentryStore.INDEX_GROUP_ROLES_MAP); + actualGroupRolesMap = mapList.get(SentryConstants.INDEX_GROUP_ROLES_MAP); exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role2")); exceptedGroupRolesMap.put("group3", Sets.newHashSet("role2", "role3")); @@ -866,7 +867,7 @@ public class TestSentryStoreImportExport { verifyRolePrivilegesMap(actualRolePrivilegesMap, exceptedRolePrivilegesMap); mapList = sentryStore.getGroupUserRoleMapList(actualRolePrivilegesMap.keySet()); - actualGroupRolesMap = mapList.get(SentryStore.INDEX_GROUP_ROLES_MAP); + actualGroupRolesMap = mapList.get(SentryConstants.INDEX_GROUP_ROLES_MAP); exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2")); @@ -887,7 +888,7 @@ public class TestSentryStoreImportExport { verifyRolePrivilegesMap(actualRolePrivilegesMap, exceptedRolePrivilegesMap); mapList = sentryStore.getGroupUserRoleMapList(actualRolePrivilegesMap.keySet()); - actualGroupRolesMap = mapList.get(SentryStore.INDEX_GROUP_ROLES_MAP); + actualGroupRolesMap = mapList.get(SentryConstants.INDEX_GROUP_ROLES_MAP); exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1")); exceptedGroupRolesMap.put("group2", Sets.newHashSet("role1", "role2")); @@ -948,13 +949,13 @@ public class TestSentryStoreImportExport { // test the mapping data for group and role List<Map<String, Set<String>>> mapList = sentryStore.getGroupUserRoleMapList(null); Map<String, Set<String>> actualGroupRolesMap = mapList.get( - SentryStore.INDEX_GROUP_ROLES_MAP); + SentryConstants.INDEX_GROUP_ROLES_MAP); Map<String, Set<String>> exceptedGroupRolesMap = Maps.newHashMap(); exceptedGroupRolesMap.put("group1", Sets.newHashSet("role1", "role2", "role3")); verifyUserGroupRolesMap(actualGroupRolesMap, exceptedGroupRolesMap); Map<String, Set<String>> actualUserRolesMap = mapList.get( - SentryStore.INDEX_USER_ROLES_MAP); + SentryConstants.INDEX_USER_ROLES_MAP); Map<String, Set<String>> exceptedUserRolesMap = Maps.newHashMap(); exceptedUserRolesMap.put("user1", Sets.newHashSet("role1", "role2")); exceptedUserRolesMap.put("user2", Sets.newHashSet("role2", "role3"));