Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6330

CombinedConstraint node sharing with executable-model

    XMLWordPrintable

    Details

    • Sprint:
      2021 Week 16-18 (from Apr 19), 2021 Week 19-21 (from May 10)
    • Story Points:
      2
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      CombinedConstraint is not shared in case of exec-model:

          @Test
          public void testShareCombinedConstraint() throws Exception {
              String str =
                      "import " + StockTick.class.getCanonicalName() + ";" +
                           "rule R1 when\n" +
                           "    $a : StockTick( company == \"DROO\" )\n" +
                           "    $b : StockTick( company == \"ACME\" && this after[5s,8s] $a )\n" +
                           "then\n" +
                           "  System.out.println(\"fired\");\n" +
                           "end\n" +
                           "rule R2 when\n" +
                           "    $a : StockTick( company == \"DROO\" )\n" +
                           "    $b : StockTick( company == \"ACME\" && this after[5s,8s] $a )\n" +
                           "then\n" +
                           "  System.out.println(\"fired\");\n" +
                           "end\n";
      
              KieSession ksession = getKieSession(CepTest.getCepKieModuleModel(), str);
              
              org.drools.core.reteoo.ReteDumper.dumpRete(ksession);
              
              SessionPseudoClock clock = ksession.getSessionClock();
      
              ksession.insert(new StockTick("DROO"));
              clock.advanceTime(6, TimeUnit.SECONDS);
              ksession.insert(new StockTick("ACME"));
      
              assertEquals(2, ksession.fireAllRules());
      
              clock.advanceTime(4, TimeUnit.SECONDS);
              ksession.insert(new StockTick("ACME"));
      
              assertEquals(0, ksession.fireAllRules());
      
              assertEquals(1, ReteDumper.collectNodes(ksession).stream().filter(NotNode.class::isInstance).count());
          }
      
      [EntryPointNode(1) EntryPoint::DEFAULT ] on Partition(MAIN)
        [ObjectTypeNode(3)::EntryPoint::DEFAULT objectType=[ClassObjectType event=org.drools.modelcompiler.domain.StockTick] expiration=-1ms ] on Partition(MAIN)
          [AlphaNode(4) constraint=Constraint for 'GENERATED_C9C1F2ED4BF75A3013057D83BE21BF1B' (index: AlphaIndex #0 (EQUAL, left: lambda 190702991, right: DROO))] on Partition(2) d 2 i 2
            [LeftInputAdapterNode(5)] on Partition(2) Ld 0 Li 0
              [JoinNode(6) - [ClassObjectType event=org.drools.modelcompiler.domain.StockTick]] <contraints=[org.drools.modelcompiler.constraints.CombinedConstraint@5de5e95]>  on Partition(2) Ld 0 Li 2 Rd 9223372036854775807 Ri 9223372036854775807
                [RuleTerminalNode(7): rule=R1] on Partition(2) d -1 i -1
              [JoinNode(8) - [ClassObjectType event=org.drools.modelcompiler.domain.StockTick]] <contraints=[org.drools.modelcompiler.constraints.CombinedConstraint@365cdacf]>  on Partition(2) Ld 0 Li 2 Rd 9223372036854775807 Ri 9223372036854775807
                [RuleTerminalNode(9): rule=R2] on Partition(2) d -1 i -1
          [JoinNode(6) - [ClassObjectType event=org.drools.modelcompiler.domain.StockTick]] <contraints=[org.drools.modelcompiler.constraints.CombinedConstraint@5de5e95]>  on Partition(2) Ld 0 Li 2 Rd 9223372036854775807 Ri 9223372036854775807
          [JoinNode(8) - [ClassObjectType event=org.drools.modelcompiler.domain.StockTick]] <contraints=[org.drools.modelcompiler.constraints.CombinedConstraint@365cdacf]>  on Partition(2) Ld 0 Li 2 Rd 9223372036854775807 Ri 9223372036854775807
        [ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ] on Partition(MAIN)
      

        Attachments

          Activity

            People

            Assignee:
            tkobayashi Toshiya Kobayashi
            Reporter:
            tkobayashi Toshiya Kobayashi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: