[rules-users] Junit, PseudoClock and NPE
Edson Tirelli
ed.tirelli at gmail.com
Mon Mar 22 14:06:09 EDT 2010
Hmmm, strange... would you be able to share your junit test? If so,
could you please open a JIRA and attach the test?
Thanks,
Edson
2010/3/22 Makewise - Vitor Rui Mendonça <Vitor.Mendonca at brisa.pt>
> Hi folks!
>
>
>
> First time in this mailing-list, with very little experience in Drools
> (Fusion, regarding CEP).
>
> I hope that someone could help me out J
>
>
>
> I’ve being investigating about this issue and I’m not getting any answer.
>
>
>
> Here’s the problem:
>
> I’ve got a DRL file with a simple rule:
>
> *rule* “....”
>
> *when*
>
> $offline : Event( code == "101", $offlineLane : lane ) *from*entry-point
> "incoming"
>
> *not* ( $online : Event(code == "102", lane == $offlineLane,
> *this* after [0s,3m] $offline ) *from* entry-point "incoming" )
>
> *then*
>
> // some code here
>
> *end*
>
>
>
> What I want is: when there’s an offline for more than 3 minutes **without**
> any online event (meanwhile), that execute the rule.
>
>
>
> I’ve got JUnits, with Drools configured with STREAM mode and PSEUDO clock.
>
>
>
> All is good in JUnit world except in this testcase:
>
> · Insert an offline event (workingMemoryEntryPoint.insert(
> offlineEvent );)
>
> · Clock advances 2m50s (clock.advanceTime(2,TimeUnit.*MINUTES* );
> clock.advanceTime(50, TimeUnit.*SECONDS* );)
>
> · Insert an online event (workingMemoryEntryPoint.insert(
> onlineEvent );)
>
> · Clock advances 0m15s (clock.advanceTime(15,TimeUnit.*SECONDS* );
> )
>
> · Assertion error: the rule runs when it shouldn’t (online event
> cancels offline event).
>
>
>
> I’ve got no clue about this but I have some more interesting info:
>
> · When clock advances 0m15s, there’s an NPE on a LinkedList:
> *java.lang.NullPointerException*
>
> at org.drools.util.LinkedList.remove(*LinkedList.java:113*)
>
> at org.drools.common.Scheduler$DuractionJob.execute(*
> Scheduler.java:71*)
>
> at org.drools.time.impl.PseudoClockScheduler$ScheduledJob.call(*
> PseudoClockScheduler.java:219*)
>
> at org.drools.time.impl.PseudoClockScheduler.runCallBacks(*
> PseudoClockScheduler.java:168*)
>
> at org.drools.time.impl.PseudoClockScheduler.advanceTime(*
> PseudoClockScheduler.java:130*)
>
> · I haven’t any code/rule that retracts events (I shouldn’t have
> it for this case, right?)
>
> · I’ve tried Drools 5.0.1 and 5.1.0.M1, with the same results
>
> · The issue causing NPE, I’ve found an old issue regarding Drools
> 3.0.4 and the bug was corrected in 3.0.5 (
> https://jira.jboss.org/jira/browse/JBRULES-455)
>
> · I think that someone wrote about this error (in Drools 5) but I
> don’t have the link to it.
>
>
>
> Thanks In Advance!
>
>
>
> Best regards,
>
>
>
> Vítor Mendonça Moreira
> *Analista / Programador
> Direcção de Investigação e Desenvolvimento*
>
> Rua Dr. Francisco Sá Carneiro, nº. 4 r/c esq.
> 2500 - 206 - Caldas da Rainha
> Tel: (+351) 262 832 196
> Fax: (+351) 262 186 455
> Web: www.makewise.pt
> Uma empresa: Grupo Sousa Pedro <http://www.sousapedro.com>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100322/3ed5d7be/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 2725 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100322/3ed5d7be/attachment.jpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 635 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100322/3ed5d7be/attachment-0001.jpe
More information about the rules-users
mailing list