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

2010-03-25 Thread kicho

Nicolas!

Thank you very very much! It works now! 
-- 
View this message in context: 
http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519882.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2010-03-25 Thread Nicolas Héron
Hello
you must set to RoleAttr "=rr" and not just "rr"
In the new 5.1, you will have a guided way to set bound variables to each
other
Regards
Nicolas

2010/3/25 kicho 

>
> Hi Nicolas!
>
> Thank you for your quick answer! But, i was kind of hoping that that's not
> the solution...
>
> I'll attach screen shots of rule configuration and test scenario so that we
> could all see what am i doing wrong.
>
> Rule screen:
>
> http://n3.nabble.com/file/n519577/business_rule.jpg
>
> Rule source:
>
> http://n3.nabble.com/file/n519577/business_rule_src.jpg
>
> Test scenario:
>
> http://n3.nabble.com/file/n519577/test_scenario.jpg
>
> When i choose "Run scenario": this is what i get:
>
> http://n3.nabble.com/file/n519577/test_scenario_fail.jpg
>
> As you can see, i get a blank screen with no info at all, which points me
> to
> conclusion that something (not good) happend.
>
> In server log i found this:
>
> 2010-03-25 09:27:17,684 INFO  [STDOUT] ERROR 25-03 09:27:17,684
> (ServiceImplementation.java:runScenario:1942)[Error: could not
> access/write property (roleAttr) in: comExpert01.User]
> [Near : {... __fact__.roleAttr = __val_ }]
>   ^
> [Line: 1, Column: 0]
>
> I've tried to google this but with no success.
> I'm running guvnor as a standalone dist downloaded from jboss site, version
> 5.0.1 on jbossAS 4.2.3, for repository instead of derby i'm using mysql 5.x
>
> I should also mention that if i don't declare roleAttr in test scenario
> (something like this):
>
> http://n3.nabble.com/file/n519577/test_scenario_no_roleAttr.jpg
>
> I get another blank screen after running test with this exception in log
> file:
>
> 2010-03-25 09:49:38,295 INFO  [STDOUT] ERROR 25-03 09:49:38,295
> (ServiceImplementation.java:runScenario:1942)
> org.drools.RuntimeDroolsException: Exception executing predicate
> roleAttr.roleName == "ADMIN"
>
> Since there is no documentation about managing test scenarios i don't know
> what is wrong here.
>
> If you could give me some more directions or hints i would be very
> grateful.
> --
> View this message in context:
> http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519577.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2010-03-25 Thread david_nabble

Hi !


kicho wrote:
> 
> As you can see, i get a blank screen with no info at all, which points me
> to conclusion that something (not good) happend.
> 
> In server log i found this:
> 
> 2010-03-25 09:27:17,684 INFO  [STDOUT] ERROR 25-03 09:27:17,684
> (ServiceImplementation.java:runScenario:1942)  [Error: could not
> access/write property (roleAttr) in: comExpert01.User]
> [Near : {... __fact__.roleAttr = __val_ }]
>^
> [Line: 1, Column: 0]
> 

Does your model declare a setRoleAttr(Role r) Method for the user class?


kicho wrote:
> 
>  http://n3.nabble.com/file/n519577/test_scenario_no_roleAttr.jpg 
> 
> I get another blank screen after running test with this exception in log
> file:
> 
> 2010-03-25 09:49:38,295 INFO  [STDOUT] ERROR 25-03 09:49:38,295
> (ServiceImplementation.java:runScenario:1942) 
> org.drools.RuntimeDroolsException: Exception executing predicate
> roleAttr.roleName == "ADMIN"
> 
 
no idea on this so far..

Could you provide your (test-)model?


-- 
View this message in context: 
http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519650.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2010-03-25 Thread kicho

Hi Nicolas!

Thank you for your quick answer! But, i was kind of hoping that that's not
the solution...

I'll attach screen shots of rule configuration and test scenario so that we
could all see what am i doing wrong.

Rule screen:

http://n3.nabble.com/file/n519577/business_rule.jpg 

Rule source:

http://n3.nabble.com/file/n519577/business_rule_src.jpg 

Test scenario:

http://n3.nabble.com/file/n519577/test_scenario.jpg 

When i choose "Run scenario": this is what i get:

http://n3.nabble.com/file/n519577/test_scenario_fail.jpg 

As you can see, i get a blank screen with no info at all, which points me to
conclusion that something (not good) happend.

In server log i found this:

2010-03-25 09:27:17,684 INFO  [STDOUT] ERROR 25-03 09:27:17,684
(ServiceImplementation.java:runScenario:1942)[Error: could not
access/write property (roleAttr) in: comExpert01.User]
[Near : {... __fact__.roleAttr = __val_ }]
   ^
[Line: 1, Column: 0]

I've tried to google this but with no success.
I'm running guvnor as a standalone dist downloaded from jboss site, version
5.0.1 on jbossAS 4.2.3, for repository instead of derby i'm using mysql 5.x

I should also mention that if i don't declare roleAttr in test scenario
(something like this):

http://n3.nabble.com/file/n519577/test_scenario_no_roleAttr.jpg 

I get another blank screen after running test with this exception in log
file:

2010-03-25 09:49:38,295 INFO  [STDOUT] ERROR 25-03 09:49:38,295
(ServiceImplementation.java:runScenario:1942)   
org.drools.RuntimeDroolsException: Exception executing predicate
roleAttr.roleName == "ADMIN"

Since there is no documentation about managing test scenarios i don't know
what is wrong here.

If you could give me some more directions or hints i would be very grateful.
-- 
View this message in context: 
http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519577.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2010-03-24 Thread Nicolas Héron
Hello
You must set
GIVEN
  Role (rr)
   a=rose
   User [usr]
  firstName = "..."
  lastName = "..."
  *role=rr*

2010/3/24 Krunoslav Sabljak 

> 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@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2010-03-24 Thread Krunoslav Sabljak
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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users