You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "yurloc (via GitHub)" <gi...@apache.org> on 2024/05/13 17:34:53 UTC
[I] [new-parser] Tests using wrong duration attribute format [incubator-kie-drools]
yurloc opened a new issue, #5937:
URL: https://github.com/apache/incubator-kie-drools/issues/5937
## Parent issue
- #5678
## 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 milliseconds
- `duration (1m30s)` or `duration(P1M)` - parentheses and a time literal (either "human-friendly" or [ISO-8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations))
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)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] Tests using wrong duration attribute format [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #5937:
URL: https://github.com/apache/incubator-kie-drools/issues/5937#issuecomment-2126495568
`/take`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] Tests using wrong duration attribute format [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #5937:
URL: https://github.com/apache/incubator-kie-drools/issues/5937#issuecomment-2132492192
Fixed by https://github.com/apache/incubator-kie-drools/pull/5969
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] [new-parser] Tests using wrong duration attribute format [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas closed issue #5937: [new-parser] Tests using wrong duration attribute format
URL: https://github.com/apache/incubator-kie-drools/issues/5937
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org