Search in sources :

Example 11 with ContextImpl

use of org.drools.core.command.impl.ContextImpl in project drools by kiegroup.

the class SetDMNActiveModelCommandTest method init.

@Before
public void init() {
    registryContext = new ContextImpl();
    dmnRuntime = kieContainer.newKieSession().getKieRuntime(DMNRuntime.class);
}
Also used : ContextImpl(org.drools.core.command.impl.ContextImpl) DMNRuntime(org.kie.dmn.api.core.DMNRuntime) Before(org.junit.Before)

Example 12 with ContextImpl

use of org.drools.core.command.impl.ContextImpl in project drools by kiegroup.

the class GetDMNDecisionResultsCommandTest method execute.

@Test
public void execute() {
    RegistryContext registryContext = new ContextImpl();
    GetDMNDecisionResultsCommand getDMNDecisionResultsCommand = new GetDMNDecisionResultsCommand();
    assertThatThrownBy(() -> getDMNDecisionResultsCommand.execute(registryContext)).isInstanceOf(IllegalStateException.class).hasMessage("There is no DMNResult available");
    DMNResultImpl dmnResult = new DMNResultImpl(null);
    dmnResult.setContext(new DMNContextImpl());
    registryContext.register(DMNResult.class, dmnResult);
    List<DMNDecisionResult> result = getDMNDecisionResultsCommand.execute(registryContext);
    assertEquals(0, result.size());
}
Also used : DMNResultImpl(org.kie.dmn.core.impl.DMNResultImpl) DMNDecisionResult(org.kie.dmn.api.core.DMNDecisionResult) RegistryContext(org.kie.internal.command.RegistryContext) ContextImpl(org.drools.core.command.impl.ContextImpl) DMNContextImpl(org.kie.dmn.core.impl.DMNContextImpl) DMNContextImpl(org.kie.dmn.core.impl.DMNContextImpl) Test(org.junit.Test)

Aggregations

ContextImpl (org.drools.core.command.impl.ContextImpl)12 RegistryContext (org.kie.internal.command.RegistryContext)7 Test (org.junit.Test)6 DMNRuntime (org.kie.dmn.api.core.DMNRuntime)3 DMNContextImpl (org.kie.dmn.core.impl.DMNContextImpl)3 DMNResultImpl (org.kie.dmn.core.impl.DMNResultImpl)3 BatchExecutionCommandImpl (org.drools.core.command.runtime.BatchExecutionCommandImpl)2 FireAllRulesCommand (org.drools.core.command.runtime.rule.FireAllRulesCommand)2 ExecutionResultImpl (org.drools.core.runtime.impl.ExecutionResultImpl)2 Before (org.junit.Before)2 BatchExecutionCommand (org.kie.api.command.BatchExecutionCommand)2 Command (org.kie.api.command.Command)2 DMNContext (org.kie.dmn.api.core.DMNContext)2 StatefulKnowledgeSession (org.kie.internal.runtime.StatefulKnowledgeSession)2 ExecutableCommand (org.drools.core.command.impl.ExecutableCommand)1 RegistryContext (org.drools.core.command.impl.RegistryContext)1 ExecutableCommand (org.kie.api.command.ExecutableCommand)1 Context (org.kie.api.runtime.Context)1 DMNDecisionResult (org.kie.dmn.api.core.DMNDecisionResult)1 DMNMessage (org.kie.dmn.api.core.DMNMessage)1