@Override public KieCommands getCommands() { return kieServices.getCommands(); }
@Test public void testRegisterAgendaEventListenerStateless() throws Exception { statelessKieSession.execute(KieServices.Factory.get().getCommands().newInsert("test")); checkThatListenerFired(statelessKieSession.getAgendaEventListeners()); }
@Test public void testRegisterRuleEventListenerStateless() throws Exception { statelessKieSession.execute(KieServices.Factory.get().getCommands().newInsert("test")); checkThatListenerFired(statelessKieSession.getRuleRuntimeEventListeners()); }
@Override public <T> T execute( Command<T> command ) { KieCommands kieCommands = KieServices.Factory.get().getCommands(); List<Command<?>> cmds = new ArrayList<Command<?>>(); cmds.addAll( commands ); cmds.add( command ); return (T) delegate.execute( CommandFactory.newBatchExecution( cmds ) ); }
@Override public <T> T execute( Command<T> command ) { KieCommands kieCommands = KieServices.Factory.get().getCommands(); List<Command<?>> cmds = new ArrayList<Command<?>>(); cmds.addAll( commands ); cmds.add( command ); return (T) delegate.execute( CommandFactory.newBatchExecution( cmds ) ); }
Command dispose = KieServices.Factory.get().getCommands().newDispose(); session.insert("whatever"); session.fireAllRules();
@Override public void execute( Object object ) { KieCommands kieCommands = KieServices.Factory.get().getCommands(); List<Command<?>> cmds = new ArrayList<Command<?>>(); cmds.addAll( commands ); cmds.add( kieCommands.newInsert( object ) ); cmds.add( kieCommands.newFireAllRules() ); delegate.execute( CommandFactory.newBatchExecution( cmds ) ); }
@Override public void execute( Object object ) { KieCommands kieCommands = KieServices.Factory.get().getCommands(); List<Command<?>> cmds = new ArrayList<Command<?>>(); cmds.addAll( commands ); cmds.add( kieCommands.newInsert( object ) ); cmds.add( kieCommands.newFireAllRules() ); delegate.execute( CommandFactory.newBatchExecution( cmds ) ); }
@Override public void execute( Iterable objects ) { KieCommands kieCommands = KieServices.Factory.get().getCommands(); List<Command<?>> cmds = new ArrayList<Command<?>>(); cmds.addAll( commands ); for ( Object object : objects ) { cmds.add( kieCommands.newInsert( object ) ); } cmds.add( kieCommands.newFireAllRules() ); delegate.execute( CommandFactory.newBatchExecution( cmds ) ); } }
@Override public void execute( Iterable objects ) { KieCommands kieCommands = KieServices.Factory.get().getCommands(); List<Command<?>> cmds = new ArrayList<Command<?>>(); cmds.addAll( commands ); for ( Object object : objects ) { cmds.add( kieCommands.newInsert( object ) ); } cmds.add( kieCommands.newFireAllRules() ); delegate.execute( CommandFactory.newBatchExecution( cmds ) ); } }
public Results fireRules(List data) { Results res = new Results(); KieCommands commands = kServices.getCommands(); List<Command> cmds = new ArrayList<Command>(); cmds.add(commands.newInsertElements(data)); cmds.add(CommandFactory.newFireAllRules()); cmds.add(CommandFactory.newQuery(QUERY_RESULT, QUERY_NAME)); ExecutionResults er = session.execute(commands.newBatchExecution(cmds)); this.addResults(res.getResults(), er, QUERY_RESULT); return res; }
@BeforeClass public static void setupFactory() throws Exception { commandsFactory = KieServices.Factory.get().getCommands(); }
@BeforeClass public static void setupFactory() throws Exception { commandsFactory = KieServices.Factory.get().getCommands(); }
@Test public void tessDefaultDynamicKBase() throws IOException, ClassNotFoundException, InterruptedException { assertNotNull( defaultDynamicSKSession ); KieCommands cmds = KieServices.Factory.get().getCommands(); List<String> list = new ArrayList<String>(); defaultDynamicSKSession.setGlobal( "list", list ); defaultDynamicSKSession.execute( cmds.newFireAllRules() ); assertEquals( 2, list.size() ); assertTrue( list.get(0).endsWith( "1.0" ) ); assertTrue( list.get(1).endsWith( "1.0" ) ); }
@Test public void tessDefaultClassPathKBase() throws IOException, ClassNotFoundException, InterruptedException { assertNotNull( defaultClassPathSKSession ); KieCommands cmds = KieServices.Factory.get().getCommands(); List<String> list = new ArrayList<String>(); defaultClassPathSKSession.setGlobal( "list", list ); defaultClassPathSKSession.execute( cmds.newFireAllRules() ); assertEquals( 2, list.size() ); assertTrue( list.get(0).endsWith( "2.0" ) ); assertTrue( list.get(1).endsWith( "2.0" ) ); }
@Test public void testDynamicStatelessKieSessionReleaseId() throws IOException, ClassNotFoundException, InterruptedException { assertNotNull( kbase1ksession1v10 ); assertNotNull( kbase1ksession1v10 ); KieCommands cmds = KieServices.Factory.get().getCommands(); List<String> list = new ArrayList<String>(); kbase1ksession1v10.setGlobal( "list", list ); kbase1ksession1v10.execute( cmds.newFireAllRules() ); assertEquals( 2, list.size() ); assertTrue( list.get(0).endsWith( "1.0" ) ); assertTrue( list.get(1).endsWith( "1.0" ) ); list = new ArrayList<String>(); kbase1ksession1v11.setGlobal( "list", list ); kbase1ksession1v11.execute( cmds.newFireAllRules() ); assertEquals( 2, list.size() ); assertTrue( list.get(0).endsWith( "1.1" ) ); assertTrue( list.get(1).endsWith( "1.1" ) ); }
@Test public void testNamedStatelessKieSessions() throws IOException, ClassNotFoundException, InterruptedException { assertNotNull(kbase1ksession1sks1); assertNotNull(kbase1ksession1sks2); assertNotNull(kbase1ksession1sks22); assertNotSame(kbase1ksession1sks1, kbase1ksession1sks2); assertSame( kbase1ksession1sks2, kbase1ksession1sks22); KieCommands cmds = KieServices.Factory.get().getCommands(); List<String> list = new ArrayList<String>(); kbase1ksession1sks1.setGlobal( "list", list ); kbase1ksession1sks1.execute( cmds.newFireAllRules() ); assertEquals( 2, list.size() ); assertTrue( list.get(0).endsWith( "1.0" ) ); assertTrue( list.get(1).endsWith( "1.0" ) ); list = new ArrayList<String>(); kbase1ksession1sks2.setGlobal( "list", list ); kbase1ksession1sks2.execute( cmds.newFireAllRules() ); assertEquals( 2, list.size() ); assertTrue( list.get(0).endsWith( "1.0" ) ); assertTrue( list.get(1).endsWith( "1.0" ) ); }
KieCommands cmds = KieServices.Factory.get().getCommands(); List<Command<?>> batch = new ArrayList<Command<?>>(); Map<String, Object> inouts = getInputOutputMap(inputMessage, operation, runtime);