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 2015/06/23 17:14:40 UTC

[2/4] struts git commit: WW-4518 Moves results to dedicated package

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java
deleted file mode 100644
index f4287d0..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import com.mockobjects.dynamic.C;
-import com.mockobjects.dynamic.Mock;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsInternalTestCase;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * HttpHeaderResultTest
- */
-public class HttpHeaderResultTest extends StrutsInternalTestCase {
-
-    ActionInvocation invocation;
-    HttpHeaderResult result;
-    HttpServletResponse response;
-    Mock responseMock;
-    ReflectionProvider reflectionProvider;
-
-    public void testHeaderValuesAreNotParsedWhenParseIsFalse() throws Exception {
-        Map<String, String> params = new HashMap<String, String>();
-        params.put("headers.foo", "${bar}");
-        params.put("headers.baz", "baz");
-
-        Map<String, String> values = new HashMap<String, String>();
-        values.put("bar", "abc");
-        ActionContext.getContext().getValueStack().push(values);
-
-        reflectionProvider.setProperties(params, result);
-
-        responseMock.expect("addHeader", C.args(C.eq("foo"), C.eq("${bar}")));
-        responseMock.expect("addHeader", C.args(C.eq("baz"), C.eq("baz")));
-        result.setParse(false);
-        result.execute(invocation);
-        responseMock.verify();
-    }
-
-    public void testHeaderValuesAreParsedAndSet() throws Exception {
-        Map<String, String> params = new HashMap<String, String>();
-        params.put("headers.foo", "${bar}");
-        params.put("headers.baz", "baz");
-
-        Map<String, String> values = new HashMap<String, String>();
-        values.put("bar", "abc");
-        ActionContext.getContext().getValueStack().push(values);
-
-        reflectionProvider.setProperties(params, result);
-
-        responseMock.expect("addHeader", C.args(C.eq("foo"), C.eq("abc")));
-        responseMock.expect("addHeader", C.args(C.eq("baz"), C.eq("baz")));
-        result.execute(invocation);
-        responseMock.verify();
-    }
-    
-    public void testErrorMessageIsParsedAndSet() throws Exception {
-        ActionContext.getContext().getValueStack().set("errMsg", "abc");
-        ActionContext.getContext().getValueStack().set("errCode", "404");
-        result.setError("${errCode}");
-        result.setErrorMessage("${errMsg}");
-        
-        responseMock.expect("sendError", C.args(C.eq(404), C.eq("abc")));
-        result.execute(invocation);
-        responseMock.verify();
-    }
-    
-    public void testErrorMessageIsNotParsedAndSet() throws Exception {
-        ActionContext.getContext().getValueStack().set("errMsg", "abc");
-        result.setError("404");
-        result.setParse(false);
-        result.setErrorMessage("${errMsg}");
-        
-        responseMock.expect("sendError", C.args(C.eq(404), C.eq("${errMsg}")));
-        result.execute(invocation);
-        responseMock.verify();
-    }
-
-    public void testStatusIsSet() throws Exception {
-        responseMock.expect("setStatus", C.eq(123));
-        result.setStatus(123);
-        result.execute(invocation);
-        responseMock.verify();
-    }
-    
-    public void testErrorIsSet() throws Exception {
-        responseMock.expect("sendError", C.eq(404));
-        result.setError("404");
-        result.execute(invocation);
-        responseMock.verify();
-    }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        result = new HttpHeaderResult();
-        responseMock = new Mock(HttpServletResponse.class);
-        response = (HttpServletResponse) responseMock.proxy();
-        invocation = (ActionInvocation) new Mock(ActionInvocation.class).proxy();
-        reflectionProvider = container.getInstance(ReflectionProvider.class);
-        ServletActionContext.setResponse(response);
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        ActionContext.setContext(null);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java
deleted file mode 100644
index 959458a..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.mock.MockActionInvocation;
-import com.opensymphony.xwork2.util.ClassLoaderUtil;
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.struts2.StrutsStatics;
-import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.struts2.views.jsp.AbstractUITagTest;
-import org.apache.struts2.views.jsp.StrutsMockHttpServletResponse;
-import org.apache.struts2.views.jsp.StrutsMockServletContext;
-
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-/**
- * Test case for PlainTextResult.
- *
- */
-public class PlainTextResultTest extends StrutsInternalTestCase {
-
-    ValueStack stack;
-    MockActionInvocation invocation;
-    ActionContext context;
-    StrutsMockHttpServletResponse response;
-    PrintWriter writer;
-    StringWriter stringWriter;
-    StrutsMockServletContext servletContext;
-
-
-    public void testPlainText() throws Exception {
-        PlainTextResult result = new PlainTextResult();
-        result.setLocation("/someJspFile.jsp");
-
-        response.setExpectedContentType("text/plain");
-        response.setExpectedHeader("Content-Disposition", "inline");
-
-        try (InputStream jspResourceInputStream =
-            ClassLoaderUtil.getResourceAsStream(
-                "org/apache/struts2/dispatcher/someJspFile.jsp",
-                PlainTextResultTest.class)) {
-            servletContext.setResourceAsStream(jspResourceInputStream);
-            result.execute(invocation);
-
-            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
-            String e = AbstractUITagTest.normalize(
-                    readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
-            assertEquals(r, e);
-        }
-    }
-
-    public void testPlainTextWithoutSlash() throws Exception {
-        PlainTextResult result = new PlainTextResult();
-        result.setLocation("someJspFile.jsp");
-
-        response.setExpectedContentType("text/plain");
-        response.setExpectedHeader("Content-Disposition", "inline");
-
-        try (InputStream jspResourceInputStream =
-            ClassLoaderUtil.getResourceAsStream("org/apache/struts2/dispatcher/someJspFile.jsp", PlainTextResultTest.class)) {
-            servletContext.setResourceAsStream(jspResourceInputStream);
-            result.execute(invocation);
-
-            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
-            String e = AbstractUITagTest.normalize(readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
-            assertEquals(r, e);
-        }
-    }
-
-    public void testPlainTextWithEncoding() throws Exception {
-        PlainTextResult result = new PlainTextResult();
-        result.setLocation("/someJspFile.jsp");
-        result.setCharSet("UTF-8");
-
-        response.setExpectedContentType("text/plain; charset=UTF-8");
-        response.setExpectedHeader("Content-Disposition", "inline");
-
-        try (InputStream jspResourceInputStream =
-            ClassLoaderUtil.getResourceAsStream(
-                "org/apache/struts2/dispatcher/someJspFile.jsp",
-                PlainTextResultTest.class)) {
-            servletContext.setResourceAsStream(jspResourceInputStream);
-            result.execute(invocation);
-
-            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
-            String e = AbstractUITagTest.normalize(
-                    readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
-            assertEquals(r, e);
-        }
-    }
-
-    protected String readAsString(String resource) throws Exception {
-        try (InputStream is = ClassLoaderUtil.getResourceAsStream(resource, PlainTextResultTest.class)) {
-            int sizeRead = 0;
-            byte[] buffer = new byte[1024];
-            StringBuilder stringBuilder = new StringBuilder();
-            while((sizeRead = is.read(buffer)) != -1) {
-                stringBuilder.append(new String(buffer, 0, sizeRead));
-            }
-            return stringBuilder.toString();
-        }
-    }
-
-
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        stringWriter = new StringWriter();
-        writer = new PrintWriter(stringWriter);
-        response = new StrutsMockHttpServletResponse();
-        response.setWriter(writer);
-        servletContext = new StrutsMockServletContext();
-        stack = ActionContext.getContext().getValueStack();
-        context = new ActionContext(stack.getContext());
-        context.put(StrutsStatics.HTTP_RESPONSE, response);
-        context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
-        invocation = new MockActionInvocation();
-        invocation.setStack(stack);
-        invocation.setInvocationContext(context);
-    }
-
-
-    protected void tearDown() throws Exception {
-        stack = null;
-        invocation = null;
-        context = null;
-        response = null;
-        writer = null;
-        stringWriter = null;
-        servletContext = null;
-
-        super.tearDown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java
deleted file mode 100644
index 168ea04..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.ActionProxy;
-import com.opensymphony.xwork2.ObjectFactory;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.struts2.dispatcher.mapper.ActionMapper;
-import org.apache.struts2.views.util.DefaultUrlHelper;
-import org.easymock.IMocksControl;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.easymock.EasyMock.createControl;
-import static org.easymock.EasyMock.expect;
-
-
-/**
- * @version $Date$ $Id$
- */
-public class ServletActionRedirectResultTest extends StrutsInternalTestCase {
-
-    public void testIncludeParameterInResultWithConditionParseOn() throws Exception {
-
-        ResultConfig resultConfig = new ResultConfig.Builder("", "")
-            .addParam("actionName", "someActionName")
-            .addParam("namespace", "someNamespace")
-            .addParam("encode", "true")
-            .addParam("parse", "true")
-            .addParam("location", "someLocation")
-            .addParam("prependServletContext", "true")
-            .addParam("method", "someMethod")
-			.addParam("statusCode", "333")
-			.addParam("param1", "${#value1}")
-            .addParam("param2", "${#value2}")
-            .addParam("param3", "${#value3}")
-            .addParam("anchor", "${#fragment}")
-            .build();
-
-
-
-        ActionContext context = ActionContext.getContext();
-        ValueStack stack = context.getValueStack();
-        context.getContextMap().put("value1", "value 1");
-        context.getContextMap().put("value2", "value 2");
-        context.getContextMap().put("value3", "value 3");
-        MockHttpServletRequest req = new MockHttpServletRequest();
-        MockHttpServletResponse res = new MockHttpServletResponse();
-        context.put(ServletActionContext.HTTP_REQUEST, req);
-        context.put(ServletActionContext.HTTP_RESPONSE, res);
-
-
-        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
-        results.put("myResult", resultConfig);
-
-        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
-                .addResultConfigs(results).build();
-
-        ServletActionRedirectResult result = new ServletActionRedirectResult();
-        result.setActionName("myAction");
-        result.setNamespace("/myNamespace");
-        result.setParse(true);
-        result.setEncode(false);
-        result.setPrependServletContext(false);
-        result.setAnchor("fragment");
-        result.setUrlHelper(new DefaultUrlHelper());
-
-        IMocksControl control = createControl();
-        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
-        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
-        expect(mockInvocation.getProxy()).andReturn(mockActionProxy);
-        expect(mockInvocation.getResultCode()).andReturn("myResult");
-        expect(mockActionProxy.getConfig()).andReturn(actionConfig);
-        expect(mockInvocation.getInvocationContext()).andReturn(context);
-        expect(mockInvocation.getStack()).andReturn(stack).anyTimes();
-
-        control.replay();
-        result.setActionMapper(container.getInstance(ActionMapper.class));
-        result.execute(mockInvocation);
-        assertEquals("/myNamespace/myAction.action?param1=value+1&param2=value+2&param3=value+3#fragment", res.getRedirectedUrl());
-
-        control.verify();
-    }
-
-    public void testIncludeParameterInResult() throws Exception {
-
-        ResultConfig resultConfig = new ResultConfig.Builder("", "")
-            .addParam("actionName", "someActionName")
-            .addParam("namespace", "someNamespace")
-            .addParam("encode", "true")
-            .addParam("parse", "true")
-            .addParam("location", "someLocation")
-            .addParam("prependServletContext", "true")
-            .addParam("method", "someMethod")
-            .addParam("param1", "value 1")
-            .addParam("param2", "value 2")
-            .addParam("param3", "value 3")
-            .addParam("anchor", "fragment")
-            .build();
-
-        ActionContext context = ActionContext.getContext();
-        MockHttpServletRequest req = new MockHttpServletRequest();
-        MockHttpServletResponse res = new MockHttpServletResponse();
-        context.put(ServletActionContext.HTTP_REQUEST, req);
-        context.put(ServletActionContext.HTTP_RESPONSE, res);
-
-
-        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
-        results.put("myResult", resultConfig);
-
-        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
-                .addResultConfigs(results).build();
-
-        ServletActionRedirectResult result = new ServletActionRedirectResult();
-        result.setActionName("myAction");
-        result.setNamespace("/myNamespace");
-        result.setParse(false);
-        result.setEncode(false);
-        result.setPrependServletContext(false);
-        result.setAnchor("fragment");
-        result.setUrlHelper(new DefaultUrlHelper());
-
-        IMocksControl control = createControl();
-        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
-        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
-        expect(mockInvocation.getProxy()).andReturn(mockActionProxy);
-        expect(mockInvocation.getResultCode()).andReturn("myResult");
-        expect(mockActionProxy.getConfig()).andReturn(actionConfig);
-        expect(mockInvocation.getInvocationContext()).andReturn(context);
-
-        control.replay();
-        result.setActionMapper(container.getInstance(ActionMapper.class));
-        result.execute(mockInvocation);
-        assertEquals("/myNamespace/myAction.action?param1=value+1&param2=value+2&param3=value+3#fragment", res.getRedirectedUrl());
-
-        control.verify();
-    }
-
-    public void testBuildResultWithParameter() throws Exception {
-
-        ResultConfig resultConfig = new ResultConfig.Builder("", ServletActionRedirectResult.class.getName())
-            .addParam("actionName", "someActionName")
-            .addParam("namespace", "someNamespace")
-            .addParam("encode", "true")
-            .addParam("parse", "true")
-            .addParam("location", "someLocation")
-            .addParam("prependServletContext", "true")
-            .addParam("method", "someMethod")
-            .addParam("param1", "value 1")
-            .addParam("param2", "value 2")
-            .addParam("param3", "value 3")
-            .addParam("anchor", "fragment")
-            .build();
-
-        ObjectFactory factory = container.getInstance(ObjectFactory.class);
-        ServletActionRedirectResult result = (ServletActionRedirectResult) factory.buildResult(resultConfig, new HashMap<String, Object>());
-        assertNotNull(result);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java
deleted file mode 100644
index 2d93b8c..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import ognl.Ognl;
-
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.struts2.StrutsStatics;
-
-import com.mockobjects.dynamic.C;
-import com.mockobjects.dynamic.Mock;
-import com.opensymphony.xwork2.ActionContext;
-
-
-/**
- *
- */
-public class ServletDispatcherResultTest extends StrutsInternalTestCase implements StrutsStatics {
-
-    public void testInclude() {
-        ServletDispatcherResult view = new ServletDispatcherResult();
-        view.setLocation("foo.jsp");
-
-        Mock dispatcherMock = new Mock(RequestDispatcher.class);
-        dispatcherMock.expect("include", C.ANY_ARGS);
-
-        Mock requestMock = new Mock(HttpServletRequest.class);
-        requestMock.expectAndReturn("getAttribute", "struts.actiontag.invocation", null);
-        requestMock.expectAndReturn("getRequestDispatcher", C.args(C.eq("foo.jsp")), dispatcherMock.proxy());
-
-        Mock responseMock = new Mock(HttpServletResponse.class);
-        responseMock.expectAndReturn("isCommitted", Boolean.TRUE);
-
-        ActionContext ac = new ActionContext(Ognl.createDefaultContext(null));
-        ActionContext.setContext(ac);
-        ServletActionContext.setRequest((HttpServletRequest) requestMock.proxy());
-        ServletActionContext.setResponse((HttpServletResponse) responseMock.proxy());
-
-        try {
-            view.execute(null);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-
-        dispatcherMock.verify();
-        requestMock.verify();
-        dispatcherMock.verify();
-    }
-
-    public void testSimple() {
-        ServletDispatcherResult view = new ServletDispatcherResult();
-        view.setLocation("foo.jsp");
-
-        Mock dispatcherMock = new Mock(RequestDispatcher.class);
-        dispatcherMock.expect("forward", C.ANY_ARGS);
-
-        Mock requestMock = new Mock(HttpServletRequest.class);
-        requestMock.expectAndReturn("getAttribute", "struts.actiontag.invocation", null);
-        requestMock.expectAndReturn("getAttribute", "javax.servlet.include.servlet_path", null);
-        requestMock.expectAndReturn("getRequestDispatcher", C.args(C.eq("foo.jsp")), dispatcherMock.proxy());
-        requestMock.expect("setAttribute", C.ANY_ARGS); // this is a bad mock, but it works
-        requestMock.expect("setAttribute", C.ANY_ARGS); // this is a bad mock, but it works
-        requestMock.matchAndReturn("getRequestURI", "foo.jsp");
-
-        Mock responseMock = new Mock(HttpServletResponse.class);
-        responseMock.expectAndReturn("isCommitted", Boolean.FALSE);
-
-        ActionContext ac = new ActionContext(Ognl.createDefaultContext(null));
-        ActionContext.setContext(ac);
-        ServletActionContext.setRequest((HttpServletRequest) requestMock.proxy());
-        ServletActionContext.setResponse((HttpServletResponse) responseMock.proxy());
-
-        try {
-            view.execute(null);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-
-        dispatcherMock.verify();
-        requestMock.verify();
-        dispatcherMock.verify();
-    }
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
deleted file mode 100644
index ab40dfc..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import static javax.servlet.http.HttpServletResponse.SC_SEE_OTHER;
-import static org.easymock.EasyMock.createControl;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import ognl.Ognl;
-
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.struts2.StrutsStatics;
-import org.apache.struts2.dispatcher.mapper.ActionMapper;
-import org.apache.struts2.views.util.DefaultUrlHelper;
-import org.easymock.IMocksControl;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-
-import com.mockobjects.dynamic.C;
-import com.mockobjects.dynamic.Mock;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.ActionProxy;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
-import com.opensymphony.xwork2.mock.MockActionInvocation;
-import com.opensymphony.xwork2.util.ValueStack;
-
-
-/**
- */
-public class ServletRedirectResultTest extends StrutsInternalTestCase implements StrutsStatics {
-
-    protected ServletRedirectResult view;
-    private Mock requestMock;
-    private Mock responseMock;
-    protected ActionInvocation ai;
-
-
-    public void testAbsoluteRedirect() {
-        view.setLocation("/bar/foo.jsp");
-        responseMock.expectAndReturn("encodeRedirectURL", "/context/bar/foo.jsp", "/context/bar/foo.jsp");
-        responseMock.expect("sendRedirect", C.args(C.eq("/context/bar/foo.jsp")));
-
-        try {
-            view.execute(ai);
-            requestMock.verify();
-            responseMock.verify();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    public void testFullUrlRedirect() {
-        view.setLocation("http://localhost/bar/foo.jsp");
-        responseMock.expectAndReturn("encodeRedirectURL", C.args(C.eq("http://localhost/bar/foo.jsp")), "http://localhost/bar/foo.jsp");
-        responseMock.expect("sendRedirect", C.args(C.eq("http://localhost/bar/foo.jsp")));
-
-        try {
-            view.execute(ai);
-            requestMock.verify();
-            responseMock.verify();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    public void testFullUrlRedirectWithSpaces() {
-        view.setLocation("http://localhost/bar/foo some.pdf");
-        responseMock.expectAndReturn("encodeRedirectURL", C.args(C.eq("http://localhost/bar/foo some.pdf")), "http://localhost/bar/foo some.pdf");
-        responseMock.expect("sendRedirect", C.args(C.eq("http://localhost/bar/foo some.pdf")));
-
-        try {
-            view.execute(ai);
-            requestMock.verify();
-            responseMock.verify();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    public void testFullUrlRedirectWithParams() {
-        view.setLocation("http://localhost/bar/foo.action?param=1&param 2=3");
-        responseMock.expectAndReturn("encodeRedirectURL", C.args(C.eq("http://localhost/bar/foo.action?param=1&param 2=3")), "http://localhost/bar/foo.action?param=1&param 2=3");
-        responseMock.expect("sendRedirect", C.args(C.eq("http://localhost/bar/foo.action?param=1&param 2=3")));
-
-        try {
-            view.execute(ai);
-            requestMock.verify();
-            responseMock.verify();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    public void testAbsoluteRedirect303() {
-        view.setLocation("/bar/foo.jsp");
-        view.setStatusCode(303);
-        responseMock.expectAndReturn("encodeRedirectURL", "/context/bar/foo.jsp", "/context/bar/foo.jsp");
-        responseMock.expect("setStatus", C.args(C.eq(SC_SEE_OTHER)));
-        responseMock.expect("setHeader", C.args(C.eq("Location"), C.eq("/context/bar/foo.jsp")));
-        StringWriter writer = new StringWriter();
-        responseMock.matchAndReturn("getWriter", new PrintWriter(writer));
-
-        try {
-            view.execute(ai);
-            requestMock.verify();
-            responseMock.verify();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-        assertEquals("/context/bar/foo.jsp", writer.toString());
-    }
-
-    public void testAbsoluteRedirectAnchor() {
-        view.setLocation("/bar/foo.jsp");
-        view.setAnchor("fragment");
-        responseMock.expectAndReturn("encodeRedirectURL", "/context/bar/foo.jsp#fragment", "/context/bar/foo.jsp#fragment");
-        responseMock.expect("sendRedirect", C.args(C.eq("/context/bar/foo.jsp#fragment")));
-
-        try {
-            view.execute(ai);
-            requestMock.verify();
-            responseMock.verify();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-    public void testPrependServletContextFalse() {
-        view.setLocation("/bar/foo.jsp");
-        view.setPrependServletContext(false);
-        responseMock.expectAndReturn("encodeRedirectURL", "/bar/foo.jsp", "/bar/foo.jsp");
-        responseMock.expect("sendRedirect", C.args(C.eq("/bar/foo.jsp")));
-
-        try {
-            view.execute(ai);
-            requestMock.verify();
-            responseMock.verify();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
-        }
-    }
-
-    public void testRelativeRedirect() throws Exception {
-        view.setLocation("foo.jsp");
-        requestMock.expectAndReturn("getParameterMap", new HashMap());
-        requestMock.expectAndReturn("getServletPath", "/namespace/some.action");
-        requestMock.expectAndReturn("getRequestURI", "/namespace/some.action");
-        requestMock.expectAndReturn("getAttribute", C.ANY_ARGS, null);
-        responseMock.expectAndReturn("encodeRedirectURL", "/context/namespace/foo.jsp", "/context/namespace/foo.jsp");
-        responseMock.expect("sendRedirect", C.args(C.eq("/context/namespace/foo.jsp")));
-
-        view.execute(ai);
-
-        requestMock.verify();
-        responseMock.verify();
-    }
-    
-    public void testMultipleParametersRedirect() throws Exception {
-        view.setLocation("foo.jsp?foo=bar&amp;baz=jim");
-        requestMock.expectAndReturn("getParameterMap", new HashMap());
-        requestMock.expectAndReturn("getServletPath", "/namespace/some.action");
-        requestMock.expectAndReturn("getRequestURI", "/namespace/some.action");
-        requestMock.expectAndReturn("getAttribute", C.ANY_ARGS, null);
-        responseMock.expectAndReturn("encodeRedirectURL", "/context/namespace/foo.jsp?foo=bar&amp;baz=jim", "/context/namespace/foo.jsp?foo=bar&baz=jim");
-        responseMock.expect("sendRedirect", C.args(C.eq("/context/namespace/foo.jsp?foo=bar&baz=jim")));
-
-        view.execute(ai);
-
-        requestMock.verify();
-        responseMock.verify();
-    }
-
-    public void testIncludeParameterInResult() throws Exception {
-
-        ResultConfig resultConfig = new ResultConfig.Builder("", "")
-            .addParam("namespace", "someNamespace")
-            .addParam("encode", "true")
-            .addParam("parse", "true")
-            .addParam("location", "someLocation")
-            .addParam("prependServletContext", "true")
-            .addParam("method", "someMethod")
-            .addParam("statusCode", "333")
-            .addParam("param1", "value 1")
-            .addParam("param2", "value 2")
-            .addParam("param3", "value 3")
-            .build();
-
-        ActionContext context = ActionContext.getContext();
-        MockHttpServletRequest req = new MockHttpServletRequest();
-        MockHttpServletResponse res = new MockHttpServletResponse();
-        context.put(ServletActionContext.HTTP_REQUEST, req);
-        context.put(ServletActionContext.HTTP_RESPONSE, res);
-
-
-        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
-        results.put("myResult", resultConfig);
-
-        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
-                .addResultConfigs(results).build();
-
-        ServletRedirectResult result = new ServletRedirectResult();
-        result.setLocation("/myNamespace/myAction.action");
-        result.setParse(false);
-        result.setEncode(false);
-        result.setPrependServletContext(false);
-        result.setAnchor("fragment");
-        result.setUrlHelper(new DefaultUrlHelper());
-
-        IMocksControl control = createControl();
-        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
-        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
-        expect(mockInvocation.getProxy()).andReturn(mockActionProxy);
-        expect(mockInvocation.getResultCode()).andReturn("myResult");
-        expect(mockActionProxy.getConfig()).andReturn(actionConfig);
-        expect(mockInvocation.getInvocationContext()).andReturn(context);
-
-        control.replay();
-        result.setActionMapper(container.getInstance(ActionMapper.class));
-        result.execute(mockInvocation);
-        assertEquals("/myNamespace/myAction.action?param1=value+1&param2=value+2&param3=value+3#fragment", res.getRedirectedUrl());
-        control.verify();
-    }
-
-    public void testIncludeCollectionParameterInResult() throws Exception {
-        List<String> paramValues = new ArrayList<String>();
-        paramValues.add("value 1");
-        paramValues.add("");
-        paramValues.add("value 2");
-        paramValues.add(null);
-
-        ResultConfig resultConfig = new ResultConfig.Builder("", "")
-            .addParam("namespace", "someNamespace")
-            .addParam("param", "${list}")
-            .build();
-
-        ActionContext context = ActionContext.getContext();
-        MockHttpServletRequest req = new MockHttpServletRequest();
-        MockHttpServletResponse res = new MockHttpServletResponse();
-        context.put(ServletActionContext.HTTP_REQUEST, req);
-        context.put(ServletActionContext.HTTP_RESPONSE, res);
-
-        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
-        results.put("myResult", resultConfig);
-
-        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
-                .addResultConfigs(results).build();
-
-        ServletRedirectResult result = new ServletRedirectResult();
-        result.setLocation("/myNamespace/myAction.action");
-        result.setParse(true);
-        result.setEncode(false);
-        result.setPrependServletContext(false);
-        result.setUrlHelper(new DefaultUrlHelper());
-        result.setSuppressEmptyParameters(true);
-
-        IMocksControl control = createControl();
-        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
-        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
-
-        ValueStack mockValueStack = control.createMock(ValueStack.class);
-        Map<String, Object> mockContext = new HashMap<String, Object>();
-        mockContext.put(ActionContext.CONTAINER, container);
-
-        expect(mockInvocation.getStack()).andReturn(mockValueStack);
-        expect(mockValueStack.getContext()).andReturn(mockContext);
-
-        expect(mockInvocation.getStack()).andReturn(mockValueStack);
-
-        expect(mockValueStack.findValue("list")).andReturn(paramValues); // no asType !!!
-
-        expect(mockInvocation.getProxy()).andReturn(mockActionProxy);
-        expect(mockInvocation.getResultCode()).andReturn("myResult");
-        expect(mockActionProxy.getConfig()).andReturn(actionConfig);
-        expect(mockInvocation.getInvocationContext()).andReturn(context);
-
-        expect(mockValueStack.getContext()).andReturn(mockContext);
-
-        control.replay();
-        result.setActionMapper(container.getInstance(ActionMapper.class));
-        result.execute(mockInvocation);
-        assertEquals("/myNamespace/myAction.action?param=value+1&param=value+2", res.getRedirectedUrl());
-        control.verify();
-    }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        configurationManager.getConfiguration().
-            addPackageConfig("foo", new PackageConfig.Builder("foo").namespace("/namespace").build());
-
-        view = new ServletRedirectResult();
-        container.inject(view);
-
-        responseMock = new Mock(HttpServletResponse.class);
-
-        requestMock = new Mock(HttpServletRequest.class);
-        requestMock.matchAndReturn("getContextPath", "/context");
-
-         ResultConfig resultConfig = new ResultConfig.Builder("", "").build();
-
-        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
-        results.put("myResult", resultConfig);
-
-        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
-                .addResultConfigs(results).build();
-
-        ActionContext ac = new ActionContext(Ognl.createDefaultContext(null));
-        ac.put(ServletActionContext.HTTP_REQUEST, requestMock.proxy());
-        ac.put(ServletActionContext.HTTP_RESPONSE, responseMock.proxy());
-        MockActionInvocation ai = new MockActionInvocation();
-        ai.setInvocationContext(ac);
-        ai.setResultCode("myResult");
-        ActionProxy mockActionProxy = createNiceMock(ActionProxy.class);
-        ai.setProxy(mockActionProxy);
-        expect(mockActionProxy.getConfig()).andReturn(actionConfig).anyTimes();
-        replay(mockActionProxy);
-        this.ai = ai;
-        ai.setStack(ActionContext.getContext().getValueStack());
-    }
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java
deleted file mode 100644
index 147823d..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import com.opensymphony.xwork2.Action;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.mock.MockActionInvocation;
-import com.opensymphony.xwork2.util.ClassLoaderUtil;
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsInternalTestCase;
-import org.springframework.mock.web.MockHttpServletResponse;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-
-/**
- * Unit test for {@link StreamResult}.
- *
- */
-public class StreamResultTest extends StrutsInternalTestCase {
-
-    private StreamResult result;
-    private MockHttpServletResponse response;
-
-    private MockActionInvocation mai;
-    private ValueStack stack;
-    private int contentLength = 0;
-
-    public void testStreamResultNoInputName() throws Exception {
-        result.setParse(false);
-        result.setInputName(null);
-
-        try {
-            result.doExecute("helloworld", mai);
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // success
-        }
-    }
-
-    public void testStreamResultParseNoInputName() throws Exception {
-        result.setParse(true);
-        result.setInputName("${top}");
-
-        try {
-            result.doExecute("helloworld", mai);
-            fail("Should have thrown an IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // success
-        }
-    }
-
-    public void testStreamResultDefault() throws Exception {
-        result.setInputName("streamForImage");
-
-        result.doExecute("helloworld", mai);
-
-        assertEquals(String.valueOf(contentLength), result.getContentLength());
-        assertEquals("text/plain", result.getContentType());
-        assertEquals("streamForImage", result.getInputName());
-        assertEquals(1024, result.getBufferSize()); // 1024 is default
-        assertEquals("inline", result.getContentDisposition());
-
-        assertEquals("text/plain", response.getContentType());
-        assertEquals(contentLength, response.getContentLength());
-        assertEquals("inline", response.getHeader("Content-disposition"));
-    }
-
-    public void testStreamResultWithCharSet() throws Exception {
-        result.setInputName("streamForImage");
-        result.setContentCharSet("ISO-8859-1");
-        result.doExecute("helloworld", mai);
-
-        assertEquals(String.valueOf(contentLength), result.getContentLength());
-        assertEquals("text/plain", result.getContentType());
-        assertEquals("streamForImage", result.getInputName());
-        assertEquals(1024, result.getBufferSize()); // 1024 is default
-        assertEquals("inline", result.getContentDisposition());
-        assertEquals("text/plain;charset=ISO-8859-1", response.getContentType());
-        assertEquals(contentLength, response.getContentLength());
-        assertEquals("inline", response.getHeader("Content-disposition"));
-    }
-
-    public void testStreamResultWithCharSet2() throws Exception {
-        result.setParse(true);
-        result.setInputName("streamForImage");
-        result.setContentCharSet("${contentCharSetMethod}");
-
-        result.doExecute("helloworld", mai);
-
-        assertEquals(String.valueOf(contentLength), result.getContentLength());
-        assertEquals("text/plain", result.getContentType());
-        assertEquals("streamForImage", result.getInputName());
-        assertEquals(1024, result.getBufferSize()); // 1024 is default
-        assertEquals("inline", result.getContentDisposition());
-        assertEquals("text/plain;charset=UTF-8", response.getContentType());
-        assertEquals(contentLength, response.getContentLength());
-        assertEquals("inline", response.getHeader("Content-disposition"));
-    }
-
-    public void testAllowCacheDefault() throws Exception {
-        result.setInputName("streamForImage");
-
-        result.doExecute("helloworld", mai);
-
-        //check that that headers are not set by default        
-        assertNull(response.getHeader("Pragma"));
-        assertNull(response.getHeader("Cache-Control"));
-    }
-
-     public void testAllowCacheFalse() throws Exception {
-        result.setInputName("streamForImage");
-        result.setAllowCaching(false);
-        result.doExecute("helloworld", mai);
-
-        //check that that headers are not set by default
-        assertEquals("no-cache", response.getHeader("Pragma"));
-        assertEquals("no-cache", response.getHeader("Cache-Control"));
-    }
-
-    public void testStreamResultNoDefault() throws Exception {
-        // it's not easy to test using easymock as we use getOutputStream on HttpServletResponse.
-        result.setParse(false);
-        result.setInputName("streamForImage");
-        result.setBufferSize(128);
-        result.setContentLength(String.valueOf(contentLength));
-        result.setContentDisposition("filename=\"logo.png\"");
-        result.setContentType("image/jpeg");
-
-        result.doExecute("helloworld", mai);
-
-        assertEquals(String.valueOf(contentLength), result.getContentLength());
-        assertEquals("image/jpeg", result.getContentType());
-        assertEquals("streamForImage", result.getInputName());
-        assertEquals(128, result.getBufferSize());
-        assertEquals("filename=\"logo.png\"", result.getContentDisposition());
-
-        assertEquals("image/jpeg", response.getContentType());
-        assertEquals(contentLength, response.getContentLength());
-        assertEquals("filename=\"logo.png\"", response.getHeader("Content-disposition"));
-    }
-
-    public void testStreamResultParse1() throws Exception {
-        ///////////////////
-        result.setParse(true);
-        // ${...} conditionalParse of Result, returns String,
-        // which gets evaluated to the stack, that's how it works.
-        // We use ${streamForImageAsString} that returns "streamForImage"
-        // which is a property that returns an InputStream object.
-        result.setInputName("${streamForImageAsString}");
-        result.setBufferSize(128);
-        result.setContentLength(String.valueOf(contentLength));
-        result.setContentDisposition("filename=\"logo.png\"");
-        result.setContentType("image/jpeg");
-
-        result.doExecute("helloworld", mai);
-
-        assertEquals(String.valueOf(contentLength), result.getContentLength());
-        assertEquals("image/jpeg", result.getContentType());
-        assertEquals("${streamForImageAsString}", result.getInputName());
-        assertEquals(128, result.getBufferSize());
-        assertEquals("filename=\"logo.png\"", result.getContentDisposition());
-
-        assertEquals("image/jpeg", response.getContentType());
-        assertEquals(contentLength, response.getContentLength());
-        assertEquals("filename=\"logo.png\"", response.getHeader("Content-disposition"));
-    }
-
-    public void testStreamResultParse2() throws Exception {
-        ///////////////////
-        result.setParse(true);
-        // This time we dun use ${...}, so streamForImage will
-        // be evaluated to the stack, which should reaturn an
-        // InputStream object, cause there's such a property in
-        // the action object itself.
-        result.setInputName("streamForImage");
-        result.setBufferSize(128);
-        result.setContentLength(String.valueOf(contentLength));
-        result.setContentDisposition("filename=\"logo.png\"");
-        result.setContentType("image/jpeg");
-
-        result.doExecute("helloworld", mai);
-
-        assertEquals(String.valueOf(contentLength), result.getContentLength());
-        assertEquals("image/jpeg", result.getContentType());
-        assertEquals("streamForImage", result.getInputName());
-        assertEquals(128, result.getBufferSize());
-        assertEquals("filename=\"logo.png\"", result.getContentDisposition());
-
-        assertEquals("image/jpeg", response.getContentType());
-        assertEquals(contentLength, response.getContentLength());
-        assertEquals("filename=\"logo.png\"", response.getHeader("Content-disposition"));
-    }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        response = new MockHttpServletResponse();
-
-        result = new StreamResult();
-        stack = ActionContext.getContext().getValueStack();
-
-        MyImageAction action = new MyImageAction();
-        contentLength = (int) action.getContentLength();
-
-        mai = new com.opensymphony.xwork2.mock.MockActionInvocation();
-        mai.setAction(action);
-        mai.setStack(stack);
-        mai.setInvocationContext(ActionContext.getContext());
-        stack.push(action);
-
-        ActionContext.getContext().put(ServletActionContext.HTTP_RESPONSE, response);
-    }
-
-
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        response = null;
-        result = null;
-        stack = null;
-        contentLength = 0;
-        mai = null;
-    }
-
-    public class MyImageAction implements Action {
-
-        public InputStream getStreamForImage() throws Exception {
-            // just use src/test/log4j2.xml as test file
-            URL url = ClassLoaderUtil.getResource("log4j2.xml", StreamResultTest.class);
-            File file = new File(new URI(url.toString()));
-            FileInputStream fis = new FileInputStream(file);
-            return fis;
-        }
-
-        public String execute() throws Exception {
-            return SUCCESS;
-        }
-
-        public long getContentLength() throws Exception {
-            URL url = ClassLoaderUtil.getResource("log4j2.xml", StreamResultTest.class);
-            File file = new File(new URI(url.toString()));
-            return file.length();
-        }
-
-        public String getStreamForImageAsString() {
-            return "streamForImage";
-        }
-
-        public String getContentCharSetMethod() {
-            return "UTF-8";
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java b/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java
deleted file mode 100644
index cc4bf6c..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.struts2.StrutsInternalTestCase;
-import org.easymock.EasyMock;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.ActionSupport;
-import com.opensymphony.xwork2.util.ValueStack;
-
-/**
- * Test case for StrutsResultSupport.
- */
-public class StrutsResultSupportTest extends StrutsInternalTestCase {
-
-
-    public void testParse() throws Exception {
-        ValueStack stack = ActionContext.getContext().getValueStack();
-        stack.push(new ActionSupport() {
-            public String getMyLocation() {
-                return "ThisIsMyLocation";
-            }
-        });
-
-        ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
-        mockActionInvocation.getStack();
-        EasyMock.expectLastCall().andReturn(stack);
-        EasyMock.replay(mockActionInvocation);
-
-        InternalStrutsResultSupport result = new InternalStrutsResultSupport();
-        result.setParse(true);
-        result.setEncode(false);
-        result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
-
-        result.execute(mockActionInvocation);
-
-        assertNotNull(result.getInternalLocation());
-        assertEquals("/pages/myJsp.jsp?location=ThisIsMyLocation", result.getInternalLocation());
-        EasyMock.verify(mockActionInvocation);
-    }
-
-    public void testParseAndEncode() throws Exception {
-        ValueStack stack = ActionContext.getContext().getValueStack();
-        stack.push(new ActionSupport() {
-            public String getMyLocation() {
-                return "/myPage?param=value&param1=value1";
-            }
-        });
-
-        ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
-        mockActionInvocation.getStack();
-        EasyMock.expectLastCall().andReturn(stack);
-        EasyMock.replay(mockActionInvocation);
-
-        InternalStrutsResultSupport result = new InternalStrutsResultSupport();
-        result.setParse(true);
-        result.setEncode(true);
-        result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
-
-        result.execute(mockActionInvocation);
-
-        assertNotNull(result.getInternalLocation());
-        assertEquals("/pages/myJsp.jsp?location=%2FmyPage%3Fparam%3Dvalue%26param1%3Dvalue1", result.getInternalLocation());
-        EasyMock.verify(mockActionInvocation);
-    }
-
-
-    public void testNoParseAndEncode() throws Exception {
-        ValueStack stack = ActionContext.getContext().getValueStack();
-        stack.push(new ActionSupport() {
-            public String getMyLocation() {
-                return "myLocation.jsp";
-            }
-        });
-
-        ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
-        EasyMock.replay(mockActionInvocation);
-
-        InternalStrutsResultSupport result = new InternalStrutsResultSupport();
-        result.setParse(false);
-        result.setEncode(false); // don't really need this, as encode is only valid when parse is true.
-        result.setLocation("/pages/myJsp.jsp?location=${myLocation}");
-
-        result.execute(mockActionInvocation);
-
-        assertNotNull(result.getInternalLocation());
-        assertEquals("/pages/myJsp.jsp?location=${myLocation}", result.getInternalLocation());
-        EasyMock.verify(mockActionInvocation);
-    }
-
-    public void testConditionalParseCollection() throws Exception {
-        ValueStack stack = ActionContext.getContext().getValueStack();
-        stack.push(new ActionSupport() {
-            public List<String> getList() {
-                return new ArrayList<String>(){{
-                    add("val 1");
-                    add("val 2");
-                }};
-            }
-        });
-
-        ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
-        mockActionInvocation.getStack();
-        EasyMock.expectLastCall().andReturn(stack);
-        EasyMock.replay(mockActionInvocation);
-
-        InternalStrutsResultSupport result = new InternalStrutsResultSupport();
-        result.setParse(true);
-        result.setEncode(true);
-
-        Collection<String> collection = result.conditionalParseCollection("${list}", mockActionInvocation, true);
-
-        assertNotNull(collection);
-        assertEquals(2, collection.size());
-        assertTrue(collection.contains("val+1"));
-        assertTrue(collection.contains("val+2"));
-        EasyMock.verify(mockActionInvocation);
-    }
-
-    public static class InternalStrutsResultSupport extends StrutsResultSupport {
-        private String _internalLocation = null;
-
-        protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
-            _internalLocation = finalLocation;
-        }
-
-        public String getInternalLocation() {
-            return _internalLocation;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java
deleted file mode 100644
index 383e2c7..0000000
--- a/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * $Id$
- *
- * 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.dispatcher;
-
-import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.velocity.Template;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-
-import com.mockobjects.dynamic.Mock;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.ActionProxy;
-import com.opensymphony.xwork2.util.ValueStack;
-
-
-/**
- *
- */
-public class VelocityResultTest extends StrutsInternalTestCase {
-
-    ActionInvocation actionInvocation;
-    Mock mockActionProxy;
-    ValueStack stack;
-    String namespace;
-    TestVelocityEngine velocity;
-    VelocityResult result;
-
-
-    public void testCanResolveLocationUsingOgnl() throws Exception {
-        TestResult result = new TestResult();
-
-        String location = "/myaction.action";
-        Bean bean = new Bean();
-        bean.setLocation(location);
-
-        ValueStack stack = ActionContext.getContext().getValueStack();
-        stack.push(bean);
-
-        assertEquals(location, stack.findValue("location"));
-
-        result.setLocation("${location}");
-        result.execute(actionInvocation);
-        assertEquals(location, result.finalLocation);
-    }
-
-    public void testCanResolveLocationUsingStaticExpression() throws Exception {
-        TestResult result = new TestResult();
-        String location = "/any.action";
-        result.setLocation("${'" + location + "'}");
-        result.execute(actionInvocation);
-        assertEquals(location, result.finalLocation);
-    }
-
-    public void testResourcesFoundUsingAbsolutePath() throws Exception {
-        String location = "/WEB-INF/views/registration.vm";
-
-        Template template = result.getTemplate(stack, velocity, actionInvocation, location, "UTF-8");
-        assertNotNull(template);
-        assertEquals("expect absolute locations to be handled as is", location, velocity.templateName);
-    }
-
-    public void testResourcesFoundUsingNames() throws Exception {
-        String location = "Registration.vm";
-        String expectedTemplateName = namespace + "/" + location;
-
-        Template template = result.getTemplate(stack, velocity, actionInvocation, location, "UTF-8");
-        assertNotNull(template);
-        assertEquals("expect the prefix to be appended to the path when the location is not absolute", expectedTemplateName, velocity.templateName);
-    }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        namespace = "/html";
-        result = new VelocityResult();
-        stack = ActionContext.getContext().getValueStack();
-        ActionContext.getContext().setValueStack(stack);
-        velocity = new TestVelocityEngine();
-        mockActionProxy = new Mock(ActionProxy.class);
-        mockActionProxy.expectAndReturn("getNamespace", "/html");
-
-        Mock mockActionInvocation = new Mock(ActionInvocation.class);
-        mockActionInvocation.expectAndReturn("getProxy", mockActionProxy.proxy());
-        mockActionInvocation.expectAndReturn("getStack", stack);
-        actionInvocation = (ActionInvocation) mockActionInvocation.proxy();
-    }
-
-
-    class Bean {
-        private String location;
-
-        public void setLocation(String location) {
-            this.location = location;
-        }
-
-        public String getLocation() {
-            return location;
-        }
-    }
-
-    class TestResult extends StrutsResultSupport {
-
-        private static final long serialVersionUID = -1512206785088317315L;
-
-        public String finalLocation;
-
-        protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
-            this.finalLocation = finalLocation;
-        }
-    }
-
-    class TestVelocityEngine extends VelocityEngine {
-        public String templateName;
-
-        public Template getTemplate(String templateName) throws ResourceNotFoundException, ParseErrorException, Exception {
-            this.templateName = templateName;
-
-            return new Template();
-        }
-
-        public Template getTemplate(String templateName, String charSet) throws ResourceNotFoundException, ParseErrorException, Exception {
-            this.templateName = templateName;
-
-            return new Template();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
index 29bf8ad..4314672 100644
--- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
+++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
@@ -31,7 +31,7 @@ import com.opensymphony.xwork2.config.entities.PackageConfig;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.struts2.dispatcher.StrutsResultSupport;
+import org.apache.struts2.result.StrutsResultSupport;
 import org.apache.struts2.views.jsp.StrutsMockHttpServletRequest;
 
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java
index 3ba76c2..a419a18 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java
@@ -28,7 +28,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.struts2.StrutsInternalTestCase;
-import org.apache.struts2.dispatcher.ServletActionRedirectResult;
+import org.apache.struts2.result.ServletActionRedirectResult;
 import org.easymock.EasyMock;
 
 import com.opensymphony.xwork2.Action;

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/result/HttpHeaderResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/result/HttpHeaderResultTest.java b/core/src/test/java/org/apache/struts2/result/HttpHeaderResultTest.java
new file mode 100644
index 0000000..85849f1
--- /dev/null
+++ b/core/src/test/java/org/apache/struts2/result/HttpHeaderResultTest.java
@@ -0,0 +1,134 @@
+/*
+ * $Id$
+ *
+ * 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.result;
+
+import com.mockobjects.dynamic.C;
+import com.mockobjects.dynamic.Mock;
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsInternalTestCase;
+import org.apache.struts2.result.HttpHeaderResult;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * HttpHeaderResultTest
+ */
+public class HttpHeaderResultTest extends StrutsInternalTestCase {
+
+    ActionInvocation invocation;
+    HttpHeaderResult result;
+    HttpServletResponse response;
+    Mock responseMock;
+    ReflectionProvider reflectionProvider;
+
+    public void testHeaderValuesAreNotParsedWhenParseIsFalse() throws Exception {
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("headers.foo", "${bar}");
+        params.put("headers.baz", "baz");
+
+        Map<String, String> values = new HashMap<String, String>();
+        values.put("bar", "abc");
+        ActionContext.getContext().getValueStack().push(values);
+
+        reflectionProvider.setProperties(params, result);
+
+        responseMock.expect("addHeader", C.args(C.eq("foo"), C.eq("${bar}")));
+        responseMock.expect("addHeader", C.args(C.eq("baz"), C.eq("baz")));
+        result.setParse(false);
+        result.execute(invocation);
+        responseMock.verify();
+    }
+
+    public void testHeaderValuesAreParsedAndSet() throws Exception {
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("headers.foo", "${bar}");
+        params.put("headers.baz", "baz");
+
+        Map<String, String> values = new HashMap<String, String>();
+        values.put("bar", "abc");
+        ActionContext.getContext().getValueStack().push(values);
+
+        reflectionProvider.setProperties(params, result);
+
+        responseMock.expect("addHeader", C.args(C.eq("foo"), C.eq("abc")));
+        responseMock.expect("addHeader", C.args(C.eq("baz"), C.eq("baz")));
+        result.execute(invocation);
+        responseMock.verify();
+    }
+    
+    public void testErrorMessageIsParsedAndSet() throws Exception {
+        ActionContext.getContext().getValueStack().set("errMsg", "abc");
+        ActionContext.getContext().getValueStack().set("errCode", "404");
+        result.setError("${errCode}");
+        result.setErrorMessage("${errMsg}");
+        
+        responseMock.expect("sendError", C.args(C.eq(404), C.eq("abc")));
+        result.execute(invocation);
+        responseMock.verify();
+    }
+    
+    public void testErrorMessageIsNotParsedAndSet() throws Exception {
+        ActionContext.getContext().getValueStack().set("errMsg", "abc");
+        result.setError("404");
+        result.setParse(false);
+        result.setErrorMessage("${errMsg}");
+        
+        responseMock.expect("sendError", C.args(C.eq(404), C.eq("${errMsg}")));
+        result.execute(invocation);
+        responseMock.verify();
+    }
+
+    public void testStatusIsSet() throws Exception {
+        responseMock.expect("setStatus", C.eq(123));
+        result.setStatus(123);
+        result.execute(invocation);
+        responseMock.verify();
+    }
+    
+    public void testErrorIsSet() throws Exception {
+        responseMock.expect("sendError", C.eq(404));
+        result.setError("404");
+        result.execute(invocation);
+        responseMock.verify();
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        result = new HttpHeaderResult();
+        responseMock = new Mock(HttpServletResponse.class);
+        response = (HttpServletResponse) responseMock.proxy();
+        invocation = (ActionInvocation) new Mock(ActionInvocation.class).proxy();
+        reflectionProvider = container.getInstance(ReflectionProvider.class);
+        ServletActionContext.setResponse(response);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        ActionContext.setContext(null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java b/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java
new file mode 100644
index 0000000..faa631f
--- /dev/null
+++ b/core/src/test/java/org/apache/struts2/result/PlainTextResultTest.java
@@ -0,0 +1,156 @@
+/*
+ * $Id$
+ *
+ * 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.result;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.mock.MockActionInvocation;
+import com.opensymphony.xwork2.util.ClassLoaderUtil;
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.struts2.StrutsStatics;
+import org.apache.struts2.StrutsInternalTestCase;
+import org.apache.struts2.views.jsp.AbstractUITagTest;
+import org.apache.struts2.views.jsp.StrutsMockHttpServletResponse;
+import org.apache.struts2.views.jsp.StrutsMockServletContext;
+
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * Test case for PlainTextResult.
+ *
+ */
+public class PlainTextResultTest extends StrutsInternalTestCase {
+
+    ValueStack stack;
+    MockActionInvocation invocation;
+    ActionContext context;
+    StrutsMockHttpServletResponse response;
+    PrintWriter writer;
+    StringWriter stringWriter;
+    StrutsMockServletContext servletContext;
+
+
+    public void testPlainText() throws Exception {
+        PlainTextResult result = new PlainTextResult();
+        result.setLocation("/someJspFile.jsp");
+
+        response.setExpectedContentType("text/plain");
+        response.setExpectedHeader("Content-Disposition", "inline");
+
+        try (InputStream jspResourceInputStream =
+            ClassLoaderUtil.getResourceAsStream(
+                "org/apache/struts2/dispatcher/someJspFile.jsp",
+                PlainTextResultTest.class)) {
+            servletContext.setResourceAsStream(jspResourceInputStream);
+            result.execute(invocation);
+
+            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
+            String e = AbstractUITagTest.normalize(
+                    readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
+            assertEquals(r, e);
+        }
+    }
+
+    public void testPlainTextWithoutSlash() throws Exception {
+        PlainTextResult result = new PlainTextResult();
+        result.setLocation("someJspFile.jsp");
+
+        response.setExpectedContentType("text/plain");
+        response.setExpectedHeader("Content-Disposition", "inline");
+
+        try (InputStream jspResourceInputStream =
+            ClassLoaderUtil.getResourceAsStream("org/apache/struts2/dispatcher/someJspFile.jsp", PlainTextResultTest.class)) {
+            servletContext.setResourceAsStream(jspResourceInputStream);
+            result.execute(invocation);
+
+            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
+            String e = AbstractUITagTest.normalize(readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
+            assertEquals(r, e);
+        }
+    }
+
+    public void testPlainTextWithEncoding() throws Exception {
+        PlainTextResult result = new PlainTextResult();
+        result.setLocation("/someJspFile.jsp");
+        result.setCharSet("UTF-8");
+
+        response.setExpectedContentType("text/plain; charset=UTF-8");
+        response.setExpectedHeader("Content-Disposition", "inline");
+
+        try (InputStream jspResourceInputStream =
+            ClassLoaderUtil.getResourceAsStream(
+                "org/apache/struts2/dispatcher/someJspFile.jsp",
+                PlainTextResultTest.class)) {
+            servletContext.setResourceAsStream(jspResourceInputStream);
+            result.execute(invocation);
+
+            String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
+            String e = AbstractUITagTest.normalize(
+                    readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
+            assertEquals(r, e);
+        }
+    }
+
+    protected String readAsString(String resource) throws Exception {
+        try (InputStream is = ClassLoaderUtil.getResourceAsStream(resource, PlainTextResultTest.class)) {
+            int sizeRead = 0;
+            byte[] buffer = new byte[1024];
+            StringBuilder stringBuilder = new StringBuilder();
+            while((sizeRead = is.read(buffer)) != -1) {
+                stringBuilder.append(new String(buffer, 0, sizeRead));
+            }
+            return stringBuilder.toString();
+        }
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        stringWriter = new StringWriter();
+        writer = new PrintWriter(stringWriter);
+        response = new StrutsMockHttpServletResponse();
+        response.setWriter(writer);
+        servletContext = new StrutsMockServletContext();
+        stack = ActionContext.getContext().getValueStack();
+        context = new ActionContext(stack.getContext());
+        context.put(StrutsStatics.HTTP_RESPONSE, response);
+        context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
+        invocation = new MockActionInvocation();
+        invocation.setStack(stack);
+        invocation.setInvocationContext(context);
+    }
+
+
+    protected void tearDown() throws Exception {
+        stack = null;
+        invocation = null;
+        context = null;
+        response = null;
+        writer = null;
+        stringWriter = null;
+        servletContext = null;
+
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/6bc99ab9/core/src/test/java/org/apache/struts2/result/ServletActionRedirectResultTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/result/ServletActionRedirectResultTest.java b/core/src/test/java/org/apache/struts2/result/ServletActionRedirectResultTest.java
new file mode 100644
index 0000000..2bea0a1
--- /dev/null
+++ b/core/src/test/java/org/apache/struts2/result/ServletActionRedirectResultTest.java
@@ -0,0 +1,189 @@
+/*
+ * $Id$
+ *
+ * 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.result;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.ObjectFactory;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsInternalTestCase;
+import org.apache.struts2.dispatcher.mapper.ActionMapper;
+import org.apache.struts2.result.ServletActionRedirectResult;
+import org.apache.struts2.views.util.DefaultUrlHelper;
+import org.easymock.IMocksControl;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.easymock.EasyMock.createControl;
+import static org.easymock.EasyMock.expect;
+
+
+/**
+ * @version $Date$ $Id$
+ */
+public class ServletActionRedirectResultTest extends StrutsInternalTestCase {
+
+    public void testIncludeParameterInResultWithConditionParseOn() throws Exception {
+
+        ResultConfig resultConfig = new ResultConfig.Builder("", "")
+            .addParam("actionName", "someActionName")
+            .addParam("namespace", "someNamespace")
+            .addParam("encode", "true")
+            .addParam("parse", "true")
+            .addParam("location", "someLocation")
+            .addParam("prependServletContext", "true")
+            .addParam("method", "someMethod")
+			.addParam("statusCode", "333")
+			.addParam("param1", "${#value1}")
+            .addParam("param2", "${#value2}")
+            .addParam("param3", "${#value3}")
+            .addParam("anchor", "${#fragment}")
+            .build();
+
+
+
+        ActionContext context = ActionContext.getContext();
+        ValueStack stack = context.getValueStack();
+        context.getContextMap().put("value1", "value 1");
+        context.getContextMap().put("value2", "value 2");
+        context.getContextMap().put("value3", "value 3");
+        MockHttpServletRequest req = new MockHttpServletRequest();
+        MockHttpServletResponse res = new MockHttpServletResponse();
+        context.put(ServletActionContext.HTTP_REQUEST, req);
+        context.put(ServletActionContext.HTTP_RESPONSE, res);
+
+
+        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
+        results.put("myResult", resultConfig);
+
+        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
+                .addResultConfigs(results).build();
+
+        ServletActionRedirectResult result = new ServletActionRedirectResult();
+        result.setActionName("myAction");
+        result.setNamespace("/myNamespace");
+        result.setParse(true);
+        result.setEncode(false);
+        result.setPrependServletContext(false);
+        result.setAnchor("fragment");
+        result.setUrlHelper(new DefaultUrlHelper());
+
+        IMocksControl control = createControl();
+        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
+        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
+        expect(mockInvocation.getProxy()).andReturn(mockActionProxy);
+        expect(mockInvocation.getResultCode()).andReturn("myResult");
+        expect(mockActionProxy.getConfig()).andReturn(actionConfig);
+        expect(mockInvocation.getInvocationContext()).andReturn(context);
+        expect(mockInvocation.getStack()).andReturn(stack).anyTimes();
+
+        control.replay();
+        result.setActionMapper(container.getInstance(ActionMapper.class));
+        result.execute(mockInvocation);
+        assertEquals("/myNamespace/myAction.action?param1=value+1&param2=value+2&param3=value+3#fragment", res.getRedirectedUrl());
+
+        control.verify();
+    }
+
+    public void testIncludeParameterInResult() throws Exception {
+
+        ResultConfig resultConfig = new ResultConfig.Builder("", "")
+            .addParam("actionName", "someActionName")
+            .addParam("namespace", "someNamespace")
+            .addParam("encode", "true")
+            .addParam("parse", "true")
+            .addParam("location", "someLocation")
+            .addParam("prependServletContext", "true")
+            .addParam("method", "someMethod")
+            .addParam("param1", "value 1")
+            .addParam("param2", "value 2")
+            .addParam("param3", "value 3")
+            .addParam("anchor", "fragment")
+            .build();
+
+        ActionContext context = ActionContext.getContext();
+        MockHttpServletRequest req = new MockHttpServletRequest();
+        MockHttpServletResponse res = new MockHttpServletResponse();
+        context.put(ServletActionContext.HTTP_REQUEST, req);
+        context.put(ServletActionContext.HTTP_RESPONSE, res);
+
+
+        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
+        results.put("myResult", resultConfig);
+
+        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
+                .addResultConfigs(results).build();
+
+        ServletActionRedirectResult result = new ServletActionRedirectResult();
+        result.setActionName("myAction");
+        result.setNamespace("/myNamespace");
+        result.setParse(false);
+        result.setEncode(false);
+        result.setPrependServletContext(false);
+        result.setAnchor("fragment");
+        result.setUrlHelper(new DefaultUrlHelper());
+
+        IMocksControl control = createControl();
+        ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
+        ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
+        expect(mockInvocation.getProxy()).andReturn(mockActionProxy);
+        expect(mockInvocation.getResultCode()).andReturn("myResult");
+        expect(mockActionProxy.getConfig()).andReturn(actionConfig);
+        expect(mockInvocation.getInvocationContext()).andReturn(context);
+
+        control.replay();
+        result.setActionMapper(container.getInstance(ActionMapper.class));
+        result.execute(mockInvocation);
+        assertEquals("/myNamespace/myAction.action?param1=value+1&param2=value+2&param3=value+3#fragment", res.getRedirectedUrl());
+
+        control.verify();
+    }
+
+    public void testBuildResultWithParameter() throws Exception {
+
+        ResultConfig resultConfig = new ResultConfig.Builder("", ServletActionRedirectResult.class.getName())
+            .addParam("actionName", "someActionName")
+            .addParam("namespace", "someNamespace")
+            .addParam("encode", "true")
+            .addParam("parse", "true")
+            .addParam("location", "someLocation")
+            .addParam("prependServletContext", "true")
+            .addParam("method", "someMethod")
+            .addParam("param1", "value 1")
+            .addParam("param2", "value 2")
+            .addParam("param3", "value 3")
+            .addParam("anchor", "fragment")
+            .build();
+
+        ObjectFactory factory = container.getInstance(ObjectFactory.class);
+        ServletActionRedirectResult result = (ServletActionRedirectResult) factory.buildResult(resultConfig, new HashMap<String, Object>());
+        assertNotNull(result);
+    }
+    
+}