use of org.drools.impact.analysis.integrationtests.domain.ProductItem in project drools by kiegroup.
the class SpecialUsageTest method testMapWithFunction.
@Test
public void testMapWithFunction() {
String str = "package mypkg;\n" + "import " + ControlFact.class.getCanonicalName() + ";" + "import " + ProductItem.class.getCanonicalName() + ";" + "import static " + FunctionUtils.class.getCanonicalName() + ".convertMapToBigDecimal;" + "dialect \"mvel\"" + "rule R1 when\n" + " $c : ControlFact()\n" + "then\n" + " $c.mapData[\"Price\"] = \"100.0\";" + " modify ($c) {mapData = $c.mapData};" + "end\n" + "rule R2 when\n" + " ControlFact($price : convertMapToBigDecimal(mapData, \"Price\"))\n" + " ProductItem(price == $price)\n" + "then\n" + "end\n";
// runRule(str, new ControlFact(), new ProductItem("Product1", new BigDecimal("100.0")));
AnalysisModel analysisModel = new ModelBuilder().build(str);
ModelToGraphConverter converter = new ModelToGraphConverter();
Graph graph = converter.toGraph(analysisModel);
assertLink(graph, "mypkg.R1", "mypkg.R2", ReactivityType.UNKNOWN);
}
Aggregations