Package org.apache.rave.portal.model.impl

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


        assertTrue(user.getAuthorityCodes().isEmpty());
    }

    @Test
    public void setAuthorities_Valid(){
        Authority auth = new AuthorityImpl();
        auth.setAuthority("auth");
        user.setAuthorities(Arrays.asList(auth));

        assertNotNull(user.getAuthorityCodes());
        assertThat(user.getAuthorityCodes().get(0), is(sameInstance(auth.getAuthority())));
    }
View Full Code Here


        assertTrue(granted.size() == 1);
    }

    @Test
    public void addAuthority_Valid(){
        Authority authority = new AuthorityImpl();
        authority.setAuthority("auth");
        user.addAuthority(authority);
        assertTrue(user.getAuthorityCodes().contains(authority.getAuthority()));
    }
View Full Code Here

        assertTrue(user.getAuthorityCodes().contains(authority.getAuthority()));
    }

    @Test
    public void addAuthority_Contains(){
        Authority authority = new AuthorityImpl();
        authority.setAuthority("auth");
        List<String> authorityCodes = Arrays.asList(authority.getAuthority());
        user.setAuthorityCodes(authorityCodes);
        user.addAuthority(authority);
    }
View Full Code Here

        user.addAuthority(authority);
    }

    @Test
    public void removeAuthority_Valid(){
        Authority auth = new AuthorityImpl();
        auth.setAuthority("stinky");
        user.setAuthorityCodes(new ArrayList<String>());
        user.getAuthorityCodes().add("stinky");

        user.removeAuthority(auth);
View Full Code Here

        assertFalse(user.getAuthorityCodes().contains("stinky"));
    }

    @Test
    public void removeAuthority_NotContain(){
        Authority auth = new AuthorityImpl();
        user.removeAuthority(auth);
        assertNotNull(user.getAuthorityCodes());
    }
View Full Code Here

        assertNotNull(authority);
    }

    @Test
    public void convert_Valid(){
        Authority authority = new AuthorityImpl();
        authority.setAuthority("asd;lkfjlkj");
        authority.setDefaultForNewUser(true);

        MongoDbAuthority converted = authorityConverter.convert(authority);
        assertNotNull(converted.getAuthority());
        //assertNotNull(converted.getId());
        assertThat(converted.getAuthority(), is(sameInstance(authority.getAuthority())));
        assertThat(converted.isDefaultForNewUser(), is(sameInstance(authority.isDefaultForNewUser())));

        Authority authorityMongo = new MongoDbAuthority();
        authorityMongo.setAuthority("authority");
        authorityMongo.setDefaultForNewUser(true);
        MongoDbAuthority mongoConverted = authorityConverter.convert(authorityMongo);
View Full Code Here

        return new SearchResult<User>(users, totalResult);
    }

    private static SearchResult<Authority> createSearchResultWithTwoAuthorities() {
        List<Authority> authorities = new ArrayList<Authority>();
        Authority foo = new AuthorityImpl();
        foo.setAuthority("FOO");
        Authority bar = new AuthorityImpl();
        bar.setAuthority("BAR");
        authorities.add(foo);
        authorities.add(bar);
        return new SearchResult<Authority>(authorities, authorities.size());
    }
View Full Code Here

    }

    private void updateAuthorities(User source, JpaUser converted) {
        converted.getAuthorities().clear();
        for(GrantedAuthority grantedAuthority : source.getAuthorities()) {
            converted.addAuthority(grantedAuthority instanceof Authority ? (Authority)grantedAuthority : new AuthorityImpl(grantedAuthority));
        }
    }
View Full Code Here

        template.setExpired(true);
        template.setLocked(true);
        template.setOpenId("TEST_O");
        template.setForgotPasswordHash("TEST_P");
        template.setForgotPasswordTime(new Date());
        template.addAuthority(new AuthorityImpl(new SimpleGrantedAuthority("HOO")));


        JpaUser jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
View Full Code Here

    }

    @Test
    public void setAuthenticatedUser_validRole() {
        final User authUser = new UserImpl(USER_ID);
        final Authority userRole = new AuthorityImpl();
        userRole.setAuthority("admin");
        authUser.addAuthority(userRole);
        expect(userRepository.get(USER_ID)).andReturn(authUser).anyTimes();
        replay(userRepository);

        service.setAuthenticatedUser(USER_ID);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.impl.AuthorityImpl

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.