Examples of UserImpl


Examples of org.apache.rave.portal.model.impl.UserImpl

        final String aboutMe = newUser.getAboutMe();
        final String openId = newUser.getOpenId();

        throwExceptionIfUserExists(userName, email);

        User user = new UserImpl();
        //set the required fields
        user.setUsername(userName);
        user.setEmail(email);
        String hashedPassword = passwordEncoder.encode(password);
        user.setPassword(hashedPassword);

        user.setExpired(false);
        user.setLocked(false);
        user.setEnabled(true);
        user.setDefaultPageLayout(pageLayoutService.getPageLayoutByCode(defaultPageLayoutCode));
        user.setAuthorities(authorityService.getDefaultAuthorities().getResultSet());

        //set the optional fields
        user.setGivenName(givenName);
        user.setFamilyName(familyName);
        user.setDisplayName(displayName);
        user.setStatus(status);
        user.setAboutMe(aboutMe);
        user.setOpenId(openId);

        userService.registerNewUser(user);
    }
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

        assertTrue("Can validate org.apache.rave.model.User", validator.supports(UserImpl.class));
    }

    @Test
    public void testValidate() throws Exception {
        User user = new UserImpl();
        user.setUsername(VALID_NAME);
        user.setPassword(VALID_PASSWORD);
        user.setConfirmPassword(VALID_PASSWORD);
        user.setEmail(VALID_EMAIL);

        Errors errors = new BindException(user, USER);
        validator.validate(user, errors);

        assertFalse("No errors", errors.hasErrors());
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

        assertFalse("No errors", errors.hasErrors());
    }

    @Test
    public void testValidateFailsOnEmptyPassword() throws Exception {
        User user = new UserImpl();
        user.setUsername(VALID_NAME);
        user.setEmail(VALID_EMAIL);

        Errors errors = new BindException(user, USER);
        validator.validate(user, errors);

        assertTrue("Validation errors", errors.hasErrors());
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

    }

    @Test
    public void testValidateFailsOnShortPassword() throws Exception {
        User user = new UserImpl();
        user.setUsername(VALID_NAME);
        user.setPassword("123");
        user.setPassword("123");

        Errors errors = new BindException(user, USER);
        validator.validate(user, errors);

        assertTrue("Validation errors", errors.hasErrors());
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

    }

    @Test
    public void testValidateFailsOnPasswordMismatch() throws Exception {
        User user = new UserImpl();
        user.setUsername(VALID_NAME);
        user.setPassword(VALID_PASSWORD);
        user.setConfirmPassword("DoesNotMatch");

        Errors errors = new BindException(user, USER);
        validator.validate(user, errors);

        assertTrue("Validation errors", errors.hasErrors());
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

    @Test
    public void testMapUserFromContext_new() throws Exception {
        DirContextOperations ctx = createMock(DirContextOperations.class);

        final String username = "johnldap";
        User user = new UserImpl("123", username);

        expect(userService.getUserByUsername(username)).andReturn(null).once();
        expect(ctx.attributeExists(MAIL_ATTRIBUTE_NAME)).andReturn(true);
        expect(ctx.getStringAttribute(MAIL_ATTRIBUTE_NAME)).andReturn("johnldap@example.com").times(2);
        expect(ctx.attributeExists(DISPLAY_NAME_ATTRIBUTE_NAME)).andReturn(true);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

    @Test
    public void testMapUserFromContext_new_no_displayname() throws Exception {
        DirContextOperations ctx = createMock(DirContextOperations.class);

        final String username = "johnldap";
        User user = new UserImpl("123", username);

        expect(userService.getUserByUsername(username)).andReturn(null).once();
        expect(ctx.attributeExists(MAIL_ATTRIBUTE_NAME)).andReturn(true);
        expect(ctx.getStringAttribute(MAIL_ATTRIBUTE_NAME)).andReturn("johnldap@example.com").times(2);
        expect(ctx.attributeExists(DISPLAY_NAME_ATTRIBUTE_NAME)).andReturn(false);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

    @Test
    public void testMapUserFromContext_existing() throws Exception {
        DirContextOperations ctx = createMock(DirContextOperations.class);

        final String username = "johnldap";
        User user = new UserImpl("123", username);

        expect(userService.getUserByUsername(username)).andReturn(user);
        expectLastCall();

        replay(userService);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

        assertEquals(user, userDetails);
    }

    @Test
    public void testMapUserToContext() throws Exception {
        User user = new UserImpl();
        DirContextAdapter adapter = new DirContextAdapter();

        contextMapper.mapUserToContext(user, adapter);

        assertTrue("Nothing happened", true);
View Full Code Here

Examples of org.apache.rave.portal.model.impl.UserImpl

    final UserForm User = new UserForm();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "canonical"; //specified username already exists in database
    final String password = "password";
    final String confirmPassword = password;
    final org.apache.rave.model.User existingUser = new UserImpl();
    List<ObjectError> errorList = new ArrayList<ObjectError>();
    final ObjectError error = new ObjectError("username.exists", "Username already exists");

    User.setUsername(username);
    User.setPassword(password);
    User.setConfirmPassword(confirmPassword);

    existingUser.setUsername(username);
    existingUser.setPassword(password);

    errorList.add(error);


    expect(errors.hasErrors()).andReturn(true).anyTimes();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.