Package org.encuestame.utils.web

Examples of org.encuestame.utils.web.UnitPermission


    /**
     * Test {@link UnitPermission}.
     */
    @Test
    public void testUnitPermission(){
        final UnitPermission permission = new UnitPermission(1L);
        permission.setId(1L);
        permission.setDescription("description");
        permission.setPermission("admin");
        assertNotNull(permission.getId());
        assertNotNull(permission.getDescription());
        assertNotNull(permission.getPermission());
        new UnitPermission();
    }
View Full Code Here


     */
    @Category(DefaultTest.class)
    @Test
    public void testCreatePermission() {
        final Permission secPerm = createPermission("writer");
        final UnitPermission permissionBean = ConvertDomainBean
                .convertPermissionToBean(secPerm);
        securityService.createPermission(permissionBean);
        final Permission permissionRetrieve = getPermissionDaoImp()
                .getPermissionById(secPerm.getIdPermission());
        assertNotNull(permissionRetrieve);
View Full Code Here

    @Test
    public void testAssignPermissionwithIdUsername() throws EnMeExpcetion {
        final UserAccount secUser = createUserAccount("demo", this.userPrimary);
        final UserAccountBean userPermissionBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUser);
        final UnitPermission permissionBean = ConvertDomainBean
                .convertPermissionToBean(this.permission);
        userPermissionBean.setId(userPermissionBean.getId());
        userPermissionBean.setUsername("demo");
        securityService.assignPermission(userPermissionBean, permissionBean);
        assertEquals("should be equals", 1, secUser.getSecUserPermissions()
View Full Code Here

     */
    @Category(DefaultTest.class)
    @Test(expected = EnMeExpcetion.class)
    public void testAssignPermissionwithoutIdUsername() throws EnMeExpcetion {
        final UserAccountBean userPermissionBean = new UserAccountBean();
        final UnitPermission permissionBean = ConvertDomainBean
                .convertPermissionToBean(this.permission);
        // modify id user id.
        userPermissionBean.setId(1L);
        securityService.assignPermission(userPermissionBean, permissionBean);
    }
View Full Code Here

    public void testAssignPermissionwithPermission() throws EnMeExpcetion {
        final UserAccount secUser = createUserAccount("juanpicado2",
                this.userPrimary);
        final UserAccountBean userPermissionBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUser);
        final UnitPermission permissionBean = new UnitPermission();
        // modify id permission.
        permissionBean.setId(1L);
        permissionBean.setPermission("auditor");
        securityService.assignPermission(userPermissionBean, permissionBean);
    }
View Full Code Here

    @Category(DefaultTest.class)
    @Test(expected = EnMeExpcetion.class)
    public void testAssignPermissionwithPermissionIdandUserId()
            throws EnMeExpcetion {
        UserAccountBean userPermissionBean = new UserAccountBean();
        UnitPermission permissionBean = new UnitPermission();
        securityService.assignPermission(userPermissionBean, permissionBean);

    }
View Full Code Here

     *             EnMeExpcetion
     */
    @Test
    @Category(DefaultTest.class)
    public void testloadBeanPermission() throws EnMeExpcetion {
        final UnitPermission permission = securityService
                .loadBeanPermission(this.permission.getPermission());
        assertNotNull(permission);
    }
View Full Code Here

        final Collection<UnitPermission> loadListPermission = new LinkedList<UnitPermission>();
        final Collection<Permission> listPermission = getPermissionDao()
                .loadAllPermissions();
        for (Iterator<Permission> iterator = listPermission.iterator(); iterator
                .hasNext();) {
            final UnitPermission permissionBean = new UnitPermission();
            Permission permission = iterator.next();
            if (!permission.equals(EnMePermission.ENCUESTAME_USER)) { //this permissions not should be included.
                permissionBean.setId(permission.getIdPermission());
                permissionBean.setPermission(permission.getPermission().toString());
                permissionBean.setDescription(permission.getPermissionDescription());
                loadListPermission.add(permissionBean);
            }
        }
        return loadListPermission;
    }
View Full Code Here

     * Load Permission domain and covert to permission bean.
     * @param permission permission
     * @return permission bean
     */
    public UnitPermission loadBeanPermission(final EnMePermission permission) {
        UnitPermission permissionBean = null;
        final Permission permissionDomain = getPermissionDao().loadPermission(permission);
        if(permissionDomain != null){
             permissionBean = ConvertDomainBean.convertPermissionToBean(permissionDomain);
        }
        return permissionBean;
View Full Code Here

     *            permission.
     * @return permBean
     */
    public static final UnitPermission convertPermissionToBean(
            final Permission permission) {
        final UnitPermission permBean = new UnitPermission();
        permBean.setId(permission.getIdPermission());
        permBean.setDescription(permission.getPermissionDescription());
        permBean.setPermission(permission.getPermission().toString());
        return permBean;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.utils.web.UnitPermission

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.