[rules-users] Junit, PseudoClock and NPE

Makewise - Vitor Rui Mendonça Vitor.Mendonca at brisa.pt
Tue Mar 23 11:30:24 EDT 2010


Edson, 

 

First of all, thanks for your quick reply!

 

I've submitted a new issue on Jira. Here's the link:

https://jira.jboss.org/jira/browse/JBRULES-2457

 

If anything else is needed please, let me know.

 

Thanks, once again J

 

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>  

 

		

 

 

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Edson Tirelli
Sent: segunda-feira, 22 de Março de 2010 18:06
To: Rules Users List
Subject: Re: [rules-users] Junit, PseudoClock and NPE

 


     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/20100323/bb9c6525/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 635 bytes
Desc: image001.jpg
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100323/bb9c6525/attachment.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 2725 bytes
Desc: image002.jpg
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100323/bb9c6525/attachment-0001.jpe 


More information about the rules-users mailing list