@Test public void testUpdateContainer() throws Exception { assumeTrue(!useNewZNodePath); accountService = mockHelixAccountServiceFactory.getAccountService(); assertEquals("The number of account in HelixAccountService is incorrect", 0, accountService.getAllAccounts().size()); boolean res = accountService.updateAccounts(Collections.singletonList(refAccount)); assertTrue("Failed to create account", res); Container modifiedContainer = new ContainerBuilder(refContainer).setDescription("Different than before").build(); Collection<Container> updatedContainers = accountService.updateContainers(refAccountName, Collections.singleton(modifiedContainer)); assertEquals("Mismatch in return count", 1, updatedContainers.size()); assertEquals("Mismatch in container data", modifiedContainer, updatedContainers.iterator().next()); Container badContainer = new ContainerBuilder(refContainerId, "Unknown container", ContainerStatus.ACTIVE, "foo", refAccountId).build(); try { accountService.updateContainers(refAccountName, Collections.singleton(badContainer)); fail("should fail because container is not found"); } catch (AccountServiceException e) { assertEquals("Mismatch in error code", AccountServiceErrorCode.NotFound, e.getErrorCode()); } badContainer = new ContainerBuilder(refContainer).setId((short) (refContainerId + 7)).build(); try { accountService.updateContainers(refAccountName, Collections.singleton(badContainer)); fail("should fail due to wrong id"); } catch (AccountServiceException e) { assertEquals("Mismatch in error code", AccountServiceErrorCode.ResourceConflict, e.getErrorCode()); } }
@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);  }