Package org.apache.jdo.tck.pc.instancecallbacks

Examples of org.apache.jdo.tck.pc.instancecallbacks.InstanceCallbackNonPersistFdsClass


        InstanceCallbackNonPersistFdsClass.initializeStaticsForTest();
       
        t.begin();
        // create instance
        InstanceCallbackNonPersistFdsClass obj1 = new InstanceCallbackNonPersistFdsClass(1.1f, 1);
        pm.makePersistent(obj1);
        Object objPtr1 = pm.getObjectId (obj1);
        obj1.setNonPersist(1, (char)1, 0, (short)0);
        t.commit()// jdoPreStore() and jdoPreClear() called
       
        t.begin();
        try {
            obj1 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr1, true)// jdoPostLoad() called
View Full Code Here


        InstanceCallbackNonPersistFdsClass.initializeStaticsForTest();

        t.begin();
        // create instance       
        InstanceCallbackNonPersistFdsClass obj1 = new InstanceCallbackNonPersistFdsClass(2.2f, 13);
        pm.makePersistent(obj1);
        Object objPtr1 = pm.getObjectId (obj1);
        obj1.setNonPersist(1, (char)2, 3.3, (short)4);
        t.commit();

        t.begin();
        // set applicationStep before and after getObjectById() to be sure when jdoPostLoad() gets called.
        InstanceCallbackNonPersistFdsClass.applicationStep = InstanceCallbackNonPersistFdsClass.beforeGetObjectById;
