Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockHttpSession


    }

    @Test
    public void showForm() throws Exception {
        controller.setServletContext(new MockServletContext());
        assertEquals("No jsp in WEB-INF", "crud/template", controller.showForm("stubs.TrivialDomainEntity", null, null, new ModelMap(), new MockHttpSession()));
        controller.setServletContext(new MockServletContext("web", new FileSystemResourceLoader()));
        assertEquals("JSP in WEB-INF", "crud/demoapp/domain/book", controller.showForm("demoapp.domain.Book", null, null, new ModelMap(), new MockHttpSession()));
    }
View Full Code Here


    super(arg0);
  }

  public void testReproceCompilerFreakout() throws Exception {
    UserActivityLoggerImpl ual = new UserActivityLoggerImpl();
    HttpSession session = new MockHttpSession();
    UserSession userSession = UserSession.getUserSession(session);
   
    assertTrue("isactivated", DBModule.isActivated());
   
    User user = UserManager.getInstance().createAndPersistUser("foo","bar","foo@bar.goo");
View Full Code Here

  public void setUp() throws Exception {
    service = new StandardSerializingAuditFilterService();
    child = new MockEventfulBaseService();
    service.setChildService(child);
   
    httpSession = new MockHttpSession();
   
    Map map = new HashMap();
    map.put(HttpSession.class, httpSession);
   
    MockLifeCycle.begin(service, new StandardEnvironment(null, map));
View Full Code Here

  @Before
  public void createMainGenerator() {
    fr = new Locale("fr", "FR");
    en = new Locale("en", "US");
   
    session = new MockHttpSession();
    Config.set(session, Config.FMT_LOCALE, fr);
   
    request = new MockHttpServletRequest();
    request.setSession(session);
    Config.set(request, Config.FMT_LOCALE, en);
View Full Code Here

    this.interceptor = getInterceptor();
  }

  public void testPreHandleWithSessionStorageEnabled() throws Exception {
    // setup mock session
    MockHttpSession session = new MockHttpSession();
    session.setAttribute(AbstractWorkflowContextHandlerInterceptor.SESSION_KEY_INSTANCE_ID, MOCK_INSTANCE_ID);
    this.request.setSession(session);

    this.interceptor.preHandle(this.request, new MockHttpServletResponse(), null);

    assertEquals("Caller not set", MOCK_CALLER, this.context.getCaller());
View Full Code Here

  }

  public void testPostHandleWithSessionStorageEnabled() throws Exception {
    this.context.setInstanceId(MOCK_INSTANCE_ID.longValue());

    MockHttpSession session = new MockHttpSession();
    this.request.setSession(session);

    this.interceptor.postHandle(this.request, new MockHttpServletResponse(), null, null);

    assertEquals(session.getAttribute(AbstractWorkflowContextHandlerInterceptor.SESSION_KEY_INSTANCE_ID), MOCK_INSTANCE_ID);
  }
View Full Code Here

  }

  public void testPostHandleWithSessionStorageDisabled() throws Exception {
    this.context.setInstanceId(MOCK_INSTANCE_ID.longValue());

    MockHttpSession session = new MockHttpSession();
    this.request.setSession(session);

    this.interceptor.setSessionStorageEnabled(false);
    this.interceptor.postHandle(this.request, new MockHttpServletResponse(), null, null);

    assertNull(session.getAttribute(AbstractWorkflowContextHandlerInterceptor.SESSION_KEY_INSTANCE_ID));
  }
View Full Code Here

    private List<SSOSiteCredentials> ssoSiteCredsOfSubject;
   
    @Override
    public void setUp()
    {
        session = new MockHttpSession();
       
        ssoSiteCredsOfSubject = new ArrayList<SSOSiteCredentials>();
       
        DefaultSSOSiteCredentials siteCreds = new DefaultSSOSiteCredentials("http://www.localhost.com", "www.localhost.com");
        siteCreds.setUsername("admin");
View Full Code Here

        springContext.setServletContext(servletContext);
        springContext.refresh();
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, springContext);
       
        MockHttpServletRequest httpRequest = new MockHttpServletRequest(servletContext, "POST", "/ajax/submit.action");
        MockHttpSession session = new MockHttpSession(servletContext);
        httpRequest.setSession(session);
        httpRequest.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, springContext);
        httpRequest.setParameter(ajaxInterceptor.getAjaxParameter(), ajaxInterceptor.AJAX_SUBMIT_REQUEST);       
        httpRequest.setParameter(ajaxInterceptor.getEventParameter(), "submit");
       
View Full Code Here

        springContext.setServletContext(servletContext);
        springContext.refresh();
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, springContext);
       
        MockHttpServletRequest httpRequest = new MockHttpServletRequest(servletContext, "POST", "/ajax/submit.action");
        MockHttpSession session = new MockHttpSession(servletContext);
        httpRequest.setSession(session);
        httpRequest.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, springContext);
        httpRequest.setParameter(ajaxInterceptor.getAjaxParameter(), ajaxInterceptor.AJAX_SUBMIT_REQUEST);       
        httpRequest.setParameter(ajaxInterceptor.getEventParameter(), "validate");
       
View Full Code Here

TOP

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

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.