Package org.apache.jdo.tck.pc.lifecycle

Examples of org.apache.jdo.tck.pc.lifecycle.StateTransitionObj


    }

    /** */
    public StateTransitionObj getDetachedCleanInstance()
    {
        StateTransitionObj obj = getHollowInstance();
        if( obj == null ) return null;
        obj = (StateTransitionObj) pm.detachCopy(obj);
        int curr = currentState(obj);
        if( curr != DETACHED_CLEAN ) {
            if (debug) {
View Full Code Here


    }

    /** */
    public StateTransitionObj getDetachedDirtyInstance()
    {
        StateTransitionObj obj = getHollowInstance();
        if( obj == null ) return null;
        obj = (StateTransitionObj) pm.detachCopy(obj);
        obj.writeField(1000);
        int curr = currentState(obj);
        if( curr != DETACHED_DIRTY ) {
            if (debug) {
                logger.debug("StateTransitionsReturnedObjects: Unable to create detached-dirty instance" +
                             " from a persistent-clean instance via detachCopy/persistent field modification," +
View Full Code Here

        }
        else {
            pm = getPM();
           
            // Get transient instance and read field value
            StateTransitionObj obj = getTransientInstance();

            int beforeValue=obj.readField();

            // Start transaction
            Transaction tx = pm.currentTransaction();
            tx.begin();

            // Get transient dirty instance
            makeTransientDirty(obj);

            // Rollback
            tx.rollback();
            int curr = currentState(obj);
            if( curr != TRANSIENT_CLEAN ){
                fail(ASSERTION_FAILED,
                     "StateTransition: Unable to create transient-clean instance " +
                     "from a transient-dirty instance via tx.rollback(), state is " + states[curr]);
            }

            // Check that field value has been rolled back
            int afterValue=obj.readField();
            if (beforeValue!=afterValue)
            {
                fail(ASSERTION_FAILED,
                     "Field value incorrect after rollback. Expected: "+beforeValue+" Found: "+afterValue);
            }
View Full Code Here

            }
        }
    }

    protected StateTransitionObj getTransientInstance() {
        StateTransitionObj obj = new StateTransitionObj(CLEAN_VALUE);
        int curr = currentState(obj);
        if( curr != TRANSIENT ){
            fail(ASSERTION_FAILED,
                 "Unable to create transient instance, state is " + states[curr]);
        }
View Full Code Here

    StateTransitionObj[] objects = new StateTransitionObj[NUM_OBJECTS];
    try {
        Transaction t = pm.currentTransaction();
        t.begin();
        for(int i = 0; i < NUM_OBJECTS; ++i ){
        objects[i]=new StateTransitionObj(i);
            objects[i].writeField(i);
            pm.makePersistent(objects[i]);
        }
        t.commit();
      return objects;
View Full Code Here

    StateTransitionObj[] objects = new StateTransitionObj[NUM_OBJECTS];
    try {
        Transaction t = pm.currentTransaction();
        t.begin();
        for(int i = 0; i < NUM_OBJECTS; ++i ){
        objects[i]=new StateTransitionObj(i);
            objects[i].writeField(i);
            pm.makePersistent(objects[i]);
        }
        t.commit();
      return objects;
View Full Code Here

        if( doPersistentInstancesExist() ) return;
        int i;
        Transaction t = pm.currentTransaction();
        t.begin();
        for( i = 0; i < 50; ++i ){
            StateTransitionObj sto = new StateTransitionObj(i);
            sto.writeField(i);
            pm.makePersistent(sto);
        }
        t.commit();
        if( !doPersistentInstancesExist() )
            if (debug)
View Full Code Here

                    prepareTransactionAndJDOSettings(transaction);

                    printSituation();
                   
                    StateTransitionObj obj = getInstanceInState(current_state);
                    if( obj == null ){  // could not get object in state
                        if( transaction.isActive() ) transaction.rollback();
                        continue;
                    }
View Full Code Here

    /** */
    Object applyOperation(int operation, StateTransitionObj stobj)
    {
        Object result = null;
        StateTransitionObj obj = (StateTransitionObj) stobj;
        switch( operation ){
            case MAKEPERSISTENT:
                result = pm.makePersistent(obj);
                break;
   
View Full Code Here

    }

    /** */
    public StateTransitionObj getTransientInstance()
    {
        StateTransitionObj obj = new StateTransitionObj(23);
        int curr = currentState(obj);
        if( curr != TRANSIENT ) {
            if (debug) {
                logger.debug("StateTransitionsReturnedObjects: Unable to create transient instance, state is " +
                             states[curr]);
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.lifecycle.StateTransitionObj

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.