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

Impact Analysis : parse ObjectCreationExpr with arguments for RHS insert

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 7.66.0.Final
    • Impact Analysis
    • None
    • NEW
    • NEW

      Currently, RhsParser.processInsert() doesn't parse a constructor with arguments so results in null insertedProperties, hence, no link or UNKNOWN link. (It can parse setters after the creation: See BasicGraphTest.testInsertRelation())

          @Test
          public void testInsertConstuctorWithArguments() {
              String str =
                      "package mypkg;\n" +
                           "import " + Person.class.getCanonicalName() + ";" +
                           "rule R1 when\n" +
                           "  $t : String(this == \"Start\")\n" +
                           "then\n" +
                           "  insert(new Person(\"Mario\", 40));\n" +
                           "end\n" +
                           "rule R2 when\n" +
                           "  $p : Person(age > 15)\n" +
                           "then\n" +
                           "end\n";
      
              runRule(str, "Start");
      
              AnalysisModel analysisModel = new ModelBuilder().build(str);
              System.out.println(analysisModel);
      
              ModelToGraphConverter converter = new ModelToGraphConverter();
              Graph graph = converter.toGraph(analysisModel);
      
              assertLink(graph, "mypkg.R1", "mypkg.R2", ReactivityType.POSITIVE);
          }
      
      Rule{pkg='mypkg', name='R1', resource='r0.drl',
      ...
       rhs=RightHandSide{actions=,
      InsertAction{actionClass=class org.drools.impact.analysis.integrationtests.domain.Person, insertedProperties=[]}}}
      

      This looks similar to DROOLS-6711 but not directly related.

            rhn-support-tkobayas Toshiya Kobayashi
            rhn-support-tkobayas Toshiya Kobayashi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: