From 76f8c98c17faba99a50519db54c5e3ba72bbb8c0 Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Thu, 23 Jan 2025 12:15:52 +0900 Subject: [PATCH] - drop half constraint - Disable drools-verifier test for DRL10 --- .../drl/parser/antlr4/DRLExprParserTest.java | 4 +-- .../drl/parser/antlr4/DescrDumperTest.java | 6 ++-- .../drl/parser/antlr4/MiscDRLParserTest.java | 24 ++++++------- .../antlr4/accumulate_with_nested_from.drl | 2 +- .../drl/parser/antlr4/in_operator_test.drl | 2 +- .../drl/parser/antlr4/notin_operator_test.drl | 2 +- .../drl/parser/antlr4/pluggable_operators.drl | 2 +- .../drl/parser/antlr4/DRL10Expressions.g4 | 33 +----------------- .../model/codegen/execmodel/CompilerTest.java | 3 ++ .../codegen/execmodel/HalfBinaryTest.java | 2 ++ .../codegen/execmodel/MvelOperatorsTest.java | 7 ++-- .../execmodel/NullSafeDereferencingTest.java | 2 ++ .../src/test/resources/logback-test.xml | 2 +- .../AlphaNodeRangeIndexingTest.java | 7 ++-- .../integrationtests/ConstraintsTest.java | 4 ++- .../integrationtests/IndexingTest.java | 4 +-- .../integrationtests/StreamsTest.java | 2 +- .../operators/ForAllTest.java | 2 +- .../integrationtests/operators/OrTest.java | 2 ++ .../compiler/beliefsystem/jtms/JTMSTest.java | 4 +-- .../mvel/integrationtests/JBRULESTest.java | 4 ++- .../NullSafeDereferencingTest.java | 4 ++- .../test_CEP_ComplexOperator.drl | 2 +- .../test_ConstraintConnectors.drl | 4 +-- .../integrationtests/strevaluator_test.drl | 2 +- .../functional/TemplatesTest.java | 14 ++++---- .../AbstractCompositeRestrictionTest.java | 2 ++ .../MultiRestrictionPatternTest.java | 2 ++ .../functional/template1_spreadsheet.drl.xls | Bin 7680 -> 7680 bytes .../testcoverage/functional/template_1.drl | 2 +- .../testcoverage/functional/template_2.drl | 6 ++-- .../sessionInsertMultithreadingTest.drl | 6 ++-- .../factmodel/traits/TraitMapCoreTest.java | 2 +- drools-verifier/drools-verifier-drl/pom.xml | 21 +++++++++++ .../builder/VerifierKnowledgeBaseBuilder.java | 7 ++++ 35 files changed, 105 insertions(+), 89 deletions(-) diff --git a/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DRLExprParserTest.java b/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DRLExprParserTest.java index 8cbebe73e6d..09aa20689e3 100644 --- a/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DRLExprParserTest.java +++ b/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DRLExprParserTest.java @@ -27,7 +27,6 @@ import org.drools.drl.ast.descr.ConstraintConnectiveDescr; import org.drools.drl.ast.descr.RelationalExprDescr; import org.drools.drl.parser.DrlExprParser; -import org.drools.drl.parser.DrlExprParserFactory; import org.drools.drl.parser.DrlParser; import org.drools.drl.parser.DroolsParserException; import org.drools.drl.parser.impl.Operator; @@ -38,7 +37,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.ValueSource; -import org.kie.internal.builder.conf.LanguageLevelOption; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeFalse; @@ -175,7 +173,7 @@ void bindingConstraint() { @Test void bindingWithRestrictions() { - String source = "$x : property > value && < 20"; + String source = "$x : property > value && property < 20"; ConstraintConnectiveDescr result = parser.parse( source ); assertThat(parser.hasErrors()).as(parser.getErrors().toString()).isFalse(); diff --git a/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DescrDumperTest.java b/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DescrDumperTest.java index 4133e9f2594..a64b618c887 100644 --- a/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DescrDumperTest.java +++ b/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/DescrDumperTest.java @@ -24,13 +24,12 @@ import org.drools.drl.ast.descr.BindingDescr; import org.drools.drl.ast.descr.ConstraintConnectiveDescr; import org.drools.drl.parser.DrlExprParser; -import org.drools.drl.parser.DrlExprParserFactory; import org.drools.mvel.evaluators.MatchesEvaluatorsDefinition; import org.drools.mvel.evaluators.SetEvaluatorsDefinition; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.kie.internal.builder.conf.LanguageLevelOption; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import static org.assertj.core.api.Assertions.assertThat; @@ -47,6 +46,7 @@ void setUp() { dumper = new DescrDumper(); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @Test void dump() { String input = "price > 10 && < 20 || == $val || == 30"; @@ -147,6 +147,7 @@ void dumpWithDateAttr() { assertThat(result).isEqualTo(expected); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @Test void dumpComplex() { String input = "a ( > 60 && < 70 ) || ( > 50 && < 55 ) && a3 == \"black\" || a == 40 && a3 == \"pink\" || a == 12 && a3 == \"yellow\" || a3 == \"blue\""; @@ -220,6 +221,7 @@ void dumpBindings4() { assertThat(result).isEqualTo(expected); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @Test void dumpBindingsWithRestriction() { String input = "$x : age > 10 && < 20 || > 30"; diff --git a/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java b/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java index 56fbfe11152..40fb99d67fd 100644 --- a/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java +++ b/drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java @@ -75,7 +75,8 @@ import org.drools.drl.parser.impl.Operator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.EnabledIf; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -95,14 +96,6 @@ void setUp() { parser = ParserTestUtils.getParser(); } - private static boolean isNewParser() { - return DrlParser.ANTLR4_PARSER_ENABLED; - } - - private static boolean isOldParser() { - return !DrlParser.ANTLR4_PARSER_ENABLED; - } - private String readResource(final String filename) { Path path; try { @@ -881,6 +874,7 @@ void simpleRuleWithBindings() { assertThat((String) rule.getConsequence()).isEqualToIgnoringWhitespace("if ( a == b ) { " + " assert( foo3 );" + "} else {" + " retract( foo4 );" + "}" + " System.out.println( a4 );"); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @Test void multipleRestrictionsConstraint() { RuleDescr rule = parseAndGetFirstRuleDescrFromFile("restrictions_test.drl"); @@ -2452,7 +2446,7 @@ void inOperator() { assertThat(pattern.getConstraint().getDescrs()).hasSize(1); ExprConstraintDescr fld = (ExprConstraintDescr) pattern.getConstraint().getDescrs().get(0); - assertThat(fld.getExpression()).isEqualTo("age > 30 && < 40"); + assertThat(fld.getExpression()).isEqualTo("age > 30 && age < 40"); // the second col, with 2 fields, the first with 2 restrictions, the // second field with one @@ -2486,7 +2480,7 @@ void notInOperator() { assertThat(pattern.getConstraint().getDescrs()).hasSize(1); ExprConstraintDescr fld = (ExprConstraintDescr) pattern.getConstraint().getDescrs().get(0); - assertThat(fld.getExpression()).isEqualTo("age > 30 && < 40"); + assertThat(fld.getExpression()).isEqualTo("age > 30 && age < 40"); // the second col, with 2 fields, the first with 2 restrictions, the // second field with one @@ -2536,6 +2530,7 @@ void constraintOrConnective() { assertThat(fcd.getExpression()).isEqualToIgnoringWhitespace("age < 42 || location==\"atlanta\""); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @Test void restrictions() { final String text = "rule X when Foo( bar > 1 || == 1 ) then end\n"; @@ -2987,7 +2982,7 @@ void pluggableOperators() { assertThat(eventE.getConstraint().getDescrs()).hasSize(1); ExprConstraintDescr fcdE = (ExprConstraintDescr) eventE.getConstraint().getDescrs().get(0); - assertThat(fcdE.getExpression()).isEqualTo("this not before[1, 10] $b || after[1, 10] $c && this after[1, 5] $d"); + assertThat(fcdE.getExpression()).isEqualTo("this not before[1, 10] $b || this after[1, 10] $c && this after[1, 5] $d"); } @Test @@ -3896,6 +3891,7 @@ void constraintOperators(String constraint) { assertThat(exprConstraintDescr.getExpression()).isEqualToIgnoringWhitespace(constraint); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest @ValueSource(strings = { "country matches \"[a-z]*\" || matches \"[A-Z]*\"", @@ -4419,7 +4415,7 @@ void traitExtendsMultiple() { .containsExactlyInAnyOrder("com.sample.ParentTrait", "UncleTrait", "org.test.GrandParentTrait"); } - @EnabledIf("isOldParser") + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @Test void pluggableEvaluatorOldParser() { final String source = "package org.drools\n" + @@ -4440,7 +4436,7 @@ void pluggableEvaluatorOldParser() { .containsExactly("$c : core", "this not isA t.x.E.class", "this isA t.x.D.class"); } - @EnabledIf("isNewParser") + @EnabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @Test void pluggableEvaluatorNewParser() { final String source = "package org.drools\n" + diff --git a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/accumulate_with_nested_from.drl b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/accumulate_with_nested_from.drl index 3696836b1f2..5911bcadfb4 100755 --- a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/accumulate_with_nested_from.drl +++ b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/accumulate_with_nested_from.drl @@ -18,7 +18,7 @@ rule "AccumulateParserTest" when // below statement makes no sense, but is useful to test parsing recursiveness - $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ), + $personList : ArrayList() from accumulate( Person( $age : age > 21 || age < 10 ) from collect( People() from $town.getPeople() ), max( $age ) ); then end diff --git a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/in_operator_test.drl b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/in_operator_test.drl index 54f5225c3e8..7141a89d0d4 100644 --- a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/in_operator_test.drl +++ b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/in_operator_test.drl @@ -19,7 +19,7 @@ rule simple_rule when - Person(age > 30 && < 40) + Person(age > 30 && age < 40) Vehicle(type in ( "sedan", "wagon" ), age < 3) then consequence(); diff --git a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/notin_operator_test.drl b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/notin_operator_test.drl index a2eae254405..8b054e0a4fb 100644 --- a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/notin_operator_test.drl +++ b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/notin_operator_test.drl @@ -19,7 +19,7 @@ rule simple_rule when - Person(age > 30 && < 40) + Person(age > 30 && age < 40) Vehicle(type not in ( "sedan", "wagon" ), age < 3) then consequence(); diff --git a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/pluggable_operators.drl b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/pluggable_operators.drl index 59c31d2c8e7..a605648d783 100644 --- a/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/pluggable_operators.drl +++ b/drools-drl/drools-drl-parser-tests/src/test/resources/org/drools/drl/parser/antlr4/pluggable_operators.drl @@ -23,6 +23,6 @@ when $b : EventB( this after[1,10] $a || this not after[15,20] $a ) $c : EventC( this finishes $b ) $d : EventD( this not starts $a ) - $e : EventE( this not before[1, 10] $b || after[1, 10] $c && this after[1, 5] $d ) + $e : EventE( this not before[1, 10] $b || this after[1, 10] $c && this after[1, 5] $d ) then end \ No newline at end of file diff --git a/drools-drl/drools-drl-parser/src/main/antlr4/org/drools/drl/parser/antlr4/DRL10Expressions.g4 b/drools-drl/drools-drl-parser/src/main/antlr4/org/drools/drl/parser/antlr4/DRL10Expressions.g4 index 7a4c807fcb7..e5030c2362c 100644 --- a/drools-drl/drools-drl-parser/src/main/antlr4/org/drools/drl/parser/antlr4/DRL10Expressions.g4 +++ b/drools-drl/drools-drl-parser/src/main/antlr4/org/drools/drl/parser/antlr4/DRL10Expressions.g4 @@ -571,7 +571,7 @@ locals [ BaseDescr lsd ] $relationalExpression::lsd = $result; } } - ( right=orRestriction + ( right=singleRestriction { if( buildDescr ) { $result = $right.result; // TODO access lsd directly instead of through dynamic context here @@ -581,36 +581,6 @@ locals [ BaseDescr lsd ] )* ; -orRestriction returns [BaseDescr result] - : left=andRestriction { if( buildDescr ) { $result = $left.result; } } - ( lop=OR args=fullAnnotation[null]? right=andRestriction - { if( buildDescr ) { - ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newOr(); - descr.addOrMerge( $result ); - descr.addOrMerge( $right.result ); - if ( $ctx.args != null ) { descr.addAnnotation( $args.result ); } - $result = descr; - } - } - )*? EOF? - ; - -andRestriction returns [BaseDescr result] - : left=singleRestriction { if( buildDescr ) { $result = $left.result; } } - ( lop=AND - { if ( isNotEOF() ) helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR ); } - args=fullAnnotation[null]?right=singleRestriction - { if( buildDescr ) { - ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newAnd(); - descr.addOrMerge( $result ); - descr.addOrMerge( $right.result ); - if ( $ctx.args != null ) { descr.addAnnotation( $args.result ); } - $result = descr; - } - } - )*? - ; - singleRestriction returns [BaseDescr result] : op=operator { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); } @@ -630,7 +600,6 @@ singleRestriction returns [BaseDescr result] } helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END ); } - | LPAREN or=orRestriction RPAREN { $result = $or.result; } ; diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/CompilerTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/CompilerTest.java index abe40ca412c..f1fa582c60c 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/CompilerTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/CompilerTest.java @@ -45,6 +45,7 @@ import org.drools.model.codegen.execmodel.domain.Woman; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.definition.type.FactType; @@ -145,6 +146,7 @@ public void testEqualityCheckOnNull(RUN_TYPE runType) { assertThat(results.iterator().next().getValue()).isEqualTo("Mario"); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest @MethodSource("parameters") public void testOrWithFixedLeftOperand(RUN_TYPE runType) { @@ -2095,6 +2097,7 @@ public void testNumericLimits(RUN_TYPE runType) { } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest @MethodSource("parameters") public void testMapAbbreviatedComparison(RUN_TYPE runType) { diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/HalfBinaryTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/HalfBinaryTest.java index df52b350958..0050075db76 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/HalfBinaryTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/HalfBinaryTest.java @@ -23,12 +23,14 @@ import org.drools.model.codegen.execmodel.domain.Address; import org.drools.model.codegen.execmodel.domain.Person; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.runtime.KieSession; import static org.assertj.core.api.Assertions.assertThat; +@DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") public class HalfBinaryTest extends BaseModelTest { @ParameterizedTest diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/MvelOperatorsTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/MvelOperatorsTest.java index 9986cba4046..134f4ca745a 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/MvelOperatorsTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/MvelOperatorsTest.java @@ -24,6 +24,7 @@ import java.util.Map; import org.drools.model.codegen.execmodel.domain.Person; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.builder.Message; @@ -82,6 +83,7 @@ public void testStrNot(RUN_TYPE runType) { assertThat(ksession.fireAllRules()).isEqualTo(2); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest @MethodSource("parameters") public void testStrHalf(RUN_TYPE runType) { @@ -100,6 +102,7 @@ public void testStrHalf(RUN_TYPE runType) { assertThat(ksession.fireAllRules()).isEqualTo(3); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest @MethodSource("parameters") public void testStrHalfOrAndAmpersand(RUN_TYPE runType) { @@ -125,7 +128,7 @@ public void testRange(RUN_TYPE runType) { "import " + Person.class.getCanonicalName() + "\n" + "global java.util.List list\n" + "rule R when\n" + - " Person( age > 30 && <= 40, $name : name )" + + " Person( age > 30 && age <= 40, $name : name )" + "then\n" + " list.add($name);" + "end "; @@ -152,7 +155,7 @@ public void testExcludedRange(RUN_TYPE runType) { "import " + Person.class.getCanonicalName() + "\n" + "global java.util.List list\n" + "rule R when\n" + - " Person( age <= 30 || > 40, $name : name )" + + " Person( age <= 30 || age > 40, $name : name )" + "then\n" + " list.add($name);" + "end "; diff --git a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/NullSafeDereferencingTest.java b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/NullSafeDereferencingTest.java index a442f36b28c..daae50378b1 100644 --- a/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/NullSafeDereferencingTest.java +++ b/drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/NullSafeDereferencingTest.java @@ -26,6 +26,7 @@ import org.drools.model.codegen.execmodel.domain.MysteriousMan; import org.drools.model.codegen.execmodel.domain.Person; import org.drools.model.codegen.execmodel.domain.Result; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.runtime.KieSession; @@ -253,6 +254,7 @@ public void testNullSafeDereferncingOnSecondField(RUN_TYPE runType) { assertThat(results.get(0).getValue()).isEqualTo("John2"); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest @MethodSource("parameters") public void testNullSafeDereferncingWithOrHalfBinary(RUN_TYPE runType) { diff --git a/drools-model/drools-model-codegen/src/test/resources/logback-test.xml b/drools-model/drools-model-codegen/src/test/resources/logback-test.xml index 25b6a1f4918..45cc9cf7290 100644 --- a/drools-model/drools-model-codegen/src/test/resources/logback-test.xml +++ b/drools-model/drools-model-codegen/src/test/resources/logback-test.xml @@ -36,7 +36,7 @@ - + diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AlphaNodeRangeIndexingTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AlphaNodeRangeIndexingTest.java index 42820e0ee03..2ea5cda66ae 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AlphaNodeRangeIndexingTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/AlphaNodeRangeIndexingTest.java @@ -475,17 +475,18 @@ public void testUnderThreshold(KieBaseTestConfiguration kieBaseTestConfiguration @ParameterizedTest(name = "KieBase type={0}") @MethodSource("parameters") public void testSurroundingRange(KieBaseTestConfiguration kieBaseTestConfiguration) { + // incubator-kie-drools#6228 : `age >= 0 && age < 20` doesn't enable range index in exec-model final String drl = "package org.drools.compiler.test\n" + "import " + Person.class.getCanonicalName() + "\n" + "rule test1\n when\n" + - " Person( age >= 0 && < 20 )\n" + + " Person( age >= 0, age < 20 )\n" + "then\n end\n" + "rule test2\n when\n" + - " Person( age >= 20 && < 40 )\n" + + " Person( age >= 20, age < 40 )\n" + "then\n end\n" + "rule test3\n when\n" + - " Person( age >= 40 && < 60 )\n" + + " Person( age >= 40, age < 60 )\n" + "then\n end\n"; final KieBase kbase = createKieBaseWithRangeIndexThresholdValue(kieBaseTestConfiguration, drl, 3); diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/ConstraintsTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/ConstraintsTest.java index ca9a368903e..67490e905fd 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/ConstraintsTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/ConstraintsTest.java @@ -33,6 +33,7 @@ import org.drools.testcoverage.common.util.KieBaseUtil; import org.drools.testcoverage.common.util.KieUtil; import org.drools.testcoverage.common.util.TestParametersUtil2; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.KieBase; @@ -280,7 +281,7 @@ public void testConnectorsAndOperators(KieBaseTestConfiguration kieBaseTestConfi "rule \"operator\"\n" + " when\n" + " $t1 : StockTick( company == \"RHT\" )\n" + - " $t2 : StockTick( company == \"IBM\", this after $t1 || before $t1 )\n" + + " $t2 : StockTick( company == \"IBM\", this after $t1 || this before $t1 )\n" + " then\n" + " // do something\n" + "end "; @@ -373,6 +374,7 @@ public void testDeepNestedConstraints(KieBaseTestConfiguration kieBaseTestConfig } } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest(name = "KieBase type={0}") @MethodSource("parameters") public void testMultiRestrictionFieldConstraint(KieBaseTestConfiguration kieBaseTestConfiguration) { diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/IndexingTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/IndexingTest.java index 1d0e530e664..fc6200142af 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/IndexingTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/IndexingTest.java @@ -616,7 +616,7 @@ public void testRange(KieBaseTestConfiguration kieBaseTestConfiguration) { "import " + Person.class.getCanonicalName() + ";\n" + "rule R1 salience 10 when\n" + " Person( $age : age, $doubleAge : doubleAge )\n" + - " not Cheese( price > $age && < $doubleAge )\n" + + " not Cheese( price > $age && price < $doubleAge )\n" + "then\n" + "end\n" + "rule R3 salience 5 when\n" + @@ -654,7 +654,7 @@ public void testRange2(KieBaseTestConfiguration kieBaseTestConfiguration) throws "rule R1 when\n" + " A( $a : a )\n" + " B( $b : b )\n" + - " exists C( c > $a && < $b )\n" + + " exists C( c > $a && c < $b )\n" + "then\n" + "end"; diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/StreamsTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/StreamsTest.java index 82341ecac21..a0aa9b662a9 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/StreamsTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/StreamsTest.java @@ -206,7 +206,7 @@ public void testModifyRetracOnEntryPointFacts(KieBaseTestConfiguration kieBaseTe "\n" + "rule \"Test entry point 1\"\n" + "when\n" + - " $st : StockTick( company == \"ACME\", price > 10 && < 100 ) from entry-point \"stream1\"\n" + + " $st : StockTick( company == \"ACME\", price > 10 && price < 100 ) from entry-point \"stream1\"\n" + "then\n" + " results.add( Double.valueOf( $st.getPrice() ) );\n" + " modify( $st ) { setPrice( 110 ) }\n" + diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/ForAllTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/ForAllTest.java index 7b1a6f500bf..297f92d9610 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/ForAllTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/ForAllTest.java @@ -53,7 +53,7 @@ public void test1P1CFiring1(KieBaseTestConfiguration kieBaseTestConfiguration) { @ParameterizedTest(name = "KieBase type={0}") @MethodSource("parameters") public void test1P1CFiring2(KieBaseTestConfiguration kieBaseTestConfiguration) { - check(kieBaseTestConfiguration, "age == 8 || == 45", 1, new Person("Mario", 45), new Person("Sofia", 8)); + check(kieBaseTestConfiguration, "age == 8 || age == 45", 1, new Person("Mario", 45), new Person("Sofia", 8)); } @ParameterizedTest(name = "KieBase type={0}") diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/OrTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/OrTest.java index 16d6b7a28e3..6525dcd8a5e 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/OrTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/operators/OrTest.java @@ -33,6 +33,7 @@ import org.drools.testcoverage.common.util.KieBaseUtil; import org.drools.testcoverage.common.util.KieUtil; import org.drools.testcoverage.common.util.TestParametersUtil2; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.KieBase; @@ -351,6 +352,7 @@ public void testOrWithFrom(KieBaseTestConfiguration kieBaseTestConfiguration) { } } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest(name = "KieBase type={0}") @MethodSource("parameters") public void testOrWithReturnValueRestriction(KieBaseTestConfiguration kieBaseTestConfiguration) { diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/beliefsystem/jtms/JTMSTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/beliefsystem/jtms/JTMSTest.java index 9aa335b5e66..7ba4bd8b753 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/beliefsystem/jtms/JTMSTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/beliefsystem/jtms/JTMSTest.java @@ -113,7 +113,7 @@ public void testPosNegNonConflictingInsertions(KieBaseTestConfiguration kieBaseT "\n" + "rule \"Positive\"\n" + "when\n" + - " $n : String( this != 'go1' || == 'go2' ) \n" + + " $n : String( this != 'go1' || this == 'go2' ) \n" + "then\n" + " final String s = '+' + $n;" + " final List l = list;" + @@ -121,7 +121,7 @@ public void testPosNegNonConflictingInsertions(KieBaseTestConfiguration kieBaseT "end\n" + "rule \"Negative\"\n" + "when\n" + - " $n : String( _.neg, this != 'go1' || == 'go2' ) \n" + + " $n : String( _.neg, this != 'go1' || this == 'go2' ) \n" + "then\n" + " final String s = '-' + $n; \n" + " final List l = list; \n" + diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/JBRULESTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/JBRULESTest.java index 81c339d50ac..e8baedadcf6 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/JBRULESTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/JBRULESTest.java @@ -40,6 +40,7 @@ import org.drools.testcoverage.common.util.KieBaseUtil; import org.drools.testcoverage.common.util.KieUtil; import org.drools.testcoverage.common.util.TestParametersUtil2; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.KieBase; @@ -144,6 +145,7 @@ public void testJBRULES_2995(KieBaseTestConfiguration kieBaseTestConfiguration) assertThat(rules).isEqualTo(1); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest(name = "KieBase type={0}") @MethodSource("parameters") public void testJBRULES2872(KieBaseTestConfiguration kieBaseTestConfiguration) { @@ -252,7 +254,7 @@ public void testJBRULES3323(KieBaseTestConfiguration kieBaseTestConfiguration) t rule.append( "when\n" ); rule.append( "$foo : Foo($leftId : id, $leftBar : bar != null)\n" ); rule.append( "$fooSet : Set()\n" ); - rule.append( "from accumulate ( Foo(id > $leftId, bar != null && != $leftBar, $bar : bar),\n" ); + rule.append( "from accumulate ( Foo(id > $leftId, bar != null && bar != $leftBar, $bar : bar),\n" ); rule.append( "collectSet( $bar ) )\n" ); rule.append( "then\n" ); rule.append( "//System.out.println(\"ok\");\n" ); diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NullSafeDereferencingTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NullSafeDereferencingTest.java index edcdc2764f1..1184130fa56 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NullSafeDereferencingTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/integrationtests/NullSafeDereferencingTest.java @@ -27,6 +27,7 @@ import org.drools.testcoverage.common.util.KieBaseTestConfiguration; import org.drools.testcoverage.common.util.KieBaseUtil; import org.drools.testcoverage.common.util.TestParametersUtil2; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.KieBase; @@ -235,6 +236,7 @@ public void testDoubleNullSafe(KieBaseTestConfiguration kieBaseTestConfiguration ksession.dispose(); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest(name = "KieBase type={0}") @MethodSource("parameters") public void testMixedNullSafes(KieBaseTestConfiguration kieBaseTestConfiguration) { @@ -316,7 +318,7 @@ public void testNullSafeInnerConstraint(KieBaseTestConfiguration kieBaseTestConf "rule \"Complex Type Attribute\"\n" + "when\n" + " $con : Content()\n" + - " Context( ctx == $con || == $con!.complexContent!.extension )\n" + + " Context( ctx == $con || ctx == $con!.complexContent!.extension )\n" + "then\n" + " System.out.println( $con ); \n" + "end\n" + diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_CEP_ComplexOperator.drl b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_CEP_ComplexOperator.drl index 7c154a486ac..6b760f0e4c5 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_CEP_ComplexOperator.drl +++ b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_CEP_ComplexOperator.drl @@ -32,7 +32,7 @@ end rule "before" when $a : StockTick( company == "DROO" ) - $b : StockTick( company != $a.company, this before[5,8] $a.time || after[20,22] $a ) + $b : StockTick( company != $a.company, this before[5,8] $a.time || this after[20,22] $a ) then list.add( new StockTick[] { $a, $b } ); end diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_ConstraintConnectors.drl b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_ConstraintConnectors.drl index 2028756d5e8..d87772c59c5 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_ConstraintConnectors.drl +++ b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/compiler/integrationtests/test_ConstraintConnectors.drl @@ -26,7 +26,7 @@ global java.util.List results; rule "1. && operator" salience 10 when - $person : Person( age > 30 && < 40 && hair == "red" ) + $person : Person( age > 30 && age < 40 && hair == "red" ) then results.add( $person ); end @@ -34,7 +34,7 @@ end rule "2. || operator" salience 8 when - $person : Person( age > 70 && < 90 || hair == "green" ) + $person : Person( age > 70 && age < 90 || hair == "green" ) then results.add( $person ); end diff --git a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/strevaluator_test.drl b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/strevaluator_test.drl index 773af9402f4..bb4e660ab37 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/strevaluator_test.drl +++ b/drools-test-coverage/test-compiler-integration/src/test/resources/org/drools/mvel/integrationtests/strevaluator_test.drl @@ -68,7 +68,7 @@ end rule testmultiple when - $m : RoutingMessage( routingValue str[startsWith] "R1" && str[endsWith] "R2" && str[length] 17) + $m : RoutingMessage( routingValue str[startsWith] "R1" && routingValue str[endsWith] "R2" && routingValue str[length] 17) then list.add("Message starts with R1, ends with R2 and it's length is 17"); end diff --git a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/TemplatesTest.java b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/TemplatesTest.java index d08eaecd1af..1fd1be9f8f7 100644 --- a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/TemplatesTest.java +++ b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/functional/TemplatesTest.java @@ -69,20 +69,20 @@ public static Stream parameters() { + "global java.util.List list;\n\n"; final String rule2_when = "rule \"is appropriate 2\"\n" + "\twhen\n" - + "\t\tVegetable( $name : name == \"carrot\", $field : weight >= 0 && <= 1000, $price : price <= 2, " + + "\t\tVegetable( $name : name == \"carrot\", $field : weight >= 0 && weight <= 1000, $price : price <= 2, " + "$taste : taste == Taste.HORRIBLE )\n"; final String rule2_then = "\tthen\n\t\tlist.add( $name );\nend\n\n"; final String rule1_when = "rule \"is appropriate 1\"\n" + "\twhen\n" - + "\t\tVegetable( $name : name == \"cucumber\", $field : length >= 20 && <= 40, $price : price <= 15, " + + "\t\tVegetable( $name : name == \"cucumber\", $field : length >= 20 && length <= 40, $price : price <= 15, " + "$taste : taste == Taste.EXCELENT )\n"; final String rule1_then = "\tthen\n\t\tlist.add( $name );\nend\n\n"; final String rule0_when = "rule \"is appropriate 0\"\n" + "\twhen\n" - + "\t\tVegetable( $name : name == \"tomato\", $field : weight >= 200 && <= 1000, $price : price <= 6, " - + "$taste : taste == Taste.GOOD || == Taste.EXCELENT )\n"; + + "\t\tVegetable( $name : name == \"tomato\", $field : weight >= 200 && weight <= 1000, $price : price <= 6, " + + "$taste : taste == Taste.GOOD || taste == Taste.EXCELENT )\n"; final String rule0_then = "\tthen\n\t\tlist.add( $name );\nend\n\n"; EXPECTED_RULES.append(head); @@ -135,7 +135,7 @@ public void loadingFromDLRMapsCorrectnessCheck(KieBaseTestConfiguration kieBaseT @MethodSource("parameters") public void loadingFromDLRArrayCorrectnessCheck(KieBaseTestConfiguration kieBaseTestConfiguration) throws Exception { final String[][] rows = new String[3][6]; - rows[0] = new String[]{"tomato", "weight", "200", "1000", "6", "== Taste.GOOD || == Taste.EXCELENT"}; + rows[0] = new String[]{"tomato", "weight", "200", "1000", "6", "== Taste.GOOD || taste == Taste.EXCELENT"}; rows[1] = new String[]{"cucumber", "length", "20", "40", "15", "== Taste.EXCELENT"}; rows[2] = new String[]{"carrot", "weight", "0", "1000", "2", "== Taste.HORRIBLE"}; @@ -336,7 +336,7 @@ private Collection> getMapsParam() { mapTomato.put("fieldLower", 200); mapTomato.put("fieldUpper", 1000); mapTomato.put("price", 6); - mapTomato.put("tastes", "== Taste.GOOD || == Taste.EXCELENT"); + mapTomato.put("tastes", "== Taste.GOOD || taste == Taste.EXCELENT"); maps.add(mapTomato); final Map mapCucumber = new HashMap(); @@ -420,7 +420,7 @@ public String getTastes() { String conn = ""; for (Taste t : tasteSet) { sb.append(conn).append(" == Taste.").append(t); - conn = " ||"; + conn = " || taste"; } return sb.toString(); } diff --git a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/AbstractCompositeRestrictionTest.java b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/AbstractCompositeRestrictionTest.java index 9454031c660..bd03fe49e29 100644 --- a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/AbstractCompositeRestrictionTest.java +++ b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/AbstractCompositeRestrictionTest.java @@ -24,6 +24,7 @@ import org.drools.testcoverage.common.util.KieBaseTestConfiguration; import org.drools.testcoverage.common.util.KieUtil; import org.drools.testcoverage.common.util.TestParametersUtil2; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.kie.api.KieServices; @@ -42,6 +43,7 @@ public static Stream parameters() { return TestParametersUtil2.getKieBaseConfigurations().stream(); } + @DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") @ParameterizedTest(name = "KieBase type={0}") @MethodSource("parameters") public void test(KieBaseTestConfiguration kieBaseTestConfiguration) { diff --git a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/MultiRestrictionPatternTest.java b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/MultiRestrictionPatternTest.java index 01fcb74a43c..e98774efd99 100644 --- a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/MultiRestrictionPatternTest.java +++ b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/regression/MultiRestrictionPatternTest.java @@ -28,6 +28,7 @@ import org.drools.testcoverage.common.util.KieSessionTestConfiguration; import org.drools.testcoverage.common.util.KieUtil; import org.drools.testcoverage.common.util.TestParametersUtil2; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -41,6 +42,7 @@ * Test to verify BRMS-364 (multi-restriction pattern throws UnsupportedOpEx) is * fixed */ +@DisabledIfSystemProperty(named = "drools.drl.antlr4.parser.enabled", matches = "true") public class MultiRestrictionPatternTest extends KieSessionTest { private static final String DRL_FILE = "BRMS-364.drl"; diff --git a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template1_spreadsheet.drl.xls b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template1_spreadsheet.drl.xls index a5bea4dd27bec722301874271960db83226391c7..a271469e6c3c8acde483ab56ac9e67a35fe38773 100644 GIT binary patch delta 438 zcmZp$X|UOFgM;Y{M&a^Wn%yWHiqDg)YKBgRt7!>D=s7v zBanzB50Z#+4+9GWBM?sZ;;muaH2FBMj-&FzK#>xBmIhhzIO^y?uH2J)! z@@5kuc_cB_$w{I!CW(EpodMLx4%W-S-~gmqfY<|wIe|C^h(Y0%0mR%uTmr5x7DhH#Ki42fpUqD=b(pQ@voQbx8$)nLYHEpLD+3>c2^W%x z5lBRs2T8=Zhk=D*3F8vR$zHrQjB6$z=hYEbVqmbfRR~EeE=kpM_xE>EsHxe^!*__W z{*kySNGn4v0}lfu5cUfp_)H8;4267RaCv41W`;r@gggt-o)v-!J}Uz&Lm@wc&jxgL zA(A{h!yg72PKZ1M6CcRj&AtK$82NaC7BhhH|NjjCH%klIF>-T*odgn|GC4(f5(_RF z)yWy6GbaBM{pPv@sF(w4jt7ut0pb9tSPGEl1mYSX28CV+5OV|Z6d(qL-2x!y1>!Z6 zb;Xr6K~D25OH??z_wd5({IbIffqXe2W(Hy-Qw9bHAk8pA^M>K%L~(hJhEO*a`TVnt clNDJcHXjhTU}pTZ`KMGpBjbzBl``#&04C{IrT_o{ diff --git a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_1.drl b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_1.drl index 2a1764ba46f..164fe37cc31 100644 --- a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_1.drl +++ b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_1.drl @@ -36,7 +36,7 @@ template "appropriateToBuy" rule "is appropriate @{row.rowNumber}" when - Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && <= @{fieldUpper}, $price : price <= @{price}, $taste : taste @{tastes} ) + Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && @{field} <= @{fieldUpper}, $price : price <= @{price}, $taste : taste @{tastes} ) then list.add( $name ); end diff --git a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_2.drl b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_2.drl index cffa7054095..a4e94f2fe5d 100644 --- a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_2.drl +++ b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/functional/template_2.drl @@ -36,7 +36,7 @@ template "appropriateToBuy" rule "is appropriate @{row.rowNumber}" when - Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && <= @{fieldUpper}, $price : price <= @{price}, $taste : taste @{tastes} ) + Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && @{field} <= @{fieldUpper}, $price : price <= @{price}, $taste : taste @{tastes} ) then list.add( $name ); end @@ -114,7 +114,7 @@ template "goodPriceAndSize" rule "is of good price and size @{row.rowNumber}" when - Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && <= @{fieldUpper}, $price : price <= @{price} ) + Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && @{field} <= @{fieldUpper}, $price : price <= @{price} ) then list.add( $name ); end @@ -136,7 +136,7 @@ end template rule "is of right size and taste @{row.rowNumber}" when - Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && <= @{fieldUpper}, $taste : taste @{tastes} ) + Vegetable( $name : name == "@{name}", $field : @{field} >= @{fieldLower} && @{field} <= @{fieldUpper}, $taste : taste @{tastes} ) then list.add( $name ); end diff --git a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/regression/sessionInsertMultithreadingTest.drl b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/regression/sessionInsertMultithreadingTest.drl index d6352282945..fc41fa64702 100644 --- a/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/regression/sessionInsertMultithreadingTest.drl +++ b/drools-test-coverage/test-suite/src/test/resources/org/drools/testcoverage/regression/sessionInsertMultithreadingTest.drl @@ -24,7 +24,7 @@ import org.drools.testcoverage.common.model.Message rule "Name" when - $p : Person ( name == "" || == null ) + $p : Person ( name == "" || name == null ) then modify ($p) { setName("Aquaman"); @@ -34,7 +34,7 @@ end rule "Message" no-loop when - $m : Message ( message == "" || == null ) + $m : Message ( message == "" || message == null ) then modify ($m) { setMessage("Hello world"); @@ -53,7 +53,7 @@ end rule "Message from" salience -10 when - $p : Person ( name != "" && != null && id != 0) + $p : Person ( name != "" && name != null && id != 0) $m : Message ( message == "Hello world" ) then modify ($m) { diff --git a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java index d4d9cae880c..e7c59734353 100644 --- a/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java +++ b/drools-traits/src/test/java/org/drools/traits/compiler/factmodel/traits/TraitMapCoreTest.java @@ -298,7 +298,7 @@ public void testMapCoreAliasing( ) { "\n" + "rule Log \n" + "when \n" + - " $p : PersonMap( name == \"john\", age > 10 && < 35 )\n" + + " $p : PersonMap( name == \"john\", age > 10 && age < 35 )\n" + "then \n" + " modify ( $p ) { \n" + " setHeight( 184.0 ), \n" + diff --git a/drools-verifier/drools-verifier-drl/pom.xml b/drools-verifier/drools-verifier-drl/pom.xml index 2b93a9c78b1..474178b3a6b 100644 --- a/drools-verifier/drools-verifier-drl/pom.xml +++ b/drools-verifier/drools-verifier-drl/pom.xml @@ -179,5 +179,26 @@ + + + enableNewParser + + + enableNewParser + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + true + + + + + diff --git a/drools-verifier/drools-verifier-drl/src/main/java/org/drools/verifier/builder/VerifierKnowledgeBaseBuilder.java b/drools-verifier/drools-verifier-drl/src/main/java/org/drools/verifier/builder/VerifierKnowledgeBaseBuilder.java index 10410deba94..528932959cb 100644 --- a/drools-verifier/drools-verifier-drl/src/main/java/org/drools/verifier/builder/VerifierKnowledgeBaseBuilder.java +++ b/drools-verifier/drools-verifier-drl/src/main/java/org/drools/verifier/builder/VerifierKnowledgeBaseBuilder.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.List; +import org.drools.compiler.builder.impl.KnowledgeBuilderImpl; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.verifier.VerifierConfiguration; @@ -31,6 +32,7 @@ import org.kie.internal.builder.KnowledgeBuilder; import org.kie.internal.builder.KnowledgeBuilderError; import org.kie.internal.builder.KnowledgeBuilderFactory; +import org.kie.internal.builder.conf.LanguageLevelOption; public class VerifierKnowledgeBaseBuilder { @@ -41,6 +43,11 @@ public KieBase newVerifierKnowledgeBase(VerifierConfiguration configuration) { InternalKnowledgeBase verifierKnowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); + LanguageLevelOption option = ((KnowledgeBuilderImpl) kbuilder).getBuilderConfiguration().getOption(LanguageLevelOption.KEY); + if (option == LanguageLevelOption.DRL10) { + // Temporarily verifier rules can be migrated to DRL10 (= fix half constraint). Need to be discussed. + throw new UnsupportedOperationException("Verifier does not support DRL10"); + } if ( configuration.getVerifyingResources() != null ) { for ( Resource resource : configuration.getVerifyingResources().keySet() ) {