use of org.drools.impact.analysis.parser.ModelBuilder in project drools by kiegroup.
the class SpecialUsageTest method testBindVariableLiteralInsert.
@Test
public void testBindVariableLiteralInsert() {
String str = "package mypkg;\n" + "import " + Address.class.getCanonicalName() + ";" + "import " + Person.class.getCanonicalName() + ";" + "rule R1 when\n" + " Address(city == \"Tokyo\", $data : \"ABC\")\n" + "then\n" + " Person person = new Person(\"John\");\n" + " person.setLikes($data);\n" + " insert(person);\n" + "end\n" + "rule R2 when\n" + " $p : Person(likes == \"ABC\")\n" + "then\n" + "end\n";
AnalysisModel analysisModel = new ModelBuilder().build(str);
ModelToGraphConverter converter = new ModelToGraphConverter();
Graph graph = converter.toGraph(analysisModel);
assertLink(graph, "mypkg.R1", "mypkg.R2", ReactivityType.POSITIVE);
}
Aggregations