@Test public void testCreateAndRemoveAccount() { skipIfNotGlobalAdmin(); Account account = null; try { account = createTestAccount(globalAdminClient, prefix); assertNotNull(account); assertEquals(account.getName(), prefix + "-account"); assertEquals(account.getType(), Account.Type.USER); Account updated = globalAdminClient .getAccountClient() .updateAccount(account.getName(), account.getDomainId(), prefix + "-account-2"); assertNotNull(updated); assertEquals(updated.getName(), prefix + "-account-2"); } finally { if (account != null) { globalAdminClient.getAccountClient().deleteAccount(account.getId()); } } }
@Test public void testEnableDisableAccount() { skipIfNotGlobalAdmin(); Account testAccount = null; try { testAccount = createTestAccount(globalAdminClient, prefix); AsyncCreateResponse response = domainAdminClient .getAccountClient() .disableAccount(testAccount.getName(), testAccount.getDomainId(), false); assertNotNull(response); assertTrue(jobComplete.apply(response.getJobId())); AsyncJob<Account> job = domainAdminClient.getAsyncJobClient().getAsyncJob(response.getJobId()); assertEquals(job.getResult().getState(), Account.State.DISABLED); Account updated = domainAdminClient .getAccountClient() .enableAccount(testAccount.getName(), testAccount.getDomainId()); assertNotNull(updated); assertEquals(updated.getState(), Account.State.ENABLED); } finally { if (testAccount != null) { globalAdminClient.getAccountClient().deleteAccount(testAccount.getId()); } } }