public ReteooWorkingMemory(final int id, final InternalRuleBase ruleBase) { this( id, ruleBase, SessionConfiguration.getDefaultInstance(), EnvironmentFactory.newEnvironment()); }
/** * Create a new session into which to read the stream data * * @param context * @param id * @param executor * @return * @throws IOException * @throws ClassNotFoundException */ public static ReteooStatefulSession readSession(MarshallerReaderContext context, int id) throws IOException, ClassNotFoundException { ReteooStatefulSession session = readSession( context, id, EnvironmentFactory.newEnvironment(), SessionConfiguration.getDefaultInstance()); return session; }
@Test public void testTimeMachine() { SessionConfiguration conf = SessionConfiguration.newInstance(); conf.setClockType(ClockType.PSEUDO_CLOCK); WorkingMemory wm = new KnowledgeBaseImpl("x", null).newStatefulSession(conf, null); final Calendar future = Calendar.getInstance(); ((PseudoClockScheduler) wm.getSessionClock()).setStartupTime(future.getTimeInMillis()); final RuleImpl rule = new RuleImpl("myrule"); rule.setEnabled(EnabledBoolean.ENABLED_TRUE); assertTrue(rule.isEffective(null, new RuleTerminalNode(), wm)); future.setTimeInMillis(future.getTimeInMillis() + 100000000); rule.setDateEffective(future); assertFalse(rule.isEffective(null, new RuleTerminalNode(), wm)); ((PseudoClockScheduler) wm.getSessionClock()) .advanceTime(1000000000000L, TimeUnit.MILLISECONDS); assertTrue(rule.isEffective(null, new RuleTerminalNode(), wm)); }
public KieSessionConfiguration newKnowledgeSessionConfiguration(Properties properties) { return SessionConfiguration.newInstance(properties); }
public KieSessionConfiguration newKnowledgeSessionConfiguration() { return SessionConfiguration.newInstance(); }