Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0045429
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajorhave not tried2020-11-11 18:212020-11-12 09:44
ReportershuehnerView Statuspublic 
Assigned Toshuehner 
PrioritynormalResolutionfixedFixed in VersionPR21Q1
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0045429: Code to detect+warn about Unbalanced adminMode in OBBaseTest should be improved

DescriptionOBBaseTest class used by as basis for all unit tests has code to detect case that adminMode was not reset after running a testCase and warns in that case.

That code is conceptually similar to code in OBContext.java (method: clearAdminModeStack) called and the end of an http request.

However code in OBBaseTest has two problems:
a.) It is not integrated with existing ADMIN_TRACE_SIZE debugging code from OBContext (which helps to find out root-cause of those issues)
b.) It does not reset/fix the problem.
So after having 1 test-case having the problem it reports the error for every test-case running after it (even if those tests themselves are fine)

Steps To ReproduceCause and Unbalanced AdminMode problem in one junit test case
Run i.e. ant run.all.tests
Notice that
a.) the problem is not just reported in the test-cause having the issue but all later tests
b.) Activate debugging code in OBContext.java (ADMIN_TRACE_SIZE=100 for example) and notice that the debugging does not work.

Example issue causing this situation is reported here:
https://issues.openbravo.com/view.php?id=45428 [^]
Proposed SolutionReplace/enhance existing code in OBBaseTest by calling/re-using the existing OBContext code.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
depends on backport 0045430PR20Q4 closedshuehner Openbravo ERP Code to detect+warn about Unbalanced adminMode in OBBaseTest should be improved 
related to defect 0045428 closedMery Anelo Localization Pack: Spain FacturasEventHandler -> SIIUtils.getLegalOrganization has setAdminMode but never calls restorePreviousMode 

-  Notes
(0124291)
hgbot (developer)
2020-11-12 07:32

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/225 [^]
(0124296)
hgbot (developer)
2020-11-12 09:43

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/225 [^]
(0124297)
hgbot (developer)
2020-11-12 09:43

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: ec48f7cfe1b6f5dfefab7101c3d97393400882ee
Author: Stefan Huehner <stefan.huehner@openbravo.com>
Date: 2020-11-12T08:40:11+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/ec48f7cfe1b6f5dfefab7101c3d97393400882ee [^]

Fixes ISSUE-45429: Improve unbalanced adminMode warnings in OBBaseTest.

OBBaseTest did already check if a test-case left adminMode enabled
instead of handling it properly.
However that detection was not integration with the existing OBContext
code for doing the same logic at the end of an http-request.

Reuse that existing code allows to reuse the debugging ADMIN_TRACE_SIZE
logic from OBContext also to debug Junit test issues.

---
M src-test/src/org/openbravo/test/base/OBBaseTest.java
M src/org/openbravo/dal/core/OBContext.java
---
(0124298)
hgbot (developer)
2020-11-12 09:43

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 675440a9683d83f9576656aaee0e060bcff51218
Author: Asier Lostalé <asier.lostale@openbravo.com>
Date: 2020-11-12T08:40:11+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/675440a9683d83f9576656aaee0e060bcff51218 [^]

related to ISSUE-45429: small cleanup in OBContext

This commit changes:
  * Warn message in case of unbalanced admin calls was mentioning
    enableAsAdminContext and resetAsAdminContext which are deprecated.
  * Replace ThreadLocal.set(null) with ThreadLocal.remove(), see [1] for
    reference.

[1] https://www.baeldung.com/java-memory-leaks#7-using-threadlocals [^]

---
M src/org/openbravo/dal/core/OBContext.java
---

- Issue History
Date Modified Username Field Change
2020-11-11 18:21 shuehner New Issue
2020-11-11 18:21 shuehner Assigned To => platform
2020-11-11 18:21 shuehner Modules => Core
2020-11-11 18:21 shuehner Triggers an Emergency Pack => No
2020-11-11 18:27 shuehner Relationship added related to 0045428
2020-11-12 07:32 hgbot Note Added: 0124291
2020-11-12 07:40 alostale Assigned To platform => shuehner
2020-11-12 07:40 alostale Status new => scheduled
2020-11-12 09:43 hgbot Note Added: 0124296
2020-11-12 09:43 hgbot Resolution open => fixed
2020-11-12 09:43 hgbot Status scheduled => resolved
2020-11-12 09:43 hgbot Fixed in Version => PR21Q1
2020-11-12 09:43 hgbot Note Added: 0124297
2020-11-12 09:43 hgbot Note Added: 0124298
2020-11-12 09:44 alostale Review Assigned To => alostale
2020-11-12 09:44 alostale Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker