1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
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  package org.portletbridge.mock;
17  
18  import java.net.URI;
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import javax.portlet.RenderResponse;
23  
24  import org.portletbridge.portlet.BridgeRequest;
25  import org.portletbridge.portlet.DefaultBridgeRequest;
26  import org.portletbridge.portlet.PerPortletMemento;
27  import org.portletbridge.portlet.PortletBridgeMemento;
28  
29  /***
30   * @author JMcCrindle
31   */
32  public class MockPortletBridgeMemento implements PortletBridgeMemento {
33  
34      private Map bridgeRequests = new HashMap();
35      private Map mementos = new HashMap();
36      
37      /***
38       * 
39       */
40      public MockPortletBridgeMemento() {
41          super();
42      }
43      
44      public void setupBridgeRequest(String id, BridgeRequest bridgeRequest) {
45          bridgeRequests.put(id, bridgeRequest);
46      }
47  
48      public void setupMemento(String id, PerPortletMemento memento) {
49          mementos.put(id, memento);
50      }
51  
52      /* (non-Javadoc)
53       * @see org.portletbridge.portlet.PortletBridgeMemento#getBridgeRequest(java.lang.String)
54       */
55      public BridgeRequest getBridgeRequest(String id) {
56          return (BridgeRequest) bridgeRequests.get(id);
57      }
58  
59      /* (non-Javadoc)
60       * @see org.portletbridge.portlet.PortletBridgeMemento#getPerPortletMemento(java.lang.String)
61       */
62      public PerPortletMemento getPerPortletMemento(String portletId) {
63          return (PerPortletMemento) mementos.get(portletId);
64      }
65  
66      /* (non-Javadoc)
67       * @see org.portletbridge.portlet.PortletBridgeMemento#createBridgeRequest(javax.portlet.RenderResponse, java.net.URI)
68       */
69      public BridgeRequest createBridgeRequest(RenderResponse response, String id, URI url) {
70          return new DefaultBridgeRequest();
71      }
72  
73  
74  }