You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2011/07/13 09:52:55 UTC

svn commit: r1145897 - in /struts/struts2/trunk: core/src/main/java/org/apache/struts2/interceptor/validation/ core/src/main/resources/ core/src/test/java/org/apache/struts2/interceptor/validation/ core/src/test/resources/org/apache/struts2/interceptor...

Author: lukaszlenart
Date: Wed Jul 13 07:52:54 2011
New Revision: 1145897

URL: http://svn.apache.org/viewvc?rev=1145897&view=rev
Log:
Moves JSONValidationInterceptor into JSON plugin to keep core consistent

Added:
    struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java   (contents, props changed)
      - copied, changed from r1144270, struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java
    struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/JSONValidationInterceptorTest.java   (contents, props changed)
      - copied, changed from r1144270, struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java
    struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletRequest.java
    struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletResponse.java
    struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpSession.java
    struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockServletContext.java
    struts/struts2/trunk/plugins/json/src/test/resources/org/apache/struts2/json/json-validation-1.txt   (contents, props changed)
      - copied, changed from r1144270, struts/struts2/trunk/core/src/test/resources/org/apache/struts2/interceptor/validation/json-1.txt
Removed:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/interceptor/validation/
Modified:
    struts/struts2/trunk/core/src/main/resources/struts-default.xml
    struts/struts2/trunk/plugins/json/pom.xml
    struts/struts2/trunk/plugins/json/src/main/resources/struts-plugin.xml

Modified: struts/struts2/trunk/core/src/main/resources/struts-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-default.xml?rev=1145897&r1=1145896&r2=1145897&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/struts-default.xml (original)
+++ struts/struts2/trunk/core/src/main/resources/struts-default.xml Wed Jul 13 07:52:54 2011
@@ -151,7 +151,6 @@
             <interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" />
             <interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" />
             <interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" />
-            <interceptor name="jsonValidation" class="org.apache.struts2.interceptor.validation.JSONValidationInterceptor" />
             <interceptor name="annotationWorkflow" class="com.opensymphony.xwork2.interceptor.annotations.AnnotationWorkflowInterceptor" />
             <interceptor name="multiselect" class="org.apache.struts2.interceptor.MultiselectInterceptor" />
 
@@ -176,16 +175,6 @@
                 <interceptor-ref name="workflow"/>
             </interceptor-stack>
 
-            <!-- Sample JSON validation stack -->
-            <interceptor-stack name="jsonValidationWorkflowStack">
-                <interceptor-ref name="basicStack"/>
-                <interceptor-ref name="validation">
-                    <param name="excludeMethods">input,back,cancel</param>
-                </interceptor-ref>
-                <interceptor-ref name="jsonValidation"/>
-                <interceptor-ref name="workflow"/>
-            </interceptor-stack>
-
             <!-- Sample file upload stack -->
             <interceptor-stack name="fileUploadStack">
                 <interceptor-ref name="fileUpload"/>

Modified: struts/struts2/trunk/plugins/json/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/pom.xml?rev=1145897&r1=1145896&r2=1145897&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/json/pom.xml (original)
+++ struts/struts2/trunk/plugins/json/pom.xml Wed Jul 13 07:52:54 2011
@@ -92,6 +92,18 @@
         </dependency>
 
         <dependency>
+            <groupId>mockobjects</groupId>
+            <artifactId>mockobjects-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>mockobjects</groupId>
+            <artifactId>mockobjects-jdk1.3-j2ee1.3</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-test</artifactId>
             <scope>test</scope>

Copied: struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java (from r1144270, struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java)
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java?p2=struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java&p1=struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java&r1=1144270&r2=1145897&rev=1145897&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java (original)
+++ struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java Wed Jul 13 07:52:54 2011
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-package org.apache.struts2.interceptor.validation;
+package org.apache.struts2.json;
 
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionInvocation;

Propchange: struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: struts/struts2/trunk/plugins/json/src/main/resources/struts-plugin.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/main/resources/struts-plugin.xml?rev=1145897&r1=1145896&r2=1145897&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/json/src/main/resources/struts-plugin.xml (original)
+++ struts/struts2/trunk/plugins/json/src/main/resources/struts-plugin.xml Wed Jul 13 07:52:54 2011
@@ -1,16 +1,31 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
 <!DOCTYPE struts PUBLIC
-    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
-    "http://struts.apache.org/dtds/struts-2.1.7.dtd">
+        "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
+        "http://struts.apache.org/dtds/struts-2.1.7.dtd">
 
 <struts>
     <package name="json-default" extends="struts-default">
