Package org.apache.jdo.tck.pc.mylib

Examples of org.apache.jdo.tck.pc.mylib.PCRect$Oid


        }
    }

    /** */
    private PCRect getPersistentNewInstance() {
        PCRect obj = new PCRect(0, new PCPoint(1,5), new PCPoint(7,3));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
                 "StateTransitions: Unable to create persistent-new instance " +
View Full Code Here


            tx.begin();
            p1   = new PCPoint(1,1);
            p1print = p1.toString();
            p2   = new PCPoint(2,2);
            p3   = new PCPoint2(3,3);
            rect = new PCRect(100, p1, p2);
            pm.makePersistent(p1);
            pm.makePersistent(p2);
            pm.makePersistent(p3);
            pm.makePersistent(rect);
            if (debug) {
View Full Code Here

        pm.currentTransaction().begin();
        Query query = pm.newQuery(PCRect.class);
        checkGroups(ASSERTION_FAILED + " after newQuery().getFetchPlan()",
                query.getFetchPlan(), bothGroup);
        query.setUnique(true);
        PCRect instance = (PCRect)query.execute();
        checkBothLoaded(ASSERTION_FAILED + " after query.execute()", instance);
        pm.currentTransaction().commit();
        failOnError();
    }
View Full Code Here

        tx.begin();
        /** Create new objects to be persisted.
         */
        PCPoint p1 = new PCPoint(10, 20);
        PCPoint p2 = new PCPoint(20, 40);
        PCRect rect = new PCRect(0, p1, p2);
        /** This test relies on persistence by reachability.
         */
        pm.makePersistent(rect);
        /** This is the standard way to commit a transaction.
         */
        tx.commit();

        /** Begin a new transaction so that the navigation
         * uses the object id to load the target object into the cache.
         * The RetainValues flag false guarantees that the object fields
         * are no longer loaded.
         */
        tx.begin();
        Object p1Id = pm.getObjectId(p1);
        /** Retrieves the field values from the datastore.
         */
        PCPoint p1a = (PCPoint)pm.getObjectById(p1Id, true);
        /** Navigate to the point.
         */
        PCPoint p1b = rect.getUpperLeft();
        /** Query for the point by its values in the datastore.
         */
        PCPoint p1c = findPoint(10, 20);
        tx.commit();
        tx = null;
View Full Code Here

        }
        else {
            pm = getPM();
            pm.currentTransaction().begin();

            PCRect obj = getPersistentNewInstance();
            long beforeValue=obj.getId();
            pm.currentTransaction().commit(); // obj should transition to HOLLOW
            //The next call obj.getId() is a primary key access.
            //The method must not be called inside a transaction,
            //because a JDO implementation must allow primary key accesses
            //outside of transactions.
            long afterValue=obj.getId();
            if (beforeValue!=afterValue) {
                fail(ASSERTION_FAILED,
                     "Key field value incorrect after commit. Expected: " +
                     beforeValue + " Found: " + afterValue);
            }
View Full Code Here

        }
    }

    /** */
    private PCRect getPersistentNewInstance() {
        PCRect obj = new PCRect(0, new PCPoint(1,5), new PCPoint(7,3));
        pm.makePersistent(obj); // obj should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED,
                 "StateTransitions: Unable to create persistent-new instance " +
View Full Code Here

        PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory(pmfProperties);
        PersistenceManager pm2 = pmf2.getPersistenceManager();
        Transaction tx2 = pm2.currentTransaction();
        PCPoint p21 = null;
        PCPoint p22 = null;
        PCRect rect2 = null;

        pm = getPM();
        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();
            tx2.begin();
           
            PCPoint p11 = new PCPoint(110, 120);
            PCPoint p12 = new PCPoint(120, 140);
            PCRect rect1 = new PCRect (0, p11, p12);
            pm.makePersistent (rect1);
           
            p21 = new PCPoint(210, 220);
            p22 = new PCPoint(220, 240);
            rect2 = new PCRect (0, p21, p22);
            pm2.makePersistent (rect2);
           
            tx.commit();
            tx2.commit();
       
View Full Code Here

   
    /** */
    public void testRefresh() {
        setBothGroup();
        pm.currentTransaction().begin();
        PCRect instance = (PCRect)pm.getObjectById(pcrectoid, false);
        pm.refresh(instance);
        checkBothLoaded(ASSERTION_FAILED, instance);
        pm.currentTransaction().commit();
        failOnError();
    }
View Full Code Here

   
    /** */
    public void testRefreshAllCollection() {
        setBothGroup();
        pm.currentTransaction().begin();
        PCRect instance = (PCRect)pm.getObjectById(pcrectoid, false);
        Collection instances = new HashSet();
        instances.add(instance);
        pm.refreshAll(instances);
        checkBothLoaded(ASSERTION_FAILED, instance);
        pm.currentTransaction().commit();
View Full Code Here

   
    /** */
    public void testRefreshAllArray() {
        setBothGroup();
        pm.currentTransaction().begin();
        PCRect instance = (PCRect)pm.getObjectById(pcrectoid, false);
        Object[] instances = new Object[]{instance};
        pm.refreshAll(instances);
        checkBothLoaded(ASSERTION_FAILED, instance);
        pm.currentTransaction().commit();
        failOnError();
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.mylib.PCRect$Oid

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.