Bug 814865 - Test Scenario cannot set java.sql.Date fields
Summary: Test Scenario cannot set java.sql.Date fields
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRM (Guvnor)
Version: BRMS 5.3.0.GA
Hardware: All
OS: All
unspecified
medium
Target Milestone: ER8
: BRMS 5.3.0.GA
Assignee: Toni Rikkola
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-20 21:21 UTC by Babak Mozaffari
Modified: 2023-05-15 19:53 UTC (History)
3 users (show)

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.
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


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

Description Babak Mozaffari 2012-04-20 21:21:30 UTC
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 21:23:20 UTC
Created attachment 579109 [details]
Repository Export to quickly reproduce

Comment 2 Toni Rikkola 2012-04-24 08:31:10 UTC
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 10:42:04 UTC
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 08:17:24 UTC
The fixed for this issue should be included in ER7. Please do verification on it.

Comment 5 Babak Mozaffari 2012-05-14 23:30:40 UTC
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 14:21:10 UTC
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 14:56:40 UTC
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 14:57:34 UTC
Created attachment 584996 [details]
Test Scenario with yyyy-MM-dd in properties

Comment 10 Sona Mala 2012-05-21 09:21:08 UTC
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 11:22:59 UTC
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-23 01:19:14 UTC
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 06:29:20 UTC
(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 08:32:15 UTC
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 09:08:23 UTC
Please verify them on ER8.

Comment 16 Sona Mala 2012-05-28 12:43:58 UTC
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 06:04:05 UTC
    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.