@Test public void testStartWithBackupFiles() throws Exception { testUpdateAccount(); if (accountService != null) { accountService.close(); } deleteStoreIfExists(); if (helixConfigProps.containsKey(HelixAccountServiceConfig.BACKUP_DIRECTORY_KEY)) { File[] files = accountBackupDir.toFile() .listFiles(path -> BackupFileManager.versionFilenamePattern.matcher(path.getName()).find()); assertTrue("UpdateAccount should create backup files", files.length > 0); helixConfigProps.put(HelixAccountServiceConfig.ENABLE_SERVE_FROM_BACKUP, "true"); vHelixConfigProps = new VerifiableProperties(helixConfigProps); storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps); String updaterThreadPrefix = UUID.randomUUID().toString(); MockHelixAccountServiceFactory mockHelixAccountServiceFactory = new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, updaterThreadPrefix, mockRouter); accountService = mockHelixAccountServiceFactory.getAccountService(); assertNotNull("Backup files should have data", accountService.getAllAccounts()); assertEquals("Number of accounts from backup mismatch", accountService.getAllAccounts().size(), 1 + NUM_REF_ACCOUNT); } }
@Override public void close() { if (open.compareAndSet(true, false)) { if (notifier != null) { notifier.unsubscribe(ACCOUNT_METADATA_CHANGE_TOPIC, changeTopicListener); } if (scheduler != null) { shutDownExecutorService(scheduler, config.updaterShutDownTimeoutMs, TimeUnit.MILLISECONDS); } helixStore.stop(); } }
HelixAccountService extends AbstractAccountService implements AccountService { @Override public void close() { if (open.compareAndSet(true, false)) { if (notifier != null) { notifier.unsubscribe(ACCOUNT_METADATA_CHANGE_TOPIC, changeTopicListener); } if (scheduler != null) { shutDownExecutorService(scheduler, config.updaterShutDownTimeoutMs, TimeUnit.MILLISECONDS); } helixStore.stop(); } } }
HelixAccountService extends AbstractAccountService implements AccountService { @Override public void close() { if (open.compareAndSet(true, false)) { if (notifier != null) { notifier.unsubscribe(ACCOUNT_METADATA_CHANGE_TOPIC, changeTopicListener); } if (scheduler != null) { shutDownExecutorService(scheduler, config.updaterShutDownTimeoutMs, TimeUnit.MILLISECONDS); } helixStore.stop(); } } HelixAccountService(HelixPropertyStore<ZNRecord> helixStore, AccountServiceMetrics accountServiceMetrics,
      Notifier<String> notifier, ScheduledExecutorService scheduler, HelixAccountServiceConfig config); }
HelixAccountService extends AbstractAccountService implements AccountService { @Override public void close() { if (open.compareAndSet(true, false)) { if (notifier != null) { notifier.unsubscribe(ACCOUNT_METADATA_CHANGE_TOPIC, changeTopicListener); } if (scheduler != null) { shutDownExecutorService(scheduler, config.updaterShutDownTimeoutMs, TimeUnit.MILLISECONDS); } helixStore.stop(); } } HelixAccountService(HelixPropertyStore<ZNRecord> helixStore, AccountServiceMetrics accountServiceMetrics,
      Notifier<String> notifier, ScheduledExecutorService scheduler, HelixAccountServiceConfig config); void setupRouter(final Router router); @Override boolean updateAccounts(Collection<Account> accounts); @Override void close(); void selectInactiveContainersAndMarkInZK(StatsSnapshot statsSnapshot); }
HelixAccountService extends AbstractAccountService implements AccountService { @Override public void close() { if (open.compareAndSet(true, false)) { if (notifier != null) { notifier.unsubscribe(ACCOUNT_METADATA_CHANGE_TOPIC, changeTopicListener); } if (scheduler != null) { shutDownExecutorService(scheduler, config.updaterShutDownTimeoutMs, TimeUnit.MILLISECONDS); } helixStore.stop(); } } HelixAccountService(HelixPropertyStore<ZNRecord> helixStore, AccountServiceMetrics accountServiceMetrics,
      Notifier<String> notifier, ScheduledExecutorService scheduler, HelixAccountServiceConfig config); void setupRouter(final Router router); @Override boolean updateAccounts(Collection<Account> accounts); @Override void close(); void selectInactiveContainersAndMarkInZK(StatsSnapshot statsSnapshot);  }