private void checkUser(User user) { assert user.getId() != null; assert user.getAccount() != null; assert user.getDomain() != null; }
private void checkUser(User user) { assert user.getId() != null; assert user.getAccount() != null; assert user.getDomain() != null; }
@Test public void testCreateUser() { skipIfNotGlobalAdmin(); Account testAccount = createTestAccount(globalAdminClient, prefix); User testUser = null; try { testUser = createTestUser(globalAdminClient, testAccount, prefix); assertNotNull(testUser); assertEquals(testUser.getName(), prefix + "-user"); assertEquals(testUser.getAccount(), prefix + "-account"); User updatedUser = globalAdminClient.getUserClient() .updateUser(testUser.getId(), userName(prefix + "-user-2")); assertNotNull(updatedUser); assertEquals(updatedUser.getName(), prefix + "-user-2"); ApiKeyPair apiKeys = globalAdminClient.getUserClient() .registerUserKeys(updatedUser.getId()); assertNotNull(apiKeys.getApiKey()); assertNotNull(apiKeys.getSecretKey()); checkAuthAsUser(apiKeys); } finally { if (testUser != null) { globalAdminClient.getUserClient().deleteUser(testUser.getId()); } globalAdminClient.getAccountClient().deleteAccount(testAccount.getId()); } }
testUser = createTestUser(globalAdminClient, testAccount, prefix); AsyncCreateResponse response = domainAdminClient.getUserClient().disableUser(testUser.getId()); assertNotNull(response); assertTrue(jobComplete.apply(response.getJobId())); assertEquals(job.getResult().getState(), User.State.DISABLED); User updated = domainAdminClient.getUserClient().enableUser(testUser.getId()); assertNotNull(updated); assertEquals(updated.getState(), User.State.ENABLED); globalAdminClient.getUserClient().deleteUser(testUser.getId());
@Test public void testCreateContextUsingUserAndPasswordAuthentication() { skipIfNotGlobalAdmin(); Account testAccount = null; User testUser = null; String prefix = this.prefix + "-session"; try { testAccount = createTestAccount(globalAdminClient, prefix); testUser = createTestUser(globalAdminClient, testAccount, prefix); String expectedUsername = prefix + "-user"; assertEquals(testUser.getName(), expectedUsername); checkLoginAsTheNewUser(expectedUsername); ApiKeyPair expected = globalAdminClient.getUserClient().registerUserKeys(testUser.getId()); ApiKeyPair actual = ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair( URI.create(endpoint), prefix + "-user", "password", ""); assertEquals(actual, expected); } finally { if (testUser != null) globalAdminClient.getUserClient().deleteUser(testUser.getId()); if (testAccount != null) globalAdminClient.getAccountClient().deleteAccount(testAccount.getId()); } }
testUser = createTestUser(globalAdminClient, testAccount, prefix); AsyncCreateResponse response = domainAdminClient.getUserClient().disableUser(testUser.getId()); assertNotNull(response); assertTrue(adminJobComplete.apply(response.getJobId())); assertEquals(job.getResult().getState(), User.State.DISABLED); User updated = domainAdminClient.getUserClient().enableUser(testUser.getId()); assertNotNull(updated); assertEquals(updated.getState(), User.State.ENABLED); globalAdminClient.getUserClient().deleteUser(testUser.getId());
@Test public void testCreateUser() { skipIfNotGlobalAdmin(); Account testAccount = createTestAccount(globalAdminClient, prefix); User testUser = null; try { testUser = createTestUser(globalAdminClient, testAccount, prefix); assertNotNull(testUser); assertEquals(testUser.getName(), prefix + "-user"); assertEquals(testUser.getAccount(), prefix + "-account"); User updatedUser = globalAdminClient.getUserClient() .updateUser(testUser.getId(), userName(prefix + "-user-2")); assertNotNull(updatedUser); assertEquals(updatedUser.getName(), prefix + "-user-2"); ApiKeyPair apiKeys = globalAdminClient.getUserClient() .registerUserKeys(updatedUser.getId()); assertNotNull(apiKeys.getApiKey()); assertNotNull(apiKeys.getSecretKey()); checkAuthAsUser(apiKeys); } finally { if (testUser != null) { globalAdminClient.getUserClient().deleteUser(testUser.getId()); } globalAdminClient.getAccountApi().deleteAccount(testAccount.getId()); } }
@Test public void testCreateContextUsingUserAndPasswordAuthentication() { skipIfNotGlobalAdmin(); Account testAccount = null; User testUser = null; String prefix = this.prefix + "-session"; try { testAccount = createTestAccount(globalAdminClient, prefix); testUser = createTestUser(globalAdminClient, testAccount, prefix); String expectedUsername = prefix + "-user"; assertEquals(testUser.getName(), expectedUsername); checkLoginAsTheNewUser(expectedUsername); ApiKeyPair expected = globalAdminClient.getUserClient().registerUserKeys(testUser.getId()); ApiKeyPair actual = ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair( URI.create(endpoint), prefix + "-user", "password", ""); assertEquals(actual, expected); } finally { if (testUser != null) globalAdminClient.getUserClient().deleteUser(testUser.getId()); if (testAccount != null) globalAdminClient.getAccountApi().deleteAccount(testAccount.getId()); } }
public T fromUser(User in) { return this .id(in.getId()) .name(in.getName()) .firstName(in.getFirstName()) .lastName(in.getLastName()) .email(in.getEmail()) .created(in.getCreated()) .state(in.getState()) .account(in.getAccount()) .accountType(in.getAccountType()) .domain(in.getDomain()) .domainId(in.getDomainId()) .timeZone(in.getTimeZone()) .apiKey(in.getApiKey()) .secretKey(in.getSecretKey()); } }
public T fromUser(User in) { return this .id(in.getId()) .name(in.getName()) .firstName(in.getFirstName()) .lastName(in.getLastName()) .email(in.getEmail()) .created(in.getCreated()) .state(in.getState()) .account(in.getAccount()) .accountType(in.getAccountType()) .domain(in.getDomain()) .domainId(in.getDomainId()) .timeZone(in.getTimeZone()) .apiKey(in.getApiKey()) .secretKey(in.getSecretKey()); } }
public T fromUser(User in) { return this .id(in.getId()) .name(in.getName()) .firstName(in.getFirstName()) .lastName(in.getLastName()) .email(in.getEmail()) .created(in.getCreated()) .state(in.getState()) .account(in.getAccount()) .accountType(in.getAccountType()) .domain(in.getDomain()) .domainId(in.getDomainId()) .timeZone(in.getTimeZone()) .apiKey(in.getApiKey()) .secretKey(in.getSecretKey()); } }
assert user.getLastName() != null : user; assert user.getFirstName() != null : user; assert user.getId() != null : user; assert user.getState() != null : user;
assert user.getLastName() != null : user; assert user.getFirstName() != null : user; assert user.getId() != null : user; assert user.getState() != null : user;