Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.JpaUser


    public Class<User> getSourceType() {
        return User.class;
    }

    private JpaUser createEntity(User source) {
        JpaUser converted = null;
        if (source != null) {
            converted = new JpaUser();
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here


        Authority authority = repository.getByAuthority(authorityName);
        assertNotNull(authority);
        assertEquals(authorityName, authority.getAuthority());
        assertTrue(authority.getUsers().isEmpty());

        User newUser = new JpaUser();
        newUser.setUsername("adminuser");
        newUser.addAuthority(authority);
        newUser = userRepository.save(newUser);
        assertEquals(authority, newUser.getAuthorities().iterator().next());

        authority = repository.getByAuthority(authorityName);
        assertEquals(1, authority.getUsers().size());
    }
View Full Code Here

        assertThat(user, is(nullValue()));
    }

    @Test
    public void getByUsername_valid() {
        JpaUser user = (JpaUser)repository.getByUsername(USER_NAME);
        assertThat(user, notNullValue());
        assertThat(user.getEntityId(), is(equalTo(USER_ID)));
        assertThat(true, is(passwordEncoder.matches(USER_NAME, user.getPassword())));
        assertThat(user.isAccountNonExpired(), is(true));
        assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }
View Full Code Here

        assertThat(user, is(nullValue()));
    }

    @Test
    public void getByUserEmail_valid() {
        JpaUser user = (JpaUser)repository.getByUserEmail(USER_EMAIL);
        assertThat(user, notNullValue());
        assertThat(user.getEntityId(), is(equalTo(USER_ID)));
        assertThat(true, is(passwordEncoder.matches(USER_NAME, user.getPassword())));
        assertThat(user.isAccountNonExpired(), is(true));
        assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }
View Full Code Here

        assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }
   
    @Test
    public void getByOpenId_valid() {
        JpaUser user = (JpaUser)repository.getByOpenId(OPENID);
        assertThat(user, notNullValue());
        assertThat(user.getEntityId(), is(equalTo(USER_ID_OPENID_USER)));
        assertThat(user.isAccountNonExpired(), is(true));
        assertThat(user.getOpenId(), is(equalTo(OPENID)));
    }
View Full Code Here

    public void addOrDeleteUserDoesNotAffectAuthority() {
        Authority authority = authorityRepository.get("1");
        Assert.assertNotNull("Existing authority", authority);

        int usercount = authority.getUsers().size();
        User user = new JpaUser();
        user.setUsername("dummy");
        authority.addUser(user);
        authorityRepository.save(authority);
        assertNull("Persisting an Authority does not persist an unknown user", repository.getByUsername("dummy"));
        Assert.assertEquals("Authority has 1 more user", usercount + 1, authority.getUsers().size());
View Full Code Here

        return manager.find(JpaUser.class, primaryKey);
    }

    @Override
    public User save(User item) {
        JpaUser converted = converter.convert(item);
        return saveOrUpdate(converted.getEntityId(), manager, converted);
    }
View Full Code Here

    public Class<User> getSourceType() {
        return User.class;
    }

    private JpaUser createEntity(User source) {
        JpaUser converted = null;
        if (source != null) {
            converted = new JpaUser();
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

        return manager.find(JpaUser.class, id);
    }

    @Override
    public User save(User item) {
        JpaUser converted = converter.convert(item);
        return saveOrUpdate(converted.getEntityId(), manager, converted);
    }
View Full Code Here

        assertThat(user, is(nullValue()));
    }

    @Test
    public void getByUsername_valid() {
        JpaUser user = (JpaUser)repository.getByUsername(USER_NAME);
        assertThat(user, notNullValue());
        assertThat(user.getEntityId(), is(equalTo(USER_ID)));
        assertThat(true, is(passwordEncoder.matches(USER_NAME, user.getPassword())));
        assertThat(user.isAccountNonExpired(), is(true));
        assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.JpaUser

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.