protected void setUp() throws Exception {
    super.setUp();
    param = new HashMap<>();

    interceptor = new MultiselectInterceptor();
    ai = new MockActionInvocation();
    ai.setInvocationContext(ActionContext.getContext());
    ActionContext.getContext().setParameters(HttpParameters.create(param).build());
  }
  protected void setUp() throws Exception {
    super.setUp();

    stringWriter = new StringWriter();
    writer = new PrintWriter(stringWriter);
    response = new StrutsMockHttpServletResponse();
    response.setWriter(writer);
    servletContext = new StrutsMockServletContext();
    stack = ActionContext.getContext().getValueStack();
    context = new ActionContext(stack.getContext());
    context.put(StrutsStatics.HTTP_RESPONSE, response);
    context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
    invocation = new MockActionInvocation();
    invocation.setStack(stack);
    invocation.setInvocationContext(context);
  }
示例#3
0
  public void setUp() throws Exception {
    interceptor = new I18nInterceptor();
    interceptor.init();
    session = new HashMap();

    Map<String, Object> ctx = new HashMap<String, Object>();
    ctx.put(ActionContext.PARAMETERS, HttpParameters.createEmpty().build());
    ctx.put(ActionContext.SESSION, session);

    ac = new ActionContext(ctx);

    ServletActionContext.setContext(ac);
    ServletActionContext.setRequest(new MockHttpServletRequest());

    Action action =
        new Action() {
          public String execute() throws Exception {
            return SUCCESS;
          }
        };
    mai = new MockActionInvocation();
    ((MockActionInvocation) mai).setAction(action);
    ((MockActionInvocation) mai).setInvocationContext(ac);
  }