/**
* Test createRuleSession.
*/
@Test
public void testCreateRuleStatelessRuleSession() throws Exception {
final RuleRuntime ruleRuntime = this.ruleServiceProvider.getRuleRuntime();
assertNotNull( "cannot obtain RuleRuntime",
ruleRuntime );
// expect RuleExecutionSetNotFoundException
try {
ruleRuntime.createRuleSession( "someUri",
null,
RuleRuntime.STATELESS_SESSION_TYPE );
fail( "RuleExecutionSetNotFoundException expected" );
} catch ( final RuleExecutionSetNotFoundException ex ) {
// ignore exception
}
// read rules and register with administrator
final Reader ruleReader = new InputStreamReader( RuleRuntimeTest.class.getResourceAsStream( this.RULES_RESOURCE ) );
final RuleExecutionSet ruleSet = this.ruleSetProvider.createRuleExecutionSet( ruleReader,
null );
this.ruleAdministrator.registerRuleExecutionSet( this.RULES_RESOURCE,
ruleSet,
null );
final StatelessRuleSession statelessRuleSession = (StatelessRuleSession) ruleRuntime.createRuleSession( this.RULES_RESOURCE,
null,
RuleRuntime.STATELESS_SESSION_TYPE );
assertNotNull( "cannot obtain StatelessRuleSession",
statelessRuleSession );