Hello<div>You must set</div><div><div>GIVEN</div><div> Role (rr)</div><div> a=rose</div><div> User [usr]</div><div> firstName = "..."</div><div> lastName = "..."</div>
<div> <strong><font color="#ff0000">role=rr</font></strong></div><br><div class="gmail_quote">2010/3/24 Krunoslav Sabljak <span dir="ltr"><<a href="mailto:golijat@gmail.com">golijat@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Hi all,</div>
<div> </div>
<div>first of all, i appologise if i'm starting a topic that already exists (but i couldn't find one :-)</div>
<div> </div>
<div>i'm having some difficulties with creating test scenarios in guvnor when the domain model is based on referenced objects.</div>
<div> </div>
<div>Suppose we have a model like this one:</div>
<div> </div>
<div>Class Role with attributes:</div>
<div> </div>
<div> roleId: Long</div>
<div> roleName: String</div>
<div> </div>
<div>Class User with attributes:</div>
<div> </div>
<div> userId: Long</div>
<div> userName: String</div>
<div> firstName: String</div>
<div> lastName: String</div>
<div> role: Role</div>
<div> </div>
<div>Then, lets suppose the rule like this one (it's pritty simple one)</div>
<div> </div>
<div>rule "my first rule"</div>
<div>dialect "mvel"</div>
<div>when</div>
<div> usr: User(firstName=="John", lastName="Doe", role.roleName="ADMIN" )</div>
<div>then</div>
<div> usr.userName="ADMIN"</div>
<div>end</div>
<div> </div>
<div>Now, i'm trying to create a test scenario for this rule. And my nightmare begins...</div>
<div> </div>
<div>Seems to me that there is no possibility to define referenced object in test scenario, ie:</div>
<div> </div>
<div>GIVEN </div>
<div> User [usr]</div>
<div> firstName = "..."</div>
<div> lastName = "..."</div>
<div> <strong><font color="#ff0000">role.roleName = "..."</font></strong></div>
<div> </div>
<div>EXPECTING</div>
<div>..............</div>
<div> </div>
<div>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.</div>
<div> </div>
<div>Thank you for your answers and suggestions (if any) :-))</div>
<div> </div>
<div> </div>
<div> </div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div>