jsf lifecycle updates

This commit is contained in:
Keith Donald
2008-04-22 19:35:41 +00:00
parent 199aebbd9e
commit 6c635c448a
5 changed files with 37 additions and 29 deletions

View File

@@ -79,7 +79,7 @@ public class JsfFinalResponseActionTests extends TestCase {
ext.setNativeResponse(new MockHttpServletResponse());
EasyMock.expect(context.getExternalContext()).andStubReturn(ext);
AttributeMap requestMap = new LocalAttributeMap();
EasyMock.expect(context.getRequestScope()).andStubReturn(requestMap);
EasyMock.expect(context.getFlashScope()).andStubReturn(requestMap);
EasyMock.expect(context.getRequestParameters()).andStubReturn(new LocalParameterMap(new HashMap()));
}

View File

@@ -49,7 +49,7 @@ public class JsfViewTests extends TestCase {
private RequestContext context = (RequestContext) EasyMock.createMock(RequestContext.class);
private FlowExecutionContext flowExecutionContext = (FlowExecutionContext) EasyMock
.createMock(FlowExecutionContext.class);
private MutableAttributeMap requestMap = (MutableAttributeMap) EasyMock.createMock(MutableAttributeMap.class);
private MutableAttributeMap flashScope = (MutableAttributeMap) EasyMock.createMock(MutableAttributeMap.class);
private MutableAttributeMap flowMap = (MutableAttributeMap) EasyMock.createMock(MutableAttributeMap.class);
private FlowExecutionKey key = new FlowExecutionKey() {
@@ -90,7 +90,7 @@ public class JsfViewTests extends TestCase {
RequestContextHolder.setRequestContext(context);
EasyMock.expect(context.getExternalContext()).andStubReturn(extContext);
EasyMock.expect(context.getRequestScope()).andStubReturn(requestMap);
EasyMock.expect(context.getFlashScope()).andStubReturn(flashScope);
EasyMock.expect(context.getFlowScope()).andStubReturn(flowMap);
EasyMock.expect(context.getFlowExecutionContext()).andStubReturn(flowExecutionContext);
EasyMock.expect(flowExecutionContext.getKey()).andStubReturn(key);
@@ -104,12 +104,12 @@ public class JsfViewTests extends TestCase {
public final void testRender() throws IOException {
EasyMock.expect(requestMap.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
.andStubReturn(null);
EasyMock.expect(requestMap.put(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY), EasyMock.anyObject()))
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY), EasyMock.anyObject()))
.andStubReturn(null);
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, requestMap });
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
view.render();
@@ -118,12 +118,12 @@ public class JsfViewTests extends TestCase {
public final void testRenderException() throws IOException {
EasyMock.expect(requestMap.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
.andStubReturn(null);
EasyMock.expect(requestMap.put(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY), EasyMock.anyObject()))
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY), EasyMock.anyObject()))
.andStubReturn(null);
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, requestMap });
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
jsfMock.application().setViewHandler(new ExceptionalViewHandler());
@@ -139,11 +139,11 @@ public class JsfViewTests extends TestCase {
*/
public final void testResume_Restored_NoEvent() {
EasyMock.expect(requestMap.getBoolean(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY))).andStubReturn(
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY))).andStubReturn(
Boolean.FALSE);
EasyMock.expect(requestMap.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
Boolean.FALSE);
EasyMock.expect(requestMap.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
.andStubReturn(null);
EasyMock.expect(context.getCurrentState()).andStubReturn(new MockViewState());
@@ -152,7 +152,7 @@ public class JsfViewTests extends TestCase {
UIViewRoot existingRoot = new UIViewRoot();
existingRoot.setViewId(VIEW_ID);
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, requestMap });
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
JsfView restoredView = new JsfView(existingRoot, lifecycle, context);
restoredView.setRestored(true);
@@ -169,11 +169,11 @@ public class JsfViewTests extends TestCase {
*/
public final void testGetView_Restore_Ajax_NoEvent() {
EasyMock.expect(requestMap.getBoolean(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY))).andStubReturn(
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY))).andStubReturn(
Boolean.FALSE);
EasyMock.expect(requestMap.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
Boolean.FALSE);
EasyMock.expect(requestMap.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
.andStubReturn(null);
EasyMock.expect(context.getCurrentState()).andStubReturn(new MockViewState());
@@ -183,7 +183,7 @@ public class JsfViewTests extends TestCase {
existingRoot.setViewId(VIEW_ID);
AjaxViewRoot ajaxRoot = new AjaxViewRoot(existingRoot);
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, requestMap });
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
JsfView restoredView = new JsfView(ajaxRoot, lifecycle, context);
restoredView.setRestored(true);
@@ -199,11 +199,11 @@ public class JsfViewTests extends TestCase {
*/
public final void testGetView_Restore_EventSignaled() {
EasyMock.expect(requestMap.getBoolean(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY))).andStubReturn(
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RESPONSE_COMPLETE_KEY))).andStubReturn(
Boolean.FALSE);
EasyMock.expect(requestMap.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn(
Boolean.FALSE);
EasyMock.expect(requestMap.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
.andStubReturn(null);
EasyMock.expect(context.getCurrentState()).andStubReturn(new MockViewState());
@@ -212,7 +212,7 @@ public class JsfViewTests extends TestCase {
UIViewRoot existingRoot = new UIViewRoot();
existingRoot.setViewId(VIEW_ID);
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, requestMap });
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
JsfView restoredView = new JsfView(existingRoot, lifecycle, context);
restoredView.setRestored(true);