Bug 814865 - Test Scenario cannot set java.sql.Date fields
Test Scenario cannot set java.sql.Date fields
Status: VERIFIED
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRM (Guvnor) (Show other bugs)
BRMS 5.3.0.GA
All All
unspecified Severity medium
: ER8
: BRMS 5.3.0.GA
Assigned To: Toni Rikkola
Sona Mala
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-20 17:21 EDT by Babak Mozaffari
Modified: 2012-05-31 02:04 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Screenshot (46.67 KB, image/jpeg)
2012-04-20 17:21 EDT, Babak Mozaffari
no flags Details
Repository Export to quickly reproduce (4.86 KB, application/zip)
2012-04-20 17:23 EDT, Babak Mozaffari
no flags Details
Test Scenario with yyyy-MM-dd in properties (27.20 KB, image/png)
2012-05-16 10:57 EDT, Sona Mala
no flags Details

  None (edit)
Description Babak Mozaffari 2012-04-20 17:21:30 EDT
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:
Comment 1 Babak Mozaffari 2012-04-20 17:23:20 EDT
Created attachment 579109 [details]
Repository Export to quickly reproduce
Comment 2 Toni Rikkola 2012-04-24 04:31:10 EDT
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
Comment 3 Lukáš Petrovický 2012-04-24 06:42:04 EDT
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.
Comment 4 Ryan Zhang 2012-05-14 04:17:24 EDT
The fixed for this issue should be included in ER7. Please do verification on it.
Comment 5 Babak Mozaffari 2012-05-14 19:30:40 EDT
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.
Comment 6 Sona Mala 2012-05-16 10:21:10 EDT
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).
Comment 7 Sona Mala 2012-05-16 10:56:40 EDT
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]
Comment 8 Sona Mala 2012-05-16 10:57:34 EDT
Created attachment 584996 [details]
Test Scenario with yyyy-MM-dd in properties
Comment 10 Sona Mala 2012-05-21 05:21:08 EDT
Verify: setting of sql.Date.
Assigned: operetion on sql.Date failed in test scenarion. The issue is described by comments #6 and #7.
Comment 11 Toni Rikkola 2012-05-21 07:22:59 EDT
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.
Comment 12 Mark Proctor 2012-05-22 21:19:14 EDT
I believe toni is waiting approval for his approach to fix this problem, before committing it. Can someone OK this?
Comment 13 Lukáš Petrovický 2012-05-23 02:29:20 EDT
(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.
Comment 14 Ryan Zhang 2012-05-24 04:32:15 EDT
This fix has been commited, so marked as modified.
Commit url:
https://github.com/droolsjbpm/guvnor/commit/e19a643f091e8c3b56e1eb250adf83507df6068c
Comment 15 Ryan Zhang 2012-05-25 05:08:23 EDT
Please verify them on ER8.
Comment 16 Sona Mala 2012-05-28 08:43:58 EDT
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
Comment 17 lcarlon 2012-05-31 02:04:05 EDT
    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.

Note You need to log in before you can comment on or make changes to this bug.