[rules-users] drools-guvnor, problem when creating test scenarios based on referenced domain model

Krunoslav Sabljak golijat at gmail.com
Wed Mar 24 10:17:36 EDT 2010


Hi all,

first of all, i appologise if i'm starting a topic that already exists (but
i couldn't find one :-)

i'm having some difficulties with creating test scenarios in guvnor when the
domain model is based on referenced objects.

Suppose we have a model like this one:

Class Role with attributes:

   roleId: Long
   roleName: String

Class User with attributes:

   userId: Long
   userName: String
   firstName: String
   lastName: String
   role: Role

Then, lets suppose the rule like this one (it's pritty simple one)

rule "my first rule"
dialect "mvel"
when
       usr: User(firstName=="John", lastName="Doe", role.roleName="ADMIN" )
then
       usr.userName="ADMIN"
end

Now, i'm trying to create a test scenario for this rule. And my nightmare
begins...

Seems to me that there is no possibility to define referenced object in test
scenario, ie:

GIVEN
           User [usr]
                  firstName = "..."
                  lastName = "..."
                  *role.roleName = "..."*

EXPECTING
..............

Hope that you can understand what i'm talking about. Can somebody (pretty
please) give me some directions how to achieve something like this in test
scenarios.

Thank you for your answers and suggestions (if any) :-))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100324/f7dc69c7/attachment.html 


More information about the rules-users mailing list