Search in sources :

Example 21 with BuildContext

use of org.drools.core.reteoo.builder.BuildContext in project drools by kiegroup.

the class CompositeObjectSinkAdapterTest method setUp.

@Before
public void setUp() throws Exception {
    store.setClassFieldAccessorCache(new ClassFieldAccessorCache(Thread.currentThread().getContextClassLoader()));
    store.setEagerWire(true);
    this.kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
    this.buildContext = new BuildContext(kBase);
    this.buildContext.setRule(new RuleImpl("test"));
}
Also used : ClassFieldAccessorCache(org.drools.core.base.ClassFieldAccessorCache) BuildContext(org.drools.core.reteoo.builder.BuildContext) RuleImpl(org.drools.core.definitions.rule.impl.RuleImpl) Before(org.junit.Before)

Example 22 with BuildContext

use of org.drools.core.reteoo.builder.BuildContext in project drools by kiegroup.

the class PropertyChangeListenerTest method setUp.

@Before
public void setUp() throws Exception {
    this.kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
    this.buildContext = new BuildContext(kBase);
    this.entryPoint = buildContext.getKnowledgeBase().getRete().getEntryPointNodes().values().iterator().next();
    ;
}
Also used : BuildContext(org.drools.core.reteoo.builder.BuildContext) Before(org.junit.Before)

Example 23 with BuildContext

use of org.drools.core.reteoo.builder.BuildContext in project drools by kiegroup.

the class ScenarioTest method createContext.

public BuildContext createContext() {
    RuleBaseConfiguration conf = new RuleBaseConfiguration();
    KnowledgeBaseImpl rbase = new KnowledgeBaseImpl("ID", conf);
    BuildContext buildContext = new BuildContext(rbase);
    RuleImpl rule = new RuleImpl("rule1").setPackage("org.pkg1");
    InternalKnowledgePackage pkg = new KnowledgePackageImpl("org.pkg1");
    pkg.getDialectRuntimeRegistry().setDialectData("mvel", new MVELDialectRuntimeData());
    pkg.addRule(rule);
    buildContext.setRule(rule);
    return buildContext;
}
Also used : RuleBaseConfiguration(org.drools.core.RuleBaseConfiguration) MVELDialectRuntimeData(org.drools.core.rule.MVELDialectRuntimeData) BuildContext(org.drools.core.reteoo.builder.BuildContext) KnowledgeBaseImpl(org.drools.core.impl.KnowledgeBaseImpl) RuleImpl(org.drools.core.definitions.rule.impl.RuleImpl) KnowledgePackageImpl(org.drools.core.definitions.impl.KnowledgePackageImpl) InternalKnowledgePackage(org.drools.core.definitions.InternalKnowledgePackage)

Aggregations

BuildContext (org.drools.core.reteoo.builder.BuildContext)23 RuleImpl (org.drools.core.definitions.rule.impl.RuleImpl)16 Test (org.junit.Test)11 InternalKnowledgeBase (org.drools.core.impl.InternalKnowledgeBase)9 PropagationContextFactory (org.drools.core.common.PropagationContextFactory)8 StatefulKnowledgeSessionImpl (org.drools.core.impl.StatefulKnowledgeSessionImpl)8 ClassObjectType (org.drools.core.base.ClassObjectType)7 InternalKnowledgePackage (org.drools.core.definitions.InternalKnowledgePackage)7 RuleBaseConfiguration (org.drools.core.RuleBaseConfiguration)5 KnowledgePackageImpl (org.drools.core.definitions.impl.KnowledgePackageImpl)5 KnowledgeBaseImpl (org.drools.core.impl.KnowledgeBaseImpl)5 DefaultFactHandle (org.drools.core.common.DefaultFactHandle)4 RuleTerminalNode (org.drools.core.reteoo.RuleTerminalNode)4 MVELDialectRuntimeData (org.drools.core.rule.MVELDialectRuntimeData)4 Cheese (org.drools.core.test.model.Cheese)4 Before (org.junit.Before)4 KieBaseConfiguration (org.kie.api.KieBaseConfiguration)4 HashMap (java.util.HashMap)3 PackageDescr (org.drools.compiler.lang.descr.PackageDescr)3 RuleDescr (org.drools.compiler.lang.descr.RuleDescr)3