]
Mark Proctor updated JBRULES-1106:
----------------------------------
Fix Version/s: 4.0.1
Assignee: Michael Neale (was: Mark Proctor)
Copied rules using a guided DSL in BRMS produce duplicate rule names
in built binary packages.
----------------------------------------------------------------------------------------------
Key: JBRULES-1106
URL:
http://jira.jboss.com/jira/browse/JBRULES-1106
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-brms
Affects Versions: 4.0.0.GA
Environment: Windows XP SP2, Sun JRE 1.5_09
Reporter: Shahad Ahmed
Assigned To: Michael Neale
Fix For: 4.0.1
I found the following problem when creating rules using the guided rule editor in the
BRMS with a DSL. If you use the copy option to copy an existing rule, everything seems
okay and a new copy of the rule is created in the package. However, if you build the
package and view the package source then any rule that was copied from another rule has
the same name as the original rule. Consequently your rule package has rules with the same
name and will throw an error when loaded into a rulebase. Note this problem does not
appear to occur if you do not use a DSL.
Here's how to replicate the problem for a clean BRMS install:
1. Create a new category called test.
2. In the defaultPackage create a new DSL called test as shown below:
[when]true=eval(true)
[then]report=System.out.println("Hello");
3. Save the test DSL
4. Create a new Business Rule in the defaultPackage called test1 with category test and
using the guided rule editor.
5 Add a when expression using the DSL sentence "true" and add a then action
using the DSL sentence "report". In the rule option, add the dialect attribute
and set it to "java".
6. Save rule test1.
7. Click on the Copy tab to copy test1. Name the new rule test2. You will see a dialog
that confirms the creation of rule test2.
8. Open rule test2 from the rule browser and it seems okay and has the name test2 (minor
funny is that test2 has version 2, whereas test1 only has version 1).
9. Select the package option on the left of the BRMS and select the defaultPackage so
that you see the "Build, Validate and Deploy" option. Select this and build the
package.
10 Now click on the Show Package Source button and you will see two rules both named
test1 (as shown below) instead of two rules named test1 and test2 as expected. This
package is incorrect, even though the rules in the BRMS seem to correctly have names test1
and test2. I can confirm that trying to load the exported binary package into a rulebase
cause an error to be reported (so it's not just a bug in the show package source code,
but in the generated binary as well).
package defaultPackage
rule "test1"
dialect "java"
when
eval(true)
then
System.out.println("Hello");
end
rule "test1"
dialect "java"
when
eval(true)
then
System.out.println("Hello");
end
Shahad
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: