Hi All,
I'm new to drools and using 5.2.0
I have 2 test cases I want to run on my test xml files
1. Is the xml node there
2. Does it match XSD data type pattern
The XML file contents is loaded into a DTO(which has sub DTOs) and the DTO
is passed to the RuleService
I created one rule file called F1.drl with 2 rules in it.
rule "F1 - Exists"
when
fact : basicFact()
ojb1 : ObjectDTO() from fact.Objects
not(String() from ojb1.node1())
then
System.out.println("Missing Node Data");
end
rule "F1- Pattern Match"
when
fact : basicFact()
ObjectDTO( node1 not matches
"^[\\S]{1,100}$") from fact.Objects
then
System.out.println("Bad Node value");
end
test.java has 2 junit test cases
@test for TestFailExists.XML
@Test for TestFailPattern.XML
Regardless of which rule is first the first is only one that fires on the
file that it would apply to.
I tried commenting out 1 rule and the other works fine and vice versa. I
even tried separating the
Into separate DRL files which worked as expected.
Hopefully someone can shed some light on this for me
Thank you for your time,
Joe
Show replies by date
I ended up fixing the issue. Well one of my coworkers who setup the Drools
Rules engine had to make some changes to the Drools setup, he had enabled
multi-threading. Once he disabled it my rules ran fine.
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Joe Donnelly
Sent: Tuesday, April 24, 2012 4:56 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] 2 Drools Rules in one DRL file and second Rule is not
firing.
Hi All,
I'm new to drools and using 5.2.0
I have 2 test cases I want to run on my test xml files
1. Is the xml node there
2. Does it match XSD data type pattern
The XML file contents is loaded into a DTO(which has sub DTOs) and the DTO
is passed to the RuleService
I created one rule file called F1.drl with 2 rules in it.
rule "F1 - Exists"
when
fact : basicFact()
ojb1 : ObjectDTO() from fact.Objects
not(String() from ojb1.node1())
then
System.out.println("Missing Node Data");
end
rule "F1- Pattern Match"
when
fact : basicFact()
ObjectDTO( node1 not matches
"^[\\S]{1,100}$") from fact.Objects
then
System.out.println("Bad Node value");
end
test.java has 2 junit test cases
@test for TestFailExists.XML
@Test for TestFailPattern.XML
Regardless of which rule is first the first is only one that fires on the
file that it would apply to.
I tried commenting out 1 rule and the other works fine and vice versa. I
even tried separating the
Into separate DRL files which worked as expected.
Hopefully someone can shed some light on this for me
Thank you for your time,
Joe