mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
IPAGE-5141
- all core tests compile
This commit is contained in:
@@ -352,7 +352,8 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
|
||||
endline;
|
||||
req.setContent(content.getBytes());
|
||||
|
||||
assertTrue(ServletFileUpload.isMultipartContent(req));
|
||||
fail("TODO");
|
||||
//assertTrue(ServletFileUpload.isMultipartContent(req));
|
||||
|
||||
MyFileupAction action = new MyFileupAction();
|
||||
container.inject(action);
|
||||
@@ -404,7 +405,8 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
|
||||
endline;
|
||||
req.setContent(content.getBytes());
|
||||
|
||||
assertTrue(ServletFileUpload.isMultipartContent(req));
|
||||
fail("TODO");
|
||||
//assertTrue(ServletFileUpload.isMultipartContent(req));
|
||||
|
||||
MyFileupAction action = new MyFileupAction();
|
||||
container.inject(action);
|
||||
|
||||
@@ -22,9 +22,10 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
import com.mockobjects.servlet.MockHttpServletRequest;
|
||||
import com.mockobjects.servlet.MockHttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
public class RolesInterceptorTest extends StrutsInternalTestCase {
|
||||
|
||||
@@ -127,9 +128,8 @@ public class RolesInterceptorTest extends StrutsInternalTestCase {
|
||||
|
||||
public void testHandleRejection() throws Exception {
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
response.setExpectedError(response.SC_FORBIDDEN);
|
||||
interceptor.handleRejection(null, response);
|
||||
response.verify();
|
||||
assertEquals(HttpServletResponse.SC_FORBIDDEN, response.getStatus());
|
||||
}
|
||||
|
||||
public void testAreRolesValid() throws Exception {
|
||||
|
||||
@@ -51,9 +51,6 @@ public class PlainTextResultTest extends StrutsInternalTestCase {
|
||||
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",
|
||||
@@ -66,15 +63,14 @@ public class PlainTextResultTest extends StrutsInternalTestCase {
|
||||
readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
|
||||
assertEquals(r, e);
|
||||
}
|
||||
assertEquals("text/plain", response.getContentType());
|
||||
assertEquals("inline", response.getHeader("Content-Disposition"));
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -84,6 +80,8 @@ public class PlainTextResultTest extends StrutsInternalTestCase {
|
||||
String e = AbstractUITagTest.normalize(readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
|
||||
assertEquals(r, e);
|
||||
}
|
||||
assertEquals("text/plain", response.getContentType());
|
||||
assertEquals("inline", response.getHeader("Content-Disposition"));
|
||||
}
|
||||
|
||||
public void testPlainTextWithEncoding() throws Exception {
|
||||
@@ -91,9 +89,6 @@ public class PlainTextResultTest extends StrutsInternalTestCase {
|
||||
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",
|
||||
@@ -106,6 +101,8 @@ public class PlainTextResultTest extends StrutsInternalTestCase {
|
||||
readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
|
||||
assertEquals(r, e);
|
||||
}
|
||||
assertEquals("text/plain; charset=UTF-8", response.getContentType());
|
||||
assertEquals("inline", response.getHeader("Content-Disposition"));
|
||||
}
|
||||
|
||||
protected String readAsString(String resource) throws Exception {
|
||||
|
||||
@@ -18,14 +18,6 @@
|
||||
*/
|
||||
package org.apache.struts2.util;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.mockobjects.servlet.MockPageContext;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.ActionProxy;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
@@ -33,6 +25,15 @@ import java.io.ObjectOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.springframework.mock.web.MockPageContext;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* InvocationSessionStoreTest
|
||||
|
||||
@@ -51,8 +51,8 @@ public class BeanTagTest extends AbstractUITagTest {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
pageContext.verify();
|
||||
|
||||
|
||||
|
||||
// Basic sanity check of clearTagStateForTagPoolingServers() behaviour for Struts Tags after doEndTag().
|
||||
BeanTag freshTag = new BeanTag();
|
||||
@@ -83,8 +83,8 @@ public class BeanTagTest extends AbstractUITagTest {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
pageContext.verify();
|
||||
|
||||
|
||||
|
||||
// Basic sanity check of clearTagStateForTagPoolingServers() behaviour for Struts Tags after doEndTag().
|
||||
BeanTag freshTag = new BeanTag();
|
||||
|
||||
@@ -18,23 +18,25 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.components.Component;
|
||||
import org.apache.struts2.components.If;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import com.mockobjects.servlet.MockPageContext;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ElseIfTagTest extends StrutsInternalTestCase {
|
||||
|
||||
protected MockPageContext pageContext;
|
||||
protected StrutsMockPageContext pageContext;
|
||||
protected MockJspWriter jspWriter;
|
||||
protected ValueStack stack;
|
||||
|
||||
@@ -215,18 +217,16 @@ public class ElseIfTagTest extends StrutsInternalTestCase {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
stack = ActionContext.getContext().getValueStack();
|
||||
|
||||
jspWriter = new MockJspWriter();
|
||||
HttpServletResponse resp = new MockHttpServletResponse();
|
||||
jspWriter = new MockJspWriter(resp);
|
||||
|
||||
StrutsMockHttpServletRequest request = new StrutsMockHttpServletRequest();
|
||||
|
||||
StrutsMockServletContext servletContext = new StrutsMockServletContext();
|
||||
servletContext.setServletInfo("not-weblogic");
|
||||
|
||||
pageContext = new MockPageContext();
|
||||
pageContext = new StrutsMockPageContext(servletContext, request, resp);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
pageContext.setServletContext(servletContext);
|
||||
|
||||
request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
|
||||
}
|
||||
|
||||
@@ -18,25 +18,29 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.components.Component;
|
||||
import org.apache.struts2.components.If;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import com.mockobjects.servlet.MockPageContext;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ElseTagTest extends StrutsInternalTestCase {
|
||||
|
||||
ElseTag elseTag;
|
||||
MockPageContext pageContext;
|
||||
StrutsMockPageContext pageContext;
|
||||
ValueStack stack;
|
||||
|
||||
|
||||
@@ -228,10 +232,9 @@ public class ElseTagTest extends StrutsInternalTestCase {
|
||||
servletContext.setServletInfo("not-weblogic");
|
||||
|
||||
// create the mock page context
|
||||
pageContext = new StrutsMockPageContext();
|
||||
pageContext.setRequest(request);
|
||||
pageContext.setServletContext(servletContext);
|
||||
pageContext.setJspWriter(new MockJspWriter());
|
||||
HttpServletResponse resp = new MockHttpServletResponse();
|
||||
pageContext = new StrutsMockPageContext(servletContext, request, resp);
|
||||
pageContext.setJspWriter(new MockJspWriter(new StringWriter()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,13 +18,16 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import com.mockobjects.servlet.MockPageContext;
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.components.Component;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
@@ -32,7 +35,7 @@ import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
public class I18nTagTest extends StrutsInternalTestCase {
|
||||
|
||||
I18nTag tag;
|
||||
MockPageContext pageContext;
|
||||
StrutsMockPageContext pageContext;
|
||||
ValueStack stack;
|
||||
|
||||
@Override
|
||||
@@ -47,9 +50,8 @@ public class I18nTagTest extends StrutsInternalTestCase {
|
||||
request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
|
||||
|
||||
// create the mock page context
|
||||
pageContext = new MockPageContext();
|
||||
pageContext.setRequest(request);
|
||||
pageContext.setJspWriter(new MockJspWriter());
|
||||
pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(new MockJspWriter(new StringWriter()));
|
||||
|
||||
// associate the tag with the mock page request
|
||||
tag.setPageContext(pageContext);
|
||||
|
||||
@@ -18,24 +18,26 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.components.Component;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import com.mockobjects.servlet.MockPageContext;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public class IfTagTest extends StrutsInternalTestCase {
|
||||
|
||||
IfTag tag;
|
||||
MockPageContext pageContext;
|
||||
StrutsMockPageContext pageContext;
|
||||
ValueStack stack;
|
||||
|
||||
|
||||
@@ -953,9 +955,8 @@ public class IfTagTest extends StrutsInternalTestCase {
|
||||
request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
|
||||
|
||||
// create the mock page context
|
||||
pageContext = new MockPageContext();
|
||||
pageContext.setRequest(request);
|
||||
pageContext.setJspWriter(new MockJspWriter());
|
||||
pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(new MockJspWriter(new StringWriter()));
|
||||
|
||||
// associate the tag with the mock page request
|
||||
tag.setPageContext(pageContext);
|
||||
|
||||
@@ -18,24 +18,27 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import static org.easymock.EasyMock.*;
|
||||
import static org.easymock.EasyMock.anyObject;
|
||||
import static org.easymock.EasyMock.createMock;
|
||||
import static org.easymock.EasyMock.expectLastCall;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
import static org.easymock.EasyMock.verify;
|
||||
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.components.Include;
|
||||
import org.springframework.mock.web.MockRequestDispatcher;
|
||||
|
||||
import jakarta.servlet.RequestDispatcher;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.components.Include;
|
||||
|
||||
import com.mockobjects.servlet.MockRequestDispatcher;
|
||||
|
||||
/**
|
||||
* Unit test of {@link IncludeTag}.
|
||||
*
|
||||
*/
|
||||
public class IncludeTagTest extends AbstractTagTest {
|
||||
|
||||
private RequestDispatcher mockRequestDispatcher;
|
||||
private MockRequestDispatcher mockRequestDispatcher;
|
||||
|
||||
private IncludeTag tag;
|
||||
|
||||
@@ -363,12 +366,11 @@ public class IncludeTagTest extends AbstractTagTest {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
request.setupGetRequestDispatcher(new MockRequestDispatcher());
|
||||
tag = new IncludeTag();
|
||||
|
||||
mockRequestDispatcher = (RequestDispatcher) createMock(RequestDispatcher.class);
|
||||
mockRequestDispatcher = (MockRequestDispatcher) createMock(RequestDispatcher.class);
|
||||
|
||||
request.setupGetRequestDispatcher(mockRequestDispatcher);
|
||||
request.setRequestDispatcher(mockRequestDispatcher);
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setPageContext(pageContext);
|
||||
}
|
||||
|
||||
@@ -18,12 +18,8 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import com.mockobjects.servlet.MockBodyContent;
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import org.apache.commons.collections.ListUtils;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -31,6 +27,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.ListUtils;
|
||||
import org.springframework.mock.web.MockBodyContent;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
|
||||
/**
|
||||
* Test Case for Iterator Tag
|
||||
@@ -1019,8 +1022,7 @@ public class IteratorTagTest extends AbstractUITagTest {
|
||||
// create the needed objects
|
||||
tag = new IteratorTag();
|
||||
|
||||
MockBodyContent mockBodyContent = new TestMockBodyContent();
|
||||
mockBodyContent.setupGetEnclosingWriter(new MockJspWriter());
|
||||
MockBodyContent mockBodyContent = new TestMockBodyContent("", new MockJspWriter(new StringWriter()));
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
|
||||
// associate the tag with the mock page request
|
||||
@@ -1133,7 +1135,11 @@ public class IteratorTagTest extends AbstractUITagTest {
|
||||
}
|
||||
|
||||
class TestMockBodyContent extends MockBodyContent {
|
||||
public String getString() {
|
||||
public TestMockBodyContent(String content, Writer targetWriter) {
|
||||
super(content, response, targetWriter);
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return ".-.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,15 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import com.mockobjects.servlet.MockPageContext;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.components.Component;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
|
||||
@@ -44,12 +47,11 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("TEST");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setValue("title");
|
||||
@@ -62,9 +64,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("TEST", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -88,12 +90,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("TEST");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setPageContext(pageContext);
|
||||
@@ -108,9 +110,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("TEST", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -135,12 +137,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setValue("title");
|
||||
@@ -152,9 +154,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -178,12 +180,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setPageContext(pageContext);
|
||||
@@ -197,9 +199,8 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
assertEquals("", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -225,12 +226,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("test");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setValue("title");
|
||||
@@ -242,9 +243,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("test", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -269,12 +270,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("test");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setPageContext(pageContext);
|
||||
@@ -288,9 +289,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("test", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -316,12 +317,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: test");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPageContext(pageContext);
|
||||
|
||||
@@ -332,9 +333,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: test", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -360,12 +361,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: test");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setPageContext(pageContext);
|
||||
@@ -378,9 +379,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: test", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -404,12 +405,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: tm_jee");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{
|
||||
@@ -428,9 +429,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testWithAltSyntax1_clearTagStateSet() throws Exception {
|
||||
@@ -439,12 +440,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: tm_jee");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{
|
||||
@@ -466,9 +467,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testEscapeJavaScript() throws Exception {
|
||||
@@ -477,12 +478,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("\t\b\n\f\r\"'/\\");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: \\t\\b\\n\\f\\r\\\"\\'\\/\\\\");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -501,9 +502,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: \\t\\b\\n\\f\\r\\\"\\'\\/\\\\", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testEscapeJavaScript_clearTagStateSet() throws Exception {
|
||||
@@ -512,12 +513,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("\t\b\n\f\r\"\'/\\");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: \\t\\b\\n\\f\\r\\\"\\\'\\/\\\\");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -539,9 +540,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: \\t\\b\\n\\f\\r\\\"\\'\\/\\\\", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testEscapeXml() throws Exception {
|
||||
@@ -550,12 +551,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("<>'\"&");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: <>'"&");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -574,9 +575,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: <>'"&", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testEscapeXml_clearTagStateSet() throws Exception {
|
||||
@@ -585,12 +586,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("<>'\"&");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: <>'"&");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -612,9 +613,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: <>'"&", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testEscapeCsv() throws Exception {
|
||||
@@ -623,12 +624,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("\"something,\",\"");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("\"Foo is: \"\"something,\"\",\"\"\"");
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -647,9 +648,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("\"Foo is: \"\"something,\"\",\"\"\"", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testEscapeCsv_clearTagStateSet() throws Exception {
|
||||
@@ -658,12 +659,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("\"something,\",\"");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("\"Foo is: \"\"something,\"\",\"\"\"");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -685,9 +686,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("\"Foo is: \"\"something,\"\",\"\"\"", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testWithAltSyntax2() throws Exception {
|
||||
@@ -696,12 +697,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: tm_jee");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -718,9 +719,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testWithAltSyntax2_clearTagStateSet() throws Exception {
|
||||
@@ -729,12 +730,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: tm_jee");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -754,9 +755,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testWithoutAltSyntax1() throws Exception {
|
||||
@@ -765,12 +766,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: tm_jee");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -787,9 +788,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testWithoutAltSyntax1_clearTagStateSet() throws Exception {
|
||||
@@ -798,12 +799,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("Foo is: tm_jee");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -823,9 +824,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testWithoutAltSyntax2() throws Exception {
|
||||
@@ -834,11 +835,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -855,9 +857,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testWithoutAltSyntax2_clearTagStateSet() throws Exception {
|
||||
@@ -866,11 +868,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
foo.setTitle("tm_jee");
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
// test
|
||||
{PropertyTag tag = new PropertyTag();
|
||||
@@ -890,9 +893,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
objectsAreReflectionEqual(tag, freshTag));}
|
||||
|
||||
// verify test
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("Foo is: tm_jee", sw.toString());
|
||||
|
||||
}
|
||||
|
||||
public void testSimple_release() {
|
||||
@@ -903,12 +906,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("test");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setValue("title");
|
||||
@@ -920,9 +923,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("test", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
@@ -953,12 +956,12 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
|
||||
stack.push(foo);
|
||||
|
||||
MockJspWriter jspWriter = new MockJspWriter();
|
||||
jspWriter.setExpectedData("test");
|
||||
StringWriter sw = new StringWriter();
|
||||
MockJspWriter jspWriter = new MockJspWriter(sw);
|
||||
|
||||
MockPageContext pageContext = new MockPageContext();
|
||||
StrutsMockPageContext pageContext = new StrutsMockPageContext(null, request, null);
|
||||
pageContext.setJspWriter(jspWriter);
|
||||
pageContext.setRequest(request);
|
||||
|
||||
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setPageContext(pageContext);
|
||||
@@ -972,9 +975,9 @@ public class PropertyTagTest extends StrutsInternalTestCase {
|
||||
fail();
|
||||
}
|
||||
|
||||
request.verify();
|
||||
jspWriter.verify();
|
||||
pageContext.verify();
|
||||
|
||||
assertEquals("test", sw.toString());
|
||||
|
||||
|
||||
try {
|
||||
tag.doEndTag();
|
||||
|
||||
@@ -18,8 +18,11 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
|
||||
|
||||
@@ -249,7 +252,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
tag.setName("foo");
|
||||
tag.setValue(null);
|
||||
// Do not set any value - default for tag should be true
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString(beginEndSpaceString);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
tag.doStartTag();
|
||||
@@ -266,7 +269,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
tag.setName("foo");
|
||||
tag.setValue(null);
|
||||
tag.setTrimBody(true);
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString(beginEndSpaceString);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
tag.doStartTag();
|
||||
@@ -281,7 +284,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
tag.setName("foo");
|
||||
tag.setValue(null);
|
||||
tag.setTrimBody(false);
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString(beginEndSpaceString);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
tag.doStartTag();
|
||||
@@ -303,7 +306,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
tag.setName("foo");
|
||||
tag.setValue(null);
|
||||
// Do not set any value - default for tag should be true
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString(beginEndSpaceString);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
tag.doStartTag();
|
||||
@@ -322,7 +325,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
tag.setName("foo");
|
||||
tag.setValue(null);
|
||||
tag.setTrimBody(true);
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString(beginEndSpaceString);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
tag.doStartTag();
|
||||
@@ -338,7 +341,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
tag.setName("foo");
|
||||
tag.setValue(null);
|
||||
tag.setTrimBody(false);
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString(beginEndSpaceString);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
tag.doStartTag();
|
||||
@@ -357,7 +360,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
String variableName = "foo";
|
||||
tag.setName(variableName);
|
||||
tag.setValue(null);
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
String emptyBody = "";
|
||||
mockBodyContent.setString(emptyBody);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
@@ -379,7 +382,7 @@ public class SetTagTest extends AbstractUITagTest {
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setName(variableName);
|
||||
tag.setValue(null);
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
String emptyBody = "";
|
||||
mockBodyContent.setString(emptyBody);
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockRequestDispatcher;
|
||||
|
||||
import jakarta.servlet.RequestDispatcher;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
@@ -50,6 +51,7 @@ public class StrutsMockHttpServletRequest extends MockHttpServletRequest {
|
||||
private int serverPort;
|
||||
private String encoding;
|
||||
private String requestDispatherString;
|
||||
private RequestDispatcher requestDispatcher = null;
|
||||
|
||||
|
||||
public void setAttribute(String s, Object o) {
|
||||
@@ -121,7 +123,14 @@ public class StrutsMockHttpServletRequest extends MockHttpServletRequest {
|
||||
|
||||
public RequestDispatcher getRequestDispatcher(String string) {
|
||||
this.requestDispatherString = string;
|
||||
return super.getRequestDispatcher(string);
|
||||
if(this.requestDispatcher == null) {
|
||||
this.requestDispatcher = new MockRequestDispatcher(string);
|
||||
}
|
||||
return this.requestDispatcher;
|
||||
}
|
||||
|
||||
public void setRequestDispatcher(RequestDispatcher rd) {
|
||||
this.requestDispatcher = rd;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ public class StrutsMockHttpServletResponse extends MockHttpServletResponse {
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,27 +18,30 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.TestAction;
|
||||
import org.apache.struts2.components.Text;
|
||||
import org.apache.struts2.views.jsp.ui.StrutsBodyContent;
|
||||
import org.apache.struts2.views.jsp.ui.TestAction1;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.BodyTag;
|
||||
import java.io.StringWriter;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsException;
|
||||
import org.apache.struts2.TestAction;
|
||||
import org.apache.struts2.components.Text;
|
||||
import org.apache.struts2.views.jsp.ui.StrutsBodyContent;
|
||||
import org.apache.struts2.views.jsp.ui.TestAction1;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.tagext.BodyTag;
|
||||
|
||||
|
||||
/**
|
||||
@@ -63,7 +66,7 @@ public class TextTagTest extends AbstractTagTest {
|
||||
// simulate the condition
|
||||
// <s:text name="some.invalid.key">My Default Message</s:text>
|
||||
|
||||
StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString("Sample Of Default Message");
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
tag.setName("some.invalid.key.so.we.should.get.the.default.message");
|
||||
@@ -86,7 +89,7 @@ public class TextTagTest extends AbstractTagTest {
|
||||
// simulate the condition
|
||||
// <s:text name="some.invalid.key">My Default Message</s:text>
|
||||
|
||||
StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
mockBodyContent.setString("Sample Of Default Message");
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setBodyContent(mockBodyContent);
|
||||
|
||||
@@ -18,13 +18,14 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.mockobjects.servlet.MockBodyContent;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionProxy;
|
||||
import com.opensymphony.xwork2.DefaultActionInvocation;
|
||||
import com.opensymphony.xwork2.DefaultActionProxyFactory;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.components.URL;
|
||||
import org.apache.struts2.dispatcher.ApplicationMap;
|
||||
@@ -34,16 +35,17 @@ import org.apache.struts2.dispatcher.RequestMap;
|
||||
import org.apache.struts2.dispatcher.SessionMap;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
import org.apache.struts2.dispatcher.mapper.DefaultActionMapper;
|
||||
import org.springframework.mock.web.MockBodyContent;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionProxy;
|
||||
import com.opensymphony.xwork2.DefaultActionInvocation;
|
||||
import com.opensymphony.xwork2.DefaultActionProxyFactory;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import jakarta.servlet.jsp.JspWriter;
|
||||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Unit test for {@link URLTag}.
|
||||
@@ -1542,11 +1544,7 @@ public class URLTagTest extends AbstractUITagTest {
|
||||
servletContext.setRealPath(new File("nosuchfile.properties").getAbsolutePath());
|
||||
servletContext.setServletInfo("Resin");
|
||||
|
||||
pageContext = new StrutsMockPageContext();
|
||||
pageContext.setRequest(request);
|
||||
pageContext.setResponse(response);
|
||||
pageContext.setServletContext(servletContext);
|
||||
|
||||
pageContext = new StrutsMockPageContext(servletContext, request, response);
|
||||
mockContainer = new Mock(Container.class);
|
||||
|
||||
session = new SessionMap(request);
|
||||
@@ -1660,10 +1658,7 @@ public class URLTagTest extends AbstractUITagTest {
|
||||
servletContext.setRealPath(new File("nosuchfile.properties").getAbsolutePath());
|
||||
servletContext.setServletInfo("Resin");
|
||||
|
||||
pageContext = new StrutsMockPageContext();
|
||||
pageContext.setRequest(request);
|
||||
pageContext.setResponse(response);
|
||||
pageContext.setServletContext(servletContext);
|
||||
pageContext = new StrutsMockPageContext(servletContext, request, response);
|
||||
|
||||
mockContainer = new Mock(Container.class);
|
||||
|
||||
@@ -1943,12 +1938,7 @@ public class URLTagTest extends AbstractUITagTest {
|
||||
ParamTag param2 = new ParamTag();
|
||||
param2.setPageContext(pageContext);
|
||||
param2.setName("paramWithSetBody");
|
||||
param2.setBodyContent(new MockBodyContent() {
|
||||
@Override
|
||||
public String getString() {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
param2.setBodyContent(new MockBodyContent("", response));
|
||||
param2.setSuppressEmptyParameters(false);
|
||||
param2.doStartTag();
|
||||
param2.doEndTag();
|
||||
@@ -1964,12 +1954,7 @@ public class URLTagTest extends AbstractUITagTest {
|
||||
ParamTag param4 = new ParamTag();
|
||||
param4.setPageContext(pageContext);
|
||||
param4.setName("paramWithSetBodySuppressed");
|
||||
param4.setBodyContent(new MockBodyContent() {
|
||||
@Override
|
||||
public String getString() {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
param4.setBodyContent(new MockBodyContent("", response));
|
||||
param4.setSuppressEmptyParameters(true);
|
||||
param4.doStartTag();
|
||||
param4.doEndTag();
|
||||
@@ -2026,12 +2011,7 @@ public class URLTagTest extends AbstractUITagTest {
|
||||
param2.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
param2.setPageContext(pageContext);
|
||||
param2.setName("paramWithSetBody");
|
||||
param2.setBodyContent(new MockBodyContent() {
|
||||
@Override
|
||||
public String getString() {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
param2.setBodyContent(new MockBodyContent("", response));
|
||||
param2.setSuppressEmptyParameters(false);
|
||||
param2.doStartTag();
|
||||
setComponentTagClearTagState(param2, true); // Ensure component tag state clearing is set true (to match tag).
|
||||
@@ -2051,12 +2031,7 @@ public class URLTagTest extends AbstractUITagTest {
|
||||
param4.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
param4.setPageContext(pageContext);
|
||||
param4.setName("paramWithSetBodySuppressed");
|
||||
param4.setBodyContent(new MockBodyContent() {
|
||||
@Override
|
||||
public String getString() {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
param4.setBodyContent(new MockBodyContent("", response));
|
||||
param4.setSuppressEmptyParameters(true);
|
||||
param4.doStartTag();
|
||||
setComponentTagClearTagState(param4, true); // Ensure component tag state clearing is set true (to match tag).
|
||||
|
||||
@@ -41,7 +41,7 @@ public class JspTemplateTest extends AbstractUITagTest {
|
||||
Mock rdMock = new Mock(RequestDispatcher.class);
|
||||
rdMock.expect("include",C.args(C.isA(HttpServletRequest.class), C.isA(HttpServletResponse.class)));
|
||||
RequestDispatcher dispatcher = (RequestDispatcher) rdMock.proxy();
|
||||
request.setupGetRequestDispatcher(dispatcher);
|
||||
request.setRequestDispatcher(dispatcher);
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setTemplate("/test/checkbox.jsp");
|
||||
tag.doStartTag();
|
||||
@@ -64,7 +64,7 @@ public class JspTemplateTest extends AbstractUITagTest {
|
||||
Mock rdMock = new Mock(RequestDispatcher.class);
|
||||
rdMock.expect("include",C.args(C.isA(HttpServletRequest.class), C.isA(HttpServletResponse.class)));
|
||||
RequestDispatcher dispatcher = (RequestDispatcher) rdMock.proxy();
|
||||
request.setupGetRequestDispatcher(dispatcher);
|
||||
request.setRequestDispatcher(dispatcher);
|
||||
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setTemplate("/test/checkbox.jsp");
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
*/
|
||||
package org.apache.struts2.views.jsp.ui;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.struts2.TestConfigurationProvider;
|
||||
import org.apache.struts2.views.jsp.AbstractUITagTest;
|
||||
import org.apache.struts2.views.jsp.ParamTag;
|
||||
import org.apache.struts2.views.jsp.StrutsMockBodyContent;
|
||||
|
||||
import com.mockobjects.servlet.MockJspWriter;
|
||||
import org.springframework.mock.web.MockJspWriter;
|
||||
|
||||
/**
|
||||
* UI components Tooltip test case.
|
||||
@@ -883,7 +883,7 @@ public class TooltipTest extends AbstractUITagTest {
|
||||
ParamTag formParamTag = new ParamTag();
|
||||
formParamTag.setPageContext(pageContext);
|
||||
formParamTag.setName("tooltipConfig");
|
||||
StrutsMockBodyContent bodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
StrutsMockBodyContent bodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
bodyContent.setString(
|
||||
"tooltipIcon=/static/tooltip/myTooltip.gif| " +
|
||||
"tooltipDelay=500| " +
|
||||
@@ -901,7 +901,7 @@ public class TooltipTest extends AbstractUITagTest {
|
||||
ParamTag textFieldParamTag = new ParamTag();
|
||||
textFieldParamTag.setPageContext(pageContext);
|
||||
textFieldParamTag.setName("tooltipConfig");
|
||||
StrutsMockBodyContent bodyContent2 = new StrutsMockBodyContent(new MockJspWriter());
|
||||
StrutsMockBodyContent bodyContent2 = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
bodyContent2.setString(
|
||||
"tooltipIcon=/static/tooltip/myTooltip2.gif| " +
|
||||
"tooltipDelay=5000 "
|
||||
@@ -956,7 +956,7 @@ public class TooltipTest extends AbstractUITagTest {
|
||||
ParamTag formParamTag = new ParamTag();
|
||||
formParamTag.setPageContext(pageContext);
|
||||
formParamTag.setName("tooltipConfig");
|
||||
StrutsMockBodyContent bodyContent = new StrutsMockBodyContent(new MockJspWriter());
|
||||
StrutsMockBodyContent bodyContent = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
bodyContent.setString(
|
||||
"tooltipIcon=/static/tooltip/myTooltip.gif| " +
|
||||
"tooltipDelay=500| " +
|
||||
@@ -976,7 +976,7 @@ public class TooltipTest extends AbstractUITagTest {
|
||||
textFieldParamTag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
|
||||
textFieldParamTag.setPageContext(pageContext);
|
||||
textFieldParamTag.setName("tooltipConfig");
|
||||
StrutsMockBodyContent bodyContent2 = new StrutsMockBodyContent(new MockJspWriter());
|
||||
StrutsMockBodyContent bodyContent2 = new StrutsMockBodyContent(new MockJspWriter(new StringWriter()));
|
||||
bodyContent2.setString(
|
||||
"tooltipIcon=/static/tooltip/myTooltip2.gif| " +
|
||||
"tooltipDelay=5000 "
|
||||
|
||||
@@ -18,21 +18,23 @@
|
||||
*/
|
||||
package org.apache.struts2.views.util;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Scope.Strategy;
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.url.StrutsQueryStringBuilder;
|
||||
import org.apache.struts2.url.StrutsUrlEncoder;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.struts2.StrutsInternalTestCase;
|
||||
import org.apache.struts2.url.StrutsQueryStringBuilder;
|
||||
import org.apache.struts2.url.StrutsUrlEncoder;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.inject.Scope.Strategy;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Test case for DefaultUrlHelper.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user