Class DefaultRuleEngineTestSupportService
java.lang.Object
de.hybris.platform.ruleengine.test.impl.DefaultRuleEngineTestSupportService
- All Implemented Interfaces:
RuleEngineTestSupportService
public class DefaultRuleEngineTestSupportService
extends Object
implements RuleEngineTestSupportService
Default implementation (drools engine) of RuleEngineTestSupportService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassociateRulesModule(AbstractRulesModuleModel module, Set<? extends AbstractRuleEngineRuleModel> rules) associate the rules to a moduleassociateRulesToNewModule(String moduleName, Set<? extends AbstractRuleEngineRuleModel> rules) create the rule module and associate the rules to itfactory method declaration to create new instance of AbstractRuleEngineRuleModeldecorateRuleForTest(Map<String, String> params) Returns a Customer, adding additional functionality to AbstractRuleEngineRuleModel, based on parameters mapprotected ModelServicegetTestModuleName(AbstractRuleEngineRuleModel ruleModel) Returns the name of the module, associated to the rulegetTestRulesModule(AbstractRuleEngineContextModel abstractContext, Set<AbstractRuleEngineRuleModel> rules) Creates the concrete subclass of AbstractRulesModuleModel, based on rule engine implementationReturns a module, associated to a ruleprotected voidsetGlobals(AbstractRuleEngineRuleModel ruleModel, Map<String, String> globals) voidsetModelService(ModelService modelService)
-
Constructor Details
-
DefaultRuleEngineTestSupportService
public DefaultRuleEngineTestSupportService()
-
-
Method Details
-
createRuleModel
Description copied from interface:RuleEngineTestSupportServicefactory method declaration to create new instance of AbstractRuleEngineRuleModel- Specified by:
createRuleModelin interfaceRuleEngineTestSupportService- Returns:
- instance of AbstractRuleEngineRuleModel subclass
-
associateRulesToNewModule
public AbstractRulesModuleModel associateRulesToNewModule(String moduleName, Set<? extends AbstractRuleEngineRuleModel> rules) Description copied from interface:RuleEngineTestSupportServicecreate the rule module and associate the rules to it- Specified by:
associateRulesToNewModulein interfaceRuleEngineTestSupportService- Parameters:
moduleName- - name of the module (or the related knowledge base)rules- - set of rules to associate the module with- Returns:
- instance of AbstractRulesModuleModel subclass
-
associateRulesModule
public void associateRulesModule(AbstractRulesModuleModel module, Set<? extends AbstractRuleEngineRuleModel> rules) Description copied from interface:RuleEngineTestSupportServiceassociate the rules to a module- Specified by:
associateRulesModulein interfaceRuleEngineTestSupportService- Parameters:
module- - rule modulerules- - set of rules to associate the module with
-
getTestRulesModule
public AbstractRulesModuleModel getTestRulesModule(AbstractRuleEngineContextModel abstractContext, Set<AbstractRuleEngineRuleModel> rules) Description copied from interface:RuleEngineTestSupportServiceCreates the concrete subclass of AbstractRulesModuleModel, based on rule engine implementation- Specified by:
getTestRulesModulein interfaceRuleEngineTestSupportService- Parameters:
abstractContext- instance of AbstractRuleEngineContextModelrules- - a set of AbstractRuleEngineRuleModel instances- Returns:
- instance of AbstractRulesModuleModel subclass (based on rule engine implementation)
-
resolveAssociatedRuleModule
public Optional<AbstractRulesModuleModel> resolveAssociatedRuleModule(AbstractRuleEngineRuleModel ruleModel) Description copied from interface:RuleEngineTestSupportServiceReturns a module, associated to a rule- Specified by:
resolveAssociatedRuleModulein interfaceRuleEngineTestSupportService- Parameters:
ruleModel- an instance of the AbstractRuleEngineRuleModel subclass- Returns:
- Optional instance of AbstractRulesModuleModel
-
decorateRuleForTest
Description copied from interface:RuleEngineTestSupportServiceReturns a Customer, adding additional functionality to AbstractRuleEngineRuleModel, based on parameters map- Specified by:
decorateRuleForTestin interfaceRuleEngineTestSupportService- Parameters:
params- Map of strings to strings, parametrizing additional functionality (e.g. global values in case of Drools implementation)- Returns:
- an instance of Customer for AbstractRuleEngineRuleModel
-
getTestModuleName
Description copied from interface:RuleEngineTestSupportServiceReturns the name of the module, associated to the rule- Specified by:
getTestModuleNamein interfaceRuleEngineTestSupportService- Parameters:
ruleModel- an instance of AbstractRuleEngineRuleModel or it's subclass- Returns:
- name of the associated module, if applicable. Null otherwise
-
setGlobals
-
getModelService
-
setModelService
-