Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletContext


    }

    @Test
    public void testLookup2() throws Exception {
        ContextAnchor.THREAD_CONTEXT.remove();
        ServletContext servletContext = new MockServletContext();
        servletContext.setAttribute("TestAttr", "AttrValue");
        servletContext.setInitParameter("myapp.logdir", "target");
        servletContext.setAttribute("Name1", "Ben");
        servletContext.setInitParameter("Name2", "Jerry");
        servletContext.setInitParameter("log4jConfiguration", "log4j-webvar.xml");
        Log4jWebLifeCycle initializer = Log4jWebInitializerImpl.getLog4jWebInitializer(servletContext);
        initializer.start();
        initializer.setLoggerContext();
        LoggerContext ctx = ContextAnchor.THREAD_CONTEXT.get();
        assertNotNull("No LoggerContext", ctx);
View Full Code Here


    request.setPathInfo("/fooFlow");
    request.setMethod("POST");
    request.addParameter("prop", "A");
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockRequestContext context = new MockRequestContext();
    context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
    context.setAttribute("method", "bindAndValidate");

    // use a FormAction to do the binding
    FormAction formAction = new FormAction();
    formAction.setFormObjectClass(TestBean.class);
View Full Code Here

    BindBean bindBean = new BindBean();
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = (org.springframework.web.servlet.View) EasyMock
        .createMock(org.springframework.web.servlet.View.class);
View Full Code Here

          HttpServletResponse response) {
        return context;
      }
    };
    flowHandlerAdapter.setFlowExecutor(flowExecutor);
    MockServletContext servletContext = new MockServletContext();
    StaticWebApplicationContext applicationContext = new StaticWebApplicationContext();
    applicationContext.setServletContext(servletContext);
    flowHandlerAdapter.setApplicationContext(applicationContext);
    flowHandlerAdapter.afterPropertiesSet();
View Full Code Here

    context.getFlowScope().put("bar", "baz");
    context.getFlowScope().put("bindBean", new BindBean());
    context.getConversationScope().put("baz", "boop");
    context.getFlashScope().put("boop", "bing");
    context.getMockExternalContext().setCurrentUser("Keith");
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
View Full Code Here

    context.getFlowScope().put("bar", "baz");
    context.getFlowScope().put("bindBean", new BindBean());
    context.getConversationScope().put("baz", "boop");
    context.getFlashScope().put("boop", "bing");
    context.getMockExternalContext().setCurrentUser("Keith");
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
    view.setExpressionParser(DefaultExpressionParserFactory.getExpressionParser());
View Full Code Here

    Object bindBean = new BindBean();
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
View Full Code Here

    assertEquals("2008-01-01", bm.getFieldValue("dateProperty"));
  }

  public void testResumeNoEvent() throws Exception {
    MockRequestContext context = new MockRequestContext();
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
View Full Code Here

  }

  public void testResumeEventNoModelBinding() throws Exception {
    MockRequestContext context = new MockRequestContext();
    context.putRequestParameter("_eventId", "submit");
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
View Full Code Here

    BindBean bindBean = new BindBean();
    StaticExpression modelObject = new StaticExpression(bindBean);
    modelObject.setExpressionString("bindBean");
    context.getCurrentState().getAttributes().put("model", modelObject);
    context.getFlowScope().put("bindBean", bindBean);
    context.getMockExternalContext().setNativeContext(new MockServletContext());
    context.getMockExternalContext().setNativeRequest(new MockHttpServletRequest());
    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.MockServletContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.