You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ge...@apache.org on 2005/03/17 00:49:29 UTC

svn commit: r157832 - struts/core/trunk/src/share/org/apache/struts/chain/contexts/MockActionContext.java

Author: germuska
Date: Wed Mar 16 15:49:28 2005
New Revision: 157832

URL: http://svn.apache.org/viewcvs?view=rev&rev=157832
Log:
Simple MockActionContext - are there any useful methods we could add to improve testing?

Added:
    struts/core/trunk/src/share/org/apache/struts/chain/contexts/MockActionContext.java

Added: struts/core/trunk/src/share/org/apache/struts/chain/contexts/MockActionContext.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/contexts/MockActionContext.java?view=auto&rev=157832
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/chain/contexts/MockActionContext.java (added)
+++ struts/core/trunk/src/share/org/apache/struts/chain/contexts/MockActionContext.java Wed Mar 16 15:49:28 2005
@@ -0,0 +1,61 @@
+/*
+ * $Id$
+ * 
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts.chain.contexts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Implementation of <code>ActionContext</code> which begins with empty maps for 
+ * <code>applicationScope</code>, <code>sessionScope</code>, <code>requestScope</code>,
+ * and <code>parameterMap</code> properties.
+ * :TODO Are there any useful "assert" type methods we could add to this? 
+ */
+public class MockActionContext extends ActionContextBase {
+    private Map applicationScope = new HashMap();
+    private Map requestScope = new HashMap();
+    private Map sessionScope = new HashMap();
+    private Map parameterMap = new HashMap(); 
+
+    public Map getApplicationScope() {
+        return applicationScope;
+    }
+    public void setApplicationScope(Map applicationScope) {
+        this.applicationScope = applicationScope;
+    }
+    public Map getParameterMap() {
+        return parameterMap;
+    }
+    public void setParameterMap(Map parameterMap) {
+        this.parameterMap = parameterMap;
+    }
+    public Map getRequestScope() {
+        return requestScope;
+    }
+    public void setRequestScope(Map requestScope) {
+        this.requestScope = requestScope;
+    }
+    public Map getSessionScope() {
+        return sessionScope;
+    }
+    public void setSessionScope(Map sessionScope) {
+        this.sessionScope = sessionScope;
+    }
+}
+
+



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org