concurrency issue in service-eca-global-event-exec service test ---------------------------------------------------------------
Key: OFBIZ-3124 URL: https://issues.apache.org/jira/browse/OFBIZ-3124 Project: OFBiz Issue Type: Bug Components: framework Affects Versions: Release Branch 9.04 Reporter: Wickersheimer Jeremy Priority: Minor There is a problem in the test service-eca-global-event-exec which sometimes fails because the global-* eca are actually running in separate threads than the main test thread. Therefore it sometimes happen that service-eca-global-event-exec-assert-data gets executed befaure the needed secas had a chance to finish running. Here is for example the log part i get on failure (some debug lines added by me). You can see [testServiceEcaGlobalEventExecOnCommit updated SVC_SECAGC.] happens after the assert failure. {code} [java] 2009-10-29 11:33:20,215 (main) [ TestRunContainer.java:220:INFO ] [JUNIT (end)] : service-eca-global-event-exec(org.ofbiz.testtools.ServiceTest) finished. (in 63 ms) [java] 2009-10-29 11:33:20,216 (main) [ TestRunContainer.java:224:INFO ] [JUNIT (start)] : service-eca-global-event-exec-assert-data(org.ofbiz.testtools.EntityXmlAssertTest) starting... [java] 2009-10-29 11:33:20,218 (Thread-99) [ ServiceXaWrapper.java:294:INFO ] [Commit] Invoking [testServiceEcaGlobalEventExecOnCommit] via runSyncIgnore [java] 2009-10-29 11:33:20,222 (Thread-99) [ ServiceDispatcher.java:257:INFO ] [ServiceDispatcher.runSync] : invoking service testServiceEcaGlobalEventExecOnCommit [org.ofbiz.service.test.ServiceEngineTestServices/testServiceEcaGlobalEventExecOnCommit] (java) INPUT = [locale=en_US, userLogin=null] [java] 2009-10-29 11:33:20,222 (Thread-99) [ServiceEngineTestServices.java:354:INFO ] testServiceEcaGlobalEventExecOnCommit starting ... [java] 2009-10-29 11:33:20,225 (Thread-97) [ ServiceDispatcher.java:582:INFO ] Sync service [test-dispatcher-l76D0XsSak/testServiceEcaGlobalEventExecOnRollback] finished in [20] milliseconds, OUTPUT = [responseMessage=success] [java] 2009-10-29 11:33:20,229 (main) [ TestRunContainer.java:216:WARN ] [java] ---- error report -------------------------------------------------------------- [java] [JUNIT (failure)] - org.ofbiz.testtools.EntityXmlAssertTest : Field [TestingType.description] did not match; file value [New description for SVC_SECAGC, what it should be after the global-commit test], db value [Original description for SVC_SECAGC; if this is still here the global-commit event didn't run] pk [[GenericEntity:TestingType][testingTypeId,SVC_SECAGC(java.lang.String)]] [java] Exception: junit.framework.AssertionFailedError [java] Message: Field [TestingType.description] did not match; file value [New description for SVC_SECAGC, what it should be after the global-commit test], db value [Original description for SVC_SECAGC; if this is still here the global-commit event didn't run] pk [[GenericEntity:TestingType][testingTypeId,SVC_SECAGC(java.lang.String)]] [java] ---- stack trace --------------------------------------------------------------- [java] junit.framework.AssertionFailedError: Field [TestingType.description] did not match; file value [New description for SVC_SECAGC, what it should be after the global-commit test], db value [Original description for SVC_SECAGC; if this is still here the global-commit event didn't run] pk [[GenericEntity:TestingType][testingTypeId,SVC_SECAGC(java.lang.String)]] [java] org.ofbiz.testtools.EntityXmlAssertTest.run(EntityXmlAssertTest.java:90) [java] junit.framework.TestSuite.runTest(TestSuite.java:208) [java] junit.framework.TestSuite.run(TestSuite.java:203) [java] org.ofbiz.testtools.TestRunContainer.start(TestRunContainer.java:139) [java] org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:102) [java] org.ofbiz.base.start.Start.startStartLoaders(Start.java:264) [java] org.ofbiz.base.start.Start.startServer(Start.java:313) [java] org.ofbiz.base.start.Start.start(Start.java:317) [java] org.ofbiz.base.start.Start.main(Start.java:400) [java] -------------------------------------------------------------------------------- [java] [java] 2009-10-29 11:33:20,230 (Thread-99) [ServiceEngineTestServices.java:359:INFO ] testServiceEcaGlobalEventExecOnCommit updated SVC_SECAGC. [java] 2009-10-29 11:33:20,231 (Thread-99) [ ServiceDispatcher.java:582:INFO ] Sync service [test-dispatcher-l76D0XsSak/testServiceEcaGlobalEventExecOnCommit] finished in [9] milliseconds, OUTPUT = [responseMessage=success] [java] 2009-10-29 11:33:20,236 (main) [ TestRunContainer.java:220:INFO ] [JUNIT (end)] : service-eca-global-event-exec-assert-data(org.ofbiz.testtools.EntityXmlAssertTest) finished. (in 19 ms) {code} A possible solution is to add a pause before the assert, it could be a simple hack (for now i insert a test-case with a service that just sleep for a while) but it could be useful to have this integrated in /test-suite.xsd and be able to do : {code:xml} <test-case case-name="service-eca-global-event-exec-assert-data"> <sleep milliseconds="5000" /> <entity-xml action="assert" entity-xml-url="component://service/testdef/data/ServiceEcaGlobalEventAssertData.xml"/> </test-case> {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.