8 Replies Latest reply on Aug 20, 2007 1:05 PM by jeffcwang

    45 JUnit tests fail

    jeffcwang Newbie


      I just checked out the code from CVS built and ran the Junit tests. Of 891 units tests, 43 are reporting errors and 2 are reporting errors. I tried running with a larger heap space (from Wiki) but no better. Looking at some of the stack traces, there is a recurring error with hibernate :

      org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed}
       at org.jbpm.svc.Services.close(Services.java:234)
       at org.jbpm.JbpmContext.close(JbpmContext.java:139)
       at org.jbpm.db.AbstractDbTestCase.closeJbpmContext(AbstractDbTestCase.java:139)
       at org.jbpm.db.AbstractDbTestCase.tearDown(AbstractDbTestCase.java:75)
       at junit.framework.TestCase.runBare(TestCase.java:130)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:118)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:218)
       at org.jbpm.svc.Services.close(Services.java:222)
       ... 22 more
      Caused by: org.hibernate.HibernateException: instance not of expected entity type: org.jbpm.sim.SimState is not a: org.jbpm.graph.def.Node
       at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3633)
       at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347)
       at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
       at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:80)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
       at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
       at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:218)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
       at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
       at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
       at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
       at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
       at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:255)
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:213)
       ... 23 more

      Has anyone else had this problem? I am using all the default settings of jbpm config that came in CVS.


        • 1. Re: 45 JUnit tests fail
          jeffcwang Newbie

          Found the problem. Someone changed the node-types.xml file and mapped the state node to org.jbpm.sim.SimState. Apparently, this broke everything but I'm not sure why. Mapping state back to org.jbpm.graph.node.State fixes all but one of the Junit test cases. The only test case that fails now is testForNonSerializbleClasses.

          • 2. Re: 45 JUnit tests fail
            Edward Staub Expert

            Tom checked some Simulator work sometime in the last few months - sounds like it's related. I'd look for a SimState.hbm.xml and see if it's skewed or not getting deployed or something.

            -Ed Staub

            • 3. Re: 45 JUnit tests fail
              jeffcwang Newbie

              Hi Ed,

              There was no SimState.hbm.xml, so I created one in the sim directory of both the src and target. It was still no good. I've only seriously started learning the J2EE stack in the last few weeks and i'm in so called "XML Hell". I'm not sure what xml files go where, and what xml tags to use in specific xml files. My SimState.hbm.xml file looks like this:

              <?xml version="1.0"?>
              <!DOCTYPE hibernate-mapping PUBLIC
               "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
              <hibernate-mapping auto-import="false" default-access="field" >
               <subclass name="org.jbpm.sim.SimState"
               extends="org.jbpm.graph.def.State" />

              It still doesn't make sense why the SimState mapping would cause things to break in the Junit test. I looked at the jbpm-jpdl.jar in my web-console.war file and the SimState mapping is there but everything works just fine. So I only see the errors in the junit tests.


              • 4. Re: 45 JUnit tests fail
                Edward Staub Expert


                Don't assume that I know very much!
                In particular, I don't know whether a SimState hibernate mapping file is necessary or not. After looking at it a bit, I suspect not - but I just don't know.

                If it IS needed, there are a couple more things to do:

                1.) The mapping files are included by a master file called hibernate.cfg.xml to create the mapping. If you don't point at your new file, it ain't there.

                2.) The discriminator field is 1 character, so "SS" won't cut it.

                Sorry if I sent you off after wild geese.


                • 5. Re: 45 JUnit tests fail
                  jeffcwang Newbie

                  Hey ed,

                  Thanks for the pointers. I changed the discriminator-value to just "S" and then added the mapping in hibernate.cfg.xml and it seems work. I am still getting 6 errors that results in NullPointerExceptions but that is much better than 45. Still, not using the SimState results in no errors (but 1 failure).

                  • 6. Re: 45 JUnit tests fail
                    Edward Staub Expert


                    I'm not sure whether you intended this or not...
                    "S" is already in use for "State". I don't know what Hibernate will do with the same value pointing at two different classes - probably one wins, one loses. Since SimState is a subclass of State, the resulting problems might be a little hard to puzzle out.

                    Frankly, I'd just drop it, or write up a short JIRA ticket. This is in new code (checked in Aug 1) that may not be fully baked, and isn't yet advertised as a feature.

                    -Ed Staub

                    -Ed Staub

                    • 7. Re: 45 JUnit tests fail
                      Tom Baeyens Master

                      last week i screwed up a couple of things and i fixed them again.

                      all should be good now.

                      let me know if that is not the case.

                      • 8. Re: 45 JUnit tests fail
                        jeffcwang Newbie

                        Hey tom,

                        Just checked out from CVS. It looks like everything is fixed now (including the typos in the build scripts). All tests pass now. Thanks! I still could not get the junit reports to generate, even when increasing heap size using ANT_OPTS though.

                        thanks again