Package org.openengsb.domain.userprojects.model

Examples of org.openengsb.domain.userprojects.model.Role


        deleteRolesFromPersistence(roles);
    }

    @Override
    public void deleteRoleByName(String roleName) {
        deleteRole(new Role(roleName));
    }
View Full Code Here


    @Override
    public void deleteRolesByName(List<String> roleNames) {
        List<Role> roles = Lists.newArrayList();

        for (String roleName : roleNames) {
            roles.add(new Role(roleName));
        }

        deleteRoles(roles);
    }
View Full Code Here

    }

    private List<Role> createRoles(List<Entry> roleEntries) throws NoSuchNodeException, MissingParentException {
        List<Role> roles = Lists.newArrayList();
        for (Entry entry : roleEntries) {
            Role role = new Role();
            role.setName(entry.getDn().getRdn().getValue().getString());
            role.setPermissions(getNamesOfDirectChildren(ldapDao.getDirectChildren(DnFactory.rolePermissions(role))));
            role.setRoles(getNamesOfDirectChildren(ldapDao.getDirectChildren(DnFactory.roleSubroles(role))));
            roles.add(role);
        }
        return roles;
    }
View Full Code Here

    }
   
    @Test
    @Ignore
    public void testFindRoles() throws InterruptedException {
        Role role = createTestRole();
        List<Role> expected = Arrays.asList(role);
        ldapService.updateRoles(expected);
        assertTrue(CollectionUtils.isEqualCollection(modelManager.findRoles(), expected));
    }
View Full Code Here

    }

    @Test
    public void testUpdateRoles_shouldCreateRole() throws LdapInvalidAttributeValueException,
        NoSuchNodeException, MissingParentException {
        Role role = createTestRole();
        ldapService.updateRoles(Lists.newArrayList(role));
        assertThat(ldapDao.exists(DnFactory.role(role)), is(true));
        assertCorrectlyStored(role);
    }
View Full Code Here

    }

    @Test
    public void testUpdateRoles_shouldUpdateRole() throws LdapInvalidAttributeValueException,
        NoSuchNodeException, MissingParentException {
        Role role = createTestRole();
        ldapService.updateRoles(Lists.newArrayList(role));
        role.getPermissions().add("update");
        role.getRoles().clear();
        ldapService.updateRoles(Lists.newArrayList(role));
        assertCorrectlyStored(role);
    }
View Full Code Here

        assertThat(ldapDao.exists(dn), is(false));
    }

    @Test
    public void testDeleteRoles_shouldDelete() {
        Role role = createTestRole();
        List<Role> list = Lists.newArrayList(role);
        ldapService.updateRoles(list);
        Dn dn = DnFactory.role(role);
        assertThat(ldapDao.exists(dn), is(true));
        ldapService.deleteRoles(list);
View Full Code Here

        project.setAttributes(Lists.newArrayList(createTestAttribute("att", "val1", "val2")));
        return project;
    }

    protected Role createTestRole() {
        Role role = new Role();
        role.setName("role");
        role.setPermissions(Lists.newArrayList("perm1", "perm2"));
        role.setRoles(Lists.newArrayList("subrole"));
        return role;
    }
View Full Code Here

TOP

Related Classes of org.openengsb.domain.userprojects.model.Role

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.