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

Nicolas Héron nicolas.heron.java at gmail.com
Wed Mar 24 12:14:23 EDT 2010


Hello
You must set
GIVEN
          Role (rr)
               a=rose
           User [usr]
                  firstName = "..."
                  lastName = "..."
                  *role=rr*

2010/3/24 Krunoslav Sabljak <golijat at gmail.com>

> 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) :-))
>
>
>
>
> _______________________________________________
> 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/20100324/d1f97543/attachment.html 


More information about the rules-users mailing list