Package org.appfuse.model

Examples of org.appfuse.model.Role


    @Autowired
    private RoleManager roleManager;
   
    public Role create(Class<? extends Role> clazz) {
        return new Role();
    }
View Full Code Here


    @Autowired
    private RoleDao dao;

    @Test
    public void testGetRoleInvalid() throws Exception {
        Role role = dao.getRoleByName("badrolename");
        assertNull(role);
    }
View Full Code Here

        assertNull(role);
    }

    @Test
    public void testGetRole() throws Exception {
        Role role = dao.getRoleByName(Constants.USER_ROLE);
        assertNotNull(role);
    }
View Full Code Here

        assertNotNull(role);
    }

    @Test
    public void testUpdateRole() throws Exception {
        Role role = dao.getRoleByName("ROLE_USER");
        log.debug(role);
        role.setDescription("test descr");

        dao.save(role);
        assertEquals(role.getDescription(), "test descr");
    }
View Full Code Here

        assertEquals(role.getDescription(), "test descr");
    }

    @Test
    public void testAddAndRemoveRole() throws Exception {
        Role role = new Role("testrole");
        role.setDescription("new role descr");
        dao.save(role);
        //setComplete(); // change behavior from rollback to commit
        //endTransaction();

        //startNewTransaction();
        role = dao.getRoleByName("testrole");
        assertNotNull(role.getDescription());

        dao.removeRole("testrole");
        //setComplete();
        //super.endTransaction(); // deletes role from database
View Full Code Here

    public User getCurrentUser() {
        final String username = getCurrentUsername();
        if(username != null) {
            final User user = userManager.getUserByUsername(username);
            if(isFullyAuthenticated()) {
                user.getRoles().add(new Role(RoleProxy.FULLY_AUTHENTICATED));
            }
            return user;
        }
        return null;
    }
View Full Code Here

    @Test
    public void testAddUserRole() throws Exception {
        User user = dao.get(-1L);
        assertEquals(1, user.getRoles().size());

        Role role = rdao.getRoleByName(Constants.ADMIN_ROLE);
        user.addRole(role);
        dao.save(user);

        assertEquals(2, user.getRoles().size());
View Full Code Here

        address.setPostalCode("80210");
        user.setAddress(address);
        user.setEmail("testuser@appfuse.org");
        user.setWebsite("http://raibledesigns.com");

        Role role = rdao.getRoleByName(Constants.USER_ROLE);
        assertNotNull(role.getId());
        user.addRole(role);

        user = dao.save(user);

        assertNotNull(user.getId());
View Full Code Here

    @Test
    public void testAddUserRole() throws Exception {
        User user = dao.get(-1L);
        assertEquals(1, user.getRoles().size());

        Role role = rdao.getRoleByName(Constants.ADMIN_ROLE);
        user.addRole(role);
        dao.saveUser(user);
        flush();

        user = dao.get(-1L);
View Full Code Here

        address.setPostalCode("80210");
        user.setAddress(address);
        user.setEmail("testuser@appfuse.org");
        user.setWebsite("http://raibledesigns.com");

        Role role = rdao.getRoleByName(Constants.USER_ROLE);
        assertNotNull(role.getId());
        user.addRole(role);

        user = dao.saveUser(user);
        flush();
View Full Code Here

TOP

Related Classes of org.appfuse.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.