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

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


        validPageLayout = new PageLayoutImpl();
        validPageLayout.setNumberOfRegions(4L);
        validPageLayout.setCode(VALID_LAYOUT_CODE);

        Authority role1 = new AuthorityImpl();
        role1.setAuthority("DEFAULT_ROLE1");
        Authority role2 = new AuthorityImpl();
        role2.setAuthority("DEFAULT_ROLE2");

        validAuthorityList = new ArrayList<Authority>();
        validAuthorityList.add(role1);
        validAuthorityList.add(role2);
        validAuthoritySearchResult = new SearchResult<Authority>(validAuthorityList, validAuthorityList.size());
View Full Code Here


        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

    }

    @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

        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

        verify(repository);

    }

    private static Authority createAuthority() {
        AuthorityImpl authority = new AuthorityImpl();
        authority.setAuthority("FOO");
        final long entityId = 123L;
        return authority;
    }
View Full Code Here

        return authority;
    }

    @Test
    public void getAuthorityById_NotFound() {
        AuthorityImpl authority = new AuthorityImpl();
        authority.setAuthority("BAR");
        final String entityId = "456";

        expect(repository.get(entityId)).andReturn(null);
        replay(repository);
        Authority sAuthority = service.getAuthorityById(entityId);
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.