Package org.jbpm.test.listener
Class TrackingAgendaEventListener
- java.lang.Object
-
- org.kie.api.event.rule.DefaultAgendaEventListener
-
- org.jbpm.test.listener.TrackingAgendaEventListener
-
- All Implemented Interfaces:
EventListener,org.kie.api.event.rule.AgendaEventListener
public class TrackingAgendaEventListener extends org.kie.api.event.rule.DefaultAgendaEventListenerAgendaEventListener to track fired rules. When rule is fired for the first time it's added to fired rules and when the rule fires afterwards the counter is incremented to make it possible to track how many times the rule was fired
-
-
Constructor Summary
Constructors Constructor Description TrackingAgendaEventListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterMatchFired(org.kie.api.event.rule.AfterMatchFiredEvent event)voidclear()Clears all the informationCollection<String>getFiredRules()booleanisRuleFired(String rule)Return true if the rule was fired at least onceintruleFiredCount(String rule)Returns number saying how many times the rule was firedintrulesCount()
-
-
-
Method Detail
-
afterMatchFired
public void afterMatchFired(org.kie.api.event.rule.AfterMatchFiredEvent event)
- Specified by:
afterMatchFiredin interfaceorg.kie.api.event.rule.AgendaEventListener- Overrides:
afterMatchFiredin classorg.kie.api.event.rule.DefaultAgendaEventListener
-
isRuleFired
public boolean isRuleFired(String rule)
Return true if the rule was fired at least once- Parameters:
rule- - name of the rule- Returns:
- true if the rule was fired
-
ruleFiredCount
public int ruleFiredCount(String rule)
Returns number saying how many times the rule was fired- Parameters:
rule- - name ot the rule- Returns:
- number how many times rule was fired, 0 if rule wasn't fired
-
rulesCount
public int rulesCount()
- Returns:
- how many rules were fired
-
clear
public void clear()
Clears all the information
-
getFiredRules
public Collection<String> getFiredRules()
-
-