use of org.wso2.carbon.identity.test.integration.service.stub.UserDTO in project identity-governance by wso2-extensions.
the class Utils method getRecoveryUser.
public static UserDTO getRecoveryUser(User user) {
UserDTO userDTO = new UserDTO();
userDTO.setRealm(user.getUserStoreDomain());
userDTO.setTenantDomain(user.getTenantDomain());
userDTO.setUsername(user.getUserName());
return userDTO;
}
use of org.wso2.carbon.identity.test.integration.service.stub.UserDTO in project identity-governance by wso2-extensions.
the class Utils method getUserDTO.
public static UserDTO getUserDTO(User user) {
UserDTO userDTO = new UserDTO();
if (user == null) {
return userDTO;
}
userDTO.setTenantDomain(user.getTenantDomain());
if (StringUtils.isNotBlank(user.getUserStoreDomain())) {
userDTO.setRealm(user.getUserStoreDomain());
} else {
userDTO.setRealm(IdentityUtil.getPrimaryDomainName());
}
userDTO.setUsername(user.getUserName());
return userDTO;
}
use of org.wso2.carbon.identity.test.integration.service.stub.UserDTO in project identity-governance by wso2-extensions.
the class UtilsTest method buildSelfRegistrationUserDTO.
private SelfRegistrationUserDTO buildSelfRegistrationUserDTO() {
SelfRegistrationUserDTO userDTO = new SelfRegistrationUserDTO();
userDTO.setTenantDomain("testTenant");
userDTO.setUsername("testUser");
userDTO.setRealm("testRealm");
return userDTO;
}
use of org.wso2.carbon.identity.test.integration.service.stub.UserDTO in project identity-governance by wso2-extensions.
the class UsernameUpdateServiceImplTest method buildUserDTO.
private UserDTO buildUserDTO(String existingUsername, String newUsername, String userStoreDomain, String tenantDomain) {
UserDTO userDTO = new UserDTO();
userDTO.setExistingUsername(existingUsername);
userDTO.setNewUsername(newUsername);
userDTO.setUserStoreDomain(userStoreDomain);
userDTO.setTenantDomain(tenantDomain);
return userDTO;
}
use of org.wso2.carbon.identity.test.integration.service.stub.UserDTO in project identity-governance by wso2-extensions.
the class UsernameUpdateServiceImplTest method testExceptionWhileRetrievingRealm.
@Test(expectedExceptions = UsernameUpdateException.class)
public void testExceptionWhileRetrievingRealm() throws Exception {
UserDTO userDTO = buildUserDTO("testuser1", "testuser11", UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
RealmService realmService = mock(RealmService.class);
TenantManager tenantManager = mock(TenantManager.class);
when(realmService.getTenantManager()).thenReturn(tenantManager);
when(tenantManager.getTenantId(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)).thenReturn(MultitenantConstants.SUPER_TENANT_ID);
when(realmService.getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID)).thenThrow(new UserStoreException("Error while retrieving tenant realm"));
UsernameUpdateServiceImpl usernameUpdateServiceImpl = new UsernameUpdateServiceImpl();
usernameUpdateServiceImpl.setRealmService(realmService);
usernameUpdateServiceImpl.updateUsername(userDTO);
}
Aggregations