Examples of MockRequestContext


Examples of org.springframework.webflow.test.MockRequestContext

public class SetActionTests extends TestCase {
  public void testSetAction() throws Exception {
    StaticExpression name = new StaticExpression("");
    SetAction action = new SetAction(name, new StaticExpression("bar"), null, null);
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
    assertEquals("bar", name.getValue(null));
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

  }

  public void testSetActionWithTypeConversion() throws Exception {
    StaticExpression name = new StaticExpression("");
    SetAction action = new SetAction(name, new StaticExpression("3"), Integer.class, new DefaultConversionService());
    MockRequestContext context = new MockRequestContext();
    Event result = action.execute(context);
    assertEquals("success", result.getId());
    assertEquals(new Integer(3), name.getValue(null));
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    jpaListener = new JpaFlowExecutionListener(entityManagerFactory, tm);
    jpaTemplate = new JpaTemplate(entityManagerFactory);
  }

  public void testFlowNotAPersistenceContext() {
    MockRequestContext context = new MockRequestContext();
    MockFlowSession flowSession = new MockFlowSession();
    jpaListener.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");
    jpaListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    TestBean bean = new TestBean(1, "Keith Donald");
    jpaTemplate.persist(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");
    jpaListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    TestBean bean1 = new TestBean(1, "Keith Donald");
    jpaTemplate.persist(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

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

  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");
    jpaListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    TestBean bean = new TestBean(1, "Keith Donald");
    jpaTemplate.persist(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");
    jpaListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

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

View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

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

  public void testExceptionThrown() {
    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");
    jpaListener.sessionStarting(context, flowSession, null);
    context.setActiveSession(flowSession);
    assertSessionBound();

    TestBean bean = new TestBean(1, "Keith Donald");
    jpaTemplate.persist(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

  }

  public void testExceptionThrownWithNothingBound() {
    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");
    assertSessionNotBound();
    jpaListener.exceptionThrown(context, new FlowExecutionException("foo", "bar", "test"));
    assertSessionNotBound();
View Full Code Here

Examples of org.springframework.webflow.test.MockRequestContext

    Action[] actions = new Action[] { actionMock };
    tested = new CompositeAction(actions);
  }

  public void testDoExecute() throws Exception {
    MockRequestContext mockRequestContext = new MockRequestContext();
    LocalAttributeMap attributes = new LocalAttributeMap();
    attributes.put("some key", "some value");
    EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(new Event(this, "some event", attributes));
    EasyMock.replay(new Object[] { actionMock });
    Event result = tested.doExecute(mockRequestContext);
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.