예제 #1
0
 public ReteooWorkingMemory(final int id, final InternalRuleBase ruleBase) {
   this(
       id,
       ruleBase,
       SessionConfiguration.getDefaultInstance(),
       EnvironmentFactory.newEnvironment());
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
파일: RuleTest.java 프로젝트: mok89/drools
  @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));
  }
예제 #4
0
 public KieSessionConfiguration newKnowledgeSessionConfiguration(Properties properties) {
   return SessionConfiguration.newInstance(properties);
 }
예제 #5
0
 public KieSessionConfiguration newKnowledgeSessionConfiguration() {
   return SessionConfiguration.newInstance();
 }