Issue Details (XML | Word | Printable)

Key: JDO-62
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Erik Bengtson
Reporter: Craig Russell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JDO

Test MakePersistentAndInstancesNotReachable fails. Instances not reachable at commit need to transition to transient.

Created: 09/Jun/05 10:08 AM   Updated: 23/Apr/06 02:38 AM
Return to search
Component/s: tck2
Affects Version/s: None
Fix Version/s: JDO 2 beta

Time Tracking:
Not Specified

Environment: JPOX

Resolution Date: 23/Apr/06 02:38 AM


 Description  « Hide
This test checks that provisionally persistent instances revert to transient if at commit they are no longer reachable from a persistent instance.

    public void test() {
        pm = getPM();
        createObjects(pm);
        runTest(pm);
  }

    /** */
    private void createObjects(PersistenceManager pm) {
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Company comp = new Company(1L, "Sun Microsystems", new Date(), new Address(0,"","","","",""));
        //Add transient departments
        dep1 = new Department(1L, "Department 1");
        dep2 = new Department(2L, "Department 1");
        dep3 = new Department(3L, "Department 1");
        comp.addDepartment(dep1);
        comp.addDepartment(dep2);
        comp.addDepartment(dep3);
        pm.makePersistent(comp); //Now the transient departments should be made provisionally persistent via reachability
        int curr = currentState(dep1);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED, "dep1 should be persistent-new, state is " + states[curr]);
        }
        curr = currentState(dep2);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED, "dep2 should be persistent-new, state is " + states[curr]);
        }
        curr = currentState(dep3);
        if( curr != PERSISTENT_NEW ){
            fail(ASSERTION_FAILED, "dep3 should be persistent-new, state is " + states[curr]);
        }
        //Remove departments
        comp.removeDepartment(dep1);
        comp.removeDepartment(dep2);
        comp.removeDepartment(dep3);
        tx.commit(); //Now the removed departments should be made transient again
    }

    /** */
    void runTest(PersistenceManager pm) {
        int curr = currentState(dep1);
        if( curr != TRANSIENT ){
            fail(ASSERTION_FAILED, "dep1 should be transient, state is " + states[curr]);
        }
        curr = currentState(dep2);
        if( curr != TRANSIENT ){
            fail(ASSERTION_FAILED, "dep2 should be transient, state is " + states[curr]);
        }
        curr = currentState(dep3);
        if( curr != TRANSIENT ){
            fail(ASSERTION_FAILED, "dep3 should be transient, state is " + states[curr]);
        }
    }
[DEBUG] tck - Free memory: 14194616
    [java] [DEBUG] tck - dep1 should be transient, state is hollow
    [java] [ERROR] tck - Exception during setUp or runtest: <junit.framework.AssertionFailedError: Assertion A12.5.7-6C (MakePersistentAndInstancesNotReachable) failed:
    [java] dep1 should be transient, state is hollow>junit.framework.AssertionFailedError: Assertion A12.5.7-6C (MakePersistentAndInstancesNotReachable) failed:
    [java] dep1 should be transient, state is hollow
    [java] at junit.framework.Assert.fail(Assert.java:47)
    [java] at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:510)
    [java] at org.apache.jdo.tck.api.persistencemanager.lifecycle.MakePersistentAndInstancesNotReachable.runTest(MakePersistentAndInstancesNotReachable.java:112)
    [java] at org.apache.jdo.tck.api.persistencemanager.lifecycle.MakePersistentAndInstancesNotReachable.test(MakePersistentAndInstancesNotReachable.java:73)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java] at java.lang.reflect.Method.invoke(Method.java:324)
    [java] at junit.framework.TestCase.runTest(TestCase.java:154)
    [java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:181)
    [java] at junit.framework.TestResult$1.protect(TestResult.java:106)
    [java] at junit.framework.TestResult.runProtected(TestResult.java:124)
    [java] at junit.framework.TestResult.run(TestResult.java:109)
    [java] at junit.framework.TestCase.run(TestCase.java:118)
    [java] at junit.framework.TestSuite.runTest(TestSuite.java:208)
    [java] at junit.framework.TestSuite.run(TestSuite.java:203)
    [java] at junit.framework.TestSuite.runTest(TestSuite.java:208)
    [java] at junit.framework.TestSuite.run(TestSuite.java:203)
    [java] at junit.textui.TestRunner.doRun(TestRunner.java:116)
    [java] at junit.textui.TestRunner.doRun(TestRunner.java:109)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:112)
    [java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:90)
    [java]
    [java] [DEBUG] tck - Free memory: 12800800
    [java] RUN MakePersistentAndInstancesNotReachable.test FAILURE


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.