[
https://issues.redhat.com/browse/DROOLS-5877?page=com.atlassian.jira.plug...
]
Luca Molteni resolved DROOLS-5877.
----------------------------------
Resolution: Cannot Reproduce
Cannot reproduce on 7.50.0-SNAPSHOT with this test
{code:java}
@Test
public void testBigDecimalLiterals() {
String str =
"import " + Person.class.getCanonicalName() + "\n" +
"global java.util.List withMoney;\n" +
"global java.util.List withoutMoney;\n" +
"rule \"rule1\"\n" +
" dialect \"mvel\"\n" +
" when\n" +
" $pwm : Person( money >= 1000B )\n" +
" then\n" +
" withMoney.add($pwm)\n" +
"end\n" +
"\n" +
"rule \"rule2\"\n" +
" dialect \"mvel\"\n" +
" when\n" +
" $pnm : Person( money < 1000B )\n" +
" then\n" +
" withoutMoney.add($pnm)\n" +
"end";
KieSession ksession = getKieSession(str);
List<Person> withMoney = new ArrayList<>();
ksession.setGlobal("withMoney", withMoney);
List<Person> withoutMoney = new ArrayList<>();
ksession.setGlobal("withoutMoney", withoutMoney);
Person luca = new Person("luca", BigDecimal.valueOf(1000));
Person leonardo = new Person("Leonardo", BigDecimal.valueOf(999));
ksession.insert(luca);
ksession.insert(leonardo);
ksession.fireAllRules();
assertThat(withMoney).containsOnly(luca);
assertThat(withoutMoney).containsOnly(leonardo);
}
{code}
[~tari_manga] we should verify the original decision table against 7.50.0-SNAPSHOT
Support MVEL BLiteral in the exec model
---------------------------------------
Key: DROOLS-5877
URL:
https://issues.redhat.com/browse/DROOLS-5877
Project: Drools
Issue Type: Bug
Components: executable model
Reporter: Luca Molteni
Assignee: Luca Molteni
Priority: Major
It seems like it's already supported in the consequence
[
https://github.com/kiegroup/drools/blob/6408b5e1caa1e5c5fe94e45f82e1bedfb...]
{code:java}
package com.myspace.check20201202;
//from row number: 1
rule "Row 1 MatteoTable"
dialect "mvel"
when
f1 : Person( age >= 18B )
then
f1.setMinor( false );
end
//from row number: 2
rule "Row 2 MatteoTable"
dialect "mvel"
when
f1 : Person( age < 18B )
then
f1.setMinor( true );
end
package com.myspace.check20201202;
import java.math.BigDecimal;
/**
* This class was automatically generated by the data modeler tool.
*/
public class Person implements java.io.Serializable {
static final long serialVersionUID = 1L;
private java.lang.String name;
private BigDecimal age;
private java.lang.Boolean minor;
public Person() {
}
public java.lang.String getName() {
return this.name;
}
public void setName(java.lang.String name) {
this.name = name;
}
public java.lang.Boolean getMinor() {
return this.minor;
}
public void setMinor(java.lang.Boolean minor) {
this.minor = minor;
}
public java.math.BigDecimal getAge() {
return this.age;
}
public void setAge(java.math.BigDecimal age) {
this.age = age;
}
public Person(java.lang.String name, java.math.BigDecimal age,
java.lang.Boolean minor) {
this.name = name;
this.age = age;
this.minor = minor;
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.13.1#813001)