@Test public void testClockTypeConfiguration() { // setting the option using the type safe method config.setOption( ClockTypeOption.get("pseudo") ); // checking the type safe getOption() method assertEquals( ClockTypeOption.get("pseudo"), config.getOption( ClockTypeOption.class ) ); // checking the string based getProperty() method assertEquals( "pseudo", config.getProperty( ClockTypeOption.PROPERTY_NAME ) ); // setting the options using the string based setProperty() method config.setProperty( ClockTypeOption.PROPERTY_NAME, "realtime" ); // checking the type safe getOption() method assertEquals( ClockTypeOption.get("realtime"), config.getOption( ClockTypeOption.class ) ); // checking the string based getProperty() method assertEquals( "realtime", config.getProperty( ClockTypeOption.PROPERTY_NAME ) ); }
@Test public void testBeliefSystemType() { config.setOption( BeliefSystemTypeOption.get( BeliefSystemType.JTMS.toString() ) ); assertEquals( BeliefSystemTypeOption.get( BeliefSystemType.JTMS.toString() ), config.getOption( BeliefSystemTypeOption.class ) ); // checking the string based getProperty() method assertEquals( BeliefSystemType.JTMS.getId(), config.getProperty( BeliefSystemTypeOption.PROPERTY_NAME ) ); // setting the options using the string based setProperty() method config.setProperty( BeliefSystemTypeOption.PROPERTY_NAME, BeliefSystemType.DEFEASIBLE.getId() ); // checking the type safe getOption() method assertEquals( BeliefSystemTypeOption.get( BeliefSystemType.DEFEASIBLE.getId() ), config.getOption( BeliefSystemTypeOption.class ) ); // checking the string based getProperty() method assertEquals( BeliefSystemType.DEFEASIBLE.getId(), config.getProperty( BeliefSystemTypeOption.PROPERTY_NAME ) ); }
public <T extends SingleValueKnowledgeSessionOption> T getOption(Class<T> option) { return (T)adaptOption(delegate.getOption(adaptSingleValueSessionOption(option))); }
public <T extends MultiValueKnowledgeSessionOption> T getOption(Class<T> option, String key) { return (T)adaptOption(delegate.getOption(adaptMultiValueSessionOption(option), key)); }
@Test public void testStatefulRealTimeClockKieSession() throws Exception { KieSession ksession = context.getBean("statefulSessionRealTime", KieSession.class); assertNotNull(ksession); assertEquals("Session has configured different clock type", ClockTypeOption.get("realtime"), ksession.getSessionConfiguration().getOption(ClockTypeOption.class)); assertTrue(String.format("Session clock not an instance of '~s', but: '~s'.", JDKTimerService.class.getSimpleName(), ksession.getSessionClock().getClass().getSimpleName()), ksession.getSessionClock() instanceof JDKTimerService); }
@Test public void testStatefulRealTimeClockKieSession() throws Exception { KieSession ksession = context.getBean("statefulSessionRealTime", KieSession.class); assertNotNull(ksession); assertEquals("Session has configured different clock type", ClockTypeOption.get("realtime"), ksession.getSessionConfiguration().getOption(ClockTypeOption.class)); assertTrue(String.format("Session clock not an instance of '~s', but: '~s'.", JDKTimerService.class.getSimpleName(), ksession.getSessionClock().getClass().getSimpleName()), ksession.getSessionClock() instanceof JDKTimerService); }
@Test public void testStatefulPseudoClockKieSession() throws Exception { KieSession ksession = context.getBean("statefulSessionPseudo", KieSession.class); assertNotNull(ksession); assertEquals("Session has configured different clock type", ClockTypeOption.get("pseudo"), ksession.getSessionConfiguration().getOption(ClockTypeOption.class)); assertTrue(String.format("Session clock not an instance of '~s', but '~s'.", SessionPseudoClock.class.getSimpleName(), ksession.getSessionClock().getClass().getSimpleName()), ksession.getSessionClock() instanceof SessionPseudoClock); }
@Test public void testStatefulPseudoClockKieSession() throws Exception { KieSession ksession = context.getBean("statefulSessionPseudo", KieSession.class); assertNotNull(ksession); assertEquals("Session has configured different clock type", ClockTypeOption.get("pseudo"), ksession.getSessionConfiguration().getOption(ClockTypeOption.class)); assertTrue(String.format("Session clock not an instance of '~s', but '~s'.", SessionPseudoClock.class.getSimpleName(), ksession.getSessionClock().getClass().getSimpleName()), ksession.getSessionClock() instanceof SessionPseudoClock); }