Map<String, ResultConfig> results = new HashMap<String, ResultConfig>();
Map<String, String> successParams = new HashMap<String, String>();
successParams.put("actionName", "bar");
results.put("success", new ResultConfig.Builder("success", ActionChainResult.class.getName()).addParams(successParams).build());
ActionConfig fooActionConfig = new ActionConfig.Builder("defaultPackage", FOO_ACTION_NAME, SimpleAction.class.getName())
.addResultConfig(new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build())
.build();
defaultPackageContext.addActionConfig(FOO_ACTION_NAME, fooActionConfig);
results = new HashMap<String, ResultConfig>();
successParams = new HashMap<String, String>();
successParams.put("actionName", "bar");
results.put("success", new ResultConfig.Builder("success", ActionChainResult.class.getName()).addParams(successParams).build());
List<InterceptorMapping> interceptors = new ArrayList<InterceptorMapping>();
interceptors.add(new InterceptorMapping("params", new ParametersInterceptor()));
ActionConfig paramInterceptorActionConfig = new ActionConfig.Builder("defaultPackage", PARAM_INTERCEPTOR_ACTION_NAME, SimpleAction.class.getName())
.addResultConfig(new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build())
.addInterceptors(interceptors)
.build();
defaultPackageContext.addActionConfig(PARAM_INTERCEPTOR_ACTION_NAME, paramInterceptorActionConfig);
interceptors = new ArrayList<InterceptorMapping>();
interceptors.add(new InterceptorMapping("model",
objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ModelDrivenInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
interceptors.add(new InterceptorMapping("params",
objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ParametersInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
ActionConfig modelParamActionConfig = new ActionConfig.Builder("defaultPackage", MODEL_DRIVEN_PARAM_TEST, ModelDrivenAction.class.getName())
.addInterceptors(interceptors)
.addResultConfig(new ResultConfig.Builder(Action.SUCCESS, MockResult.class.getName()).build())
.build();
defaultPackageContext.addActionConfig(MODEL_DRIVEN_PARAM_TEST, modelParamActionConfig);
//List paramFilterInterceptor=new ArrayList();
//paramFilterInterceptor.add(new ParameterFilterInterC)
//ActionConfig modelParamFilterActionConfig = new ActionConfig(null, ModelDrivenAction.class, null, null, interceptors);
results = new HashMap<String, ResultConfig>();
successParams = new HashMap<String, String>();
successParams.put("actionName", "bar");
results.put("success", new ResultConfig.Builder("success", ActionChainResult.class.getName()).addParams(successParams).build());
results.put(Action.ERROR, new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build());
interceptors = new ArrayList<InterceptorMapping>();
interceptors.add(new InterceptorMapping("staticParams",
objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", StaticParametersInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
interceptors.add(new InterceptorMapping("model",
objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ModelDrivenInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
interceptors.add(new InterceptorMapping("params",
objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ParametersInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
interceptors.add(new InterceptorMapping("validation",
objectFactory.buildInterceptor(new InterceptorConfig.Builder("model", ValidationInterceptor.class.getName()).build(), EMPTY_STRING_MAP)));
//Explicitly set an out-of-range date for DateRangeValidatorTest
params = new HashMap<String, String>();
ActionConfig validationActionConfig = new ActionConfig.Builder("defaultPackage", VALIDATION_ACTION_NAME, SimpleAction.class.getName())
.addInterceptors(interceptors)
.addParams(params)
.addResultConfigs(results)
.build();
defaultPackageContext.addActionConfig(VALIDATION_ACTION_NAME, validationActionConfig);
defaultPackageContext.addActionConfig(VALIDATION_ALIAS_NAME,
new ActionConfig.Builder(validationActionConfig).name(VALIDATION_ALIAS_NAME).build());
defaultPackageContext.addActionConfig(VALIDATION_SUBPROPERTY_NAME,
new ActionConfig.Builder(validationActionConfig).name(VALIDATION_SUBPROPERTY_NAME).build());
params = new HashMap<String, String>();
ActionConfig percentageActionConfig = new ActionConfig.Builder("defaultPackage", "percentage", SimpleAction.class.getName())
.addParams(params)
.addResultConfigs(results)
.addInterceptors(interceptors)
.build();
defaultPackageContext.addActionConfig(percentageActionConfig.getName(), percentageActionConfig);
// We need this actionconfig to be the final destination for action chaining
ActionConfig barActionConfig = new ActionConfig.Builder("defaultPackage", "bar", SimpleAction.class.getName())
.addResultConfig(new ResultConfig.Builder(Action.ERROR, MockResult.class.getName()).build())
.build();
defaultPackageContext.addActionConfig(barActionConfig.getName(), barActionConfig);
ActionConfig expressionValidationActionConfig = new ActionConfig.Builder("defaultPackage", EXPRESSION_VALIDATION_ACTION, SimpleAction.class.getName())
.addInterceptors(interceptors)
.addResultConfigs(results)
.build();
defaultPackageContext.addActionConfig(EXPRESSION_VALIDATION_ACTION, expressionValidationActionConfig);