You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not 100% but it seems that these tests are wrong and the new parser is failing correctly. I've searched for occurrences in Drools code base and it seems that the following two alternative formats are allowed:
duration 100 - no parentheses, integer number assumed to be milliseconds
I think the reason why these tests do not fail with the old parser is that the old parser treats the expression inside parentheses as a "chunk" whereas the new parser goes into more detail so it is more sensitive.
Rule code snippet
rule Close
duration (100)
when
and
rule xxx
duration (30s 10s)
when
Error output
### parse : ANTLR4_PARSER_ENABLED = true
line 1:189 mismatched input '100' expecting TIME_INTERVAL
18:31:19.927 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:KieBaseModelName
[1,189]: mismatched input '100' expecting TIME_INTERVAL
[0,0]: Parser returned a null Package
18:31:19.927 [main] ERROR o.d.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem:165 - KieBuilder errors: [Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=1, column=0
text=mismatched input '100' expecting TIME_INTERVAL], Message [id=2, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=0, column=0
text=Parser returned a null Package]]
java.lang.AssertionError: [[Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=1, column=0
text=mismatched input '100' expecting TIME_INTERVAL], Message [id=2, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=0, column=0
text=Parser returned a null Package]]]
Expecting empty but was: [Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=1, column=0
text=mismatched input '100' expecting TIME_INTERVAL],
Message [id=2, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=0, column=0
text=Parser returned a null Package]]
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:169)
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:134)
at org.drools.testcoverage.common.util.KieUtil.buildAndInstallKieModuleIntoRepo(KieUtil.java:78)
at org.drools.testcoverage.common.util.KieUtil.buildAndInstallKieModuleIntoRepo(KieUtil.java:72)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromResources(KieUtil.java:249)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromResources(KieUtil.java:238)
at org.drools.testcoverage.common.util.KieBaseUtil.getKieBaseFromKieModuleFromResources(KieBaseUtil.java:102)
at org.drools.testcoverage.common.util.KieBaseUtil.getKieBaseFromKieModuleFromDrl(KieBaseUtil.java:115)
at org.drools.compiler.integrationtests.CepEspTest.testPropertyReactiveWithDurationOnRule(CepEspTest.java:5663)
and
### parse : ANTLR4_PARSER_ENABLED = true
line 4:16 extraneous input '10s' expecting ')'
18:31:52.373 [Time-limited test] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:KieBaseModelName
[4,16]: extraneous input '10s' expecting ')'
[0,0]: Parser returned a null Package
18:31:52.373 [Time-limited test] ERROR o.d.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem:165 - KieBuilder errors: [Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=4, column=0
text=extraneous input '10s' expecting ')'], Message [id=2, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=0, column=0
text=Parser returned a null Package]]
java.lang.AssertionError: [[Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=4, column=0
text=extraneous input '10s' expecting ')'], Message [id=2, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=0, column=0
text=Parser returned a null Package]]]
Expecting empty but was: [Message [id=1, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=4, column=0
text=extraneous input '10s' expecting ')'],
Message [id=2, kieBase=KieBaseModelName, level=ERROR, path=rules1.drl, line=0, column=0
text=Parser returned a null Package]]
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:169)
at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:134)
at org.drools.testcoverage.common.util.KieUtil.buildAndInstallKieModuleIntoRepo(KieUtil.java:78)
at org.drools.testcoverage.common.util.KieUtil.buildAndInstallKieModuleIntoRepo(KieUtil.java:72)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromResources(KieUtil.java:249)
at org.drools.testcoverage.common.util.KieUtil.getKieModuleFromResources(KieUtil.java:238)
at org.drools.testcoverage.common.util.KieBaseUtil.getKieBaseFromKieModuleFromResources(KieBaseUtil.java:102)
at org.drools.testcoverage.common.util.KieBaseUtil.getKieBaseFromKieModuleFromDrl(KieBaseUtil.java:115)
at org.drools.compiler.integrationtests.TimerAndCalendarWithPseudoTimeTest.testIntervalTimer(TimerAndCalendarWithPseudoTimeTest.java:143)
at org.drools.compiler.integrationtests.TimerAndCalendarWithPseudoTimeTest.testNoProtocolIntervalTimer(TimerAndCalendarWithPseudoTimeTest.java:123)
The text was updated successfully, but these errors were encountered:
Parent issue
Failing tests
org.drools.compiler.integrationtests.CepEspTest#testPropertyReactiveWithDurationOnRule
org.drools.compiler.integrationtests.TimerAndCalendarWithPseudoTimeTest#testNoProtocolIntervalTimer
Notes
I'm not 100% but it seems that these tests are wrong and the new parser is failing correctly. I've searched for occurrences in Drools code base and it seems that the following two alternative formats are allowed:
duration 100
- no parentheses, integer number assumed to be millisecondsduration (1m30s)
orduration(P1M)
- parentheses and a time literal (either "human-friendly" or ISO 8601 duration) (to be implemented by [new-parser] Support ISO 8601 format for duration attribute's value #5938).I think the reason why these tests do not fail with the old parser is that the old parser treats the expression inside parentheses as a "chunk" whereas the new parser goes into more detail so it is more sensitive.
Rule code snippet
and
Error output
and
The text was updated successfully, but these errors were encountered: