[rules-users] Use of function in Drools Test Scenario

Moe Alkhafaji moe.alkhafaji at medcpu.com
Sun Jan 23 12:20:39 EST 2011


This means that it cannot find your method. To be able to call a method from within a rule you will need to import the respective class that has the method and then use an instance to reference that method with (or just the method without an instance if it is static and you did static import). Think like a typical java program where you cannot call a method unless you define the scope or instance to call it with. 

Sent from my iPhone

On Jan 23, 2011, at 6:08 AM, Abbo <ab.bonnement at gmail.com> wrote:

> 
> Hi,
> I am a newbie on Drools, don't mind me asking stupid questions :)
> 
> W've started using Drools, first in a Proof-Of-Concept mode for a large
> scale project in which we have developers and analysts using Drools. As an
> analyst I defined the Rules and Test Scenarios in Guvnor. The developer has
> added some functions too in the Repository in the same package as my Rules
> and Test Scenarios are. So far so good. However, I encounter problems when
> using the functions in my Test Scenario. I receive a:
> 
> [Error: no such method or function: timeStringToLong] [Near : {... new
> java.util.Date(), "17:00" ....}] ^ [Line: 1, Column: 0]
> 
> The first part of the Test Scenario looks like:
> GIVEN    
>    insert [Segment] [$seg]
>    arrivalTime: =timeStringToLong(new java.util.Date(), "17:00")
> 
> If I use eval() around the function call or prefix it with the package name
> it does not help.
> So all this leads to the questions:
> - is it possible to use function calls in Test Scenarios?
> - what is the format to call functions?
> - is there somewhere documentation about input values, formats, etc.
> - do I have the fully qualify the Date parameter?
> 
> Thanks very much!
> Abbo
> 
> -- 
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Use-of-function-in-Drools-Test-Scenario-tp2313164p2313164.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list