1 /* 2 * Copyright 2002-2012 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.mock.web.portlet; 18 19 import javax.portlet.PortalContext; 20 import javax.portlet.PortletContext; 21 import javax.portlet.PortletMode; 22 import javax.portlet.RenderRequest; 23 import javax.portlet.WindowState; 24 25 /** 26 * Mock implementation of the {@link javax.portlet.RenderRequest} interface. 27 * 28 * @author John A. Lewis 29 * @author Juergen Hoeller 30 * @since 2.0 31 */ 32 public class MockRenderRequest extends MockPortletRequest implements RenderRequest { 33 34 /** 35 * Create a new MockRenderRequest with a default {@link MockPortalContext} 36 * and a default {@link MockPortletContext}. 37 * @see MockPortalContext 38 * @see MockPortletContext 39 */ 40 public MockRenderRequest() { 41 super(); 42 } 43 44 /** 45 * Create a new MockRenderRequest with a default {@link MockPortalContext} 46 * and a default {@link MockPortletContext}. 47 * @param portletMode the mode that the portlet runs in 48 */ 49 public MockRenderRequest(PortletMode portletMode) { 50 super(); 51 setPortletMode(portletMode); 52 } 53 54 /** 55 * Create a new MockRenderRequest with a default {@link MockPortalContext} 56 * and a default {@link MockPortletContext}. 57 * @param portletMode the mode that the portlet runs in 58 * @param windowState the window state to run the portlet in 59 */ 60 public MockRenderRequest(PortletMode portletMode, WindowState windowState) { 61 super(); 62 setPortletMode(portletMode); 63 setWindowState(windowState); 64 } 65 66 /** 67 * Create a new MockRenderRequest with a default {@link MockPortalContext}. 68 * @param portletContext the PortletContext that the request runs in 69 */ 70 public MockRenderRequest(PortletContext portletContext) { 71 super(portletContext); 72 } 73 74 /** 75 * Create a new MockRenderRequest. 76 * @param portalContext the PortletContext that the request runs in 77 * @param portletContext the PortletContext that the request runs in 78 */ 79 public MockRenderRequest(PortalContext portalContext, PortletContext portletContext) { 80 super(portalContext, portletContext); 81 } 82 83 84 @Override 85 protected String getLifecyclePhase() { 86 return RENDER_PHASE; 87 } 88 89 @Override 90 public String getETag() { 91 return getProperty(RenderRequest.ETAG); 92 } 93 94 }