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

Impact Analysis : CNFE for declared type

XMLWordPrintable

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

          @Test
          public void testDeclaredTypeInsert() {
              String str =
                      "package mypkg;\n" +
                           "import " + Person.class.getCanonicalName() + ";\n" +
                           "import " + BigDecimal.class.getCanonicalName() + ";\n" +
                           "declare Tuple\n" +
                           "account: String\n" +
                           "value: BigDecimal\n" +
                           "end\n" +
                           "rule R1 when\n" +
                           "  $s : String(this == \"Start\")\n" +
                           "then\n" +
                           "  insert(new Tuple());\n" +
                           "end\n" +
                           "rule R2 when\n" +
                           "  $t : Tuple()\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);
          }
      

      fails with

      java.lang.RuntimeException: java.lang.ClassNotFoundException: Unable to find class 'Tuple'
      	at org.drools.impact.analysis.parser.impl.RhsParser.getActionClass(RhsParser.java:112)
      	at org.drools.impact.analysis.parser.impl.RhsParser.processInsert(RhsParser.java:155)
      	at org.drools.impact.analysis.parser.impl.RhsParser.processStatement(RhsParser.java:79)
      	at org.drools.impact.analysis.parser.impl.RhsParser.lambda$2(RhsParser.java:68)
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
      	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
      	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
      	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
      	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
      	at org.drools.impact.analysis.parser.impl.RhsParser.parse(RhsParser.java:70)
      	at org.drools.impact.analysis.parser.impl.PackageParser.parseRule(PackageParser.java:64)
      	at org.drools.impact.analysis.parser.impl.PackageParser.parse(PackageParser.java:50)
      	at org.drools.impact.analysis.parser.internal.ImpactModelBuilderImpl.buildRules(ImpactModelBuilderImpl.java:189)
      	at org.drools.impact.analysis.parser.internal.ImpactModelBuilderImpl.doSecondBuildStep(ImpactModelBuilderImpl.java:111)
      	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:115)
      	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:99)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:270)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:216)
      	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:80)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:277)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:245)
      	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:202)
      	at org.drools.impact.analysis.parser.ModelBuilder.createKieBuilder(ModelBuilder.java:56)
      	at org.drools.impact.analysis.parser.ModelBuilder.createKieBuilder(ModelBuilder.java:39)
      	at org.drools.impact.analysis.parser.ModelBuilder.build(ModelBuilder.java:31)
      	at org.drools.impact.analysis.integrationtests.BasicGraphTest.testDeclaredTypeInsert(BasicGraphTest.java:343)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
      Caused by: java.lang.ClassNotFoundException: Unable to find class 'Tuple'
      	at org.drools.core.addon.ClassTypeResolver.lookupFromCache(ClassTypeResolver.java:139)
      	at org.drools.core.addon.ClassTypeResolver.resolveType(ClassTypeResolver.java:169)
      	at org.drools.core.addon.ClassTypeResolver.resolveType(ClassTypeResolver.java:153)
      	at org.drools.impact.analysis.parser.impl.RhsParser.getActionClass(RhsParser.java:110)
      	... 56 more
      

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

                Created:
                Updated: