@Override
public void doExecute(TestContext context) {
log.info("Executing template '" + getName() + "' with " + actions.size() + " embedded actions");
TestContext innerContext;
//decide wheather to use global test context or not
if (globalContext) {
innerContext = context;
} else {
innerContext = new TestContext();
innerContext.setFunctionRegistry(context.getFunctionRegistry());
GlobalVariables globalVariables = new GlobalVariables();
globalVariables.getVariables().putAll(context.getGlobalVariables());
innerContext.setGlobalVariables(globalVariables);
innerContext.getVariables().putAll(context.getVariables());
innerContext.setMessageValidatorRegistry(context.getMessageValidatorRegistry());
innerContext.setValidationMatcherRegistry(context.getValidationMatcherRegistry());
innerContext.setTestListeners(context.getTestListeners());
innerContext.setMessageConstructionInterceptors(context.getMessageConstructionInterceptors());
innerContext.setEndpointFactory(context.getEndpointFactory());
innerContext.setNamespaceContextBuilder(context.getNamespaceContextBuilder());
innerContext.setApplicationContext(context.getApplicationContext());
}
for (Entry<String, String> entry : parameter.entrySet()) {
String param = entry.getKey();
String paramValue = entry.getValue();
paramValue = VariableUtils.replaceVariablesInString(paramValue, innerContext, false);
if (context.getFunctionRegistry().isFunction(paramValue)) {
paramValue = FunctionUtils.resolveFunction(paramValue, context);
}
log.info("Setting parameter for template " + param + "=" + paramValue);
innerContext.setVariable(param, paramValue);
}
for (TestAction action: actions) {
action.execute(innerContext);
}