[rules-users] Instantiate fact class declared only in drl

Wolfgang Laun wolfgang.laun at gmail.com
Mon Jan 9 10:40:43 EST 2012


Yeah, I'm aware of that. Still, I find it easier, even for a unit test, to
write a DRL snippet

rule "initTest"
when
then
    SomeFact sf = ...
    insert( sf );
end

and add this in the setup, possibly even compiled from a java.lang.String.

YMMV.
-W

2012/1/9 Esteban Aliverti <esteban.aliverti at gmail.com>

> There is a full api that let you instantiate and manipulate declared types
> in Java code:
> http://docs.jboss.org/drools/release/5.4.0.Beta1/drools-expert-docs/html_single/index.html#d0e3750
>
> Best Regards,
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
> - Developer @ http://www.plugtree.com
> - Blog @ http://ilesteban.wordpress.com
>
>
>
> On Mon, Jan 9, 2012 at 4:20 PM, MarcoMojana <marco.mojana at exmachina.ch>wrote:
>
>> Ok laune, but I would like to create this objects inside a junit test (so
>> in
>> a method defined in a *.java file), not from the drl itself. Were you
>> suggesting a workaround?
>>
>> --
>> MM
>>
>>
>> laune wrote
>> >
>> > I've found that creating objects and facts from DRL-declared classes is
>> > easily done in DRL, in RHS code.
>> > -W
>> >
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Instantiate-fact-class-declared-only-in-drl-tp3644780p3644822.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120109/bda54586/attachment.html 


More information about the rules-users mailing list