@Test public void noMatch1() throws RuleDefinitionException, SessionException { RuleDefinition ruleC = Rules.define(RuleC.class); when(outputStorage.findLatestResultsByTagType(Matchers.<Set<String>> anyObject())).thenReturn(Collections.singleton(Rules.triggerRuleOutput("input"))); Collection<RuleInput> ruleInputs = session.collectInputs(ruleC, outputStorage); assertThat(ruleInputs, empty()); }
/** * Executes the Session. Invocation is exclusively possible if {@link Session} is in ACTIVATED * state, any other state forces a {@link SessionException}. Processing is enabled inserting a * initial RuleOutput to the {@link IRuleOutputStorage} which will act as input to further * rules. If processing completes without errors the {@link Session} enters PROCESSED state. In * any case of error it enters FAILURE state. * * @throws Exception * If Session lifecycle is in an invalid state. * @return The diagnosis result. */ @Override public R call() throws Exception { // Processes and collect results. // If a Session is used as Callable this call might horribly fail if sessions are not // retrieved from SessionPool and a sessions lifeCycle is neglected. But we have not chance // to activate a // session internally due to missing input information. So simply fail switch (state) { case ACTIVATED: sessionContext.getStorage().store(Rules.triggerRuleOutput(sessionContext.getInput())); doProcess(); state = State.PROCESSED; break; default: throw new SessionException("Session can not enter process stated from: " + state + " state. Ensure that Session is in ACTIVATED state before processing."); } return resultCollector.collect(sessionContext); }