use of org.drools.core.base.ClassFieldAccessorCache in project drools by kiegroup.
the class MVELEvalBuilderTest method setUp.
@Before
public void setUp() throws Exception {
store.setClassFieldAccessorCache(new ClassFieldAccessorCache(Thread.currentThread().getContextClassLoader()));
store.setEagerWire(true);
}
use of org.drools.core.base.ClassFieldAccessorCache in project drools by kiegroup.
the class DisposeCommandPublicAPITest method testDisposeCommand.
@Test
public void testDisposeCommand() {
InternalKnowledgeBase kBase;
RuleImpl rule;
InternalKnowledgePackage pkg;
kBase = KnowledgeBaseFactory.newKnowledgeBase();
pkg = new KnowledgePackageImpl("org.droos.test");
pkg.setClassFieldAccessorCache(new ClassFieldAccessorCache(Thread.currentThread().getContextClassLoader()));
JavaDialectRuntimeData data = new JavaDialectRuntimeData();
data.onAdd(pkg.getDialectRuntimeRegistry(), kBase.getRootClassLoader());
pkg.getDialectRuntimeRegistry().setDialectData("java", data);
rule = new RuleImpl("Test");
rule.setDialect("java");
rule.setConsequence(new Consequence() {
public void evaluate(KnowledgeHelper knowledgeHelper, WorkingMemory workingMemory) throws Exception {
}
public String getName() {
return "default";
}
});
pkg.addRule(rule);
kBase.addPackage(pkg);
KieSession session = kBase.newKieSession();
Command dispose = KieServices.Factory.get().getCommands().newDispose();
session.insert("whatever");
session.fireAllRules();
session.execute(dispose);
try {
session.insert("whatever");
} catch (Exception e) {
Assert.assertEquals(e.getMessage(), "Illegal method call. This session was previously disposed.");
}
}
use of org.drools.core.base.ClassFieldAccessorCache in project drools by kiegroup.
the class BooleanClassFieldExtractorTest method setUp.
@Before
public void setUp() throws Exception {
ClassFieldAccessorStore store = new ClassFieldAccessorStore();
store.setClassFieldAccessorCache(new ClassFieldAccessorCache(Thread.currentThread().getContextClassLoader()));
store.setEagerWire(true);
this.reader = store.getReader(TestBean.class, "booleanAttr");
}
use of org.drools.core.base.ClassFieldAccessorCache in project drools by kiegroup.
the class CharClassFieldExtractorTest method setUp.
@Before
public void setUp() throws Exception {
ClassFieldAccessorStore store = new ClassFieldAccessorStore();
store.setClassFieldAccessorCache(new ClassFieldAccessorCache(Thread.currentThread().getContextClassLoader()));
store.setEagerWire(true);
this.reader = store.getReader(TestBean.class, "charAttr");
}
use of org.drools.core.base.ClassFieldAccessorCache in project drools by kiegroup.
the class DoubleClassFieldExtractorTest method setUp.
@Before
public void setUp() throws Exception {
ClassFieldAccessorStore store = new ClassFieldAccessorStore();
store.setClassFieldAccessorCache(new ClassFieldAccessorCache(Thread.currentThread().getContextClassLoader()));
store.setEagerWire(true);
this.reader = store.getReader(TestBean.class, "doubleAttr");
}
Aggregations