use of org.drools.workbench.models.testscenarios.backend.OuterFact in project drools by kiegroup.
the class FactPopulatorTest method testPopulateNestedWrongOrder.
@Test
public void testPopulateNestedWrongOrder() throws Exception {
TypeResolver typeResolver = getTypeResolver();
FactData outerFactData = new FactData("OuterFact", "p1", Arrays.<Field>asList(new FieldData("name", "mic"), new FieldData("innerFact", "=c1")), false);
factPopulator.add(new NewFactPopulator(populatedData, typeResolver, outerFactData));
FactData cheeseFactData = new FactData("Cheese", "c1", Arrays.<Field>asList(new FieldData("type", "cheddar"), new FieldData("price", "42")), false);
factPopulator.add(new NewFactPopulator(populatedData, typeResolver, cheeseFactData));
factPopulator.populate();
assertTrue(populatedData.containsKey("c1"));
assertTrue(populatedData.containsKey("p1"));
OuterFact o = (OuterFact) populatedData.get("p1");
assertEquals(populatedData.get("c1"), o.getInnerFact());
}
use of org.drools.workbench.models.testscenarios.backend.OuterFact in project drools by kiegroup.
the class FactPopulatorTest method testPopulateNested.
@Test
public void testPopulateNested() throws Exception {
TypeResolver typeResolver = getTypeResolver();
FactData cheeseFactData = new FactData("Cheese", "c1", Arrays.<Field>asList(new FieldData("type", "cheddar"), new FieldData("price", "42")), false);
factPopulator.add(new NewFactPopulator(populatedData, typeResolver, cheeseFactData));
FactData outerFactData = new FactData("OuterFact", "p1", Arrays.<Field>asList(new FieldData("name", "mic"), new FieldData("innerFact", "=c1")), false);
factPopulator.add(new NewFactPopulator(populatedData, typeResolver, outerFactData));
factPopulator.populate();
assertTrue(populatedData.containsKey("c1"));
assertTrue(populatedData.containsKey("p1"));
OuterFact o = (OuterFact) populatedData.get("p1");
assertEquals(populatedData.get("c1"), o.getInnerFact());
}
Aggregations