View Javadoc

1   /*
2    * $Id: MockActionContext.java 421119 2006-07-12 04:49:11Z wsmoak $
3    *
4    * Copyright 2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.struts.chain.contexts;
19  
20  import java.util.HashMap;
21  import java.util.Map;
22  
23  //  ISSUE: Are there any useful "assert" type methods we could add to this?
24  
25  /***
26   * <p> Implement <code>ActionContext</code> with empty maps for
27   * <code>applicationScope</code>, <code>sessionScope</code>,
28   * <code>requestScope</code>, and <code>parameterMap</code> properties. </p>
29   */
30  public class MockActionContext extends ActionContextBase {
31      private Map applicationScope = new HashMap();
32      private Map requestScope = new HashMap();
33      private Map sessionScope = new HashMap();
34      private Map parameterMap = new HashMap();
35  
36      public Map getApplicationScope() {
37          return applicationScope;
38      }
39  
40      public void setApplicationScope(Map applicationScope) {
41          this.applicationScope = applicationScope;
42      }
43  
44      public Map getParameterMap() {
45          return parameterMap;
46      }
47  
48      public void setParameterMap(Map parameterMap) {
49          this.parameterMap = parameterMap;
50      }
51  
52      public Map getRequestScope() {
53          return requestScope;
54      }
55  
56      public void setRequestScope(Map requestScope) {
57          this.requestScope = requestScope;
58      }
59  
60      public Map getSessionScope() {
61          return sessionScope;
62      }
63  
64      public void setSessionScope(Map sessionScope) {
65          this.sessionScope = sessionScope;
66      }
67  }