001/*
002 * Copyright 2002-2012 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.mock.web.portlet;
018
019import java.util.Collection;
020import javax.portlet.PortalContext;
021import javax.portlet.PortletMode;
022import javax.portlet.RenderRequest;
023import javax.portlet.RenderResponse;
024
025/**
026 * Mock implementation of the {@link javax.portlet.RenderResponse} interface.
027 *
028 * @author John A. Lewis
029 * @author Juergen Hoeller
030 * @since 2.0
031 */
032public class MockRenderResponse extends MockMimeResponse implements RenderResponse {
033
034        private String title;
035
036        private Collection<PortletMode> nextPossiblePortletModes;
037
038
039        /**
040         * Create a new MockRenderResponse with a default {@link MockPortalContext}.
041         * @see MockPortalContext
042         */
043        public MockRenderResponse() {
044                super();
045        }
046
047        /**
048         * Create a new MockRenderResponse.
049         * @param portalContext the PortalContext defining the supported
050         * PortletModes and WindowStates
051         */
052        public MockRenderResponse(PortalContext portalContext) {
053                super(portalContext);
054        }
055
056        /**
057         * Create a new MockRenderResponse.
058         * @param portalContext the PortalContext defining the supported
059         * PortletModes and WindowStates
060         * @param request the corresponding render request that this response
061         * is generated for
062         */
063        public MockRenderResponse(PortalContext portalContext, RenderRequest request) {
064                super(portalContext, request);
065        }
066
067
068        //---------------------------------------------------------------------
069        // RenderResponse methods
070        //---------------------------------------------------------------------
071
072        @Override
073        public void setTitle(String title) {
074                this.title = title;
075        }
076
077        public String getTitle() {
078                return this.title;
079        }
080
081        @Override
082        public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {
083                this.nextPossiblePortletModes = portletModes;
084        }
085
086        public Collection<PortletMode> getNextPossiblePortletModes() {
087                return this.nextPossiblePortletModes;
088        }
089
090}