Examples of FullTimeEmployee


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

    public void testReplaceFromMappedSide() {
        testMethod = "testReplaceFromMappedSide";
        if (isTestToBePerformed) {
           
            // Set relationship
            IEmployee empNew = new FullTimeEmployee(100, "Jerry", "Valentine",
                    "Brown", new Date(500L), new Date(10000L), 125000);
            pm.makePersistent(empNew);
            Set members = new HashSet();
            members.add(empNew);
            proj1.setMembers(members);
            Object empNewOid = pm.getObjectId((Object)empNew);
            pm.flush();

            // Postcondition

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

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

    public void testAddNewFromMappedSide() {
        testMethod = "testAddNewFromMappedSide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Employee empNew = new FullTimeEmployee(100, "Jerry", "Valentine",
                    "Brown", new Date(500L), new Date(10000L), 125000);
            pm.makePersistent(empNew);
            proj1.addMember(empNew);
            Object empNewOid = pm.getObjectId((Object)empNew);
            pm.flush();

            // Postcondition

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

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

        testMethod = "testReplaceFromMappedSide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Set members = new HashSet();
            Employee empNew = new FullTimeEmployee(100, "Jerry", "Valentine",
                "Brown", new Date(500L), new Date(10000L), 125000);
            pm.makePersistent(empNew);
            members.add(empNew);
            proj1.setMembers(members);
            Object empNewOid = pm.getObjectId(empNew);
            pm.flush();
           
            assertFalse(testMethod + ": Test aborted, precondition is false; " +
                "expected empNewOid to be non-null", empNewOid == null);
           
            // Postcondition
           
            deferredAssertTrue(empNew.getProjects().contains(proj1),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            empNew = (Employee)pm.getObjectById(empNewOid);
            emp1 = (Employee)pm.getObjectById(emp1Oid);
            proj1 = (Project)pm.getObjectById(proj1Oid);
            deferredAssertTrue(empNew.getProjects().contains(proj1),
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set in new pm");
            pm.currentTransaction().commit();
           
View Full Code Here

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

    public void testSetToNewFromMappedSide() {
        testMethod = "testSetToNewFromMappedSide";
        if (isTestToBePerformed) {
           
            // Set relationship
            IEmployee empNew = new FullTimeEmployee(99, "Matthew", "", "Adams",
                new Date(0L), new Date(10000L), 125000);
            pm.makePersistent(empNew);
            medIns1.setEmployee(empNew);
            Object empNewOid = pm.getObjectId((Object)empNew);
            pm.flush();
           
            assertFalse(testMethod + ": Test aborted, precondition is false; " +
                "expected empNewOid to be non-null", empNewOid == null);
           
            // Postcondition
            deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set on flush");
            deferredAssertTrue(emp1.getMedicalInsurance() == null,
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "previous relationship (emp1) not nulled on flush");
           
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
            empNew = (IEmployee)pm.getObjectById(empNewOid);
            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
            deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set in new pm");
            deferredAssertTrue(emp1.getMedicalInsurance() == null,
                ASSERTION_FAILED + testMethod,
View Full Code Here

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

    public void testAddNewFromMappedbySide() {
        testMethod = "testAddNewFromMappedbySide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Employee empNew = new FullTimeEmployee(101, "Jenny", "Merriwether",
                "White", new Date(500L), new Date(10000L), 135000);
            pm.makePersistent(empNew);
            Object empNewOid = pm.getObjectId((Object)empNew);

            dept1.addEmployee(empNew);
            pm.flush();
           
            // Postcondition
            deferredAssertTrue(empNew.getDepartment() == dept1,
                ASSERTION_FAILED + testMethod,
                "Postcondition is false; "
                + "other side of relationship not set on flush");
            pm.currentTransaction().commit();
            cleanupPM();
            getPM();
           
            pm.currentTransaction().begin();
            empNew = (Employee)pm.getObjectById(empNewOid);
            dept1 = (Department)pm.getObjectById(dept1Oid);
            deferredAssertTrue(empNew.getDepartment() == dept1,
                ASSERTION_FAILED + testMethod,
                "In new transaction, postcondition is false; " +
                "other side of relationship is not set.");
            pm.currentTransaction().commit();
           
View Full Code Here

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

    public void testReplaceFromMappedSide() {
        testMethod = "testReplaceFromMappedSide";
        if (isTestToBePerformed) {
           
            // Set relationship
            IEmployee empNew = new FullTimeEmployee(100, "Jerry", "Valentine",
                    "Brown", new Date(500L), new Date(10000L), 125000);
            pm.makePersistent(empNew);
            Set<IEmployee> members = new HashSet<IEmployee>();
            members.add(empNew);
            proj1.setMembers(members);
            Object empNewOid = pm.getObjectId((Object)empNew);
            pm.flush();

            // Postcondition

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

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

    public void testAddNewFromMappedSide() {
        testMethod = "testAddNewFromMappedSide";
        if (isTestToBePerformed) {
           
            // Set relationship
            Employee empNew = new FullTimeEmployee(100, "Jerry", "Valentine",
                    "Brown", new Date(500L), new Date(10000L), 125000);
            pm.makePersistent(empNew);
            proj1.addMember(empNew);
            Object empNewOid = pm.getObjectId((Object)empNew);
            pm.flush();

            // Postcondition

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

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

        born.set(1969, 7, 20);
        hired.set(1982, 5, 5);
        Address addr2 = new Address (7002L, "43 Sematery Drive",
                                     "Woodside", "CA", "94320", "USA");
        Employee scott = new FullTimeEmployee(3001L, "Scott", "McNealy", "G",
                                              born.getTime(), addr2,
                                              hired.getTime(), 200000.0);
        born.set(1960, 4, 8);
        hired.set(1985, 2, 3);
        Address addr3 = new Address (7003L, "1298 Wanderlust Road",
                                     "Pleasanton", "CA", "95560", "USA");
        Employee ed =  new PartTimeEmployee(3002L, "Ed", "Zander", null,
                                            born.getTime(), addr3,
                                            hired.getTime(), 400000.0);
        scott.addToTeam(ed);

        // Set up their departments.
        Department board =
            new Department(2001L, "board", company);
        h = new HashSet();
        h.add(scott);
        board.setEmployees(h);
        scott.setDepartment(board);
       
        company.addDepartment(board);

        Department emg = new Department(2002L, "emg", company);
        h = new HashSet();
        h.add(ed);
        emg.setEmployees(h);
        ed.setDepartment(emg);
       
        company.addDepartment(emg);

        // Insure these guys
        DentalInsurance scottDentalIns = new DentalInsurance(
            5001L, "Aetna", scott, new BigDecimal("12000"));
        MedicalInsurance scottMedicalIns = new MedicalInsurance(
            5002L, "Aetna", scott, "PPO");
        DentalInsurance edDentalIns = new DentalInsurance(
            5003L, "BlueCross", ed, new BigDecimal("10000"));
        MedicalInsurance edMedicalIns = new MedicalInsurance(
            5004L, "BlueCross", ed, "EPO");
        scott.setDentalInsurance(scottDentalIns);
        scott.setMedicalInsurance(scottMedicalIns);
        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

        h = new HashSet();
        h.add(solaris);
        ed.setProjects(h); // Ed works on Solaris
       
View Full Code Here

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

   
    /** */
    protected Employee addEmployee() {
        Address addr1 = new Address (7004L, "456 Chelsey Lane",
                                     "Mountain View", "CA", "94040", "USA");
        Employee emp1 = new FullTimeEmployee (3003L, "First3003", "Last3003", "Middle3003",
                                              new Date(), addr1, new Date(), 10000.0);
        getPM().makePersistent (emp1);
        return emp1;
    }
View Full Code Here

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

    private void createObjects(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Date date = new Date();
        Person p1 = new Person(1L, "Craig", "Russell", null, date, null);
        Employee p2 = new FullTimeEmployee(2L, "Michael", "Bouschen", null, date, null, date, 0.0);
        Employee p3 = new PartTimeEmployee(3L, "Michelle", "Caisse", null, date, null, date, 0.0);
        Employee p4 = new FullTimeEmployee(4L, "Victor", "Kirkebo", null, date, null, date, 0.0);
        pm.makePersistent(p1);
        pm.makePersistent(p2);
        pm.makePersistent(p3);
        pm.makePersistent(p4);
        tx.commit();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.