DefaultConsoleDbConfig extends AbstractConfigBean implements ConsoleDbConfig { @Override public boolean shouldSentinelCheck(String cluster, boolean disableCache) { return !sentinelCheckWhiteList(disableCache).contains(cluster); }  @PostConstruct void postConstruct(); @Override boolean isSentinelAutoProcess(); @Override boolean isAlertSystemOn(); @Override boolean ignoreMigrationSystemAvailability(); @Override boolean shouldSentinelCheck(String cluster, boolean disableCache); @Override Set<String> sentinelCheckWhiteList(boolean disableCache); static final String KEY_SENTINEL_AUTO_PROCESS; static final String KEY_ALERT_SYSTEM_ON; static final String KEY_IGNORE_MIGRATION_SYSTEM_AVAILABILITY; static final String KEY_SENTINEL_CHECK_EXCLUDE; }
@Test public void testShouldSentinelCheck() throws DalException { String key = DefaultConsoleDbConfig.KEY_SENTINEL_CHECK_EXCLUDE; String mockCluster = "test-cluster"; configModel.setKey(key).setSubKey(mockCluster); configModel.setVal("true"); service.stopSentinelCheck(configModel, 0); sleep(1000); Assert.assertTrue(consoleDbConfig.shouldSentinelCheck(mockCluster, true)); service.stopSentinelCheck(configModel, 1); Assert.assertFalse(consoleDbConfig.shouldSentinelCheck(mockCluster, true)); service.startSentinelCheck(configModel); Assert.assertTrue(consoleDbConfig.shouldSentinelCheck(mockCluster, true)); }
@Test public void testShouldSentinelCheckWithCache() throws DalException { String key = DefaultConsoleDbConfig.KEY_SENTINEL_CHECK_EXCLUDE; String mockCluster = "test-cluster"; configModel.setKey(key).setSubKey(mockCluster); configModel.setVal("true"); service.stopSentinelCheck(configModel, 1); Assert.assertFalse(consoleDbConfig.shouldSentinelCheck(mockCluster, false)); service.startSentinelCheck(configModel); Assert.assertFalse(consoleDbConfig.shouldSentinelCheck(mockCluster, false)); }