View Full Code Here

        int origIntValue1 = 10, origIntValue2 = 12;
        float origFloatValue1 = 2.5f, origFloatValue2 = -3.0f;
       
        // create two instances
       
        InstanceCallbackNonPersistFdsClass obj1 = new InstanceCallbackNonPersistFdsClass(origFloatValue1, origIntValue1);
        pm.makePersistent(obj1);
        Object objPtr1 = pm.getObjectId (obj1);
        obj1.setNonPersist(5, (char)10, .25, (short)100);
        expectedIntValue1 = obj1.calcIntValue();
        expectedFloatValue1 = obj1.calcFloatValue();
       
        InstanceCallbackNonPersistFdsClass obj2 = new InstanceCallbackNonPersistFdsClass(origFloatValue2, origIntValue2);
        pm.makePersistent(obj2);
        Object objPtr2 = pm.getObjectId (obj2);
        obj2.setNonPersist(2, (char)125, .1, (short)750);
        expectedIntValue2 = obj2.calcIntValue();
        expectedFloatValue2 = obj2.calcFloatValue();

        t.commit();
       
        t.begin();
        // read both objects back in to determine persistent state is as expected.
        try {
            obj1 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr1, true);
            checkValues("Object1 created and read back in:  ", origIntValue1, expectedIntValue1, obj1.intValue);
            checkValues("Object1 created and read back in:  ", origFloatValue1, expectedFloatValue1, obj1.floatValue);
            origIntValue1 = obj1.intValue;
            origFloatValue1 = obj1.floatValue;
            obj1.setNonManaged(-1, (char)62);
            expectedIntValue1 = obj1.calcIntValue();
            expectedFloatValue1 = obj1.calcFloatValue();
        } catch (JDOUserException e) {
            // could not locate persistent object created in previous transaction
            fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj1 created in previous transaction, got " + e);
            return;
        } catch (JDODataStoreException e) {
            // could not locate persistent object created in previous transaction
            fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj1 created in previous transaction, got " + e);
            return;
        }

        try {
            obj2 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr2, true);
            checkValues("Object2 created and read back in:  ", origIntValue2, expectedIntValue2, obj2.intValue);
            checkValues("Object2 created and read back in:  ", origFloatValue2, expectedFloatValue2, obj2.floatValue);
            origIntValue2 = obj2.intValue;
            origFloatValue2 = obj2.floatValue;
            obj2.setNonPersist(12, (char)30, 5.0, (short)137);
            expectedIntValue2 = obj2.calcIntValue();
            expectedFloatValue2 = obj2.calcFloatValue();
           
            // change obj2 making it persistent dirty (leave obj1 persistent clean).
            obj2.incrementIntValue();
        } catch (JDOUserException e) {
            // could not locate persistent object created in previous transaction
            fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj2 created in previous transaction, got " + e);
            return;
        } catch (JDODataStoreException e) {
View Full Code Here

        InstanceCallbackNonPersistFdsClass.initializeStaticsForTest();

        t.begin();
        // create instance       
        InstanceCallbackNonPersistFdsClass obj1 = new InstanceCallbackNonPersistFdsClass(2.2f, 13);
        pm.makePersistent(obj1);
        Object objPtr1 = pm.getObjectId (obj1);
        obj1.setNonPersist(1, (char)2, 3.3, (short)4);
        t.commit();

        t.begin();
        // set applicationStep before and after getObjectById() to be sure when jdoPostLoad() gets called.
        InstanceCallbackNonPersistFdsClass.applicationStep = InstanceCallbackNonPersistFdsClass.beforeGetObjectById;
View Full Code Here

        int origIntValue1 = 10, origIntValue2 = 12;
        float origFloatValue1 = 2.5f, origFloatValue2 = -3.0f;
       
        // create two instances
       
        InstanceCallbackNonPersistFdsClass obj1 = new InstanceCallbackNonPersistFdsClass(origFloatValue1, origIntValue1);
        pm.makePersistent(obj1);
        Object objPtr1 = pm.getObjectId (obj1);
        obj1.setNonPersist(5, (char)10, .25, (short)100);
        expectedIntValue1 = obj1.calcIntValue();
        expectedFloatValue1 = obj1.calcFloatValue();
       
        InstanceCallbackNonPersistFdsClass obj2 = new InstanceCallbackNonPersistFdsClass(origFloatValue2, origIntValue2);
        pm.makePersistent(obj2);
        Object objPtr2 = pm.getObjectId (obj2);
        obj2.setNonPersist(2, (char)125, .1, (short)750);
        expectedIntValue2 = obj2.calcIntValue();
        expectedFloatValue2 = obj2.calcFloatValue();

        t.commit();
       
        t.begin();
        // read both objects back in to determine persistent state is as expected.
        try {
            obj1 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr1, true);
            checkValues("Object1 created and read back in:  ", origIntValue1, expectedIntValue1, obj1.intValue);
            checkValues("Object1 created and read back in:  ", origFloatValue1, expectedFloatValue1, obj1.floatValue);
            origIntValue1 = obj1.intValue;
            origFloatValue1 = obj1.floatValue;
            obj1.setNonManaged(-1, (char)62);
            expectedIntValue1 = obj1.calcIntValue();
            expectedFloatValue1 = obj1.calcFloatValue();
        } catch (JDOUserException e) {
            // could not locate persistent object created in previous transaction
            fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj1 created in previous transaction, got " + e);
            return;
        } catch (JDODataStoreException e) {
            // could not locate persistent object created in previous transaction
            fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj1 created in previous transaction, got " + e);
            return;
        }

        try {
            obj2 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr2, true);
            checkValues("Object2 created and read back in:  ", origIntValue2, expectedIntValue2, obj2.intValue);
            checkValues("Object2 created and read back in:  ", origFloatValue2, expectedFloatValue2, obj2.floatValue);
            origIntValue2 = obj2.intValue;
            origFloatValue2 = obj2.floatValue;
            obj2.setNonPersist(12, (char)30, 5.0, (short)137);
            expectedIntValue2 = obj2.calcIntValue();
            expectedFloatValue2 = obj2.calcFloatValue();
           
            // change obj2 making it persistent dirty (leave obj1 persistent clean).
            obj2.incrementIntValue();
        } catch (JDOUserException e) {
            // could not locate persistent object created in previous transaction
            fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj2 created in previous transaction, got " + e);
            return;
        } catch (JDODataStoreException e) {
View Full Code Here

        InstanceCallbackNonPersistFdsClass.initializeStaticsForTest();
       
        t.begin();
        // create instance
        InstanceCallbackNonPersistFdsClass obj1 = new InstanceCallbackNonPersistFdsClass(1.1f, 1);
        pm.makePersistent(obj1);
        Object objPtr1 = pm.getObjectId (obj1);
        obj1.setNonPersist(1, (char)1, 0, (short)0);
        t.commit()// jdoPreStore() and jdoPreClear() called
       
        t.begin();
        try {
            obj1 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr1, true)// jdoPostLoad() called
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.instancecallbacks.InstanceCallbackNonPersistFdsClass

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.