Package org.jtalks.jcommune.plugin.auth.poulpe.dto

Examples of org.jtalks.jcommune.plugin.auth.poulpe.dto.User


        server.stop();
    }

    @Test
    public void testSendRegistrationRequestShouldBeSuccessful() throws Exception {
        User user = createUser("username", "passwordHash", "email@email.ru");
        whenHttp(server).match(post(regUrl)).then(status(HttpStatus.OK_200));

        ClientResource clientResource = service.sendRegistrationRequest(user, true);

        assertEquals(clientResource.getStatus().getCode(), HttpStatus.OK_200.getStatusCode());
View Full Code Here


        assertEquals(clientResource.getStatus().getCode(), HttpStatus.OK_200.getStatusCode());
    }

    @Test
    public void testSendRegistrationRequestWithBadResponseShouldFail() throws Exception {
        User user = createUser("username", "passwordHash", "email.ru");
        whenHttp(server).match(post(regUrl)).then(status(HttpStatus.INTERNAL_SERVER_ERROR_500));

        ClientResource clientResource = service.sendRegistrationRequest(user, true);

        assertEquals(clientResource.getStatus().getCode(), HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode());
View Full Code Here

        assertEquals(clientResource.getStatus().getCode(), HttpStatus.INTERNAL_SERVER_ERROR_500.getStatusCode());
    }

    @Test
    public void testSendRegistrationRequestWithValidationErrorResponseShouldFail() throws Exception {
        User user = createUser("username", "passwordHash", "email.ru");
        whenHttp(server).match(post(regUrl)).then(status(HttpStatus.BAD_REQUEST_400));

        ClientResource clientResource = service.sendRegistrationRequest(user, true);

        assertEquals(clientResource.getStatus().getCode(), HttpStatus.BAD_REQUEST_400.getStatusCode());
View Full Code Here

        assertEquals(clientResource.getStatus().getCode(), HttpStatus.NOT_FOUND_404.getStatusCode());
    }

    private User createUser(String username, String password, String email) {
        User user = new User();
        user.setUsername(username);
        user.setPasswordHash(password);
        user.setEmail(email);
        return user;
    }
View Full Code Here

     * @param dryRun  do not register the user, just check if it is possible
     * @return errors
     */
    public Map<String, String> registerUser(UserDto userDto, Boolean dryRun)
            throws IOException, NoConnectionException, JAXBException, UnexpectedErrorException {
        User user = createUser(userDto.getUsername(), userDto.getPassword(), userDto.getEmail());
        ClientResource clientResource = sendRegistrationRequest(user, dryRun);
        Map<String, String> result = getRegistrationResult(clientResource, userDto.getLanguage().getLocale());
        closeRestletConnection(clientResource);
        return result;
    }
View Full Code Here

     * @param passwordHash password hash
     * @param email        user email
     * @return user entity
     */
    private User createUser(String username, String passwordHash, String email) {
        User user = new User();
        user.setUsername(username == null ? "" : username);
        user.setEmail(email == null ? "" : email);
        user.setPasswordHash(passwordHash);
        return user;
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.plugin.auth.poulpe.dto.User

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.