[rules-users] Using java enums in guvnor test scenarios (6.0.1Final)

Toni Rikkola toni.rikkola at gmail.com
Tue Jul 22 05:25:46 EDT 2014


Hi,

Tested this and looks like you found a bug. Made a ticket for it so we
can get it fixed.
https://bugzilla.redhat.com/show_bug.cgi?id=1121985

Thanks for reporting
Toni Rikkola


On ma, 2014-07-21 at 10:28 -0700, pacovalsera wrote:
> Hi all, I'm defining a test scenario within guvnor (now called kie-workbench)
> and I'm experiencing some issues about using java enums.
> 
> The case is simple, I have a java model (deploying a jar) with a class
> having a member of enum type. The enum is defined in the same package but in
> a different java file, not an inner class. This is packed in a jar that I
> deploy manually uploading the file to the embedded maven repo using the
> workbench.
> 
> /
> public class ClassWithMemberAsEnum { private EnumType enumMember;
> /*getters/setters included*/}
> public enum EnumType {HELLO, BYE}
> /
> 
> Then I write a dummy rule with the guided editor like this:
> 
> /
> import es.shin.test.ClassWithMemberAsEnum;
> import es.shin.test.EnumType;
> 	
> rule "DummyRule"
>     dialect "mvel"
>     when
>         x : ClassWithMemberAsEnum( enumMember == EnumType.HELLO )
>     then
>         x.setEnumMember( EnumType.BYE );
> end
> /
> 
> And finally a test scenario inserting a ClassWithMemberAsEnum initialized
> with enumMember=EnumType.HELLO and checking that it is changed to
> EnumType.BYE after firing all rules.
> 
> The error message returned in the reporting console is:
> 
> /
> EnumTest : [Error: unable to resolve method using strict-mode:
> java.lang.Object.es()] [Near : {... es.shin.test.EnumType.HELLO ....}] ^
> [Line: 1, Column: 1]
> /
> 
> I have tried the same case but defining the class in the data modeler and
> the enum with the enumeration editor, without using any jar artifact. The
> case worked as expected.
> 
> Has anybody experienced the same issue?  Thanks for your help.
> 
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Using-java-enums-in-guvnor-test-scenarios-6-0-1Final-tp4030411.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




More information about the rules-users mailing list