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