[jboss-jira] [JBoss JIRA] (DROOLS-2509) Executable model isn't generated correctly for from clause in the form func(x)
Mario Fusco (JIRA)
issues at jboss.org
Tue May 1 03:31:00 EDT 2018
[ https://issues.jboss.org/browse/DROOLS-2509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-2509.
---------------------------------
Resolution: Done
Fixed by https://github.com/kiegroup/drools/commit/1b1e8efbb8f384f31e8a573dec058ecc7a0bef3d
> Executable model isn't generated correctly for from clause in the form func(x)
> ------------------------------------------------------------------------------
>
> Key: DROOLS-2509
> URL: https://issues.jboss.org/browse/DROOLS-2509
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Reporter: Mario Fusco
> Assignee: Luca Molteni
>
> Executable model is generated correctly when the from clause is in the form x.func() but not when it is func( x ). See the reproducer below
> {code}
> public static Integer getLength(String s) {
> return s.length();
> }
> @Test
> public void testFromExternalFunction() {
> final String str =
> "import " + FromTest.class.getCanonicalName() + ";\n" +
> "global java.util.List list\n" +
> "\n" +
> "rule R when\n" +
> " $s : String()\n" +
> " $i : Integer( this > 10 ) from FromTest.getLength($s)\n" +
> "then\n" +
> " list.add( \"received long message: \" + $s);\n" +
> "end\n";
> KieSession ksession = getKieSession( str );
> final List<String> list = new ArrayList<>();
> ksession.setGlobal( "list", list );
> ksession.insert("Hello World!");
> ksession.fireAllRules();
> Assertions.assertThat(list).containsExactlyInAnyOrder("received long message: Hello World!");
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list