Search in sources :

Example 1 with Address

use of org.drools.core.test.model.Address in project drools by kiegroup.

the class MVELClassFieldExtractorTest method setUp.

@Before
public void setUp() throws Exception {
    store.setClassFieldAccessorCache(new ClassFieldAccessorCache(Thread.currentThread().getContextClassLoader()));
    store.setEagerWire(true);
    extractor = (MVELObjectClassFieldReader) store.getMVELReader(Person.class.getPackage().getName(), Person.class.getName(), "addresses['home'].street", true, String.class);
    MVELDialectRuntimeData data = new MVELDialectRuntimeData();
    data.addImport(Person.class.getSimpleName(), Person.class);
    data.onAdd(null, ProjectClassLoader.createProjectClassLoader());
    extractor.compile(data);
    person[0] = new Person("bob", 30);
    business[0] = new Address("Business Street", "999", null);
    home[0] = new Address("Home Street", "555", "55555555");
    person[0].getAddresses().put("business", business[0]);
    person[0].getAddresses().put("home", home[0]);
    person[1] = new Person("mark", 35);
    business[1] = new Address("Another Business Street", "999", null);
    home[1] = new Address("Another Home Street", "555", "55555555");
    person[1].getAddresses().put("business", business[1]);
    person[1].getAddresses().put("home", home[1]);
}
Also used : ClassFieldAccessorCache(org.drools.core.base.ClassFieldAccessorCache) MVELDialectRuntimeData(org.drools.core.rule.MVELDialectRuntimeData) Address(org.drools.core.test.model.Address) Person(org.drools.core.test.model.Person) Before(org.junit.Before)

Aggregations

ClassFieldAccessorCache (org.drools.core.base.ClassFieldAccessorCache)1 MVELDialectRuntimeData (org.drools.core.rule.MVELDialectRuntimeData)1 Address (org.drools.core.test.model.Address)1 Person (org.drools.core.test.model.Person)1 Before (org.junit.Before)1