Examples of MockRequestContext


Examples of org.springframework.webflow.test.MockRequestContext

    listener.sessionCreating(context, flow);
  }

  public void testStateEnteringNoSecurity() {
    SecurityFlowExecutionListener listener = new SecurityFlowExecutionListener();
    RequestContext context = new MockRequestContext();
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory());
    listener.stateEntering(context, state);
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    listener.stateEntering(context, state);
  }

  public void testStateEnteringWithSecurity() {
    SecurityFlowExecutionListener listener = new SecurityFlowExecutionListener();
    RequestContext context = new MockRequestContext();
    Flow flow = new Flow("flow");
    ViewState state = new ViewState(flow, "view", new StubViewFactory());
    SecurityRule rule = getSecurityRuleAllAuthorized();
    ((LocalAttributeMap) state.getAttributes()).put(SecurityRule.SECURITY_ATTRIBUTE_NAME, rule);
    configureSecurityContext();
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    listener.stateEntering(context, state);
  }

  public void testTransitionExecutingNoSecurity() {
    SecurityFlowExecutionListener listener = new SecurityFlowExecutionListener();
    RequestContext context = new MockRequestContext();
    Transition transition = new Transition(new DefaultTargetStateResolver("target"));
    listener.transitionExecuting(context, transition);
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    listener.transitionExecuting(context, transition);
  }

  public void testTransitionExecutingWithSecurity() {
    SecurityFlowExecutionListener listener = new SecurityFlowExecutionListener();
    RequestContext context = new MockRequestContext();
    Transition transition = new Transition(new DefaultTargetStateResolver("target"));
    SecurityRule rule = getSecurityRuleAnyAuthorized();
    ((LocalAttributeMap) transition.getAttributes()).put(SecurityRule.SECURITY_ATTRIBUTE_NAME, rule);
    configureSecurityContext();
    listener.transitionExecuting(context, transition);
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    HibernateTransactionManager tm = new HibernateTransactionManager(sessionFactory);
    hibernateListener = new HibernateFlowExecutionListener(sessionFactory, tm);
  }

  public void testSameSession() {
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    flowSession.getDefinition().getAttributes().put("persistenceContext", "true");
    hibernateListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    // Session created and bound to conversation
    final Session hibSession = (Session) flowSession.getScope().get("persistenceContext");
    assertNotNull("Should have been populated", hibSession);
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    hibernateListener.paused(context);
    assertSessionNotBound();
  }

  public void testFlowNotAPersistenceContext() {
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    hibernateListener.sessionStarting(context, flowSession, null);
    assertSessionNotBound();
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    assertSessionNotBound();
  }

  public void testFlowCommitsInSingleRequest() {
    assertEquals("Table should only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    flowSession.getDefinition().getAttributes().put("persistenceContext", "true");
    hibernateListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    TestBean bean = new TestBean("Keith Donald");
    hibernateTemplate.save(bean);
    assertEquals("Table should still only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    assertFalse(flowSession.getScope().contains("hibernate.session"));
  }

  public void testFlowCommitsAfterMultipleRequests() {
    assertEquals("Table should only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    flowSession.getDefinition().getAttributes().put("persistenceContext", "true");
    hibernateListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    TestBean bean1 = new TestBean("Keith Donald");
    hibernateTemplate.save(bean1);
    assertEquals("Table should still only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

  }

  public void testCancelEndState() {
    assertEquals("Table should only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    flowSession.getDefinition().getAttributes().put("persistenceContext", "true");
    hibernateListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    TestBean bean = new TestBean("Keith Donald");
    hibernateTemplate.save(bean);
    assertEquals("Table should still only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    assertFalse(flowSession.getScope().contains("hibernate.session"));
  }

  public void testNoCommitAttributeSetOnEndState() {
    assertEquals("Table should only have one row", 1, jdbcTemplate.queryForInt("select count(*) from T_BEAN"));
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    flowSession.getDefinition().getAttributes().put("persistenceContext", "true");
    hibernateListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    EndState endState = new EndState(flowSession.getDefinitionInternal(), "cancel");
    flowSession.setState(endState);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.