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

        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

    }

    /** */
    void applyOperation(int operation, StateTransitionObj stobj)
    {
        StateTransitionObj obj = (StateTransitionObj) stobj;
        switch( operation ){
        case MAKEPERSISTENT:
        {
            pm.makePersistent(obj);
            break;
        }
        case DELETEPERSISTENT:
        {
            pm.deletePersistent(obj);
            break;
        }
        case MAKETRANSACTIONAL:
        {
            pm.makeTransactional(obj);
            break;
        }
        case MAKENONTRANSACTIONAL:
        {
            pm.makeNontransactional(obj);
            break;
        }
        case MAKETRANSIENT:
        {
            pm.makeTransient(obj);
            break;
        }
        case COMMITNORETAINVALUES:
        {
            pm.currentTransaction().commit();
            break;
        }
        case COMMITRETAINVALUES:
        {
            pm.currentTransaction().commit();
            break;
        }
        case ROLLBACKNORESTOREVALUES:
        {
            pm.currentTransaction().rollback();
            break;
        }
        case ROLLBACKRESTOREVALUES:
        {
            pm.currentTransaction().rollback();
            break;
        }
        case REFRESHDATASTORE:
        {
            pm.refresh(obj);
            break;
        }
        case REFRESHOPTIMISTIC:
        {
            pm.refresh(obj);
            break;
        }
        case EVICT:
        {
            pm.evict(obj);
            break;
        }
        case READOUTSIDETX:
        {
            obj.readField();
            break;
        }
        case READOPTIMISTIC:
        {
            obj.readField();
            break;
        }
        case READDATASTORE:
        {
            obj.readField();
            break;
        }
        case WRITEOUTSIDETX:
        {
            obj.writeField(42);
            break;
        }
        case WRITEINSIDETX:
        {
            obj.writeField(42);
            break;
        }
        case RETRIEVEOUTSIDETX:
        {
            pm.retrieve(obj);
View Full Code Here

    }

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

    }

    /** */
    public StateTransitionObj getPersistentNewInstance()
    {
        StateTransitionObj obj = getTransientInstance();
        if( obj == null ) return null;
        pm.makePersistent(obj); // should transition to persistent-new
        int curr = currentState(obj);
        if( curr != PERSISTENT_NEW ) {
            if (debug) {
View Full Code Here

    }
   
    /** */
    public StateTransitionObj getPersistentCleanInstance()
    {
        StateTransitionObj obj = getHollowInstance();
        if( obj == null ) return null;
        StateTransitionObj sto = (StateTransitionObj) obj;
        sto.readField();
        int curr = currentState(sto);
        if( curr != PERSISTENT_CLEAN ) {
            if (debug) {
                logger.debug("StateTransition: Unable to create persistent-clean instance" +
                             " from a hollow instance by reading a field, state is " +
View Full Code Here

    }
   
    /** */
    public StateTransitionObj getPersistentDirtyInstance()
    {
        StateTransitionObj obj = getHollowInstance();
        if( obj == null ) return null;
        StateTransitionObj pcobj = (StateTransitionObj) obj;
        pcobj.writeField(23);
        int curr = currentState(obj);
        if( curr != PERSISTENT_DIRTY ) {
            if (debug) {
                logger.debug("StateTransition: Unable to create persistent-dirty instance" +
                             " from a hollow instance by writing a field, state is " +
View Full Code Here

        if( !iter.hasNext() ){
            if (debug)
                logger.debug("Extent for StateTransitionObj should not be empty");
            return null;
        }
        StateTransitionObj obj = (StateTransitionObj) iter.next();
       
        pm.makeTransactional(obj);
        transaction.setRetainValues(false);
        transaction.commit(); // This should put the instance in the HOLLOW state
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.