You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by mi...@apache.org on 2005/09/06 20:26:18 UTC
svn commit: r279054 - in /jakarta/tapestry/trunk/framework/src:
scripts/TestFor.xml test-data/context34/Home.html
test/org/apache/tapestry/junit/mock/c34/Home.java
test/org/apache/tapestry/junit/mock/c34/Item.java
Author: mindbridge
Date: Tue Sep 6 11:26:09 2005
New Revision: 279054
URL: http://svn.apache.org/viewcvs?rev=279054&view=rev
Log:
Unit test modifications that cover the changes in
the For component code.
Added:
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Item.java
Modified:
jakarta/tapestry/trunk/framework/src/scripts/TestFor.xml
jakarta/tapestry/trunk/framework/src/test-data/context34/Home.html
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Home.java
Modified: jakarta/tapestry/trunk/framework/src/scripts/TestFor.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/scripts/TestFor.xml?rev=279054&r1=279053&r2=279054&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/scripts/TestFor.xml (original)
+++ jakarta/tapestry/trunk/framework/src/scripts/TestFor.xml Tue Sep 6 11:26:09 2005
@@ -57,7 +57,7 @@
</request>
<request>
- <parameter name="formids" value="If_1,If_2,for2,for3,for4"/>
+ <parameter name="formids" value="If_1,If_2,for2,for3,for4,for5,for6"/>
<parameter name="component" value="$Form"/>
<parameter name="page" value="Home"/>
<parameter name="service" value="direct"/>
@@ -65,19 +65,25 @@
<parameter name="If_1" value="T"/>
<parameter name="If_2" value="F"/>
<parameter name="for2">
- <value>VV</value>
- <value>Suno</value>
- <value>Sdue</value>
+ <value>VSuno</value>
+ <value>VSdue</value>
</parameter>
<parameter name="for3">
- <value>PP</value>
- <value>Sbg_BG</value>
- <value>Sde_DE</value>
+ <value>PSbg_BG</value>
+ <value>PSde_DE</value>
</parameter>
<parameter name="for4">
- <value>PP</value>
- <value>Sen_US</value>
- <value>Sbg_BG</value>
+ <value>PSen_US</value>
+ <value>PSbg_BG</value>
+ </parameter>
+ <parameter name="for5">
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUx</value>
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUz</value>
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWU2</value>
+ </parameter>
+ <parameter name="for6">
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUx</value>
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUz</value>
</parameter>
<assert-output name="Test If 1">
@@ -112,6 +118,10 @@
But show this form text too!
</assert-output>
+ <assert-output name="Test For index count">
+Rewinded index count: 11
+ </assert-output>
+
<assert-output name="Test For index 0">
Rewinded index 0 is 0
</assert-output>
@@ -136,6 +146,30 @@
Rewinded index 5 is 1
</assert-output>
+ <assert-output name="Test For index 6">
+Rewinded index 6 is 0
+ </assert-output>
+
+ <assert-output name="Test For index 7">
+Rewinded index 7 is 1
+ </assert-output>
+
+ <assert-output name="Test For index 8">
+Rewinded index 8 is 2
+ </assert-output>
+
+ <assert-output name="Test For index 9">
+Rewinded index 9 is 0
+ </assert-output>
+
+ <assert-output name="Test For index 10">
+Rewinded index 10 is 1
+ </assert-output>
+
+ <assert-output name="Test For value count">
+Rewinded value count: 11
+ </assert-output>
+
<assert-output name="Test For value 0">
Rewinded value 0 is uno
</assert-output>
@@ -158,6 +192,26 @@
<assert-output name="Test For value 5">
Rewinded value 5 is en
+ </assert-output>
+
+ <assert-output name="Test For value 6">
+Rewinded value 6 is Item[id1 : value1]
+ </assert-output>
+
+ <assert-output name="Test For value 7">
+Rewinded value 7 is Item[id3 : value3]
+ </assert-output>
+
+ <assert-output name="Test For value 8">
+Rewinded value 8 is Item[null : value6]
+ </assert-output>
+
+ <assert-output name="Test For value 9">
+Rewinded value 9 is Item[null : value1]
+ </assert-output>
+
+ <assert-output name="Test For value 10">
+Rewinded value 10 is Item[null : value3]
</assert-output>
</request>
Modified: jakarta/tapestry/trunk/framework/src/test-data/context34/Home.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test-data/context34/Home.html?rev=279054&r1=279053&r2=279054&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test-data/context34/Home.html (original)
+++ jakarta/tapestry/trunk/framework/src/test-data/context34/Home.html Tue Sep 6 11:26:09 2005
@@ -50,6 +50,14 @@
index="ognl: index" value="ognl: value">
for4 <span jwcid="@Insert" value="ognl: components.for4.index"/> : <span jwcid="@Insert" value="ognl: components.for4.value"/>
</span>
+
+ <span jwcid="for5@For" source="ognl: items" fullSource="ognl: allItems" index="ognl: index" value="ognl: value">
+ for5 <span jwcid="@Insert" value="ognl: components.for5.index"/> : <span jwcid="@Insert" value="ognl: components.for5.value"/>
+ </span>
+
+ <span jwcid="for6@For" source="ognl: items" match="false" index="ognl: index" value="ognl: value">
+ for6 <span jwcid="@Insert" value="ognl: components.for6.index"/> : <span jwcid="@Insert" value="ognl: components.for6.value"/>
+ </span>
</span>
Modified: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Home.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Home.java?rev=279054&r1=279053&r2=279054&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Home.java (original)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Home.java Tue Sep 6 11:26:09 2005
@@ -14,14 +14,15 @@
package org.apache.tapestry.junit.mock.c34;
+import java.util.ArrayList;
import java.util.List;
import org.apache.tapestry.html.BasePage;
/**
- * Used to test expression binding optimization.
+ * Used to test the For and If components.
*
- * @author Howard Lewis Ship
+ * @author Mindbridge
*/
public abstract class Home extends BasePage
{
@@ -36,5 +37,22 @@
public void setValue(Object value) {
if (getRequestCycle().isRewinding())
getRewindedValues().add(value);
+ }
+
+ public List getItems() {
+ List items = new ArrayList();
+ items.add(new Item("id1", "value1"));
+ items.add(new Item("id2", "value2"));
+ return items;
+ }
+
+ public List getAllItems() {
+ List items = new ArrayList();
+ items.add(new Item("id1", "value1"));
+ items.add(new Item("id2", "value2"));
+ items.add(new Item("id3", "value3"));
+ items.add(new Item("id4", "value4"));
+ items.add(new Item("id5", "value5"));
+ return items;
}
}
Added: jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Item.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Item.java?rev=279054&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Item.java (added)
+++ jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/junit/mock/c34/Item.java Tue Sep 6 11:26:09 2005
@@ -0,0 +1,50 @@
+// Copyright 2004, 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.tapestry.junit.mock.c34;
+
+import java.io.Serializable;
+
+/**
+ * A serializable Item with one volatile field that is not serialized.
+ *
+ * Used to test whether the value string representation is matched,
+ * or whether it is unsqueezed instead.
+ *
+ * @author Mindbridge
+ */
+public class Item implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private transient String _id = "unknown";
+ private String _value = "unknown";
+
+ public Item(String id, String value) {
+ _id = id;
+ _value = value;
+ }
+
+ public String getId() {
+ return _id;
+ }
+
+ public String getValue() {
+ return _value;
+ }
+
+ public String toString() {
+ return "Item[" + _id + " : " + _value + "]";
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org