Package se.gu.fire.data

Examples of se.gu.fire.data.GroupManager


    public void someStudentGroupTests() {

        UserManager userMan = new UserManager();
        userMan.setEntityManager(em);
       
        GroupManager groupMan = new GroupManager();
        groupMan.setEntityManager(em);
       
        FireUser user1 = TestUtil.createRandomUser();

        StudentGroup sg = new StudentGroup();

        sg.addGroupMember(user1);

        em.getTransaction().begin();
        userMan.create(user1);
        groupMan.create(sg);
        em.getTransaction().commit();

        FireUser user2 = userMan.read(user1.getId());
        assertNotNull(user2);

        StudentGroup group = groupMan.read(sg.getId());
        assertNotNull(group);

        assertEquals(user2, user1);
       
        // Test getGroupForUser
        List<FireUser> users = groupMan.getGroupMembers(group);
        assertTrue(users.size() > 0);

        TestData data = new TestData();

        StudentGroup group2 = new StudentGroup();
        group2.addAllGroupMembers(data.users);

        em.getTransaction().begin();
        for (FireUser user : data.users) userMan.create(user);
        groupMan.create(group2);
        em.getTransaction().commit();

        StudentGroup group3 = groupMan.getGroupForUser(data.user2);

        assertEquals(group2, group3);
    }
View Full Code Here


        this.entMan = entMan;

        assignMan = new AssignmentManager();
        subMan = new SubmissionManager();
        userMan = new UserManager();
        groupMan = new GroupManager();
        comMan = new CommentManager();
        passMan = new PasswordManager();
        fileMan = new StoredFileManager();
        mans = collectMans();
View Full Code Here

        sm.setEntityManager(em);

        UserManager um = new UserManager();
        um.setEntityManager(em);

        GroupManager gm = new GroupManager();
        gm.setEntityManager(em);

        CommentManager cm = new CommentManager();
        cm.setEntityManager(em);

        // Fix assignment
        Assignment assign = new Assignment.Builder()
                .title("Ratnum labb")
                .information("Programmera RatNum labben ordentligt annars kommer Christopher.")
                .finalDeadline(new Date(Calendar.getInstance().getTime().getTime()+15000))
                .firstDeadline(new Date(Calendar.getInstance().getTime().getTime()+10000))
                .build();
           
        em.getTransaction().begin();
        am.create(assign);
        em.getTransaction().commit();


        // Fix users
        FireUser u = TestUtil.createRandomUser();
       
        em.getTransaction().begin();
        um.create(u);
        em.getTransaction().commit();


        FireUser u2 = TestUtil.createRandomUser();
       
        em.getTransaction().begin();
        um.create(u2);
        em.getTransaction().commit();

        // Student group
        StudentGroup group = new StudentGroup();
        em.getTransaction().begin();
        group.addGroupMember(u);
        gm.create(group);
        em.getTransaction().commit();

        assertEquals(SubmissionStatus.NotSubmitted, sm.getAssignmentStatus(assign, group));

View Full Code Here

TOP

Related Classes of se.gu.fire.data.GroupManager

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.