Package info.jtrac.domain

Examples of info.jtrac.domain.Space


        assertEquals(1, c.getAssignedToMe());
        assertEquals(1, c.getTotal());
    }
   
    public void testRemoveSpaceRoleDoesNotOrphanDatabaseRecord() {
        Space space = getSpace();
        jtrac.storeSpace(space);
        long spaceId = space.getId();
        User user = new User();
        user.setLoginName("test");
        user.addSpaceWithRole(space, "ROLE_ADMIN");
        jtrac.storeUser(user);
        long id = jdbcTemplate.queryForLong("select id from user_space_roles where space_id = " + spaceId);
View Full Code Here


        assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where space_id = " + spaceId));
        cleanDatabase();
    }
   
    public void testFindSpacesWhereGuestAllowed() {
        Space space = getSpace();
        space.setGuestAllowed(true);
        jtrac.storeSpace(space);
        assertEquals(1, jtrac.findSpacesWhereGuestAllowed().size());
    }
View Full Code Here

        jtrac.storeSpace(space);
        assertEquals(1, jtrac.findSpacesWhereGuestAllowed().size());
    }
   
    public void testRenameSpaceRole() {
        Space space = getSpace();
        jtrac.storeSpace(space);
        User u = new User();
        u.setLoginName("test");
        u.addSpaceWithRole(space, "DEFAULT");
        jtrac.storeUser(u);
View Full Code Here

   
    public void testGetItemAsHtmlDoesNotThrowException() {
        Config config = new Config("mail.server.host", "dummyhost");
        jtrac.storeConfig(config);
        // now email sending is switched on
        Space s = getSpace();
        jtrac.storeSpace(s);
        User u = new User();
        u.setLoginName("test");
        u.setName("Test User");
        u.setEmail("test");
View Full Code Here

        String rendered = ItemUtils.getAsXml(i).asXML();
        assertTrue(rendered.contains("<item refId=\"TEST-"));
    }
   
    public void testDeleteItemThatHasRelatedItems() {
        Space s = getSpace();
        jtrac.storeSpace(s);
        User u = new User();
        u.setLoginName("test");
        u.setEmail("dummy");
        u.addSpaceWithRole(s, "DEFAULT");
View Full Code Here

        Item temp = jtrac.loadItem(i1.getId());
        jtrac.removeItem(temp);
    }       
   
    public void testDeletingUserDeletesItemUsersAlso() {
        Space s = getSpace();
        jtrac.storeSpace(s);
        User u = new User();
        u.setLoginName("test");
        u.setEmail("dummy");
        u.addSpaceWithRole(s, "DEFAULT");
View Full Code Here

   
    public void testLogicToFindNotUsersAndSpacesNotAllocated() {
       
        cleanDatabase();
       
        Space s1 = getSpace();
        Metadata m1 = getMetadata();
        m1.initRoles();
        s1.setMetadata(m1);
        jtrac.storeSpace(s1);
       
        Space s2 = getSpace();
        s2.setPrefixCode("TEST2");
        Metadata m2 = getMetadata();
        m2.initRoles();
        s2.setMetadata(m2);
        jtrac.storeSpace(s2);
       
        User u1 = new User();
        u1.setLoginName("test");
       
View Full Code Here

        writeXml(d, response);     
    }
   
    public void spaceUsersGet(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String prefixCode = request.getParameter("prefixCode");
        Space space = jtrac.loadSpace(prefixCode);
        Document d = XmlUtils.getNewDocument("users");
        Element root = d.getRootElement();
        root.addAttribute("prefixCode", prefixCode);
        List<User> users = jtrac.findUsersForSpace(space.getId());
        for(User user : users) {
            root.addElement("user").addAttribute("loginName", user.getLoginName()).addText(user.getName());
        }
        writeXml(d, response);
    }
View Full Code Here

        List<UserSpaceRole> usrs = dao.findUserRolesForSpace(spaceId);
        List<User> notFullyAllocated = new ArrayList<User>(notAtAllAllocated);
        if(usrs.size() == 0) {
            return notFullyAllocated;           
        }
        Space space = usrs.get(0).getSpace();
        Set<UserSpaceRole> allocated = new HashSet(usrs);
        Set<String> roleKeys = new HashSet(space.getMetadata().getAllRoleKeys());               
        Set<User> processed = new HashSet<User>(usrs.size());
        Set<User> superUsers = new HashSet(dao.findSuperUsers());
        for(UserSpaceRole usr : usrs) {
            User user = usr.getUser();
            if(processed.contains(user)) {
View Full Code Here

        Set<UserSpaceRole> allocated = new HashSet(usrs);
        Set<Space> processed = new HashSet<Space>(usrs.size());
        User user = usrs.get(0).getUser();
        boolean isSuperUser = user.isSuperUser();                        
        for(UserSpaceRole usr : usrs) {
            Space space = usr.getSpace();
            if(space == null || processed.contains(space)) {
                continue;
            }
            processed.add(space);
            for(String roleKey : space.getMetadata().getAllRoleKeys()) {
                if(isSuperUser && Role.isAdmin(roleKey)) {
                    continue;
                }
                UserSpaceRole temp = new UserSpaceRole(user, space, roleKey);
                if(!allocated.contains(temp)) {
View Full Code Here

TOP

Related Classes of info.jtrac.domain.Space

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.