Bug 1079253 - BRMS 6.0.1 CR1 - guided rule editor update rule not shown in UI editor.
Summary: BRMS 6.0.1 CR1 - guided rule editor update rule not shown in UI editor.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.1
Hardware: x86_64
OS: Mac OS
high
high
Target Milestone: CR2
: 6.0.1
Assignee: manstis
QA Contact: Jiri Locker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-21 10:01 UTC by Eric D. Schabell
Modified: 2014-08-06 19:58 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-08-06 19:58:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1081080 0 urgent CLOSED java.lang.NoClassDefFoundError:org/apache/commons/lang/StringUtils when opening guided rule that modifies facts on RHS 2021-02-22 00:41:40 UTC

Internal Links: 1081080

Description Eric D. Schabell 2014-03-21 10:01:22 UTC
Description of problem: using brms-coolstore-demo project (https://github.com/eschabell/brms-coolstore-demo/tree/6.0.1) branch 6.0.1

Setup project, start server, AUTHORING -> PROJECT AUTHORING -> GUIDED RULE -> TOTAL SHOPPING CART

Code view tab shows:
	|	import java.lang.Number;
2.	|	import com.redhat.coolstore.ShoppingCart;
3.	|	
4.	|	rule "Total Shopping Cart"
5.	|	    no-loop true
6.	|	    ruleflow-group "total-rules"
7.	|	    dialect "mvel"
8.	|	    when
9.	|	        $sc : ShoppingCart( )
10.	|	    then
11.	|	        $sc.setCartTotal( 0.0 );
12.	|	        $sc.setCartItemPromoSavings( 0.0 );
13.	|	        update( $sc );
14.	|	end

Using editor I remove the literal field behind line 12, changing to:

$sc.setCartItemPromoSavings( ($sc.cartItemPromoSavings == 0.0) ? 0.0 : $sc.cartItemPromoSavings * -1 );

Save the file, says successful, but close pop-up warns 'Sure you want to discard unsaved changes?', only choice is yes or cancel. Close rule, reopen and changes not shown.

From command line clone ssh://localhost:8001/coolstore-demo and view source of same guided rule and it shows change:

import java.lang.Number;
import com.redhat.coolstore.ShoppingCart;

rule "Total Shopping Cart"
	no-loop true
	ruleflow-group "total-rules"
	dialect "mvel"
	when
		$sc : ShoppingCart( )
	then
		$sc.setCartTotal( 0.0 );
		$sc.setCartItemPromoSavings( ($sc.cartItemPromoSavings == 0.0) ? 0.0 : $sc.cartItemPromoSavings * -1 );
		update( $sc );
end

Restart of server does not show new changes in UI editor either. No caching on in browser.

Version-Release number of selected component (if applicable):
6.0.1.CR1

How reproducible:
see above

Steps to Reproduce:
1. see above
2.
3.

Actual results:
Changes not shown.

Expected results:
Changes should be shown in editor.

Additional info:

Comment 2 Jiri Locker 2014-03-21 15:46:31 UTC
Confirmed. It seems arbitrary Formulas are not recognized and replaced by Literal with default value. Try:

when $a : Appliacnt()
then $a.setAge( 1 + 1 );

Save, reopen. You'll see $a.setAge( 0 );

Comment 3 manstis 2014-03-24 09:04:47 UTC
Yes, I can confirm the same.

(In reply to Jiri Locker from comment #2)
> Confirmed. It seems arbitrary Formulas are not recognized and replaced by
> Literal with default value. Try:
> 
> when $a : Appliacnt()
> then $a.setAge( 1 + 1 );
> 
> Save, reopen. You'll see $a.setAge( 0 );

Comment 4 manstis 2014-03-24 09:22:36 UTC
I can also confirm the persisted value is correct, however it is the DRL->RuleModel unmarshalling that cannot handle the formula... investigating a fix.

Comment 6 Michael 2014-03-24 14:18:45 UTC
Ticket cherry-picked into 6.0.1.CR2
Commit: 37a839f5abec709587db6995d1fdec3633b719fa

Comment 7 Jiri Locker 2014-04-01 13:57:19 UTC
The changes are now displayed correctly after saving and reopening the rule.

Please note that the rule has validation errors, though, which fail the project build. But this was broken in CR1 too.

Comment 8 Jiri Locker 2014-04-01 15:19:19 UTC
(In reply to Jiri Locker from comment #7)
> Please note that the rule has validation errors, though, which fail the
> project build. But this was broken in CR1 too.

Sorry, false alarm. I made a mistake in the $sc.setCartItemPromoSavings formula. The described rule is valid.


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