public static User createTestUser(CloudStackGlobalClient client, Account account, String prefix) { return client.getUserClient().createUser(prefix + "-user", account.getName(), "dummy2@example.com", base16().lowerCase().encode(md5().hashString("password", UTF_8).asBytes()), "First", "Last"); }
public static User createTestUser(CloudStackGlobalApi client, Account account, String prefix) { return client.getUserClient().createUser(prefix + "-user", account.getName(), "dummy2@example.com", base16().lowerCase().encode(md5().hashString("password", UTF_8).asBytes()), "First", "Last"); }
@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 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.getAccountApi().updateAccount( account.getName(), account.getDomainId(), prefix + "-account-2"); assertNotNull(updated); assertEquals(updated.getName(), prefix + "-account-2"); } finally { if (account != null) { globalAdminClient.getAccountApi().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()); } } }
@Test public void testEnableDisableAccount() { skipIfNotGlobalAdmin(); Account testAccount = null; try { testAccount = createTestAccount(globalAdminClient, prefix); AsyncCreateResponse response = domainAdminClient.getAccountApi() .disableAccount(testAccount.getName(), testAccount.getDomainId(), false); assertNotNull(response); assertTrue(adminJobComplete.apply(response.getJobId())); AsyncJob<Account> job = domainAdminClient.getAsyncJobApi().getAsyncJob(response.getJobId()); assertEquals(job.getResult().getState(), Account.State.DISABLED); Account updated = domainAdminClient.getAccountApi() .enableAccount(testAccount.getName(), testAccount.getDomainId()); assertNotNull(updated); assertEquals(updated.getState(), Account.State.ENABLED); } finally { if (testAccount != null) { globalAdminClient.getAccountApi().deleteAccount(testAccount.getId()); } } }
protected void checkAccount(Account account) { assert account.getId() != null : account; assertEquals(account.toString(), client.getAccountClient().getAccount(account.getId()).toString()); assert account.getName() != null : account; assert account.getType() != null && account.getType() != Account.Type.UNRECOGNIZED : account; assert account.getDomain() != null : account;
.IPs(in.getIPs()) .cleanupRequired(in.isCleanupRequired()) .name(in.getName()) .receivedBytes(in.getReceivedBytes()) .sentBytes(in.getSentBytes())
protected void checkAccount(Account account) { assert account.getId() != null : account; assertEquals(account.toString(), client.getAccountApi().getAccount(account.getId()).toString()); assert account.getName() != null : account; assert account.getType() != null && account.getType() != Account.Type.UNRECOGNIZED : account; assert account.getDomain() != null : account;
.IPs(in.getIPs()) .cleanupRequired(in.isCleanupRequired()) .name(in.getName()) .receivedBytes(in.getReceivedBytes()) .sentBytes(in.getSentBytes())
.IPs(in.getIPs()) .cleanupRequired(in.isCleanupRequired()) .name(in.getName()) .receivedBytes(in.getReceivedBytes()) .sentBytes(in.getSentBytes())