HMSFollower implements Runnable, AutoCloseable, PubSub.Subscriber { @VisibleForTesting String getAuthServerName() { return notificationProcessor.getAuthServerName(); } HMSFollower(Configuration conf, SentryStoreInterface store, LeaderStatusMonitor leaderMonitor,
              HiveConnectionFactory hiveConnectionFactory); @VisibleForTesting  HMSFollower(Configuration conf, SentryStoreInterface store, LeaderStatusMonitor leaderMonitor,
              HiveConnectionFactory hiveConnectionFactory, String authServerName); @VisibleForTesting static boolean isConnectedToHms(); @Override void close(); @Override void run(); void processNotifications(Collection<NotificationEvent> events); @Override void onMessage(PubSub.Topic topic, String message);  }
@Test public void testInputConfigurationGetInputAuthServerName() { Configuration sentryConfiguration = new Configuration(); HMSFollower hmsFollower = new HMSFollower(sentryConfiguration, sentryStore, null, hiveConnectionFactory, hiveInstance); String authServerName = hmsFollower.getAuthServerName(); Assert.assertEquals(true, authServerName.equals(hiveInstance)); }
@Test public void testNoConfigurationGetDefaultAuthServerName() { Configuration sentryConfiguration = new Configuration(); HMSFollower hmsFollower = new HMSFollower(sentryConfiguration, sentryStore, null, hiveConnectionFactory, null); String authServerName = hmsFollower.getAuthServerName(); Assert.assertEquals(true, authServerName.equals(AuthzConfVars.AUTHZ_SERVER_NAME_DEPRECATED.getDefault())); }
@Test public void testNewNameConfigurationGetAuthServerName() { String serverName = "newServer"; Configuration sentryConfiguration = new Configuration(); sentryConfiguration.set(HiveAuthzConf.AuthzConfVars.AUTHZ_SERVER_NAME.getVar(), serverName); HMSFollower hmsFollower = new HMSFollower(sentryConfiguration, sentryStore, null, hiveConnectionFactory, null); String authServerName = hmsFollower.getAuthServerName(); Assert.assertEquals(true, authServerName.equals(serverName)); }
@Test public void testOldNameConfigurationGetAuthServerName() { String serverName = "oldServer"; Configuration sentryConfiguration = new Configuration(); sentryConfiguration.set(AuthzConfVars.AUTHZ_SERVER_NAME_DEPRECATED.getVar(), serverName); HMSFollower hmsFollower = new HMSFollower(sentryConfiguration, sentryStore, null, hiveConnectionFactory, null); String authServerName = hmsFollower.getAuthServerName(); Assert.assertEquals(true, authServerName.equals(serverName)); }