/** * Creates a new mock flow execution context for the specified root flow definition. */ public MockFlowExecutionContext(Flow flow) { this(new MockFlowSession(flow)); }
/** * Creates a new mock flow execution context -- automatically installs a root flow definition and active flow * session. */ public MockFlowExecutionContext() { setActiveSession(new MockFlowSession()); this.flow = activeSession.getDefinition(); }
public void start(Flow flow, MutableAttributeMap<?> input) throws IllegalStateException { MockFlowSession session = new MockFlowSession(flow, input); if (getFlowExecutionContext().isActive()) { session.setParent(getFlowExecutionContext().getActiveSession()); } getMockFlowExecutionContext().setActiveSession(session); flow.start(this, input); }
/** * Creates a new mock flow execution context for the specified root flow definition. */ public MockFlowExecutionContext(Flow rootFlow) { this.flow = rootFlow; activeSession = new MockFlowSession(rootFlow); }
/** * Creates a new mock flow execution context for the specified root flow definition. */ public MockFlowExecutionContext(Flow flow) { this(new MockFlowSession(flow)); }
/** * Creates a new mock flow execution context for the specified root flow definition. */ public MockFlowExecutionContext(Flow flow) { this(new MockFlowSession(flow)); }
/** * Creates a new mock flow execution context -- automatically installs a root flow definition and active flow * session. */ public MockFlowExecutionContext() { activeSession = new MockFlowSession(); this.flow = activeSession.getDefinition(); }
/** * Creates a new mock flow execution context -- automatically installs a root flow definition and active flow * session. */ public MockFlowExecutionContext() { setActiveSession(new MockFlowSession()); this.flow = activeSession.getDefinition(); }
/** * Creates a new mock flow execution context -- automatically installs a root flow definition and active flow * session. */ public MockFlowExecutionContext() { setActiveSession(new MockFlowSession()); this.flow = activeSession.getDefinition(); }
public ViewSelection start(Flow flow, MutableAttributeMap input) throws IllegalStateException { getMockFlowExecutionContext().setActiveSession(new MockFlowSession(flow, input)); getMockFlowExecutionContext().getMockActiveSession().setStatus(FlowSessionStatus.STARTING); ViewSelection selectedView = flow.start(this, input); return selectedView; }
public void testFlowNotAPersistenceContext() { MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); hibernateListener.sessionStarting(context, flowSession, null); assertSessionNotBound(); }
public void testFlowNotAPersistenceContext() { MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); jpaListener.sessionStarting(context, flowSession, null); assertSessionNotBound(); }
public void start(Flow flow, MutableAttributeMap<?> input) throws IllegalStateException { MockFlowSession session = new MockFlowSession(flow, input); if (getFlowExecutionContext().isActive()) { session.setParent(getFlowExecutionContext().getActiveSession()); } getMockFlowExecutionContext().setActiveSession(session); flow.start(this, input); }
public void start(Flow flow, MutableAttributeMap input) throws IllegalStateException { MockFlowSession session = new MockFlowSession(flow, input); if (getFlowExecutionContext().isActive()) { session.setParent(getFlowExecutionContext().getActiveSession()); } getMockFlowExecutionContext().setActiveSession(session); flow.start(this, input); }
private MockFlowSession newFlowSession(boolean persistenceContext, FlowSession parent) { MockFlowSession flowSession = new MockFlowSession(); flowSession.setParent(parent); if (persistenceContext) { flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); } EndState endState = new EndState(flowSession.getDefinitionInternal(), "success"); endState.getAttributes().put("commit", true); flowSession.setState(endState); return flowSession; }
public void testExceptionThrownWithNothingBound() { assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); assertSessionNotBound(); hibernateListener.exceptionThrown(context, new FlowExecutionException("foo", "bar", "test")); assertSessionNotBound(); }
public void testExceptionThrownWithNothingBound() { assertEquals("Table should only have one row", 1, getCount()); MockRequestContext context = new MockRequestContext(); MockFlowSession flowSession = new MockFlowSession(); flowSession.getDefinition().getAttributes().put("persistenceContext", "true"); assertSessionNotBound(); jpaListener.exceptionThrown(context, new FlowExecutionException("foo", "bar", "test")); assertSessionNotBound(); }
public void testNoCommitAttributeSetOnEndState() { assertEquals("Table should only have one row", 1, getCount()); 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); hibernateListener.sessionEnding(context, flowSession, "success", null); hibernateListener.sessionEnded(context, flowSession, "cancel", null); assertEquals("Table should only have three rows", 1, getCount()); assertSessionNotBound(); }
public void testExceptionThrown() { assertEquals("Table should only have one row", 1, getCount()); 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"); hibernate.templateSave(bean1); assertEquals("Table should still only have one row", 1, getCount()); hibernateListener.exceptionThrown(context, new FlowExecutionException("bla", "bla", "bla")); assertEquals("Table should still only have one row", 1, getCount()); assertSessionNotBound(); }
public void testLazyInitializedCollection() { 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 = hibernate.templateGet(TestBean.class, 0L); assertFalse("addresses should not be initialized", Hibernate.isInitialized(bean.getAddresses())); hibernateListener.paused(context); assertFalse("addresses should not be initialized", Hibernate.isInitialized(bean.getAddresses())); Hibernate.initialize(bean.getAddresses()); assertTrue("addresses should be initialized", Hibernate.isInitialized(bean.getAddresses())); }