View Javadoc
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 java.util.Collection;
20  import javax.portlet.PortalContext;
21  import javax.portlet.PortletMode;
22  import javax.portlet.RenderRequest;
23  import javax.portlet.RenderResponse;
24  
25  /**
26   * Mock implementation of the {@link javax.portlet.RenderResponse} interface.
27   *
28   * @author John A. Lewis
29   * @author Juergen Hoeller
30   * @since 2.0
31   */
32  public class MockRenderResponse extends MockMimeResponse implements RenderResponse {
33  
34  	private String title;
35  
36  	private Collection<PortletMode> nextPossiblePortletModes;
37  
38  
39  	/**
40  	 * Create a new MockRenderResponse with a default {@link MockPortalContext}.
41  	 * @see MockPortalContext
42  	 */
43  	public MockRenderResponse() {
44  		super();
45  	}
46  
47  	/**
48  	 * Create a new MockRenderResponse.
49  	 * @param portalContext the PortalContext defining the supported
50  	 * PortletModes and WindowStates
51  	 */
52  	public MockRenderResponse(PortalContext portalContext) {
53  		super(portalContext);
54  	}
55  
56  	/**
57  	 * Create a new MockRenderResponse.
58  	 * @param portalContext the PortalContext defining the supported
59  	 * PortletModes and WindowStates
60  	 * @param request the corresponding render request that this response
61  	 * is generated for
62  	 */
63  	public MockRenderResponse(PortalContext portalContext, RenderRequest request) {
64  		super(portalContext, request);
65  	}
66  
67  
68  	//---------------------------------------------------------------------
69  	// RenderResponse methods
70  	//---------------------------------------------------------------------
71  
72  	@Override
73  	public void setTitle(String title) {
74  		this.title = title;
75  	}
76  
77  	public String getTitle() {
78  		return this.title;
79  	}
80  
81  	@Override
82  	public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {
83  		this.nextPossiblePortletModes = portletModes;
84  	}
85  
86  	public Collection<PortletMode> getNextPossiblePortletModes() {
87  		return this.nextPossiblePortletModes;
88  	}
89  
90  }