Search in sources :

Example 11 with ExecutableBuilder

use of org.kie.api.runtime.builder.ExecutableBuilder in project drools by kiegroup.

the class BatchRunFluentTest method testSetAndGetWithCommandRegisterWithoutEnds.

@Test
public void testSetAndGetWithCommandRegisterWithoutEnds() {
    ExecutableBuilder f = ExecutableBuilder.create();
    f.newApplicationContext("app1").getKieContainer(releaseId).newSession().set("s1").end().getKieContainer(releaseId).newSession().set("s2").get("s1", KieSessionFluent.class).insert("h1").fireAllRules().get("s2", KieSessionFluent.class).insert("h2").fireAllRules().get("s1", KieSessionFluent.class).getGlobal("outS").out("outS1").dispose().get("s2", KieSessionFluent.class).getGlobal("outS").out("outS2").dispose();
    RequestContext requestContext = ExecutableRunner.create().execute(f.getExecutable());
    // Check that nothing went to the 'out'
    assertEquals("h1", requestContext.get("outS1"));
    assertEquals("h2", requestContext.get("outS2"));
}
Also used : ExecutableBuilder(org.kie.api.runtime.builder.ExecutableBuilder) KieSessionFluent(org.kie.api.runtime.builder.KieSessionFluent) RequestContext(org.kie.api.runtime.RequestContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 RequestContext (org.kie.api.runtime.RequestContext)11 ExecutableBuilder (org.kie.api.runtime.builder.ExecutableBuilder)11 ExecutableBuilderImpl (org.drools.core.fluent.impl.ExecutableBuilderImpl)3 KieSessionFluent (org.kie.api.runtime.builder.KieSessionFluent)2 RequestContextImpl (org.drools.core.command.RequestContextImpl)1