Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-565

Executable model isn't generated correctly for from clause in the form func(x)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Verified (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 7.1.0.GA
    • Component/s: BRE
    • Labels:
      None
    • Target Release:
    • Fix Build:
      CR1

      Description

      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

          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!");
          }
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  volothamp Luca Molteni
                  Reporter:
                  mfusco Mario Fusco
                  Tester:
                  Tibor Zimányi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: