Author: gvanmatre
Date: Fri Nov 4 19:18:44 2005
New Revision: 330963
URL: http://svn.apache.org/viewcvs?rev=330963&view=rev
Log:
Bug#: 37366 and 37365 submitted by Rahul Akolkar
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/CommentBuilder.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/SelectOneRadioBuilder.java
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java
struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/GenericComparator.java
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/Clay.java
Fri Nov 4 19:18:44 2005
@@ -260,7 +260,7 @@
.getMessage("clay.config.notloaded"));
// find the top-level display element associated with the subtree
- ComponentBean b = (ComponentBean) config.getElement(getJsfid());
+ ComponentBean b = config.getElement(getJsfid());
if (b == null)
throw new NullPointerException(messages.getMessage(
"clay.jsfid.notfound", new Object[] { getJsfid() }));
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java
Fri Nov 4 19:18:44 2005
@@ -94,7 +94,7 @@
.resolveVariable(context, ShaleConstants.TAG_UTILITY_BEAN);
// evaluate any VB expression that we were passed
- String resolvedBasename = (String) tagUtils.eval(basename);
+ String resolvedBasename = tagUtils.eval(basename);
if (null == resolvedBasename || null == var) {
throw new NullPointerException("null basename or var");
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
Fri Nov 4 19:18:44 2005
@@ -64,7 +64,7 @@
throw new NullPointerException(messages
.getMessage("clay.null.componentBean"));
- UIComponent parent = (UIComponent) clayContext.getParent();
+ UIComponent parent = clayContext.getParent();
if (parent == null)
throw new NullPointerException(messages
.getMessage("clay.null.parentBean"));
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/ComponentConfigBean.java
Fri Nov 4 19:18:44 2005
@@ -115,13 +115,13 @@
if (suffixes == null) {
suffixes = new String[2];
- suffixes[0] = (String) context.getInitParameter(
+ suffixes[0] = context.getInitParameter(
Globals.CLAY_HTML_TEMPLATE_SUFFIX);
if (suffixes[0] == null) {
suffixes[0] = Globals.CLAY_DEFAULT_HTML_TEMPLATE_SUFFIX;
}
- suffixes[1] = (String) context.getInitParameter(
+ suffixes[1] = context.getInitParameter(
Globals.CLAY_XML_TEMPLATE_SUFFIX);
if (suffixes[1] == null) {
suffixes[1] = Globals.CLAY_DEFAULT_XML_TEMPLATE_SUFFIX;
@@ -129,7 +129,7 @@
}
- String autoReloadClayFiles = (String)
context.getInitParameter(Globals.AUTO_RELOAD_CLAY_FILES);
+ String autoReloadClayFiles =
context.getInitParameter(Globals.AUTO_RELOAD_CLAY_FILES);
if (autoReloadClayFiles != null) {
try {
isWatchDogOn =
Boolean.valueOf(autoReloadClayFiles).booleanValue();
@@ -422,7 +422,7 @@
// resolve inheritance of converter
if (b.getConverter() != null)
- assignParent(((ComponentBean) b).getConverter());
+ assignParent(b.getConverter());
// resolve inheritance of validators
Iterator vi = b.getValidatorIterator();
@@ -780,7 +780,7 @@
ci = null;
if (b.getConverter() != null)
- checkCircularInheritance(((ComponentBean) b).getConverter());
+ checkCircularInheritance(b.getConverter());
Iterator vi = b.getValidatorIterator();
while (vi.hasNext())
@@ -825,7 +825,7 @@
b.getChildren().clear();
if (b.getConverter() != null)
- unassignParent(((ComponentBean) b).getConverter());
+ unassignParent(b.getConverter());
b.addConverter(null);
Iterator vi = b.getValidatorIterator();
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
Fri Nov 4 19:18:44 2005
@@ -201,7 +201,7 @@
"jsfid.notfound", new Object[] { jsfid }));
// find the top-level display element associated with the subtree
- ComponentBean b = (ComponentBean) config.getElement(jsfid);
+ ComponentBean b = config.getElement(jsfid);
if (b == null)
throw new NullPointerException(messages.getMessage(
"jsfid.notfound", new Object[] { jsfid }));
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandler.java
Fri Nov 4 19:18:44 2005
@@ -195,13 +195,13 @@
if (suffixes == null) {
suffixes = new String[2];
- suffixes[0] = (String)
context.getExternalContext().getInitParameter(
+ suffixes[0] = context.getExternalContext().getInitParameter(
Globals.CLAY_HTML_TEMPLATE_SUFFIX);
if (suffixes[0] == null) {
suffixes[0] = Globals.CLAY_DEFAULT_HTML_TEMPLATE_SUFFIX;
}
- suffixes[1] = (String)
context.getExternalContext().getInitParameter(
+ suffixes[1] = context.getExternalContext().getInitParameter(
Globals.CLAY_XML_TEMPLATE_SUFFIX);
if (suffixes[1] == null) {
suffixes[1] = Globals.CLAY_DEFAULT_XML_TEMPLATE_SUFFIX;
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/faces/ClayViewHandlerCommand.java
Fri Nov 4 19:18:44 2005
@@ -71,13 +71,13 @@
if (suffixes == null) {
suffixes = new String[2];
- suffixes[0] = (String) context.getContext().getInitParameter(
+ suffixes[0] = context.getContext().getInitParameter(
Globals.CLAY_HTML_TEMPLATE_SUFFIX);
if (suffixes[0] == null) {
suffixes[0] = Globals.CLAY_DEFAULT_HTML_TEMPLATE_SUFFIX;
}
- suffixes[1] = (String) context.getContext().getInitParameter(
+ suffixes[1] = context.getContext().getInitParameter(
Globals.CLAY_XML_TEMPLATE_SUFFIX);
if (suffixes[1] == null) {
suffixes[1] = Globals.CLAY_DEFAULT_XML_TEMPLATE_SUFFIX;
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/Parser.java
Fri Nov 4 19:18:44 2005
@@ -223,7 +223,7 @@
new Object[] {node.getToken(),
node.getToken().getRawText()}));
}
- current = (Node) current.getParent();
+ current = current.getParent();
}
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java
Fri Nov 4 19:18:44 2005
@@ -296,7 +296,7 @@
AttributeBean original = null;
Token valueToken = (Token) e.getValue();
if (valueToken != null) {
- if ((original = (AttributeBean) target.getAttribute((String)
e.getKey())) != null) {
+ if ((original = target.getAttribute((String) e.getKey())) !=
null) {
createAttribute(original, valueToken.getRawText(), target);
} else {
//any token that is not an attribute in the target becomes
a symbol
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/CommentBuilder.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/CommentBuilder.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/CommentBuilder.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/CommentBuilder.java
Fri Nov 4 19:18:44 2005
@@ -57,7 +57,7 @@
protected void encodeBegin(Node node, ElementBean target, ComponentBean
root) {
super.encodeBegin(node, target, root);
- AttributeBean valueAttr = (AttributeBean) target.getAttribute("value");
+ AttributeBean valueAttr = target.getAttribute("value");
StringBuffer comment = new StringBuffer(valueAttr.getValue());
captureComment(node, comment);
valueAttr.setValue(comment.toString());
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/SelectOneRadioBuilder.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/SelectOneRadioBuilder.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/SelectOneRadioBuilder.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/SelectOneRadioBuilder.java
Fri Nov 4 19:18:44 2005
@@ -24,8 +24,8 @@
/**
* <p>
- * This [EMAIL PROTECTED] Builder} will create a target {
- * @link org.apache.shale.clay.config.beans.ElementBean} for a single
+ * This [EMAIL PROTECTED] Builder} will create a target
+ * [EMAIL PROTECTED] org.apache.shale.clay.config.beans.ElementBean} for a
single
* input radio [EMAIL PROTECTED] Node}. The mapping between the html and the
builder is
* handled by the [EMAIL PROTECTED]
org.apache.shale.clay.parser.builder.chain.InputBuilderRule}.
* </p>
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java
(original)
+++
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/chain/InputBuilderRule.java
Fri Nov 4 19:18:44 2005
@@ -55,8 +55,8 @@
* <dd><b>submit</b>[EMAIL PROTECTED]
org.apache.shale.clay.parser.builder.CommandButtonBuilder}
* </dl>
* <br>
- * The [EMAIL PROTECTED] BuilderRuleContext will hold the current html
[EMAIL PROTECTED] Node} and
- * target [EMAIL PROTECTED] Builder}}.
+ * The [EMAIL PROTECTED] BuilderRuleContext} will hold the current html
[EMAIL PROTECTED] Node} and
+ * target [EMAIL PROTECTED] Builder}.
* </p>
*/
public boolean execute(Context context) throws Exception {
Modified:
struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/utils/ClayAmalgamTestCase.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
(original)
+++
struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/utils/ClayAmalgamTestCase.java
Fri Nov 4 19:18:44 2005
@@ -1,148 +1,148 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shale.clay.utils;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.faces.component.UIComponent;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.shale.clay.config.beans.AttributeBean;
-import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.faces.ShaleConstants;
-import org.apache.shale.test.base.AbstractViewControllerTestCase;
-import org.apache.shale.util.Tags;
-
-public class ClayAmalgamTestCase extends AbstractViewControllerTestCase {
-
- private ClayAmalgam clayAmalgam = null;
-
- public void setUp() {
- super.setUp();
-
- clayAmalgam = new ClayAmalgam();
- application.addComponent("org.apache.shale.clay.component.Clay",
"org.apache.shale.clay.component.Clay");
- servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
- }
-
- // Construct a new instance of this test case.
- public ClayAmalgamTestCase(String name) {
- super(name);
- }
-
- // Return the tests included in this test case.
- public static Test suite() {
- return (new TestSuite(ClayAmalgamTestCase.class));
- }
-
- //test the import file into a outputText component
- public void testClayImport() {
- //test excapeXml=true
- Map requestParams = new TreeMap();
- requestParams.put("url", "/org/apache/shale/clay/utils/hello.html");
- externalContext.setRequestParameterMap(requestParams);
-
- ComponentBean displayElement = new ComponentBean();
- displayElement.setId("clayImport");
- displayElement.setComponentType("org.apache.shale.clay.component.Clay");
- displayElement.setJsfid("clayImport");
-
- UIComponent component = (UIComponent)
application.createComponent("org.apache.shale.clay.component.Clay");
- component.setId("clayImport");
- component.getAttributes().put("url","#{param.url}");
- component.getAttributes().put("escapeXml", Boolean.TRUE.toString());
-
- clayAmalgam.clayImport(facesContext, component, displayElement);
-
- assertEquals("jsfid", displayElement.getJsfid(), "outputText");
- assertEquals("componentType", displayElement.getComponentType(),
"javax.faces.HtmlOutputText");
-
- AttributeBean attr = displayElement.getAttribute("escape");
- assertNotNull("escape", attr);
- assertEquals("escape", attr.getValue(), Boolean.FALSE.toString());
-
- attr = displayElement.getAttribute("isTransient");
- assertNotNull("isTransient", attr);
- assertEquals("isTransient", attr.getValue(), Boolean.TRUE.toString());
-
- attr = displayElement.getAttribute("value");
- assertNotNull("value", attr);
- assertEquals("value", attr.getValue(),
"<html><head></head><body bgcolor=\"blue\">Hello
World</body></html>");
-
- //test excapeXml=false
- component.getAttributes().put("escapeXml", Boolean.FALSE.toString());
- displayElement = new ComponentBean();
- displayElement.setId("clayImport");
- displayElement.setComponentType("org.apache.shale.clay.component.Clay");
- displayElement.setJsfid("clayImport");
-
- clayAmalgam.clayImport(facesContext, component, displayElement);
-
- assertEquals("jsfid", displayElement.getJsfid(), "outputText");
- assertEquals("componentType", displayElement.getComponentType(),
"javax.faces.HtmlOutputText");
-
- attr = displayElement.getAttribute("escape");
- assertNotNull("escape", attr);
- assertEquals("escape", attr.getValue(), Boolean.FALSE.toString());
-
- attr = displayElement.getAttribute("isTransient");
- assertNotNull("isTransient", attr);
- assertEquals("isTransient", attr.getValue(), Boolean.TRUE.toString());
-
- attr = displayElement.getAttribute("value");
- assertNotNull("value", attr);
- assertEquals("value", attr.getValue(), "<html><head></head><body
bgcolor=\"blue\">Hello World</body></html>");
-
-
- }
-
- //convert an escaped value into a un-escaped outputText
- public void testClayOut() {
- ComponentBean displayElement = new ComponentBean();
- displayElement.setId("clayOut");
-
displayElement.setComponentType("org.apache.shale.clay.component.Clay");
- displayElement.setJsfid("clayOut");
-
- UIComponent component = (UIComponent)
application.createComponent("org.apache.shale.clay.component.Clay");
- component.setId("clayOut");
-
component.getAttributes().put("value","<html><head></head><body
bgcolor=\"blue\">Hello World</body></html>");
- component.getAttributes().put("escapeXml", Boolean.FALSE.toString());
-
-
- clayAmalgam.clayOut(facesContext, component, displayElement);
-
- assertEquals("jsfid", displayElement.getJsfid(), "outputText");
- assertEquals("componentType", displayElement.getComponentType(),
"javax.faces.HtmlOutputText");
-
- AttributeBean attr = displayElement.getAttribute("escape");
- assertNotNull("escape", attr);
- assertEquals("escape", attr.getValue(), Boolean.FALSE.toString());
-
- attr = displayElement.getAttribute("isTransient");
- assertNotNull("isTransient", attr);
- assertEquals("isTransient", attr.getValue(), Boolean.TRUE.toString());
-
- attr = displayElement.getAttribute("value");
- assertNotNull("value", attr);
- assertEquals("value", attr.getValue(), "<html><head></head><body
bgcolor=\"blue\">Hello World</body></html>");
-
- }
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shale.clay.utils;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.faces.component.UIComponent;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.shale.clay.config.beans.AttributeBean;
+import org.apache.shale.clay.config.beans.ComponentBean;
+import org.apache.shale.faces.ShaleConstants;
+import org.apache.shale.test.base.AbstractViewControllerTestCase;
+import org.apache.shale.util.Tags;
+
+public class ClayAmalgamTestCase extends AbstractViewControllerTestCase {
+
+ private ClayAmalgam clayAmalgam = null;
+
+ public void setUp() {
+ super.setUp();
+
+ clayAmalgam = new ClayAmalgam();
+ application.addComponent("org.apache.shale.clay.component.Clay",
"org.apache.shale.clay.component.Clay");
+ servletContext.setAttribute(ShaleConstants.TAG_UTILITY_BEAN, new
Tags());
+ }
+
+ // Construct a new instance of this test case.
+ public ClayAmalgamTestCase(String name) {
+ super(name);
+ }
+
+ // Return the tests included in this test case.
+ public static Test suite() {
+ return (new TestSuite(ClayAmalgamTestCase.class));
+ }
+
+ //test the import file into a outputText component
+ public void testClayImport() {
+ //test excapeXml=true
+ Map requestParams = new TreeMap();
+ requestParams.put("url", "/org/apache/shale/clay/utils/hello.html");
+ externalContext.setRequestParameterMap(requestParams);
+
+ ComponentBean displayElement = new ComponentBean();
+ displayElement.setId("clayImport");
+ displayElement.setComponentType("org.apache.shale.clay.component.Clay");
+ displayElement.setJsfid("clayImport");
+
+ UIComponent component =
application.createComponent("org.apache.shale.clay.component.Clay");
+ component.setId("clayImport");
+ component.getAttributes().put("url","#{param.url}");
+ component.getAttributes().put("escapeXml", Boolean.TRUE.toString());
+
+ clayAmalgam.clayImport(facesContext, component, displayElement);
+
+ assertEquals("jsfid", displayElement.getJsfid(), "outputText");
+ assertEquals("componentType", displayElement.getComponentType(),
"javax.faces.HtmlOutputText");
+
+ AttributeBean attr = displayElement.getAttribute("escape");
+ assertNotNull("escape", attr);
+ assertEquals("escape", attr.getValue(), Boolean.FALSE.toString());
+
+ attr = displayElement.getAttribute("isTransient");
+ assertNotNull("isTransient", attr);
+ assertEquals("isTransient", attr.getValue(), Boolean.TRUE.toString());
+
+ attr = displayElement.getAttribute("value");
+ assertNotNull("value", attr);
+ assertEquals("value", attr.getValue(),
"<html><head></head><body bgcolor=\"blue\">Hello
World</body></html>");
+
+ //test excapeXml=false
+ component.getAttributes().put("escapeXml", Boolean.FALSE.toString());
+ displayElement = new ComponentBean();
+ displayElement.setId("clayImport");
+ displayElement.setComponentType("org.apache.shale.clay.component.Clay");
+ displayElement.setJsfid("clayImport");
+
+ clayAmalgam.clayImport(facesContext, component, displayElement);
+
+ assertEquals("jsfid", displayElement.getJsfid(), "outputText");
+ assertEquals("componentType", displayElement.getComponentType(),
"javax.faces.HtmlOutputText");
+
+ attr = displayElement.getAttribute("escape");
+ assertNotNull("escape", attr);
+ assertEquals("escape", attr.getValue(), Boolean.FALSE.toString());
+
+ attr = displayElement.getAttribute("isTransient");
+ assertNotNull("isTransient", attr);
+ assertEquals("isTransient", attr.getValue(), Boolean.TRUE.toString());
+
+ attr = displayElement.getAttribute("value");
+ assertNotNull("value", attr);
+ assertEquals("value", attr.getValue(), "<html><head></head><body
bgcolor=\"blue\">Hello World</body></html>");
+
+
+ }
+
+ //convert an escaped value into a un-escaped outputText
+ public void testClayOut() {
+ ComponentBean displayElement = new ComponentBean();
+ displayElement.setId("clayOut");
+
displayElement.setComponentType("org.apache.shale.clay.component.Clay");
+ displayElement.setJsfid("clayOut");
+
+ UIComponent component =
application.createComponent("org.apache.shale.clay.component.Clay");
+ component.setId("clayOut");
+
component.getAttributes().put("value","<html><head></head><body
bgcolor=\"blue\">Hello World</body></html>");
+ component.getAttributes().put("escapeXml", Boolean.FALSE.toString());
+
+
+ clayAmalgam.clayOut(facesContext, component, displayElement);
+
+ assertEquals("jsfid", displayElement.getJsfid(), "outputText");
+ assertEquals("componentType", displayElement.getComponentType(),
"javax.faces.HtmlOutputText");
+
+ AttributeBean attr = displayElement.getAttribute("escape");
+ assertNotNull("escape", attr);
+ assertEquals("escape", attr.getValue(), Boolean.FALSE.toString());
+
+ attr = displayElement.getAttribute("isTransient");
+ assertNotNull("isTransient", attr);
+ assertEquals("isTransient", attr.getValue(), Boolean.TRUE.toString());
+
+ attr = displayElement.getAttribute("value");
+ assertNotNull("value", attr);
+ assertEquals("value", attr.getValue(), "<html><head></head><body
bgcolor=\"blue\">Hello World</body></html>");
+
+ }
+
+}
Modified:
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/GenericComparator.java
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/GenericComparator.java?rev=330963&r1=330962&r2=330963&view=diff
==============================================================================
---
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/GenericComparator.java
(original)
+++
struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/rolodex/GenericComparator.java
Fri Nov 4 19:18:44 2005
@@ -79,7 +79,7 @@
StringTokenizer tokenizer = new StringTokenizer(properties, ",");
sortBy = new ArrayList();
while (tokenizer.hasMoreTokens()) {
- String token = (String) tokenizer.nextToken().trim();
+ String token = tokenizer.nextToken().trim();
sortBy.add(token);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]