View Javadoc

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