[ http://issues.apache.org/jira/browse/JDO-62?page=all ] Michael Bouschen reopened JDO-62: ---------------------------------
> Test MakePersistentAndInstancesNotReachable fails. Instances not reachable at > commit need to transition to transient. > --------------------------------------------------------------------------------------------------------------------- > > Key: JDO-62 > URL: http://issues.apache.org/jira/browse/JDO-62 > Project: JDO > Type: Bug > Components: tck20 > Environment: JPOX > Reporter: Craig Russell > Assignee: Erik Bengtson > > 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 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
