Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-1737

Rule is ignored after migration from 6.5.0.Final to 7.2.0.Final

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • 2017 Week 36-37
    • Hide

      open attached maven project and run Main720 to get actual behavior, then run Main650 to get expected mehavior.

      Show
      open attached maven project and run Main720 to get actual behavior, then run Main650 to get expected mehavior.
    • NEW
    • NEW

      We are trying to migrate project on newest version of drools, but had regression testing failure. We have extracted simplest scenario to reproduce it.

      package demo
      
      import demo.DataRow;
      import demo.ExpectedError;
      import demo.Dark;
      
      
      rule "rule-1"
      	salience 130
      	no-loop true
      when
      	$a: DataRow(viewId == Dark.Xantor.$ID, $d: row[Dark.Xantor.wand] != null)
      	$b: DataRow(viewId == Dark.Aragorn.$ID, row[Dark.Aragorn.sword] == $d)
      	$c: DataRow(viewId == Dark.Tant.$ID, row[Dark.Tant.crown] == $d)
      then
      	$a.setField(Dark.Xantor.sword, $c.getField(Dark.Tant.sword));
      	$a.setField(Dark.Xantor.chainmail, $c.getField(Dark.Tant.tower));
      	update($a);
      end
      
      rule "rule-2"
      	salience 110
      	no-loop true
      when
      	$a: DataRow(viewId == Dark.Xantor.$ID,
      						$b: row[Dark.Xantor.wand] != null,
      						row[Dark.Xantor.sword] == "claymore",
      						row[Dark.Xantor.bow] == null)
      then
          throw new ExpectedError();
      end
      

      initial facts:

      Dark.Tant( crown: 123, sword: claymore )
      Dark.Aragorn( sword: 123 )
      Dark.Xantor( wand: 123 )
      

      Expected to catch ExpectedError (rule-2 to be fired), but nothing happens.

      Detailed exploit attached as Maven project with two executable modules. Main650 class demonstrates positive scenario (it run rules with 6.5.0.Final), Main720 (runs the same rules with 7.2.0.Final) - negative. "Main" class contains basic scenario without link to drools version

              mfusco@redhat.com Mario Fusco
              kkolyan_jira Nikolay Plekhanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: