[jboss-jira] [JBoss JIRA] (DROOLS-4979) Support static method invocation in accumulate
Mario Fusco (Jira)
issues at jboss.org
Tue Jan 28 22:40:22 EST 2020
[ https://issues.redhat.com/browse/DROOLS-4979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-4979.
---------------------------------
Resolution: Done
Fixed by https://github.com/kiegroup/drools/commit/6f194422718daa86a4356ce69fb72676ed95f4c2
> Support static method invocation in accumulate
> ----------------------------------------------
>
> Key: DROOLS-4979
> URL: https://issues.redhat.com/browse/DROOLS-4979
> Project: Drools
> Issue Type: Bug
> Reporter: Luca Molteni
> Assignee: Mario Fusco
> Priority: Major
>
> {code:java}
> @Test
> public void testAccumulateOfDurationBetweenDateTime() {
> final String drl =
> "import java.time.Duration\n" +
> "import " + Interval.class.getCanonicalName() + ";\n" +
> "global java.util.List result; \n" +
> "\n" +
> "rule \"Rule1\"\n" +
> "when\n" +
> " $count : Number() from accumulate(\n" +
> " Interval($start : start, $end : end), " +
> " sum(Duration.between($start, $end).toMinutes()) " +
> " ) " +
> "then\n" +
> " result.add($count);\n" +
> "end\n";
> List<Long> result = new ArrayList<>();
> KieSession ksession = getKieSession(drl);
> ksession.setGlobal("result", result);
> ksession.insert(new Interval(
> LocalDateTime.of(2020, 1, 22, 11, 43),
> LocalDateTime.of(2020, 1, 22, 12, 43)
> ));
> ksession.fireAllRules();
> assertEquals(60, result.iterator().next().longValue());
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list