@Test public void testGetContainerByStatus() throws Exception { Set<Short> accountIdSet = new HashSet<>(); refAccountId = Utils.getRandomShort(random); accountIdSet.add(refAccountId); generateRefAccounts(idToRefAccountMap, idToRefContainerMap, accountIdSet, 5, 2); accountService = mockHelixAccountServiceFactory.getAccountService(); accountService.updateAccounts(idToRefAccountMap.values()); assertAccountsInAccountService(idToRefAccountMap.values(), 5, accountService); List<Account> accountsToUpdate = new ArrayList<>(); int cnt = 0; for (Account account : accountService.getAllAccounts()) { AccountBuilder accountBuilder = new AccountBuilder(account); for (Container container : account.getAllContainers()) { if (cnt % 2 == 0) { ContainerBuilder containerBuilder = new ContainerBuilder(container); containerBuilder.setId((short) (-1 * (container.getId()))); containerBuilder.setName(container.getName() + "-extra"); containerBuilder.setStatus(ContainerStatus.DELETE_IN_PROGRESS); containerBuilder.setDescription(container.getDescription() + "--extra"); containerBuilder.setReplicationPolicy(container.getReplicationPolicy() + "---extra"); containerBuilder.setTtlRequired(container.isTtlRequired()); accountBuilder.addOrUpdateContainer(containerBuilder.build()); } cnt++; } accountsToUpdate.add(accountBuilder.build()); } updateAccountsAndAssertAccountExistence(accountsToUpdate, 5, true); Set<Container> containerList = accountService.getContainersByStatus(ContainerStatus.DELETE_IN_PROGRESS); assertEquals("Wrong number of containers in containerList", 5, containerList.size()); for (Container container : containerList) { assertSame("Container status mismatch", container.getStatus(), ContainerStatus.DELETE_IN_PROGRESS); } }
@Override public boolean updateAccounts(Collection<Account> accounts) { return updateAccountsWithAccountMetadataStore(accounts, accountMetadataStore); }
HelixAccountService extends AbstractAccountService implements AccountService { @Override public boolean updateAccounts(Collection<Account> accounts) { return updateAccountsWithAccountMetadataStore(accounts, accountMetadataStore); } }
HelixAccountService extends AbstractAccountService implements AccountService { @Override public boolean updateAccounts(Collection<Account> accounts) { return updateAccountsWithAccountMetadataStore(accounts, accountMetadataStore); } HelixAccountService(HelixPropertyStore<ZNRecord> helixStore, AccountServiceMetrics accountServiceMetrics,
      Notifier<String> notifier, ScheduledExecutorService scheduler, HelixAccountServiceConfig config); }
HelixAccountService extends AbstractAccountService implements AccountService { @Override public boolean updateAccounts(Collection<Account> accounts) { return updateAccountsWithAccountMetadataStore(accounts, accountMetadataStore); } 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 boolean updateAccounts(Collection<Account> accounts) { return updateAccountsWithAccountMetadataStore(accounts, accountMetadataStore); } 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);  }