Package org.jtalks.jcommune.model.dto

Examples of org.jtalks.jcommune.model.dto.UserDto


    }

    @Test(expectedExceptions = NoConnectionException.class)
    public void registerUserShouldThrowNoConnectionExceptionIfPoulpeUnavailable()
            throws UnexpectedErrorException, NoConnectionException, IOException, JAXBException {
        UserDto userDto = createUserDto("user", "1234", "email@email.em");

        when(service.registerUser(userDto, false)).thenThrow(new NoConnectionException());

        plugin.registerUser(userDto, null);
    }
View Full Code Here


    }

    @Test(expectedExceptions = UnexpectedErrorException.class)
    public void registerUserShouldThrowUnexpectedErrorExceptionIfSomeErrorOccurred()
            throws UnexpectedErrorException, NoConnectionException, IOException, JAXBException {
        UserDto userDto = createUserDto("user", "1234", "email@email.em");

        when(service.registerUser(userDto, false)).thenThrow(new JAXBException(""));

        plugin.registerUser(userDto, null);
    }
View Full Code Here

        plugin.authenticate(username, password);
    }

    private UserDto createUserDto(String username, String password, String email) {
        UserDto userDto = new UserDto();
        userDto.setUsername(username);
        userDto.setEmail(email);
        userDto.setPassword(password);
        return userDto;
    }
View Full Code Here

        }
        return error;
    }

    private UserDto createUserDto(String username, String password, String email) {
        UserDto userDto = new UserDto();
        userDto.setUsername(username);
        userDto.setEmail(email);
        userDto.setPassword(password);
        return userDto;
    }
View Full Code Here

    public BindingResult register(RegisterUserDto registerUserDto)
            throws UnexpectedErrorException, NoConnectionException {
        BindingResult result = new BeanPropertyBindingResult(registerUserDto, "newUser");
        BindingResult jcErrors = new BeanPropertyBindingResult(registerUserDto, "newUser");
        validator.validate(registerUserDto, jcErrors);
        UserDto userDto = registerUserDto.getUserDto();
        String encodedPassword = (userDto.getPassword() == null || userDto.getPassword().isEmpty()) ? ""
                : encryptionService.encryptPassword(userDto.getPassword());
        userDto.setPassword(encodedPassword);
        registerByPlugin(userDto, true, result);
        mergeValidationErrors(jcErrors, result);
        if (!result.hasErrors()) {
            registerByPlugin(userDto, false, result);
            // because next http call can fail (in the interim another user was registered)
View Full Code Here

        TransactionalAuthenticator authenticatorSpy = spy(new TransactionalAuthenticator(pluginLoader, userDao, groupDao,
                realEncryptionService, mailService, avatarService, pluginService,
                securityFacade, rememberMeServices, sessionStrategy, validator, authenticationManager));

        authenticatorSpy.register(registerUserDto);
        UserDto expected = new UserDto();
        expected.setEmail("email@email.em");
        expected.setUsername("username");
        expected.setPassword(realEncryptionService.encryptPassword(password));

        verify(authenticatorSpy).registerByPlugin(refEq(expected), eq(true), any(BindingResult.class));
        verify(authenticatorSpy).storeRegisteredUser(refEq(expected));
    }
View Full Code Here

        verify(authenticatorSpy).storeRegisteredUser(refEq(expected));
    }

    private RegisterUserDto createRegisterUserDto(String username, String password, String email, String honeypotCaptcha) {
        RegisterUserDto registerUserDto = new RegisterUserDto();
        UserDto userDto = new UserDto();
        userDto.setUsername(username);
        userDto.setEmail(email);
        userDto.setPassword(password);
        registerUserDto.setUserDto(userDto);
        registerUserDto.setHoneypotCaptcha(honeypotCaptcha);
        return registerUserDto;
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.dto.UserDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.