Bug 744737

Summary: Guided editor: problematic removing of variable binding
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Zuzana Krejčová <zkrejcov>
Component: BRM (Guvnor)Assignee: manstis
Status: VERIFIED --- QA Contact: Lukáš Petrovický <lpetrovi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: BRMS 5.2.0-ER1CC: lpetrovi, manstis
Target Milestone: ---   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
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: --- Target Upstream Version:
Attachments:
Description Flags
removed field variable, viewing source
none
validatind after removing field variable
none
validation after removing fact variable for first condition in the rule none

Description Zuzana Krejčová 2011-10-10 10:59:34 UTC
Description of problem:
In the Guided rules editor, facts and fields can be bound to variables. The only way to remove that binding is to bind it to a new variable that is an empty string. This causes some problem with the rule source.
After removing the variable from a fact, the corresponding row in the source looks like this: 
  when  
          : fact(/*whatever was matched here*/)
  then
The colon after the variable is still there, even if there's no variable now (except for the empty string and that shouldn't count). If it was on the first line, you can still validate the rule and it will be ok. More problems show, when you do the same thing to a fact on another line or when you remove a binding form a field. Validation then returns an error message containing something like: 
  [<rule>] [ERR 102] Line x:y mismatched input ':' in rule "<rule>"
  [<rule>] Parser returned a null Package


Version-Release number of selected component (if applicable):
BRMS 5.2.0 ER5


Steps to Reproduce:
1. Add a Fact to a rule,
2. add another fact, add a field to it.
3. Bind a) a valid variable or b) an empty string variable to the 2nd fact and another to its field.
4a. Rewrite the binding with an empty string for the a) second fact or b) its field.

Validate.

  
Actual results:
Error message
  [<rule>] [ERR 102] Line x:y mismatched input ':' in rule "<rule>"
  [<rule>] Parser returned a null Package


Expected results:
Rule validated ok.


Additional info:
It should be enough to just test the variable string for an empty string before setting anything and removing the variable and the colon when it is empty.

Comment 1 Zuzana Krejčová 2011-10-10 12:02:48 UTC
Created attachment 527224 [details]
removed field variable, viewing source

Comment 2 Zuzana Krejčová 2011-10-10 12:03:33 UTC
Created attachment 527225 [details]
validatind after removing field variable

Comment 3 Zuzana Krejčová 2011-10-10 12:04:41 UTC
Created attachment 527226 [details]
validation after removing fact variable for first condition in the rule

Comment 4 manstis 2011-11-08 21:13:53 UTC
Followed the prescribed steps to reproduce and was unable with the current code-base for 5.3.x. Looking at the commit history it appears to have been fixed as a side-effect of JIRA "GUVNOR-1553: Guided Rule Editor: Cannot set enum attribute with a formula expression in guided editor"