Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0035062Openbravo ERPA. Platformpublic2017-01-26 17:452017-03-15 20:18
shuehner 
alostale 
urgentmajorhave not tried
closedfixed 
5
 
3.0PR17Q2 
caristu
Core
No
0035062: junit Weld tests not firing first 'begin transaction' event to DAL EventHandlers
Having an event Handler in DAL using onBeginTransaction & onCommitTransaction developer expects to always get alerted to both events in obivous order:
1.) begin
2.) end.

Which works fine in the application.

However when running junit tests extending WeldBaseTest the very first onBeginTransction event is missing causing functional errors if some custom EventHandler depends on this.

As EventHandler technically run on every flush that bug can be very visible like breaking 1.9k junit tests (indirectly).

Attached demo EventHandler is enough to show the problem.

- Add attached demo code to show the bug
- Run junit test 'CdiInfrastructure' in eclipse
- Check log4j output and see that very first begin event is missing
No tags attached.
related to defect 0035060 closed alostale EntityPersistanceEventObservers are executed twice on commitAndClose 
? InterceptorBugTest.java (1,924) 2017-01-26 17:45
https://issues.openbravo.com/file_download.php?file_id=10351&type=bug
Issue History
2017-01-26 17:45shuehnerNew Issue
2017-01-26 17:45shuehnerAssigned To => platform
2017-01-26 17:45shuehnerModules => Core
2017-01-26 17:45shuehnerTriggers an Emergency Pack => No
2017-01-26 17:45shuehnerFile Added: InterceptorBugTest.java
2017-01-26 17:46shuehnerNote Added: 0093850
2017-01-27 07:42alostaleStatusnew => acknowledged
2017-01-27 12:17alostaleRelationship addedrelated to 0035060
2017-01-27 12:18alostaleStatusacknowledged => scheduled
2017-01-27 12:18alostaleAssigned Toplatform => alostale
2017-01-27 12:55alostaleReview Assigned To => caristu
2017-01-27 12:58hgbotCheckin
2017-01-27 12:58hgbotNote Added: 0093888
2017-01-27 12:58hgbotStatusscheduled => resolved
2017-01-27 12:58hgbotResolutionopen => fixed
2017-01-27 12:58hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/d4172df7143364ddce691d43fe5bc083244e95a2 [^]
2017-01-27 12:58hgbotCheckin
2017-01-27 12:58hgbotNote Added: 0093889
2017-01-30 11:19hgbotCheckin
2017-01-30 11:19hgbotNote Added: 0093924
2017-01-30 11:20caristuNote Added: 0093925
2017-01-30 11:20caristuStatusresolved => closed
2017-01-30 11:20caristuFixed in Version => 3.0PR17Q2
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095129
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095130
2017-03-15 20:18hudsonbotCheckin
2017-03-15 20:18hudsonbotNote Added: 0095138

Notes
(0093850)
shuehner   
2017-01-26 17:46   
Possible cause: Interceptors are not setup or working properly at moment that very transaction is started.
(0093888)
hgbot   
2017-01-27 12:58   
Repository: erp/devel/pi
Changeset: d4172df7143364ddce691d43fe5bc083244e95a2
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 27 12:21:43 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/d4172df7143364ddce691d43fe5bc083244e95a2 [^]

fixed bug 35062: junit Weld tests not firing first 'begin transaction' event

  This occurred in the 1st test case executed for each class because method
  OBBaseTest.setUp was invoked before WeldBaseTest @Before method (because of
  inheritance tree), this setUp method creates Dal transaction before WeldBaseTest
  configured observers.

  Fixed by enforcing correct execution order: 1st WeldBaseTest then OBBaseTest.

---
M modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/WeldBaseTest.java
---
(0093889)
hgbot   
2017-01-27 12:58   
Repository: erp/devel/pi
Changeset: 9faeff1d4b25469b52067d393e2d2ec23b691867
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 27 12:22:42 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/9faeff1d4b25469b52067d393e2d2ec23b691867 [^]

realted to bug 35062: added test cases

---
M modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/DalPersistanceEventTest.java
M modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/ObserverBaseTest.java
M modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/event/OrderLineTestObserver.java
---
(0093924)
hgbot   
2017-01-30 11:19   
Repository: erp/devel/pi
Changeset: c2c0957f23d30f2356c8252f13f2ead617d5e6b7
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon Jan 30 11:18:40 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/c2c0957f23d30f2356c8252f13f2ead617d5e6b7 [^]

related to issue 35062: fix typo

---
M modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/DalPersistanceEventTest.java
---
(0093925)
caristu   
2017-01-30 11:20   
Code review + testing OK: first 'begin transaction' event is now fired for classes extending WeldBaseTest.
(0095129)
hudsonbot   
2017-03-15 20:18   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/54e102bef53e [^]
Maturity status: Test
(0095130)
hudsonbot   
2017-03-15 20:18   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/54e102bef53e [^]
Maturity status: Test
(0095138)
hudsonbot   
2017-03-15 20:18   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/54e102bef53e [^]
Maturity status: Test