drccrd commented on code in PR #6786:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6786#discussion_r3524617486


##########
drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/DeclaredTypesTest.java:
##########
@@ -599,6 +599,26 @@ public void testExtendPojo(RUN_TYPE runType) throws 
Exception {
         assertThat(ksession.fireAllRules()).isEqualTo(1);
     }
 
+    @ParameterizedTest
+    @MethodSource("parameters")
+    public void testGlobalReferencedInConstraintFromDifferentPackage(RUN_TYPE 
runType) {
+        // A global declared in one DRL package must be resolvable from a 
pattern constraint compiled
+        // from a different package in the same KieBase, matching the classic 
compiler where globals are
+        // KieBase-wide and visible without a wildcard import. Here a 
BigDecimal global 'threshold' is
+        // declared in com.test.globals and referenced from a Person 
constraint in com.test.rules.
+        String globalDrl =
+                "package com.test.globals;\n" +
+                "global java.math.BigDecimal threshold;\n";
+        String ruleDrl =
+                "package com.test.rules;\n" +
+                "import " + Person.class.getCanonicalName() + ";\n" +
+                "rule R when\n" +
+                "  Person( money.compareTo(threshold) < 0 )\n" +
+                "then end";
+        KieSession ksession = getKieSession(runType, globalDrl, ruleDrl);
+        ksession.fireAllRules();
+    }

Review Comment:
   Added.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to