Package org.apache.jdo.tck.pc.company

Examples of org.apache.jdo.tck.pc.company.Project


        ed.setDentalInsurance(edDentalIns);
        ed.setMedicalInsurance(edMedicalIns);

        // Give them some projects to work on.  Scott works on both; Ed only
        // on one.
        Project solaris = new Project(4001L, "Solaris", new BigDecimal(100.375));
        Project sparc = new Project(4002L, "Sparc", new BigDecimal(200.500));
        h = new HashSet();
        h.add(scott);
        h.add(ed);
        solaris.setMembers(h); // Solaris is worked on by Scott and Ed

        h = new HashSet();
        h.add(scott);
        sparc.setMembers(h); // Sparc is worked on by Scott
       
        h = new HashSet();
        h.add(solaris);
        h.add(sparc);
        scott.setProjects(h); // Scott works on Solaris and Sparc
View Full Code Here


    public void testReplaceFromMappedbySide() {
        testMethod = "testReplaceFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            IProject projNew = new Project(99L, "Skunkworks",
                    new BigDecimal(10000.35));
            pm.makePersistent(projNew);
            Set projects = new HashSet();
            projects.add(projNew);
            emp1.setProjects(projects);
            Object projNewOid = pm.getObjectId((Object)projNew);
            pm.flush();

            // Postcondition
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            projNew = (Project)pm.getObjectById(projNewOid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

    public void testAddNewFromMappedbySide() {
        testMethod = "testAddNewFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Project projNew = new Project(99L, "Skunkworks",
                    new BigDecimal(10000.35));
            pm.makePersistent(projNew);
            emp1.addProject(projNew);
            Object projNewOid = pm.getObjectId((Object)projNew);
            pm.flush();

            // Postcondition
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            projNew = (Project)pm.getObjectById(projNewOid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

        testMethod = "testAddExistingFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Object proj2Oid = getOidByName("proj2");
            Project proj2 = (Project)pm.getObjectById(proj2Oid);
            emp1.addProject(proj2);
            pm.flush();

            // Postcondition
             deferredAssertTrue(proj2.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            proj2 = (Project)pm.getObjectById(proj2Oid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
             deferredAssertTrue(proj2.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

        testMethod = "testReplaceFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Set projects = new HashSet();
            Project projNew = new Project(99L, "Skunkworks",
                new BigDecimal(10000.35));
            pm.makePersistent(projNew);
            projects.add(projNew);
            emp1.setProjects(projects);
            Object projNewOid = pm.getObjectId((Object)projNew);
            pm.flush();
           
            assertFalse(testMethod + ": Test aborted, precondition is false; " +
                "expected projNewOid to be non-null", projNewOid == null);
           
            // Postcondition
            deferredAssertTrue(projNew.getMembers().contains(emp1),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            projNew = (Project)pm.getObjectById(projNewOid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
            deferredAssertTrue(projNew.getMembers().contains(emp1),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

                    ((Employee)employee.getHradvisor()).removeAdvisee(employee);
                }
                if (employee.getReviewedProjects() != null) {
                    for (Iterator it=employee.getReviewedProjects().iterator();
                            it.hasNext(); ) {
                        Project other = (Project) it.next();
                        other.removeReviewer(employee);
                    }
                }
                if (employee.getProjects() != null) {
                    for (Iterator it=employee.getProjects().iterator();
                            it.hasNext(); ) {
                        Project other = (Project) it.next();
                        other.removeMember(employee);
                    }
                }
                if (employee.getTeam() != null) {
                    for (Iterator it=employee.getTeam().iterator(); it.hasNext(); ) {
                        Employee other = (Employee) it.next();
                        other.setManager(null);
                    }
                }
                if (employee.getHradvisees() != null) {
                    for (Iterator it=employee.getHradvisees().iterator(); it.hasNext(); ) {
                        Employee other = (Employee) it.next();
                        other.setHradvisor(employee);
                    }
                }
            }
           
            // make the instance dirty.
View Full Code Here

    public void testReplaceFromMappedbySide() {
        testMethod = "testReplaceFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            IProject projNew = new Project(99L, "Skunkworks",
                    new BigDecimal(10000.35));
            pm.makePersistent(projNew);
            Set<IProject> projects = new HashSet<IProject>();
            projects.add(projNew);
            emp1.setProjects(projects);
            Object projNewOid = pm.getObjectId((Object)projNew);
            pm.flush();

            // Postcondition
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            projNew = (Project)pm.getObjectById(projNewOid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

    public void testAddNewFromMappedbySide() {
        testMethod = "testAddNewFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Project projNew = new Project(99L, "Skunkworks",
                    new BigDecimal(10000.35));
            pm.makePersistent(projNew);
            emp1.addProject(projNew);
            Object projNewOid = pm.getObjectId((Object)projNew);
            pm.flush();

            // Postcondition
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            projNew = (Project)pm.getObjectById(projNewOid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
             deferredAssertTrue(projNew.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

        testMethod = "testAddExistingFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Object proj2Oid = getOidByName("proj2");
            Project proj2 = (Project)pm.getObjectById(proj2Oid);
            emp1.addProject(proj2);
            pm.flush();

            // Postcondition
             deferredAssertTrue(proj2.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            proj2 = (Project)pm.getObjectById(proj2Oid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
             deferredAssertTrue(proj2.getMembers().contains(emp1),
                    ASSERTION_FAILED + testMethod,
                    "Postcondition is false; "
                    + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

        ed.setDentalInsurance(edDentalIns);
        ed.setMedicalInsurance(edMedicalIns);

        // Give them some projects to work on.  Scott works on both; Ed only
        // on one.
        Project solaris = new Project(4001L, "Solaris", new BigDecimal(100.375));
        Project sparc = new Project(4002L, "Sparc", new BigDecimal(200.500));
        h = new HashSet();
        h.add(scott);
        h.add(ed);
        solaris.setMembers(h); // Solaris is worked on by Scott and Ed

        h = new HashSet();
        h.add(scott);
        sparc.setMembers(h); // Sparc is worked on by Scott
       
        h = new HashSet();
        h.add(solaris);
        h.add(sparc);
        scott.setProjects(h); // Scott works on Solaris and Sparc
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.company.Project

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.