Search in sources :

Example 1 with KiePMMLStatusHolder

use of org.kie.pmml.models.drools.executor.KiePMMLStatusHolder in project drools by kiegroup.

the class KiePMMLSessionUtilsTest method kiePMMLSessionUtils.

@Test
public void kiePMMLSessionUtils() {
    List<Command> retrieved = kiePMMLSessionUtils.commands;
    assertNotNull(retrieved);
    assertEquals(3, retrieved.size());
    assertTrue(retrieved.get(0) instanceof InsertObjectCommand);
    InsertObjectCommand insertObjectCommand = (InsertObjectCommand) retrieved.get(0);
    assertEquals("DEFAULT", insertObjectCommand.getEntryPoint());
    assertNotNull(insertObjectCommand.getObject());
    assertTrue(insertObjectCommand.getObject() instanceof KiePMMLStatusHolder);
    KiePMMLStatusHolder kiePMMLStatusHolder = (KiePMMLStatusHolder) insertObjectCommand.getObject();
    assertEquals(0.0, kiePMMLStatusHolder.getAccumulator(), 0.0);
    assertNull(kiePMMLStatusHolder.getStatus());
    assertTrue(retrieved.get(1) instanceof InsertObjectCommand);
    insertObjectCommand = (InsertObjectCommand) retrieved.get(1);
    assertEquals("DEFAULT", insertObjectCommand.getEntryPoint());
    assertNotNull(insertObjectCommand.getObject());
    assertTrue(insertObjectCommand.getObject() instanceof PMML4Result);
    assertEquals(PMML4_RESULT, insertObjectCommand.getObject());
    assertTrue(retrieved.get(2) instanceof SetGlobalCommand);
    SetGlobalCommand setGlobalCommand = (SetGlobalCommand) retrieved.get(2);
    assertEquals("$pmml4Result", setGlobalCommand.getIdentifier());
    assertTrue(setGlobalCommand.getObject() instanceof PMML4Result);
    assertEquals(PMML4_RESULT, setGlobalCommand.getObject());
}
Also used : SetGlobalCommand(org.drools.core.command.runtime.SetGlobalCommand) PMML4Result(org.kie.api.pmml.PMML4Result) Command(org.kie.api.command.Command) InsertObjectCommand(org.drools.core.command.runtime.rule.InsertObjectCommand) SetGlobalCommand(org.drools.core.command.runtime.SetGlobalCommand) KiePMMLStatusHolder(org.kie.pmml.models.drools.executor.KiePMMLStatusHolder) InsertObjectCommand(org.drools.core.command.runtime.rule.InsertObjectCommand) Test(org.junit.Test)

Aggregations

SetGlobalCommand (org.drools.core.command.runtime.SetGlobalCommand)1 InsertObjectCommand (org.drools.core.command.runtime.rule.InsertObjectCommand)1 Test (org.junit.Test)1 Command (org.kie.api.command.Command)1 PMML4Result (org.kie.api.pmml.PMML4Result)1 KiePMMLStatusHolder (org.kie.pmml.models.drools.executor.KiePMMLStatusHolder)1