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.util.Enumeration;
19  import java.util.Hashtable;
20  import java.util.Locale;
21  import java.util.ResourceBundle;
22  
23  import javax.portlet.PortletConfig;
24  import javax.portlet.PortletContext;
25  
26  /***
27   * @author jmccrindle
28   */
29  public class MockPortletConfig implements PortletConfig {
30  
31      private Hashtable initParams = new Hashtable();
32      private ResourceBundle bundle;
33      
34      /***
35       * Default Constructor
36       */
37      public MockPortletConfig() {
38          super();
39      }
40  
41      /* (non-Javadoc)
42       * @see javax.portlet.PortletConfig#getPortletName()
43       */
44      public String getPortletName() {
45          return null;
46      }
47  
48      /* (non-Javadoc)
49       * @see javax.portlet.PortletConfig#getPortletContext()
50       */
51      public PortletContext getPortletContext() {
52          return null;
53      }
54  
55      /* (non-Javadoc)
56       * @see javax.portlet.PortletConfig#getResourceBundle(java.util.Locale)
57       */
58      public ResourceBundle getResourceBundle(Locale locale) {
59          return bundle;
60      }
61  
62      /* (non-Javadoc)
63       * @see javax.portlet.PortletConfig#getInitParameter(java.lang.String)
64       */
65      public String getInitParameter(String name) {
66          return (String) initParams.get(name);
67      }
68  
69      /* (non-Javadoc)
70       * @see javax.portlet.PortletConfig#getInitParameterNames()
71       */
72      public Enumeration getInitParameterNames() {
73          return initParams.keys();
74      }
75      
76      public void setupInitParam(String name, String value) {
77          initParams.put(name, value);
78      }
79  
80      /***
81       * @param bundle
82       */
83      public void setupResourceBundle(ResourceBundle bundle) {
84          this.bundle = bundle;
85      }
86  
87  }