1
2
3
4
5
6
7
8
9
10 package com.sri.emo.wizard.completion.management;
11
12 import java.util.HashMap;
13 import java.util.Map;
14 import com.jcorporate.expresso.core.controller.ExpressoResponse;
15 import com.jcorporate.expresso.core.controller.session.PersistentSession;
16 import com.sri.emo.wizard.completion.model.CompletionBean;
17
18
19 /***
20 *
21 * @author Michael Rimov
22 */
23 public class TestPromptChooseNode extends ChooseCompletionTestBase {
24
25
26 public void testHandleRequest() throws Exception {
27 Map parameters = new HashMap();
28 ExpressoResponse response = testFixture.invokeFacade(CompletionEditor.class, parameters, PromptChooseNode.STATE_NAME);
29 PersistentSession session = response.getExpressoRequest().getSession();
30 assertTrue(session.getPersistentAttribute(CompletionBeanManager.BEAN_NAME) != null);
31
32 CompletionBean bean = getCompletionBean(response);
33 assertTrue(bean.getCurrentNode() == null);
34 }
35
36 public void testSessionTimeoutDoesntTransitionToOtherStates() throws Exception {
37 Map parameters = new HashMap();
38 ExpressoResponse response = testFixture.invokeFacade(CompletionEditor.class, parameters, PromptChooseNode.STATE_NAME);
39 testFixture.newSession();
40 response = testFixture.invokeFacade(CompletionEditor.class, parameters, PromptChooseNode.STATE_NAME);
41 PersistentSession session = response.getExpressoRequest().getSession();
42 assertTrue(session.getPersistentAttribute(CompletionBeanManager.BEAN_NAME) != null);
43
44 assertEquals(CompletionEditor.class.getName(),response.getControllerClass());
45 assertEquals(PromptChooseNode.STATE_NAME, response.getRequestedState());
46 }
47 }