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

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


    }
   
    /** */
    protected void initDB() {
        HashSet h;
        Address addr1 = new Address (7001L, "18 Network Circle",
                                     "Santa Clara", "CA", "94455", "USA");
        company = new Company (1L, "Sun Microsystems", new Date(), addr1);
        GregorianCalendar born =
            new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"));
        GregorianCalendar hired =
            new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"));

        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);
View Full Code Here


        // System.out.println ("Company OID: " + pm.getObjectId(company));
    }
   
    /** */
    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

        //Try to get a PersistenceManager and begin and commit a transaction
        pm = getPM();
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Company comp = new Company(1L, "Sun Microsystems", new Date(),
                                   new Address(0,"","","","",""));
        pm.makePersistent(comp);
        tx.commit();
        pm.close();
        pm = null;
    }
View Full Code Here

    /** */
    private void createObjects(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Company comp = new Company(1L, "Sun Microsystems", new Date(), new Address(0,"","","","",""));
        //Add transient departments
        dep1 = new Department(1L, "Department 1");
        dep2 = new Department(2L, "Department 1");
        dep3 = new Department(3L, "Department 1");
        comp.addDepartment(dep1);
View Full Code Here

        pmf2 = JDOHelper.getPersistenceManagerFactory(properties);
        // insert an instance to find
        getPM();
        pm.currentTransaction().begin();
        Company comp = new Company(1L, "Sun Microsystems", new Date(),
                                   new Address(0,"","","","",""));
        pm.makePersistent(comp);
        oid = pm.getObjectId(comp);
        pm.currentTransaction().commit();
        pm.close();
    }
View Full Code Here

        //Try to makePersistent and flush the transaction
        pm = pmf2.getPersistenceManager();
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Company comp = new Company(2L, "Sun Microsystems2", new Date(),
                                   new Address(0,"","","","",""));
        try {
            pm.makePersistent(comp);
            pm.flush();
            fail("When the PersistenceManagerFactory is read only, " +
                    "flush of a persistent-new instance must throw " +
View Full Code Here

    /** */
    private void createObjects(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Company comp = new Company(1L, "Sun Microsystems", new Date(), new Address(0,"","","","",""));
        pm.makePersistent(comp);
        //Add transient departments
        comp.addDepartment(new Department(1L, "Department 1"));
        comp.addDepartment(new Department(2L, "Department 2"));
        comp.addDepartment(new Department(3L, "Department 3"));
View Full Code Here

        addTearDownClass(Company.class);
    }

    private Company getPersistentNewInstance(long companyid) {
        Company obj = new Company(companyid, "MyCompany", expectedDate,
                new Address(0,"","","","",""));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
                "Unable to create persistent-new instance "
View Full Code Here

        pm.currentTransaction().begin();
        Query query = pm.newQuery(Company.class,
                "name.startsWith(\"MyCompany\")");
        query.setResult("address");
        query.setUnique(true);
        Address myCompanyAddress = (Address) query.execute();
        myCompanyAddress.setZipcode(testZip);
        if (JDOHelper.isDirty((Object)comp)) {
            appendMessage("Expected Company instance not to be dirty; "
                + "actual state is " + getStateOfInstance((Object)comp));
        }
        pm.currentTransaction().commit();

        // Check value of address
        pm.currentTransaction().begin();
        Address persistedCompanyAddress = (Address) query.execute();
        String actualZip = persistedCompanyAddress.getZipcode();
        if (actualZip.equals(testZip)) {
            appendMessage("Expected projected field value is "
                + testZip + "; actual value is " + actualZip);
        }
        logger.debug("MyCompany's zipcode is '" + actualZip + "'");
View Full Code Here

        addTearDownClass(Company.class);
    }

    private Company getPersistentNewInstance(long companyid) {
        Company obj = new Company(companyid, "MyCompany", expectedDate,
                new Address(0,"","","","",""));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
                "Unable to create persistent-new instance "
View Full Code Here

TOP

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

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.