daniel-clark-mint opened a new issue, #2105:
URL: https://github.com/apache/incubator-kie-issues/issues/2105

   Detected while preparing to upgrade to drools 10.0.1, our unit tests 
detected this changed behavior. It seems like the conditional consequence is 
exhibiting "do" behavior rather than "break" behavior and executing both 
consequences.
   Reproducer:
   `package com.example.reproducer;
   
   declare InputObject
     id: Integer
     description: String
   end
   
   declare InferenceObject
     id: Integer
     description: String
   end
   
   rule "setup" salience -100
     when
     then
       insert( new InputObject( 1, "Input Object 1" ) );
       insert( new InputObject( 2, "Input Object 2" ) );
       insert( new InputObject( 2, "Input Object 2" ) );
       insert( new InputObject( 3, "Input Object 3" ) );
       insert( new InputObject( 4, "Input Object 4" ) );
   end
   
   rule "pre test"
     when
       InputObject(
         $id: id,
         $desc: description
       )
     then
       insertLogical( new InferenceObject( $id, $desc ) );
   end
   
   rule "test"
     when
       InputObject(
         $id: id,
         $desc: description
       )
       accumulate(
         InferenceObject(
           $id != 2,
           $desc != description
         ),
         $otherCount: count()
       )
       accumulate(
         InferenceObject(
           $id == id,
           $desc == description
         ),
         $count:  count()
       )
       if( $count == 2 && $count > 1 && $otherCount != 2 ) break [ Do2 ]
     then
       if( $count == 2 && $count > 1 && $otherCount != 2 )
       {
         System.err.println( "Unnamed (should be false)" );
         System.err.println( $count == 2 && $count > 1 && $otherCount != 2 );
         System.err.println( Long.toString( $count ) + ": " + $desc );
       }
     then[ Do2 ]
       if( !( $count == 2 && $count > 1 && $otherCount != 2 ) )
       {
         System.err.println( "NamedConsequence (should be true)" );
         System.err.println( $count == 2 && $count > 1 && $otherCount != 2 );
         System.err.println( Long.toString( $count ) + ": " + $desc );
       }
   end
   
   rule "post test"
     when
       InputObject(
         $id: id,
         $desc: description
       )
     then
       insertLogical( new InferenceObject( 4, "Input Object 4" ) );
   end`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to