Skip to content

Commit c545fce

Browse files
committed
BZ-1043395 - Invalid rules in jboss-bpm-example (Big App) - can't be opened/validated in Guider Rule Editor
1 parent 2682ab2 commit c545fce

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

drools-workbench-models/drools-workbench-models-commons/src/test/java/org/drools/workbench/models/commons/backend/rule/RuleModelDRLPersistenceUnmarshallingTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.drools.workbench.models.datamodel.rule.ActionFieldValue;
3030
import org.drools.workbench.models.datamodel.rule.ActionGlobalCollectionAdd;
3131
import org.drools.workbench.models.datamodel.rule.ActionSetField;
32+
import org.drools.workbench.models.datamodel.rule.ActionUpdateField;
3233
import org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint;
3334
import org.drools.workbench.models.datamodel.rule.CEPWindow;
3435
import org.drools.workbench.models.datamodel.rule.CompositeFactPattern;
@@ -2022,6 +2023,33 @@ public void testMVELInlineList() throws Exception {
20222023

20232024
}
20242025

2026+
@Test
2027+
@Ignore("https://bugzilla.redhat.com/show_bug.cgi?id=1043395 - Invalid rules in jboss-bpm-example (Big App) - can't be opened/validated in Guider Rule Editor")
2028+
public void testFunctionInRHS() throws Exception {
2029+
String drl = "" +
2030+
"rule \"Borked\"\n" +
2031+
" dialect \"mvel\"\n" +
2032+
" when\n" +
2033+
" application : Application( )\n" +
2034+
" then\n" +
2035+
" application.setApr( application.getApr() + 5 );\n" +
2036+
" update( application )" +
2037+
"end";
2038+
2039+
RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal(drl,
2040+
dmo);
2041+
2042+
assertTrue(m.rhs[0] instanceof ActionUpdateField);
2043+
2044+
ActionUpdateField field = (ActionUpdateField) m.rhs[0];
2045+
assertTrue(field.getFieldValues()[0] instanceof ActionFieldValue);
2046+
ActionFieldValue value = field.getFieldValues()[0];
2047+
assertEquals("apr", value.getField());
2048+
assertEquals("application.getApr() + 5", value.getValue());
2049+
assertEquals(3, value.getNature());
2050+
assertEquals("Numeric", value.getType());
2051+
}
2052+
20252053
private void assertEqualsIgnoreWhitespace( final String expected,
20262054
final String actual ) {
20272055
final String cleanExpected = expected.replaceAll( "\\s+",

0 commit comments

Comments
 (0)