org.wso2.carbon.identity.user.registration.stub.dto.UserDTO Java Examples

The following examples show how to use org.wso2.carbon.identity.user.registration.stub.dto.UserDTO. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserRegistrationAdminServiceClient.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Add new user.
 * @param username Username of the user.
 * @param password Password of the user.
 * @param userFields User fields to be updated.
 * @throws RemoteException
 * @throws UserRegistrationAdminServiceException
 */
public void addUser(String username, char[] password, List<UserFieldDTO> userFields) throws RemoteException,
        UserRegistrationAdminServiceException {

    UserDTO userDTO = new UserDTO();
    userDTO.setUserName(username);
    userDTO.setPassword(new String(password));

    userDTO.setUserFields(userFields.toArray(new UserFieldDTO[userFields.size()]));
    stub.addUser(userDTO);
}
 
Example #2
Source File: UserRegistrationAdminServiceClient.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Add new user.
 *
 * @param username   Username of the user.
 * @param password   Password of the user.
 * @param userFields User fields to be updated.
 * @throws java.rmi.RemoteException
 * @throws UserRegistrationAdminServiceException
 */
public void addUser(String username, char[] password, List<UserFieldDTO> userFields) throws RemoteException,
                                                                                            UserRegistrationAdminServiceException {

    UserDTO userDTO = new UserDTO();
    userDTO.setUserName(username);
    userDTO.setPassword(new String(password));

    userDTO.setUserFields(userFields.toArray(new UserFieldDTO[userFields.size()]));
    stub.addUser(userDTO);
}
 
Example #3
Source File: UserRegistrationAdminServiceClient.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Add new user.
 * @param username Username of the user.
 * @param password Password of the user.
 * @param userFields User fields to be updated.
 * @throws RemoteException
 * @throws UserRegistrationAdminServiceException
 */
public void addUser(String username, char[] password, List<UserFieldDTO> userFields) throws RemoteException,
        UserRegistrationAdminServiceException {

    UserDTO userDTO = new UserDTO();
    userDTO.setUserName(username);
    userDTO.setPassword(new String(password));

    userDTO.setUserFields(userFields.toArray(new UserFieldDTO[userFields.size()]));
    stub.addUser(userDTO);
}
 
Example #4
Source File: UserSignUpWorkflowExecutor.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * Method to add user to userStore
 * @param serverURL
 * @param userDTO
 * @throws Exception
 */
public void addUserToUserStore(String serverURL, UserDTO userDTO) throws RemoteException, UserRegistrationAdminServiceException {
	if (log.isDebugEnabled()) {
		log.debug("Adding to user store user :" + userDTO.getUserName());
	}
       UserRegistrationAdminServiceStub stub = new UserRegistrationAdminServiceStub(null, serverURL +
               "UserRegistrationAdminService");
       ServiceClient client = stub._getServiceClient();
       Options option = client.getOptions();
       option.setManageSession(true);

       stub.addUser(userDTO);

}
 
Example #5
Source File: UserSignUpWorkflowExecutorTest.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
@Test
public void testAddingUsersToUserStore() throws UserStoreException, RemoteException, UserAdminUserAdminException {
    try {
        UserSignUpWorkflowExecutor userSignUpWorkflowExecutor = new UserSignUpWSWorkflowExecutor();
        userSignUpWorkflowExecutor.addUserToUserStore(serverURL, new UserDTO());
        Assert.assertTrue(true);
    } catch (Exception e) {
        Assert.fail("Unexpected exception occurred while adding users to user store");
    }
}
 
Example #6
Source File: UserSignUpWorkflowExecutorTest.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
@Test
public void testFailureToAddUsersToUserStoreWhenRemoteServiceCallFailed() throws UserStoreException,
        RemoteException, UserAdminUserAdminException, UserRegistrationAdminServiceException {
    PowerMockito.doThrow(new RemoteException("Exception occurred while adding user to user store")).when
            (userRegistrationAdminServiceStub).addUser((UserDTO) Mockito
            .anyObject());
    try {
        UserSignUpWorkflowExecutor userSignUpWorkflowExecutor = new UserSignUpWSWorkflowExecutor();
        userSignUpWorkflowExecutor.addUserToUserStore(serverURL, new UserDTO());
        Assert.fail("Expected exception has been not thrown while adding user to user store");
    } catch (Exception e) {
        Assert.assertEquals(e.getMessage(), "Exception occurred while adding user to user store");
    }
}