[jboss-jira] [JBoss JIRA] (DROOLS-1266) OOPath use with primitives does not return any match

Mario Fusco (JIRA) issues at jboss.org
Thu Sep 1 06:38:00 EDT 2016


    [ https://issues.jboss.org/browse/DROOLS-1266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287298#comment-13287298 ] 

Mario Fusco commented on DROOLS-1266:
-------------------------------------

Fix cherry-picked to 6.5.x branch with https://github.com/droolsjbpm/drools/commit/245376eeb

> OOPath use with primitives does not return any match
> ----------------------------------------------------
>
>                 Key: DROOLS-1266
>                 URL: https://issues.jboss.org/browse/DROOLS-1266
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>            Reporter: Matteo Mortari
>            Assignee: Mario Fusco
>
> Consider the following reproducer:
> {code:java}
>     @Test
>     public void testPrimitives() {
>         String drl =
>                 "import org.drools.compiler.xpath.*;\n" +
>                 "global java.util.List list\n" +
>                 "\n" +
>                 "rule R when\n" +
>                 "  Adult( $x: /children.age )\n" +
>                 "then\n" +
>                 "  list.add( $x );\n" +
>                 "end\n";
>         
>         System.out.println(drl);
>         KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL )
>                                              .build()
>                                              .newKieSession();
>         List<String> list = new ArrayList<String>();
>         ksession.setGlobal( "list", list );
>         Man bob = new Man( "Bob", 40 );
>         bob.addChild( new Child( "Charles", 12 ) );
>         bob.addChild( new Child( "Debbie", 8 ) );
>         ksession.insert( bob );
>         ksession.fireAllRules();
>         
>         assertEquals(2, list.size());
>     }
> {code}
> these reproducer/test fails. Does not provide any match of the primitive type returned by {{age}}.
> Please note if the rule was instead:
> {code:java}
> rule R when
>   Adult( $x: /children.name )
> then
>   ...
> {code}
> the test would pass.
> Hence appears OOPath is not matching on the primitive types?



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list