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

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


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


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

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

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

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

    protected void localSetUp() {
        addTearDownClass(PCRect.class);
        addTearDownClass(PCPoint.class);
        upperLeft = new PCPoint(0,10);
        lowerRight = new PCPoint(10,0);
        pcrect = new PCRect(upperLeft, lowerRight);
        getPM().currentTransaction().begin();
        pm.makePersistent(pcrect); // makes all three persistent
        upperLeftoid = pm.getObjectId(upperLeft);
        lowerRightoid = pm.getObjectId(lowerRight);
        pcrectoid = pm.getObjectId(pcrect);
View Full Code Here

        try {
            Transaction tx = pm.currentTransaction();
            tx.begin();
            PCPoint p1 = new PCPoint(110, 120);
            PCPoint p2 = new PCPoint(130, 140);
            PCRect rect = new PCRect (0, p1, p2);
            pm.makePersistent (rect);
            tx.commit();
            rectOid = pm.getObjectId(rect);
            point1Oid = pm.getObjectId(p1);
            point2Oid = pm.getObjectId(p2);
View Full Code Here

    private void runNavigationalReadPCPointInstance(Integer timeout) {
        getPM();
        try {
            pm.currentTransaction().begin();
            pm.setDatastoreReadTimeoutMillis(timeout);
            PCRect rect = (PCRect)pm.getObjectById(rectOid, true);
            PCPoint p1 = rect.getUpperLeft();
            p1.name();
            pm.currentTransaction().commit();
            if (!isDatastoreTimeoutSupported()) {
                fail(ASSERTION_FAILED, "PM.setDatastoreReadTimeoutMillis should throw a " +
                     "JDOUnsupportedOptionException, if datastore timeout is not supported ");
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

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.