Search in sources :

Example 1 with SimpleTheme

use of org.apache.struts2.views.java.simple.SimpleTheme in project struts by apache.

the class AbstractTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    scriptingAttrs.put("onclick", "onclick_");
    scriptingAttrs.put("ondblclick", "ondblclick_");
    scriptingAttrs.put("onmousedown", "onmousedown_");
    scriptingAttrs.put("onmouseup", "onmouseup_");
    scriptingAttrs.put("onmouseover", "onmouseover_");
    scriptingAttrs.put("onmousemove", "onmousemove_");
    scriptingAttrs.put("onmouseout", "onmouseout_");
    scriptingAttrs.put("onfocus", "onfocus_");
    scriptingAttrs.put("onblur", "onblur_");
    scriptingAttrs.put("onkeypress", "onkeypress_");
    scriptingAttrs.put("onkeydown", "onkeydown_");
    scriptingAttrs.put("onkeyup", "onkeyup_");
    scriptingAttrs.put("onselect", "onselect_");
    scriptingAttrs.put("onchange", "onchange_");
    commonAttrs.put("accesskey", "accesskey_");
    dynamicAttrs.put("data-remote", "data-remote_");
    dynamicAttrs.put("data-label", "data-label_");
    theme = new SimpleTheme();
    writer = new StringWriter();
    map = new HashMap<>();
    template = createMock(Template.class);
    stack = createNiceMock(ValueStack.class);
    setUpStack();
    stackContext = new HashMap<>();
    context = new TemplateRenderingContext(template, writer, stack, map, null);
    stackContext.put(Component.COMPONENT_STACK, new Stack<>());
    ActionContext actionContext = ActionContext.of(stackContext).bind();
    request = createNiceMock(HttpServletRequest.class);
    expect(request.getContextPath()).andReturn("/some/path").anyTimes();
    response = createNiceMock(HttpServletResponse.class);
    expect(stack.getActionContext()).andReturn(actionContext).anyTimes();
    expect(stack.getContext()).andReturn(stackContext).anyTimes();
    Container container = createNiceMock(Container.class);
    XWorkConverter converter = new ConverterEx();
    expect(container.getInstance(XWorkConverter.class)).andReturn(converter).anyTimes();
    TextParser parser = new OgnlTextParser();
    expect(container.getInstance(TextParser.class)).andReturn(parser).anyTimes();
    replay(request);
    replay(stack);
    replay(container);
    actionContext.withContainer(container).withServletRequest(request);
}
Also used : OgnlTextParser(com.opensymphony.xwork2.util.OgnlTextParser) ValueStack(com.opensymphony.xwork2.util.ValueStack) TextParser(com.opensymphony.xwork2.util.TextParser) OgnlTextParser(com.opensymphony.xwork2.util.OgnlTextParser) HttpServletResponse(javax.servlet.http.HttpServletResponse) ActionContext(com.opensymphony.xwork2.ActionContext) Template(org.apache.struts2.components.template.Template) HttpServletRequest(javax.servlet.http.HttpServletRequest) Container(com.opensymphony.xwork2.inject.Container) StringWriter(java.io.StringWriter) XWorkConverter(com.opensymphony.xwork2.conversion.impl.XWorkConverter) TemplateRenderingContext(org.apache.struts2.components.template.TemplateRenderingContext)

Aggregations

ActionContext (com.opensymphony.xwork2.ActionContext)1 XWorkConverter (com.opensymphony.xwork2.conversion.impl.XWorkConverter)1 Container (com.opensymphony.xwork2.inject.Container)1 OgnlTextParser (com.opensymphony.xwork2.util.OgnlTextParser)1 TextParser (com.opensymphony.xwork2.util.TextParser)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1 StringWriter (java.io.StringWriter)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 Template (org.apache.struts2.components.template.Template)1 TemplateRenderingContext (org.apache.struts2.components.template.TemplateRenderingContext)1