public class BETestEngine
extends java.lang.Object
Constructor and Description |
---|
BETestEngine(java.lang.String propertyFile)
Creates a new
BETestEngine and sets the engine
properties based on the propertyFile provide. |
BETestEngine(java.lang.String ear,
java.lang.String tra,
java.lang.String cdd,
java.lang.String pu,
java.lang.String agent)
Creates a new
BETestEngine and sets the engine properties
based on the parameters provided |
BETestEngine(java.lang.String ear,
java.lang.String tra,
java.lang.String cdd,
java.lang.String pu,
java.lang.String agent,
boolean apiMode)
Creates a new
BETestEngine and sets the engine properties
based on the parameters provided |
Modifier and Type | Method and Description |
---|---|
void |
assertConcept(Concept c,
boolean executeRules)
Asserts a new concept into the current run's working memory
|
void |
assertConcepts(java.util.List concepts,
boolean executeRules)
Asserts all concepts into the current run's working memory
|
void |
assertEvent(SimpleEvent event,
boolean executeRules)
Asserts a new event into the current run's working memory
|
void |
assertEvent(SimpleEvent event,
boolean executeRules,
java.lang.String preprocessorUri)
Asserts a new event into the current run's working memory
|
void |
assertEvents(java.util.List events,
boolean executeRules)
Asserts all events into the current run's working memory
|
void |
assertScorecard(Concept sc,
boolean executeRules)
Asserts a new scorecard into the current run's working memory
|
void |
assertScorecards(java.util.List scorecards,
boolean executeRules)
Asserts Scorecard into the current run's working memory
|
void |
clearWorkingMemory()
Clear the working memory for the current tester rule session.
|
void |
executeRules()
Execute the rules in the current rule session.
|
java.lang.Object |
invokeCatalogFunction(java.lang.String functionFQName,
java.lang.Object[] args)
Invoke a catalog function on the current tester
RuleSession . |
java.lang.Object |
invokeDecisionTable(java.lang.String vrfURI,
java.lang.Object[] args)
Invoke the default Decision Table for the virtual rule function on the current tester
RuleSession . |
java.lang.Object |
invokeDecisionTable(java.lang.String vrfURI,
java.lang.String tableURI,
java.lang.Object[] args)
Invoke a specific Decision Table on the current tester
RuleSession . |
java.lang.Object |
invokeRuleFunction(java.lang.String funcNameUri,
java.lang.Object[] args)
Invoke a RuleFunction on the current tester
RuleSession . |
java.lang.Object |
invokeRuleFunctionInSession(java.lang.String funcNameUri,
java.lang.Object[] args)
Force the invocation of a RuleFunction in the current tester
RuleSession . |
void |
resetSession()
Reset the current tester rule session to a start state.
|
void |
resetSession(boolean resetTester)
Reset the current tester rule session to a start state.
|
void |
shutdown()
Shut down the test engine and the current rule session
|
void |
start()
Create a new
RuleServiceProvider and start the rule session specified by the agent constructor parameter |
public BETestEngine(java.lang.String propertyFile)
BETestEngine
and sets the engine
properties based on the propertyFile provide. These properties
include:propertyFile
- java.io.IOException
public BETestEngine(java.lang.String ear, java.lang.String tra, java.lang.String cdd, java.lang.String pu, java.lang.String agent)
BETestEngine
and sets the engine properties
based on the parameters providedear
- - the path to the project ear being testedtra
- (optional) - the .tra file used to configure the enginecdd
- - the path to the .cdd file being used. This may be absolute or relative to the project earpu
- - the processing unit IDagent
- (optional) - the agent name or agent key. If unspecified, the first agent found in the cluster configuration will be usedjava.lang.Exception
public BETestEngine(java.lang.String ear, java.lang.String tra, java.lang.String cdd, java.lang.String pu, java.lang.String agent, boolean apiMode)
BETestEngine
and sets the engine properties
based on the parameters providedear
- - the path to the project ear being testedtra
- (optional) - the .tra file used to configure the enginecdd
- - the path to the .cdd file being used. This may be absolute or relative to the project earpu
- - the processing unit IDagent
- (optional) - the agent name or agent key. If unspecified, the first agent found in the cluster configuration will be usedapiMode
- - whether to run the test engine in API mode. In API mode, the channels in the project will not be started,
and certain catalog functions will not be available. In many cases, this is the desired behavior while running unit tests, to
prevent external side-effects. If set to false, the mode of the test engine will be determined by the specified CDD file.java.lang.Exception
RuleServiceProvider.MODE_API}
public void assertConcept(Concept c, boolean executeRules) throws DuplicateExtIdException
c
- - the Concept to insertexecuteRules
- - if true, asserting the Concept will execute any related rulesDuplicateExtIdException
- - if the external ID of the object to assert already exists in the session.public void assertScorecard(Concept sc, boolean executeRules) throws DuplicateExtIdException
sc-
- the Scorecard to insertexecuteRules
- - if true, asserting the Concept will execute any related rulesDuplicateExtIdException
public void assertConcepts(java.util.List concepts, boolean executeRules)
concepts
- - a List of the Concepts to insertexecuteRules
- - if true, asserting the Concepts will execute any related rulespublic void assertScorecards(java.util.List scorecards, boolean executeRules)
scorecards
- - a List of the scorecards to insertexecuteRules
- - if true, asserting the Concepts will execute any related rulespublic void assertEvent(SimpleEvent event, boolean executeRules, java.lang.String preprocessorUri) throws DuplicateExtIdException
event
- - the Event to insertexecuteRules
- - if true, asserting the Event will execute any related rulespreprocessorUri
- - if specified, the Rule Function will be called with the event
to simulate a preprocessor.
The specified preprocessorUri's arguments must match the SimpleEvent typeDuplicateExtIdException
- - if the external ID of the object to assert already exists in the session.public void assertEvent(SimpleEvent event, boolean executeRules) throws DuplicateExtIdException
event
- - the Event to insertexecuteRules
- - if true, asserting the Event will execute any related rulesDuplicateExtIdException
- - if the external ID of the object to assert already exists in the session.public void assertEvents(java.util.List events, boolean executeRules)
events
- - a List of the Events to insertexecuteRules
- - if true, asserting the Events will execute any related rulespublic void clearWorkingMemory()
public void executeRules()
Expecter
can then be used to inspect the resultspublic java.lang.Object invokeCatalogFunction(java.lang.String functionFQName, java.lang.Object[] args)
RuleSession
.functionFQName
- the fully qualified Catalog function name to be invoked i.e. "System.debugOut"args
- a variable argument specifying the input argumentspublic java.lang.Object invokeRuleFunction(java.lang.String funcNameUri, java.lang.Object[] args)
RuleSession
.functionURI
- the URI of the RuleFunction to be invokedargs
- an Object array specifies the input argumentspublic java.lang.Object invokeRuleFunctionInSession(java.lang.String funcNameUri, java.lang.Object[] args)
RuleSession
.
Generally executing a Rule Function inside of a RuleSession is disallowed due to the
side-effects that can occur. This method forces the Rule Function to be invoked, which
can be useful to test specific business logic in the unit test.functionURI
- the URI of the RuleFunction to be invokedargs
- an Object array specifies the input argumentspublic java.lang.Object invokeDecisionTable(java.lang.String vrfURI, java.lang.String tableURI, java.lang.Object[] args)
RuleSession
.vrfURI
- the URI of the virtual rule functiontableURI
- the URI of the Decision Table to be invokedargs
- an Object array specifies the input argumentspublic java.lang.Object invokeDecisionTable(java.lang.String vrfURI, java.lang.Object[] args)
RuleSession
.vrfURI
- the URI of the virtual rule functionargs
- an Object array specifies the input argumentspublic void resetSession(boolean resetTester)
resetTester
- if set to 'true', the reset will also clear the following tracked information:java.lang.Exception
public void resetSession()
java.lang.Exception
public void shutdown()
public void start()
RuleServiceProvider
and start the rule session specified by the agent constructor parameter