Created attachment 579108 [details] Screenshot Description of problem: In the Given clause of a Test Scenario, a field of type java.sql.Date is recognized as a date (probably because of parent class java.util.Date) but an attempt to set a date value on it fails, again probably because it tries to set a util.Date on the field. Version-Release number of selected component (if applicable): 5.3.0 ER6 How reproducible: Any attempt to run a test scenario while setting a java.sql.Date field reproduces this error. Steps to Reproduce: 1.Create a fact with a java.sql.Date field 2.Create a test scenario, in the given choose that fact and try to set a date for that field. Run the scenario. Actual results: - Exception Expected results: Additional info:
Created attachment 579109 [details] Repository Export to quickly reproduce
There is a fix for this in the community version. If this issue gets promoted to blocker the fix will be easy to cherry pick. https://github.com/droolsjbpm/guvnor/commit/2d54f0faead22724d1e1d4e8c09e00df0ddefefa
Anne-Louise, please make this blocker+. This is a customer issue and should be resolved for 5.3. Also, it's already resolved and needs only to be merged.
The fixed for this issue should be included in ER7. Please do verification on it.
I checked ER7. Setting the java.sql.Date in a test scenario no longer causes an error however a simple attempt to set a date object and then verify its value fails. In other words if a java.sql.Date is set to today's date in the given and the expect says that it should be that same date, the test scenario fails and says those two dates are not equal.
I am not sure, how Guvnor works with Date, but in Test Scenario java.sql.Date is represented by the string "yyyy-mm-dd" and Guvnor's Date is represented by drools.dateformat=dd-MMM-yyyy (sets in WEB-INF/classes/preferences.properties).
If I set drools.dateformat=yyyy-MM-dd I get Error alert in Test Scenarion (screenshot attached) Steps to reproduce: 1. set drools.dateformat=yyyy-MM-dd 2. run BRMS 5.3 ER7 Standalone 3. import empty repository 4. import POJO model from attached repository 5. create new Test Scenario - given: Insert 'SqlDateFact' [], use tool for set date 6. run scenario => get Error: Unable to run the scenario. Invalid date input format: [2012-05-10] it should follow: [dd-MMM-yyyy]
Created attachment 584996 [details] Test Scenario with yyyy-MM-dd in properties
Verify: setting of sql.Date. Assigned: operetion on sql.Date failed in test scenarion. The issue is described by comments #6 and #7.
The problem is actually that. drools.dateformat that is set in the preferences.properties files gets over written by the Drools default format. This happens every time and I imagine it also affects other areas of Guvnor. So not a test scenario bug. Definitely a blocker. Fix for this is a one liner, I can commit it anytime.
I believe toni is waiting approval for his approach to fix this problem, before committing it. Can someone OK this?
(In reply to comment #11) > So not a test scenario bug. Definitely a blocker. Fix for this is a one > liner, I can commit it anytime. Commit, please.
This fix has been commited, so marked as modified. Commit url: https://github.com/droolsjbpm/guvnor/commit/e19a643f091e8c3b56e1eb250adf83507df6068c
Please verify them on ER8.
This issue is verified. There is not any error alert. But test scenario does not work with java.sql.Date correctly. Problem is described by https://bugzilla.redhat.com/show_bug.cgi?id=825776
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: In the Given clause of a Test Scenario, a field of type java.sql.Date is recognized as a date, but an attempt to set a date value on it fails because it tries to set a util.Date on the field. This has been resolved in that, setting java.sql.Date no longer causes an error. Please see related issue <ulink url="https://bugzilla.redhat.com/show_bug.cgi?id=825776">BZ825776</ulink> for further details.