Fixing improper render of boolean values for xslt result

WW-2457


git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@649814 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald J. Brown
2008-04-19 14:01:15 +00:00
parent 0c162a4efb
commit 872012de45
2 changed files with 18 additions and 2 deletions
@@ -146,7 +146,7 @@ public class AdapterFactory {
if (valueType.isArray())
adapterClass = ArrayAdapter.class;
else if (value instanceof String || value instanceof Number || valueType.isPrimitive())
else if (value instanceof String || value instanceof Number || value instanceof Boolean || valueType.isPrimitive())
adapterClass = StringAdapter.class;
else if (value instanceof Collection)
adapterClass = CollectionAdapter.class;
@@ -106,7 +106,7 @@ public class XSLTResultTest extends StrutsTestCase {
assertTrue(out.indexOf("<html xmlns=\"http://www.w3.org/TR/xhtml1/strict\"") > -1);
assertTrue(out.indexOf("Hello Santa Claus how are you?") > -1);
}
public void testTransform3() throws Exception {
result.setParse(false);
result.setLocation("XSLTResultTest3.xsl");
@@ -120,6 +120,18 @@ public class XSLTResultTest extends StrutsTestCase {
assertTrue(out.indexOf("XWork not in Action by Superman") > -1);
}
public void testTransformWithBoolean() throws Exception {
result.setParse(false);
result.setLocation("XSLTResultTest5.xsl");
result.execute(mai);
String out = response.getContentAsString();
assertTrue(out.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
assertTrue(out.indexOf("<html xmlns=\"http://www.w3.org/TR/xhtml1/strict\"") > -1);
assertTrue(out.indexOf("Hello Santa Claus how are you?") > -1);
assertTrue(out.indexOf("You are active: true") > -1);
}
public void testTransform4WithDocumentInclude() throws Exception {
result = new XSLTResult(){
protected URIResolver getURIResolver() {
@@ -186,6 +198,10 @@ public class XSLTResultTest extends StrutsTestCase {
public String getUsername() {
return "Santa Claus";
}
public boolean isActive() {
return true;
}
public List getBooks() {
List list = new ArrayList();