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

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


    }
   
    /** */
    public StateTransitionObj getTransientCleanInstance()
    {
        StateTransitionObj obj = getTransientInstance();
        if( obj == null ) return null;
        pm.makeTransactional(obj);
        int curr = currentState(obj);
        if( curr != TRANSIENT_CLEAN ) {
            if (debug) {
View Full Code Here


    }

    /** */
    public StateTransitionObj getTransientDirtyInstance()
    {
        StateTransitionObj obj = getTransientCleanInstance();
        if( obj == null ) return null;
        StateTransitionObj pcobj = (StateTransitionObj) obj;
        pcobj.writeField(23);
        int curr = currentState(obj);
        if( curr != TRANSIENT_DIRTY ) {
            if (debug) {
                logger.debug("StateTransition: Unable to create transient-dirty instance" +
                             " from a transient-clean instance via modifying a field, state is " +
View Full Code Here

    }

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

    }
   
    /** */
    public StateTransitionObj getPersistentDeletedInstance()
    {
        StateTransitionObj obj = getHollowInstance();
        if( obj == null ) return null;
        pm.deletePersistent(obj);
        int curr = currentState(obj);
        if( curr != PERSISTENT_DELETED ) {
            if (debug) {
View Full Code Here

    }

    /** */
    public StateTransitionObj getPersistentNontransactionalInstance()
    {
        StateTransitionObj obj = getHollowInstance();
        if( obj == null ) return null;
        boolean nontransactionalRead =
                pm.currentTransaction().getNontransactionalRead();
        pm.currentTransaction().setNontransactionalRead(true);
        obj.readField();
        pm.makeNontransactional(obj);
        pm.currentTransaction().setNontransactionalRead(nontransactionalRead);
        int curr = currentState(obj);
        if( curr != PERSISTENT_NONTRANSACTIONAL && curr != HOLLOW ) {
            if (debug) {
View Full Code Here

    }

    /** */
    public StateTransitionObj getPersistentNontransactionalDirtyInstance()
    {
        StateTransitionObj obj = getPersistentNontransactionalInstance();
        if( obj == null ) return null;
        obj.writeField(10000);
        int curr = currentState(obj);
        if( curr != PERSISTENT_NONTRANSACTIONAL_DIRTY ) {
            if (debug) {
                logger.debug("StateTransition: Unable to create persistent-nontransactional-dirty instance" +
                             " from a persistent-clean instance via makeNontransactional()/JDOHelper.makeDirty," +
View Full Code Here

    }

    /** */
    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("StateTransition: 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

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.