+
         <result-types>
             <result-type name="json" class="org.apache.struts2.json.JSONResult"/>
         </result-types>
+
         <interceptors>
             <interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/>
+            <interceptor name="jsonValidation" class="org.apache.struts2.json.JSONValidationInterceptor"/>
+
+            <!-- Sample JSON validation stack -->
+            <interceptor-stack name="jsonValidationWorkflowStack">
+                <interceptor-ref name="basicStack"/>
+                <interceptor-ref name="validation">
+                    <param name="excludeMethods">input,back,cancel</param>
+                </interceptor-ref>
+                <interceptor-ref name="jsonValidation"/>
+                <interceptor-ref name="workflow"/>
+            </interceptor-stack>
+
         </interceptors>
+
     </package>
 </struts>

Copied: struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/JSONValidationInterceptorTest.java (from r1144270, struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java)
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/JSONValidationInterceptorTest.java?p2=struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/JSONValidationInterceptorTest.java&p1=struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java&r1=1144270&r2=1145897&rev=1145897&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java (original)
+++ struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/JSONValidationInterceptorTest.java Wed Jul 13 07:52:54 2011
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-package org.apache.struts2.interceptor.validation;
+package org.apache.struts2.json;
 
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
@@ -33,10 +33,8 @@ import com.opensymphony.xwork2.validator
 import com.opensymphony.xwork2.validator.annotations.Validation;
 import org.apache.struts2.StrutsStatics;
 import org.apache.struts2.StrutsTestCase;
