InvocationSessionStoreTestpublic class InvocationSessionStoreTest extends org.apache.struts2.StrutsTestCase InvocationSessionStoreTest |
Fields Summary |
---|
private static final String | INVOCATION_KEY | private static final String | TOKEN_VALUE | private com.opensymphony.xwork2.ActionInvocation | invocation | private Map | session | private com.mockobjects.dynamic.Mock | invocationMock | private com.opensymphony.xwork2.util.ValueStack | stack |
Methods Summary |
---|
protected void | setUp()
stack = ValueStackFactory.getFactory().createValueStack();
ActionContext actionContext = new ActionContext(stack.getContext());
ActionContext.setContext(actionContext);
session = new HashMap();
actionContext.setSession(session);
invocationMock = new Mock(ActionInvocation.class);
invocation = (ActionInvocation) invocationMock.proxy();
actionContext.setValueStack(stack);
invocationMock.matchAndReturn("getStack", stack);
Mock proxyMock = new Mock(ActionProxy.class);
proxyMock.matchAndReturn("getInvocation", invocation);
ActionProxy proxy = (ActionProxy) proxyMock.proxy();
invocationMock.matchAndReturn("getProxy", proxy);
| public void | testStore()
assertNull(InvocationSessionStore.loadInvocation(INVOCATION_KEY, TOKEN_VALUE));
InvocationSessionStore.storeInvocation(INVOCATION_KEY, TOKEN_VALUE, invocation);
assertNotNull(InvocationSessionStore.loadInvocation(INVOCATION_KEY, TOKEN_VALUE));
assertEquals(invocation, InvocationSessionStore.loadInvocation(INVOCATION_KEY, TOKEN_VALUE));
| public void | testValueStackReset()
ActionContext actionContext = ActionContext.getContext();
assertEquals(stack, actionContext.getValueStack());
InvocationSessionStore.storeInvocation(INVOCATION_KEY, TOKEN_VALUE, invocation);
actionContext.setValueStack(null);
assertNull(actionContext.getValueStack());
InvocationSessionStore.loadInvocation(INVOCATION_KEY, TOKEN_VALUE);
assertEquals(stack, actionContext.getValueStack());
|
|