Package org.springframework.webflow.test

Examples of org.springframework.webflow.test.MockExternalContext


      }
    };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setKeyFactory(new MockFlowExecutionKeyFactory());

    MockExternalContext context = new MockExternalContext();
    execution.start(null, context);
    assertNull("RequestContext was not released", RequestContextHolder.getRequestContext());

    context = new MockExternalContext();
    execution.resume(context);
    assertNull("RequestContext was not released", RequestContextHolder.getRequestContext());

  }
View Full Code Here


    }
  }

  public void testPutFlowExecution() {
    FlowExecution execution = executionFactory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertNotNull(execution.getKey());
    repository.putFlowExecution(execution);
    String key = execution.getKey().toString();
    FlowExecutionKey parsedKey = repository.parseFlowExecutionKey(key);
    FlowExecution execution2 = repository.getFlowExecution(parsedKey);
View Full Code Here

    assertEquals(execution.getActiveSession().getState().getId(), execution2.getActiveSession().getState().getId());
  }

  public void testPutFlowExecutionNextSnapshotId() {
    FlowExecution execution = executionFactory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertNotNull(execution.getKey());
    repository.putFlowExecution(execution);
    String key = execution.getKey().toString();
    FlowExecutionKey parsedKey = repository.parseFlowExecutionKey(key);
    FlowExecution execution2 = repository.getFlowExecution(parsedKey);
    assertSame(execution.getDefinition(), execution2.getDefinition());
    assertEquals(execution.getActiveSession().getState().getId(), execution2.getActiveSession().getState().getId());
    MockExternalContext context = new MockExternalContext();
    context.setEventId("foo");
    execution2.resume(context);
    repository.putFlowExecution(execution2);
    assertNotSame(execution.getKey(), execution2.getKey());
  }
View Full Code Here

    }
  }

  public void testRemoveFlowExecution() {
    FlowExecution execution = executionFactory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertNotNull(execution.getKey());
    repository.putFlowExecution(execution);
    repository.removeFlowExecution(execution);
    try {
      repository.getFlowExecution(execution.getKey());
View Full Code Here

    }
  }

  public void testRemoveNoSuchFlowExecution() {
    FlowExecution execution = executionFactory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    try {
      repository.removeFlowExecution(execution);
      repository.removeFlowExecution(execution);
      fail("Should have failed");
    } catch (NoSuchFlowExecutionException e) {
View Full Code Here

    assertEquals("e12345s3", repository.getKey(execution).toString());
  }

  public void testUpdate() {
    FlowExecution execution = executionFactory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    repository.putFlowExecution(execution);
    execution.getActiveSession().getScope().put("foo", "bar");
    repository.updateFlowExecutionSnapshot(execution);
    FlowExecution execution2 = repository.getFlowExecution(execution.getKey());
    assertEquals("bar", execution2.getActiveSession().getScope().get("foo"));
View Full Code Here

    assertEquals("bar", execution2.getActiveSession().getScope().get("foo"));
  }

  public void testRemove() {
    FlowExecution execution = executionFactory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    repository.putFlowExecution(execution);
    repository.removeFlowExecutionSnapshot(execution);
    try {
      repository.getFlowExecution(execution.getKey());
      fail("Should have failed");
View Full Code Here

    }
  }

  public void testRemoveAll() {
    FlowExecution execution = executionFactory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    repository.putFlowExecution(execution);
    repository.removeAllFlowExecutionSnapshots(execution);
    try {
      repository.getFlowExecution(execution.getKey());
      fail("Should have failed");
View Full Code Here

    factory = new SerializedFlowExecutionSnapshotFactory(executionFactory, locator);
  }

  public void testCreateSnapshot() {
    FlowExecutionImpl flowExecution = (FlowExecutionImpl) executionFactory.createFlowExecution(flow);
    flowExecution.start(null, new MockExternalContext());
    flowExecution.getActiveSession().getScope().put("foo", "bar");
    FlowExecutionSnapshot snapshot = factory.createSnapshot(flowExecution);
    FlowExecutionImpl flowExecution2 = (FlowExecutionImpl) factory.restoreExecution(snapshot, "myFlow", null,
        flowExecution.getConversationScope(), executionKeyFactory);
    assertNotSame(flowExecution, flowExecution2);
View Full Code Here

    this.jsfMock.facesContext().getApplication().setViewHandler(this.viewHandler);
    this.lifecycle = new TestLifecycle(this.jsfMock.lifecycle());
    this.factory = new JsfViewFactory(this.parser.parseExpression("#{'" + VIEW_ID + "'}", new FluentParserContext()
        .template().evaluate(RequestContext.class).expectResult(String.class)), this.lifecycle);
    RequestContextHolder.setRequestContext(this.context);
    MockExternalContext ext = new MockExternalContext();
    ext.setNativeContext(new MockServletContext());
    ext.setNativeRequest(new MockHttpServletRequest());
    ext.setNativeResponse(new MockHttpServletResponse());
    EasyMock.expect(this.context.getExternalContext()).andStubReturn(ext);
    LocalAttributeMap<Object> requestMap = new LocalAttributeMap<Object>();
    EasyMock.expect(this.context.getFlashScope()).andStubReturn(requestMap);
    EasyMock.expect(this.context.getRequestParameters()).andStubReturn(
        new LocalParameterMap(new HashMap<String, Object>()));
View Full Code Here

TOP

Related Classes of org.springframework.webflow.test.MockExternalContext

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.