-import org.apache.struts2.TestUtils;
-import org.apache.struts2.views.jsp.StrutsMockHttpServletRequest;
-import org.apache.struts2.views.jsp.StrutsMockHttpServletResponse;
-import org.apache.struts2.views.jsp.StrutsMockServletContext;
+import org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor;
+import org.apache.struts2.interceptor.validation.SkipValidation;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.PrintWriter;
@@ -45,6 +43,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 public class JSONValidationInterceptorTest extends StrutsTestCase {
+
     private MockActionInvocation invocation;
     private StringWriter stringWriter;
     private TestAction action;
@@ -69,7 +68,7 @@ public class JSONValidationInterceptorTe
 
         String normalizedActual = TestUtils.normalize(json, true);
         String normalizedExpected = TestUtils
-            .normalize(JSONValidationInterceptorTest.class.getResource("json-1.txt"));
+            .normalize(JSONValidationInterceptorTest.class.getResource("json-validation-1.txt"));
         //json
         assertEquals(normalizedExpected, normalizedActual);
         //execution

Propchange: struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/JSONValidationInterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/JSONValidationInterceptorTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletRequest.java?rev=1145897&view=auto
==============================================================================
--- struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletRequest.java (added)
+++ struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletRequest.java Wed Jul 13 07:52:54 2011
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.struts2.json;
+
+import com.mockobjects.servlet.MockHttpServletRequest;
+import junit.framework.AssertionFailedError;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpSession;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Vector;
+
+
+/**
+ * StrutsMockHttpServletRequest
+ *
+ */
+public class StrutsMockHttpServletRequest extends MockHttpServletRequest {
+
+    Locale locale = Locale.US;
+    private Map attributes = new HashMap();
+    private Map parameterMap = new HashMap();
+    private String context = "";
+    private String pathInfo = "";
+    private String queryString;
+    private String requestURI;
+    private String scheme;
+    private String serverName;
+    private int serverPort;
+    private String encoding;
+    private String requestDispatherString;
+
+
+    public void setAttribute(String s, Object o) {
+        attributes.put(s, o);
+    }
+
+    public Object getAttribute(String s) {
+        return attributes.get(s);
+    }
+
+    public Enumeration getAttributeNames() {
+        Vector v = new Vector();
+        v.addAll(attributes.keySet());
+
+        return v.elements();
+    }
+
+    public String getContextPath() {
+        return this.context;
+    }
+
+    public void setLocale(Locale locale) {
+        this.locale = locale;
+    }
+
+    public Locale getLocale() {
+        return locale;
+    }
+
+    public void setCharacterEncoding(String s) {
+        this.encoding = s;
+    }
+
+    public String getCharacterEncoding() {
+        return encoding;
+    }
+
+    public void setParameterMap(Map parameterMap) {
+        this.parameterMap = parameterMap;
+    }
+
+    public Map getParameterMap() {
+        return parameterMap;
+    }
+
+    public String getParameter(String string) {
+        return (String) parameterMap.get(string);
+    }
+
+    public Enumeration getParameterNames() {
+        return Collections.enumeration(parameterMap.keySet());
+    }
+
+    public String[] getParameterValues(String string) {
+        return (String[]) parameterMap.get(string);
+    }
+
+    public String getPathInfo() {
+        return pathInfo;
+    }
+
+    public void setQueryString(String queryString) {
+        this.queryString = queryString;
+    }
+
+    public String getQueryString() {
+        return queryString;
+    }
+
+    public RequestDispatcher getRequestDispatcher(String string) {
+        this.requestDispatherString = string;
+        return super.getRequestDispatcher(string);
+    }
+
+    /**
+     * Get's the source string that was used in the last getRequestDispatcher method call.
+     */
+    public String getRequestDispatherString() {
+        return requestDispatherString;
+    }
+
+    public void setRequestURI(String requestURI) {
+        this.requestURI = requestURI;
+    }
+
+    public String getRequestURI() {
+        return requestURI;
+    }
+
+    public void setScheme(String scheme) {
+        this.scheme = scheme;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public void setServerName(String serverName) {
+        this.serverName = serverName;
+    }
+
+    public String getServerName() {
+        return serverName;
+    }
+
+    public void setServerPort(int serverPort) {
+        this.serverPort = serverPort;
+    }
+
+    public int getServerPort() {
+        return serverPort;
+    }
+
+    public HttpSession getSession() {
+        HttpSession session = null;
+
+        try {
+            session = super.getSession();
+        } catch (AssertionFailedError e) {
+            //ignore
+        }
+
+        if (session == null) {
+            session = new StrutsMockHttpSession();
+            setSession(session);
+        }
+
+        return session;
+    }
+
+    public void setupGetContext(String context) {
+        this.context = context;
+    }
+
+    public void setupGetPathInfo(String pathInfo) {
+        this.pathInfo = pathInfo;
+    }
+
+    public int getRemotePort() {
+        return 0;
+    }
+
+    public String getLocalName() {
+        return null;
+    }
+
+    public String getLocalAddr() {
+        return null;
+    }
+
+    public int getLocalPort() {
+        return 0;
+    }
+}

Added: struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletResponse.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletResponse.java?rev=1145897&view=auto
==============================================================================
--- struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletResponse.java (added)
+++ struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpServletResponse.java Wed Jul 13 07:52:54 2011
@@ -0,0 +1,90 @@
+package org.apache.struts2.json;
+
+import com.mockobjects.servlet.MockHttpServletResponse;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+
+/**
+ * StrutsMockHttpServletResponse
+ *
+ */
+public class StrutsMockHttpServletResponse extends MockHttpServletResponse {
+    private Locale locale;
+    private PrintWriter writer;
+    private int status;
+    private String redirectURL;
+    private String contentType;
+    private String encoding;
+
+    public Locale getLocale() {
+        return locale;
+    }
+
+    public void setLocale(Locale locale) {
+        this.locale = locale;
+    }
+
+    public String getContentType() {
+        return contentType;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void setContentType(String type) {
+        this.contentType = type;
+    }
+
+    public PrintWriter getWriter() throws IOException {
+        if (writer == null)
+            return new PrintWriter(new ByteArrayOutputStream());
+        else
+            return writer;
+    }
+
+    public void setCharacterEncoding(String string) {
+        this.encoding = string;
+    }
+
+    public void setWriter(PrintWriter writer) {
+        this.writer = writer;
+    }
+
+    public String encodeURL(String s) {
+        return s;
+    }
+
+    public String encodeRedirectURL(String s) {
+        return s;
+    }
+
+    public String encodeUrl(String s) {
+        return s;
+    }
+
+    public void setStatus(int i) {
+        this.status = i;
+        super.setStatus(i);
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+
+    public String getRedirectURL() {
+        return redirectURL;
+    }
+
+    public void sendRedirect(String redirectURL) throws IOException {
+        this.redirectURL = redirectURL;
+        super.sendRedirect(redirectURL);
+    }
+
+    @Override
+    public String getCharacterEncoding() {
+        return encoding;
+    }
+}
\ No newline at end of file

Added: struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpSession.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpSession.java?rev=1145897&view=auto
==============================================================================
--- struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpSession.java (added)
+++ struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockHttpSession.java Wed Jul 13 07:52:54 2011
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.struts2.json;
+
+import com.mockobjects.servlet.MockHttpSession;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+
+/**
+ * StrutsMockHttpSession
+ *
+ */
+public class StrutsMockHttpSession extends MockHttpSession {
+
+    Hashtable attributes = new Hashtable();
+
+
+    public void setAttribute(String s, Object o) {
+        attributes.put(s, o);
+    }
+
+    public Object getAttribute(String s) {
+        return attributes.get(s);
+    }
+
+    public Enumeration getAttributeNames() {
+        return attributes.keys();
+    }
+
+    public void setExpectedAttribute(String s, Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void setExpectedRemoveAttribute(String s) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void removeAttribute(String s) {
+        attributes.remove(s);
+    }
+
+    public void setupGetAttribute(String s, Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void setupGetAttributeNames(Enumeration enumeration) {
+        throw new UnsupportedOperationException();
+    }
+}

Added: struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockServletContext.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockServletContext.java?rev=1145897&view=auto
==============================================================================
--- struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockServletContext.java (added)
+++ struts/struts2/trunk/plugins/json/src/test/java/org/apache/struts2/json/StrutsMockServletContext.java Wed Jul 13 07:52:54 2011
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.struts2.json;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * StrutsMockServletContext
+ *
+ */
+public class StrutsMockServletContext implements ServletContext {
+
+    String realPath;
+    String servletInfo;
+    String contextPath;
+    Map initParams = new HashMap();
+    Map attributes = new HashMap();
+    InputStream resourceAsStream;
+
+    public void setInitParameter(String name, String value) {
+        initParams.put(name, value);
+    }
+
+    public void setRealPath(String value) {
+        realPath = value;
+    }
+
+    public String getRealPath(String string) {
+        return realPath;
+    }
+
+    public ServletContext getContext(String s) {
+        return null;
+    }
+
+    public int getMajorVersion() {
+        return 0;
+    }
+
+    public int getMinorVersion() {
+        return 0;
+    }
+
+    public String getMimeType(String s) {
+        return null;
+    }
+
+    public Set getResourcePaths(String s) {
+        return null;
+    }
+
+    public URL getResource(String s) throws MalformedURLException {
+        return null;
+    }
+
+    public InputStream getResourceAsStream(String s) {
+        if (resourceAsStream != null) {
+            return resourceAsStream;
+        }
+        return null;
+    }
+
+    public void setResourceAsStream(InputStream is) {
+        this.resourceAsStream = is;
+    }
+
+    public RequestDispatcher getRequestDispatcher(String s) {
+        return null;
+    }
+
+    public RequestDispatcher getNamedDispatcher(String s) {
+        return null;
+    }
+
+    public Servlet getServlet(String s) throws ServletException {
+        return null;
+    }
+
+    public Enumeration getServlets() {
+        return null;
+    }
+
+    public Enumeration getServletNames() {
+        return null;
+    }
+
+    public void log(String s) {
+    }
+
+    public void log(Exception e, String s) {
+    }
+
+    public void log(String s, Throwable throwable) {
+    }
+
+    public String getServerInfo() {
+        return servletInfo;
+    }
+
+    public String getInitParameter(String s) {
+        return (String) initParams.get(s);
+    }
+
+    public Enumeration getInitParameterNames() {
+        return Collections.enumeration(initParams.keySet());
+    }
+
+    public Object getAttribute(String s) {
+        return attributes.get(s);
+    }
+
+    public Enumeration getAttributeNames() {
+        return Collections.enumeration(attributes.keySet());
+    }
+
+    public void setAttribute(String s, Object o) {
+        attributes.put(s, o);
+    }
+
+    public void removeAttribute(String s) {
+        attributes.remove(s);
+    }
+
+    public String getServletContextName() {
+        return null;
+    }
+
+    public void setServletInfo(String servletInfo) {
+        this.servletInfo = servletInfo;
+    }
+
+    public String getContextPath() {
+        return contextPath;
+    }
+
+    public void setContextPath(String contextPath) {
+        this.contextPath = contextPath;
+    }
+}
\ No newline at end of file

Copied: struts/struts2/trunk/plugins/json/src/test/resources/org/apache/struts2/json/json-validation-1.txt (from r1144270, struts/struts2/trunk/core/src/test/resources/org/apache/struts2/interceptor/validation/json-1.txt)
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/test/resources/org/apache/struts2/json/json-validation-1.txt?p2=struts/struts2/trunk/plugins/json/src/test/resources/org/apache/struts2/json/json-validation-1.txt&p1=struts/struts2/trunk/core/src/test/resources/org/apache/struts2/interceptor/validation/json-1.txt&r1=1144270&r2=1145897&rev=1145897&view=diff
==============================================================================
    (empty)

Propchange: struts/struts2/trunk/plugins/json/src/test/resources/org/apache/struts2/json/json-validation-1.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/struts2/trunk/plugins/json/src/test/resources/org/apache/struts2/json/json-validation-1.txt
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL