Package com.darkhonor.rage.model

Examples of com.darkhonor.rage.model.Section


    @Test
    public void testDelete()
    {
        System.out.println("delete");
        assertTrue(instance.isOpen());
        Section section = instance.find(4L);
        assertNotNull(section);
        assertEquals("T6A", section.getName());
        assertEquals(3, section.getStudents().size());
        instance.delete(section);
        assertTrue(instance.isOpen());
        section = instance.find(4L);
        assertNull(section);
    }
View Full Code Here


    @Test
    public void testDeleteId()
    {
        System.out.println("deleteId");
        assertTrue(instance.isOpen());
        Section section = instance.find(4L);
        assertNotNull(section);
        assertEquals("T6A", section.getName());
        assertEquals(3, section.getStudents().size());
        instance.delete(4L);
        section = instance.find(4L);
        assertNull(section);
    }
View Full Code Here

    @Test(expected=NullPointerException.class)
    public void testDeleteNullSection()
    {
        System.out.println("deleteNullSection");
        Section section = null;
        assertTrue(instance.isOpen());
        instance.delete(section);
    }
View Full Code Here

        Instructor instructor = new Instructor("Sarah", "O'Reilly",
                "Sarah.OReilly");
        instructor.setId(6L);
        instructor.setDomainAccount("Sarah.OReilly");

        Section section = new Section("T6A");
        section.setId(4L);
        section.setInstructor(instructor);

        assertTrue(instance.isOpen());
        instance.delete(section);
    }
View Full Code Here

        Instructor instructor = new Instructor("Sarah", "O'Reilly",
                "Sarah.OReilly");
        instructor.setId(6L);
        instructor.setDomainAccount("Sarah.OReilly");

        Section section = new Section();
        section.setId(4L);
        section.setCourse(course);
        section.setInstructor(instructor);

        assertTrue(instance.isOpen());
        instance.delete(section);
    }
View Full Code Here

    @Test(expected=IllegalStateException.class)
    public void testDeleteClosedConnection()
    {
        System.out.println("deleteClosedConnection");
        assertTrue(instance.isOpen());
        Section section = instance.find(4L);
        assertNotNull(section);
        assertEquals("T6A", section.getName());
        assertEquals(3, section.getStudents().size());
        System.out.println("- Section: " + section);
        assertTrue(instance.isOpen());
        instance.closeConnection();
        assertFalse(instance.isOpen());
        instance.delete(section);
View Full Code Here

    @Test(expected=IllegalStateException.class)
    public void testDeleteIdClosedConnection()
    {
        System.out.println("deleteIdClosedConnection");
        assertTrue(instance.isOpen());
        Section section = instance.find(4L);
        assertNotNull(section);
        assertEquals("T6A", section.getName());
        assertEquals(3, section.getStudents().size());
        System.out.println("- Section: " + section);
        assertTrue(instance.isOpen());
        instance.closeConnection();
        assertFalse(instance.isOpen());
        instance.delete(4L);
View Full Code Here

        Instructor instructor = new Instructor("Sarah", "O'Reilly",
                "Sarah.OReilly");
        instructor.setId(6L);
        instructor.setDomainAccount("Sarah.OReilly");

        Section section = new Section("T1A");
        section.setCourse(course);
        section.setId(5L);
        section.setInstructor(instructor);
        assertTrue(instance.isOpen());
        instance.delete(section);
    }
View Full Code Here

        Student student3 = createPersistedStudent(3L, "Bob", "Reimer", "C13Robert.Reimer",
                new Integer(2013));
        Student student4 = createPersistedStudent(4L, "Andrew", "Callow",
                "C13Andrew.Callow", new Integer(2013));

        Section section1 = new Section("M1A");
        section1.setId(new Long(1L));
        Section section2 = new Section("M2B");
        section2.setId(new Long(2L));
        section1.setCourse(course);
        section2.setCourse(course);
       
        Instructor instructor1 = createPersistedInstructor(5L, "David", "Roberts",
                "David.Roberts");
        Instructor instructor2 = createPersistedInstructor(6L, "Sarah", "O'Reilly",
                "Sarah.OReilly");

        // Set the Instructors for Sections 1 & 2
        section1.setInstructor(instructor1);
        section2.setInstructor(instructor2);

        // Add Instructors to Course
        course.addInstructor(instructor1);
        course.addInstructor(instructor2);

        // Add Students 1 & 2 to Section 1
        section1.addStudent(student1);
        student1.addSection(section1);
        section1.addStudent(student2);
        student2.addSection(section1);

        course.addSection(section1);
        course.addSection(section2);

        // Add Students 3 & 4 to Section 2
        section2.addStudent(student3);
        student3.addSection(section2);
        section2.addStudent(student4);
        student4.addSection(section2);

        tx.begin();
        em.persist(section1);
        em.persist(section2);
View Full Code Here

                "C11Kerry.Beevers", new Integer(2011));

        Instructor instructor1 = createPersistedInstructor(5L, "David", "Roberts",
                "David.Roberts");

        Section section1 = new Section("T5A");
        section1.setId(new Long(3L));
        Section section2 = new Section("T6A");
        section2.setId(new Long(4L));
        section1.setCourse(course);
        section2.setCourse(course);

        // Set the Instructors for Sections 1 & 2
        section1.setInstructor(instructor1);
        section2.setInstructor(instructor1);

        // Add Instructors to Course
        course.addInstructor(instructor1);

        // Add Students 1 & 2 to Section 1
        section1.addStudent(student1);
        student1.addSection(section1);
        section1.addStudent(student2);
        student2.addSection(section1);

        course.addSection(section1);
        course.addSection(section2);

        // Add Students 3 & 4 to Section 2
        section2.addStudent(student3);
        student3.addSection(section2);
        section2.addStudent(student4);
        student4.addSection(section2);
        section2.addStudent(student5);
        student5.addSection(section2);

        tx.begin();
        em.persist(section1);
        em.persist(section2);
View Full Code Here

TOP

Related Classes of com.darkhonor.rage.model.Section

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.