KiePMMLSessionUtils { void insertObjectInSession(final Object toInsert, final String globalName) { commands.add(COMMAND_FACTORY_SERVICE.newInsert(toInsert)); commands.add(COMMAND_FACTORY_SERVICE.newSetGlobal(globalName, toInsert)); } private  KiePMMLSessionUtils(final KieBase knowledgeBase, final String modelName, final String packageName, final PMML4Result pmml4Result); static Builder builder(final KieBase knowledgeBase, final String modelName, final String packageName, final PMML4Result pmml4Result); void fireAllRules();  }
@Test public void insertObjectInSession() { final List<Command> retrieved = kiePMMLSessionUtils.commands; assertNotNull(retrieved); assertEquals(3, retrieved.size()); final Object toInsert = "TO_INSERT"; final String globalName = "GLOBAL_NAME"; kiePMMLSessionUtils.insertObjectInSession(toInsert, globalName); assertEquals(5, retrieved.size()); assertTrue(retrieved.get(3) instanceof InsertObjectCommand); InsertObjectCommand insertObjectCommand = (InsertObjectCommand) retrieved.get(3); assertEquals("DEFAULT", insertObjectCommand.getEntryPoint()); assertNotNull(insertObjectCommand.getObject()); assertEquals(toInsert, insertObjectCommand.getObject()); assertTrue(retrieved.get(4) instanceof SetGlobalCommand); SetGlobalCommand setGlobalCommand = (SetGlobalCommand) retrieved.get(4); assertEquals(globalName, setGlobalCommand.getIdentifier()); assertEquals(toInsert, setGlobalCommand.getObject()); }