Examples of MockExternalContext


Examples of org.springframework.webflow.test.MockExternalContext

    context.setEventId("finish");
    flowExecution.resume(context);
  }

  public void testManagedFlowWithUnmanagedSubflow() {
    MockExternalContext context = new MockExternalContext();
    flowExecution.start(null, context);
    context.setEventId("notmanaged");
    flowExecution.resume(context);
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(jpaListener));
    flowExecution = factory.createFlowExecution(flow);
  }

  public void testManagedFlowWithManagedSubflow() {
    MockExternalContext context = new MockExternalContext();
    flowExecution.start(null, context);
    context.setEventId("subflow");
    flowExecution.resume(context);
    context.setEventId("finish");
    flowExecution.resume(context);
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

    context.setEventId("finish");
    flowExecution.resume(context);
  }

  public void testManagedFlowWithUnmanagedSubflow() {
    MockExternalContext context = new MockExternalContext();
    flowExecution.start(null, context);
    context.setEventId("notmanaged");
    flowExecution.resume(context);
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

  protected void tearDown() throws Exception {
    ExternalContextHolder.setExternalContext(null);
  }

  public void testConversationLifeCycle() {
    ExternalContextHolder.setExternalContext(new MockExternalContext());
    Conversation conversation = conversationManager.beginConversation(new ConversationParameters("test", "test",
        "test"));
    ConversationId conversationId = conversation.getId();
    assertNotNull(conversationManager.getConversation(conversationId));
    conversation.lock();
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

    } catch (ConversationException e) {
    }
  }

  public void testNoPassivation() {
    ExternalContextHolder.setExternalContext(new MockExternalContext());
    Conversation conversation = conversationManager.beginConversation(new ConversationParameters("test", "test",
        "test"));
    conversation.lock();
    conversation.putAttribute("testAttribute", "testValue");
    ConversationId conversationId = conversation.getId();
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

    conversation.unlock();
    conversation2.unlock();
  }

  public void testPassivation() throws Exception {
    MockExternalContext externalContext = new MockExternalContext();
    ExternalContextHolder.setExternalContext(externalContext);
    Conversation conversation = conversationManager.beginConversation(new ConversationParameters("test", "test",
        "test"));
    conversation.lock();
    conversation.putAttribute("testAttribute", "testValue");
    ConversationId conversationId = conversation.getId();
    ExternalContextHolder.setExternalContext(null);
    // simulate write out of session
    byte[] passiveSession = passivate(externalContext.getSessionMap());

    // simulate start-up of server
    conversationManager = new SessionBindingConversationManager();
    String id = conversationId.toString();
    conversationId = conversationManager.parseConversationId(id);

    // simulate restore of session
    externalContext.setSessionMap(activate(passiveSession));
    ExternalContextHolder.setExternalContext(externalContext);
    Conversation conversation2 = conversationManager.getConversation(conversationId);
    assertNotSame(conversation, conversation2);
    assertEquals("testValue", conversation2.getAttribute("testAttribute"));
    conversation.end();
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

    conversation.unlock();
  }

  public void testMaxConversations() {
    conversationManager.setMaxConversations(2);
    ExternalContextHolder.setExternalContext(new MockExternalContext());
    Conversation conversation1 = conversationManager.beginConversation(new ConversationParameters("test", "test",
        "test"));
    conversation1.lock();
    assertNotNull(conversationManager.getConversation(conversation1.getId()));
    Conversation conversation2 = conversationManager.beginConversation(new ConversationParameters("test", "test",
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

    assertNotNull(conversationManager.getConversation(conversation3.getId()));
  }

  public void testCustomSessionKey() {
    conversationManager.setSessionKey("foo");
    MockExternalContext context = new MockExternalContext();
    ExternalContextHolder.setExternalContext(context);
    conversationManager.beginConversation(new ConversationParameters("test", "test", "test"));
    assertNotNull(context.getSessionMap().get("foo"));
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

      }
    };
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener));
    FlowExecution execution = factory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertTrue("Should have ended", !execution.isActive());
  }
View Full Code Here

Examples of org.springframework.webflow.test.MockExternalContext

    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(TestException.class, "end");
    flow.getExceptionHandlerSet().add(handler);
    FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(flow);
    try {
      execution.start(null, new MockExternalContext());
      fail("Should have failed no such state");
    } catch (IllegalArgumentException e) {
    }
  }
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.