[jboss-jira] [JBoss JIRA] (DROOLS-1347) Explicit expiration of event not effective - regression from 6.4 to 6.5
Matteo Mortari (JIRA)
issues at jboss.org
Fri Oct 28 11:20:00 EDT 2016
[ https://issues.jboss.org/browse/DROOLS-1347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13313518#comment-13313518 ]
Matteo Mortari edited comment on DROOLS-1347 at 10/28/16 11:19 AM:
-------------------------------------------------------------------
Rule definition advice.
In this case, the problem is the rule "Rexpected" is assuming the previous behavior of expiration (as behaving before 6.5.0.Final). In this case, the rule can be defined more correclty and aligned with the current behavior (from 6.5.0.Final) by rewriting it as:
{code:java}
rule "Rexpected"
when
$t : Character() over window:length(1)
not String(this coincides $t)
then
insert("good");
list.add("Rexpected");
end
{code}
with output:
{code}
2016-10-28 17:06:21,275 INFO [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (main) Found kmodule: file:/home/mmortari/git/DROOLS-1347/target/classes/META-INF/kmodule.xml
2016-10-28 17:06:21,462 WARN [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (main) Unable to find pom.properties in /home/mmortari/git/DROOLS-1347/target/classes
2016-10-28 17:06:21,472 INFO [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (main) Recursed up folders, found and used pom.xml /home/mmortari/git/DROOLS-1347/pom.xml
2016-10-28 17:06:21,478 INFO [org.drools.compiler.kie.builder.impl.KieRepositoryImpl] (main) KieModule was added: FileKieModule[releaseId=org.drools:DROOLS-1347:0.0.1-SNAPSHOT,file=/home/mmortari/git/DROOLS-1347/target/classes]
2016-10-28 17:06:22,314 INFO [org.drools.DROOLS_1347.RuleTest] (main) Creating kieBase with STREAM option
2016-10-28 17:06:22,380 INFO [org.drools.DROOLS_1347.RuleTest] (main) There should be rules:
2016-10-28 17:06:22,381 INFO [org.drools.DROOLS_1347.RuleTest] (main) kp [Package name=org.drools.DROOLS_1347] rule Rexpected
2016-10-28 17:06:22,381 INFO [org.drools.DROOLS_1347.RuleTest] (main) kp [Package name=org.drools.DROOLS_1347] rule Ravoid
2016-10-28 17:06:22,381 INFO [org.drools.DROOLS_1347.RuleTest] (main) Creating kieSession
2016-10-28 17:06:22,427 INFO [org.drools.DROOLS_1347.RuleTest] (main) Populating globals
2016-10-28 17:06:22,427 INFO [org.drools.DROOLS_1347.RuleTest] (main) Now running data
---a---
x a
x good
fired: [Rule name=Rexpected, agendaGroup=MAIN, salience=0, no-loop=false]
Session facts:
> a [java.lang.Character] FH: 5:1:649329985:97:1:DEFAULT:NON_TRAIT:java.lang.Character
> good [java.lang.String] FH: 5:2:1146825051:3178685:2:DEFAULT:NON_TRAIT:java.lang.String
---b---
x b
x good
fired: [Rule name=Rexpected, agendaGroup=MAIN, salience=0, no-loop=false]
Session facts:
> b [java.lang.Character] FH: 5:3:1239807799:98:3:DEFAULT:NON_TRAIT:java.lang.Character
> good [java.lang.String] FH: 5:4:1146825051:3178685:4:DEFAULT:NON_TRAIT:java.lang.String
{code}
and all assertions passes (/)
was (Author: tari_manga):
Rule definition advice.
In this case, the problem is the rule "Rexpected" is assuming the previous behavior of expiration (as behaving before 6.5.0.Final). In this case, the rule can be defined more correclty and aligned with the current behavior (from 6.5.0.Final) by rewriting it as:
{code:java}
rule "Rexpected"
when
$t : Character() over window:length(1)
not String(this coincides $t)
then
insert("good");
list.add("Rexpected");
end
{code}
with output:
{code}
2016-10-28 17:06:21,275 INFO [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (main) Found kmodule: file:/home/mmortari/git/DROOLS-1347/target/classes/META-INF/kmodule.xml
2016-10-28 17:06:21,462 WARN [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (main) Unable to find pom.properties in /home/mmortari/git/DROOLS-1347/target/classes
2016-10-28 17:06:21,472 INFO [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (main) Recursed up folders, found and used pom.xml /home/mmortari/git/DROOLS-1347/pom.xml
2016-10-28 17:06:21,478 INFO [org.drools.compiler.kie.builder.impl.KieRepositoryImpl] (main) KieModule was added: FileKieModule[releaseId=org.drools:DROOLS-1347:0.0.1-SNAPSHOT,file=/home/mmortari/git/DROOLS-1347/target/classes]
2016-10-28 17:06:22,314 INFO [org.drools.DROOLS_1347.RuleTest] (main) Creating kieBase with STREAM option
2016-10-28 17:06:22,380 INFO [org.drools.DROOLS_1347.RuleTest] (main) There should be rules:
2016-10-28 17:06:22,381 INFO [org.drools.DROOLS_1347.RuleTest] (main) kp [Package name=org.drools.DROOLS_1347] rule Rexpected
2016-10-28 17:06:22,381 INFO [org.drools.DROOLS_1347.RuleTest] (main) kp [Package name=org.drools.DROOLS_1347] rule Ravoid
2016-10-28 17:06:22,381 INFO [org.drools.DROOLS_1347.RuleTest] (main) Creating kieSession
2016-10-28 17:06:22,427 INFO [org.drools.DROOLS_1347.RuleTest] (main) Populating globals
2016-10-28 17:06:22,427 INFO [org.drools.DROOLS_1347.RuleTest] (main) Now running data
---a---
x a
x good
fired: [Rule name=Rexpected, agendaGroup=MAIN, salience=0, no-loop=false]
Session facts:
> a [java.lang.Character] FH: 5:1:649329985:97:1:DEFAULT:NON_TRAIT:java.lang.Character
> good [java.lang.String] FH: 5:2:1146825051:3178685:2:DEFAULT:NON_TRAIT:java.lang.String
---b---
x b
x good
fired: [Rule name=Rexpected, agendaGroup=MAIN, salience=0, no-loop=false]
Session facts:
> b [java.lang.Character] FH: 5:3:1239807799:98:3:DEFAULT:NON_TRAIT:java.lang.Character
> good [java.lang.String] FH: 5:4:1146825051:3178685:4:DEFAULT:NON_TRAIT:java.lang.String
{code}
and all assertions passes (/) (y)
> Explicit expiration of event not effective - regression from 6.4 to 6.5
> -----------------------------------------------------------------------
>
> Key: DROOLS-1347
> URL: https://issues.jboss.org/browse/DROOLS-1347
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 6.5.0.Final
> Reporter: Thibault Daoulas
> Assignee: Matteo Mortari
>
> I just ugraded my project from Drools 6.4.0.Final to 6.5.0.Final and have now quite a few tests on rules that fail, all have in common that they test the expiration of events, where an event that should have been removed from the working memory is still present.
--
This message was sent by Atlassian JIRA
(v7.2.2#72004)
More information about the jboss-jira
mailing list