You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2004/09/08 07:13:30 UTC
cvs commit: jakarta-commons/jelly/jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean suite.jelly
dion 2004/09/07 22:13:30
Modified: jelly/jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean
suite.jelly
Log:
detab
Revision Changes Path
1.6 +248 -248 jakarta-commons/jelly/jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean/suite.jelly
Index: suite.jelly
===================================================================
RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean/suite.jelly,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- suite.jelly 25 Feb 2004 06:10:05 -0000 1.5
+++ suite.jelly 8 Sep 2004 05:13:30 -0000 1.6
@@ -16,252 +16,252 @@
-->
<test:suite
- xmlns:j="jelly:core"
- xmlns:mytags="jelly:org.apache.commons.jelly.tags.bean.MyTagLibrary"
- xmlns:mytags2="jelly:org.apache.commons.jelly.tags.bean.MyBeanTagLibrary"
- xmlns="jelly:bean"
- xmlns:test="jelly:junit"
- xmlns:log="jelly:log">
-
- <!-- need to do this so the bean taglib recognizes the customer root tag. For nested
- tags, the object type is inferred from the available accessor methods. This definition
- is used by the testNestedBeanTag and testBeanList cases. The nesting level at
- which it appears does not play any role - it becomes globally visible after it is executed -->
-
- <beandef name="customer" className="org.apache.commons.jelly.tags.bean.Customer"/>
- <beandef name="manager" className="org.apache.commons.jelly.tags.bean.Manager" methodName="run"/>
-
- <test:case name="testNestedBeanTag">
-
- <customer var="c1" name="James" location="London" >
- <order amount="100" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- <order amount="200" price="4.99">
- <product id="p2" name="Pizza"/>
- </order>
- </customer>
-
- <log:info>Created a customer with name: ${c1.name} and location: ${c1.location}</log:info>
- <log:info>Customer has orders ${c1.orders}</log:info>
-
- <test:assertEquals expected="James" actual="${c1.name}"/>
- <test:assertEquals expected="London" actual="${c1.location}"/>
-
- <test:assertTrue test="${size(c1.orders) == 2}"/>
-
- <test:assertTrue test="${c1.orders[0].amount == 100}"/>
- <test:assertTrue test="${c1.orders[0].price == 2.99}"/>
-
- <test:assertTrue test="${c1.orders[1].amount == 200}"/>
- <test:assertTrue test="${c1.orders[1].price == 4.99}"/>
-
- <test:assertTrue test="${c1.orders[0].product != null}"/>
- <test:assertTrue test="${c1.orders[1].product != null}"/>
-
- <test:assertEquals expected="p1" actual="${c1.orders[0].product.id}"/>
- <test:assertEquals expected="Beer" actual="${c1.orders[0].product.name}"/>
-
- <test:assertEquals expected="p2" actual="${c1.orders[1].product.id}"/>
- <test:assertEquals expected="Pizza" actual="${c1.orders[1].product.name}"/>
-
- </test:case>
-
- <test:case name="testNestedBeanPropertyTag">
-
- <!--
- || This test uses a custom library which has the customer tag registered
- || Therefore, the beandef is not required
- -->
- <mytags:customer var="c1" name="James" location="London" >
- <order amount="100" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- <order amount="200" price="4.99">
- <product id="p2" name="Pizza"/>
- </order>
- </mytags:customer>
-
- <log:info>Created a customer with name: ${c1.name} and location: ${c1.location}</log:info>
- <log:info>Customer has orders ${c1.orders}</log:info>
-
- <test:assertEquals expected="James" actual="${c1.name}"/>
- <test:assertEquals expected="London" actual="${c1.location}"/>
-
- <test:assertTrue test="${size(c1.orders) == 2}"/>
-
- <test:assertTrue test="${c1.orders[0].amount == 100}"/>
- <test:assertTrue test="${c1.orders[0].price == 2.99}"/>
-
- <test:assertTrue test="${c1.orders[1].amount == 200}"/>
- <test:assertTrue test="${c1.orders[1].price == 4.99}"/>
-
- <test:assertTrue test="${c1.orders[0].product != null}"/>
- <test:assertTrue test="${c1.orders[1].product != null}"/>
-
- <test:assertEquals expected="p1" actual="${c1.orders[0].product.id}"/>
- <test:assertEquals expected="Beer" actual="${c1.orders[0].product.name}"/>
-
- <test:assertEquals expected="p2" actual="${c1.orders[1].product.id}"/>
- <test:assertEquals expected="Pizza" actual="${c1.orders[1].product.name}"/>
-
- </test:case>
-
- <test:case name="testNestedBeanPropertyTag2">
-
- <!--
- || as above but uses a non-BeanTagLibrary library.
- || i.e. just reusing the BeanTag and BeanPropertyTag
- -->
-
- <mytags2:customer var="c1" name="James" location="London" >
- <order amount="100" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- <order amount="200" price="4.99">
- <product id="p2" name="Pizza"/>
- </order>
- </mytags2:customer>
-
- <log:info>Created a customer with name: ${c1.name} and location: ${c1.location}</log:info>
- <log:info>Customer has orders ${c1.orders}</log:info>
-
- <test:assertEquals expected="James" actual="${c1.name}"/>
- <test:assertEquals expected="London" actual="${c1.location}"/>
-
- <test:assertTrue test="${size(c1.orders) == 2}"/>
-
- <test:assertTrue test="${c1.orders[0].amount == 100}"/>
- <test:assertTrue test="${c1.orders[0].price == 2.99}"/>
-
- <test:assertTrue test="${c1.orders[1].amount == 200}"/>
- <test:assertTrue test="${c1.orders[1].price == 4.99}"/>
-
- <test:assertTrue test="${c1.orders[0].product != null}"/>
- <test:assertTrue test="${c1.orders[1].product != null}"/>
-
- <test:assertEquals expected="p1" actual="${c1.orders[0].product.id}"/>
- <test:assertEquals expected="Beer" actual="${c1.orders[0].product.name}"/>
-
- <test:assertEquals expected="p2" actual="${c1.orders[1].product.id}"/>
- <test:assertEquals expected="Pizza" actual="${c1.orders[1].product.name}"/>
-
- </test:case>
-
- <test:case name="testBeanList">
-
- <j:useList var="list">
- <customer name="James" location="London">
- <order amount="100" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- <order amount="200" price="4.99">
- <product id="p2" name="Pizza"/>
- </order>
- </customer>
- <customer name="Bob" location="Atlanta">
- <order amount="200" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- </customer>
- </j:useList>
-
- <log:info>Created a list of customers ${list}</log:info>
-
- <test:assertTrue test="${size(list) == 2}"/>
-
- <test:assertEquals expected="James" actual="${list[0].name}"/>
- <test:assertEquals expected="London" actual="${list[0].location}"/>
-
- <test:assertTrue test="${size(list[0].orders) == 2}"/>
-
- <test:assertTrue test="${list[0].orders[0].amount == 100}"/>
- <test:assertTrue test="${list[0].orders[0].price == 2.99}"/>
-
- <test:assertTrue test="${list[0].orders[1].amount == 200}"/>
- <test:assertTrue test="${list[0].orders[1].price == 4.99}"/>
-
- <test:assertTrue test="${list[0].orders[0].product != null}"/>
- <test:assertTrue test="${list[0].orders[1].product != null}"/>
-
- <test:assertEquals expected="p1" actual="${list[0].orders[0].product.id}"/>
- <test:assertEquals expected="Beer" actual="${list[0].orders[0].product.name}"/>
-
- <test:assertEquals expected="p2" actual="${list[0].orders[1].product.id}"/>
- <test:assertEquals expected="Pizza" actual="${list[0].orders[1].product.name}"/>
-
-
- <test:assertEquals expected="Bob" actual="${list[1].name}"/>
- <test:assertEquals expected="Atlanta" actual="${list[1].location}"/>
-
- </test:case>
-
- <test:case name="testInvokeMethod">
-
- <manager var="foo">
- <customer name="James" location="London">
- <order amount="100" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- <order amount="200" price="4.99">
- <product id="p2" name="Pizza"/>
- </order>
- </customer>
- <customer name="Bob" location="Atlanta">
- <order amount="200" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- </customer>
- </manager>
-
- <test:assertTrue test="${foo.isInvoked()}"/>
- <test:assertTrue test="${size(foo.customers) == 2}"/>
-
- </test:case>
-
- <test:case name="testCollectionTag" xmlns="jelly:org.apache.commons.jelly.tags.bean.MyBeanTagLibrary">
-
- <myContainer var="list">
- <customer name="James" location="London">
- <order amount="100" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- <order amount="200" price="4.99">
- <product id="p2" name="Pizza"/>
- </order>
- </customer>
- <customer name="Bob" location="Atlanta">
- <order amount="200" price="2.99">
- <product id="p1" name="Beer"/>
- </order>
- </customer>
- </myContainer>
-
- <test:assertTrue test="${size(list) == 2}"/>
-
- Created list: ${list}
-
- <test:assertEquals expected="James" actual="${list[0].name}"/>
- <test:assertEquals expected="London" actual="${list[0].location}"/>
-
- <test:assertTrue test="${list[0].orders[0].amount == 100}"/>
- <test:assertTrue test="${list[0].orders[0].price == 2.99}"/>
-
- <test:assertTrue test="${list[0].orders[1].amount == 200}"/>
- <test:assertTrue test="${list[0].orders[1].price == 4.99}"/>
-
- <test:assertTrue test="${list[0].orders[0].product != null}"/>
- <test:assertTrue test="${list[0].orders[1].product != null}"/>
-
- <test:assertEquals expected="p1" actual="${list[0].orders[0].product.id}"/>
- <test:assertEquals expected="Beer" actual="${list[0].orders[0].product.name}"/>
-
- <test:assertEquals expected="p2" actual="${list[0].orders[1].product.id}"/>
- <test:assertEquals expected="Pizza" actual="${list[0].orders[1].product.name}"/>
-
-
- <test:assertEquals expected="Bob" actual="${list[1].name}"/>
- <test:assertEquals expected="Atlanta" actual="${list[1].location}"/>
- </test:case>
-
+ xmlns:j="jelly:core"
+ xmlns:mytags="jelly:org.apache.commons.jelly.tags.bean.MyTagLibrary"
+ xmlns:mytags2="jelly:org.apache.commons.jelly.tags.bean.MyBeanTagLibrary"
+ xmlns="jelly:bean"
+ xmlns:test="jelly:junit"
+ xmlns:log="jelly:log">
+
+ <!-- need to do this so the bean taglib recognizes the customer root tag. For nested
+ tags, the object type is inferred from the available accessor methods. This definition
+ is used by the testNestedBeanTag and testBeanList cases. The nesting level at
+ which it appears does not play any role - it becomes globally visible after it is executed -->
+
+ <beandef name="customer" className="org.apache.commons.jelly.tags.bean.Customer"/>
+ <beandef name="manager" className="org.apache.commons.jelly.tags.bean.Manager" methodName="run"/>
+
+ <test:case name="testNestedBeanTag">
+
+ <customer var="c1" name="James" location="London" >
+ <order amount="100" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ <order amount="200" price="4.99">
+ <product id="p2" name="Pizza"/>
+ </order>
+ </customer>
+
+ <log:info>Created a customer with name: ${c1.name} and location: ${c1.location}</log:info>
+ <log:info>Customer has orders ${c1.orders}</log:info>
+
+ <test:assertEquals expected="James" actual="${c1.name}"/>
+ <test:assertEquals expected="London" actual="${c1.location}"/>
+
+ <test:assertTrue test="${size(c1.orders) == 2}"/>
+
+ <test:assertTrue test="${c1.orders[0].amount == 100}"/>
+ <test:assertTrue test="${c1.orders[0].price == 2.99}"/>
+
+ <test:assertTrue test="${c1.orders[1].amount == 200}"/>
+ <test:assertTrue test="${c1.orders[1].price == 4.99}"/>
+
+ <test:assertTrue test="${c1.orders[0].product != null}"/>
+ <test:assertTrue test="${c1.orders[1].product != null}"/>
+
+ <test:assertEquals expected="p1" actual="${c1.orders[0].product.id}"/>
+ <test:assertEquals expected="Beer" actual="${c1.orders[0].product.name}"/>
+
+ <test:assertEquals expected="p2" actual="${c1.orders[1].product.id}"/>
+ <test:assertEquals expected="Pizza" actual="${c1.orders[1].product.name}"/>
+
+ </test:case>
+
+ <test:case name="testNestedBeanPropertyTag">
+
+ <!--
+ || This test uses a custom library which has the customer tag registered
+ || Therefore, the beandef is not required
+ -->
+ <mytags:customer var="c1" name="James" location="London" >
+ <order amount="100" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ <order amount="200" price="4.99">
+ <product id="p2" name="Pizza"/>
+ </order>
+ </mytags:customer>
+
+ <log:info>Created a customer with name: ${c1.name} and location: ${c1.location}</log:info>
+ <log:info>Customer has orders ${c1.orders}</log:info>
+
+ <test:assertEquals expected="James" actual="${c1.name}"/>
+ <test:assertEquals expected="London" actual="${c1.location}"/>
+
+ <test:assertTrue test="${size(c1.orders) == 2}"/>
+
+ <test:assertTrue test="${c1.orders[0].amount == 100}"/>
+ <test:assertTrue test="${c1.orders[0].price == 2.99}"/>
+
+ <test:assertTrue test="${c1.orders[1].amount == 200}"/>
+ <test:assertTrue test="${c1.orders[1].price == 4.99}"/>
+
+ <test:assertTrue test="${c1.orders[0].product != null}"/>
+ <test:assertTrue test="${c1.orders[1].product != null}"/>
+
+ <test:assertEquals expected="p1" actual="${c1.orders[0].product.id}"/>
+ <test:assertEquals expected="Beer" actual="${c1.orders[0].product.name}"/>
+
+ <test:assertEquals expected="p2" actual="${c1.orders[1].product.id}"/>
+ <test:assertEquals expected="Pizza" actual="${c1.orders[1].product.name}"/>
+
+ </test:case>
+
+ <test:case name="testNestedBeanPropertyTag2">
+
+ <!--
+ || as above but uses a non-BeanTagLibrary library.
+ || i.e. just reusing the BeanTag and BeanPropertyTag
+ -->
+
+ <mytags2:customer var="c1" name="James" location="London" >
+ <order amount="100" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ <order amount="200" price="4.99">
+ <product id="p2" name="Pizza"/>
+ </order>
+ </mytags2:customer>
+
+ <log:info>Created a customer with name: ${c1.name} and location: ${c1.location}</log:info>
+ <log:info>Customer has orders ${c1.orders}</log:info>
+
+ <test:assertEquals expected="James" actual="${c1.name}"/>
+ <test:assertEquals expected="London" actual="${c1.location}"/>
+
+ <test:assertTrue test="${size(c1.orders) == 2}"/>
+
+ <test:assertTrue test="${c1.orders[0].amount == 100}"/>
+ <test:assertTrue test="${c1.orders[0].price == 2.99}"/>
+
+ <test:assertTrue test="${c1.orders[1].amount == 200}"/>
+ <test:assertTrue test="${c1.orders[1].price == 4.99}"/>
+
+ <test:assertTrue test="${c1.orders[0].product != null}"/>
+ <test:assertTrue test="${c1.orders[1].product != null}"/>
+
+ <test:assertEquals expected="p1" actual="${c1.orders[0].product.id}"/>
+ <test:assertEquals expected="Beer" actual="${c1.orders[0].product.name}"/>
+
+ <test:assertEquals expected="p2" actual="${c1.orders[1].product.id}"/>
+ <test:assertEquals expected="Pizza" actual="${c1.orders[1].product.name}"/>
+
+ </test:case>
+
+ <test:case name="testBeanList">
+
+ <j:useList var="list">
+ <customer name="James" location="London">
+ <order amount="100" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ <order amount="200" price="4.99">
+ <product id="p2" name="Pizza"/>
+ </order>
+ </customer>
+ <customer name="Bob" location="Atlanta">
+ <order amount="200" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ </customer>
+ </j:useList>
+
+ <log:info>Created a list of customers ${list}</log:info>
+
+ <test:assertTrue test="${size(list) == 2}"/>
+
+ <test:assertEquals expected="James" actual="${list[0].name}"/>
+ <test:assertEquals expected="London" actual="${list[0].location}"/>
+
+ <test:assertTrue test="${size(list[0].orders) == 2}"/>
+
+ <test:assertTrue test="${list[0].orders[0].amount == 100}"/>
+ <test:assertTrue test="${list[0].orders[0].price == 2.99}"/>
+
+ <test:assertTrue test="${list[0].orders[1].amount == 200}"/>
+ <test:assertTrue test="${list[0].orders[1].price == 4.99}"/>
+
+ <test:assertTrue test="${list[0].orders[0].product != null}"/>
+ <test:assertTrue test="${list[0].orders[1].product != null}"/>
+
+ <test:assertEquals expected="p1" actual="${list[0].orders[0].product.id}"/>
+ <test:assertEquals expected="Beer" actual="${list[0].orders[0].product.name}"/>
+
+ <test:assertEquals expected="p2" actual="${list[0].orders[1].product.id}"/>
+ <test:assertEquals expected="Pizza" actual="${list[0].orders[1].product.name}"/>
+
+
+ <test:assertEquals expected="Bob" actual="${list[1].name}"/>
+ <test:assertEquals expected="Atlanta" actual="${list[1].location}"/>
+
+ </test:case>
+
+ <test:case name="testInvokeMethod">
+
+ <manager var="foo">
+ <customer name="James" location="London">
+ <order amount="100" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ <order amount="200" price="4.99">
+ <product id="p2" name="Pizza"/>
+ </order>
+ </customer>
+ <customer name="Bob" location="Atlanta">
+ <order amount="200" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ </customer>
+ </manager>
+
+ <test:assertTrue test="${foo.isInvoked()}"/>
+ <test:assertTrue test="${size(foo.customers) == 2}"/>
+
+ </test:case>
+
+ <test:case name="testCollectionTag" xmlns="jelly:org.apache.commons.jelly.tags.bean.MyBeanTagLibrary">
+
+ <myContainer var="list">
+ <customer name="James" location="London">
+ <order amount="100" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ <order amount="200" price="4.99">
+ <product id="p2" name="Pizza"/>
+ </order>
+ </customer>
+ <customer name="Bob" location="Atlanta">
+ <order amount="200" price="2.99">
+ <product id="p1" name="Beer"/>
+ </order>
+ </customer>
+ </myContainer>
+
+ <test:assertTrue test="${size(list) == 2}"/>
+
+ Created list: ${list}
+
+ <test:assertEquals expected="James" actual="${list[0].name}"/>
+ <test:assertEquals expected="London" actual="${list[0].location}"/>
+
+ <test:assertTrue test="${list[0].orders[0].amount == 100}"/>
+ <test:assertTrue test="${list[0].orders[0].price == 2.99}"/>
+
+ <test:assertTrue test="${list[0].orders[1].amount == 200}"/>
+ <test:assertTrue test="${list[0].orders[1].price == 4.99}"/>
+
+ <test:assertTrue test="${list[0].orders[0].product != null}"/>
+ <test:assertTrue test="${list[0].orders[1].product != null}"/>
+
+ <test:assertEquals expected="p1" actual="${list[0].orders[0].product.id}"/>
+ <test:assertEquals expected="Beer" actual="${list[0].orders[0].product.name}"/>
+
+ <test:assertEquals expected="p2" actual="${list[0].orders[1].product.id}"/>
+ <test:assertEquals expected="Pizza" actual="${list[0].orders[1].product.name}"/>
+
+
+ <test:assertEquals expected="Bob" actual="${list[1].name}"/>
+ <test:assertEquals expected="Atlanta" actual="${list[1].location}"/>
+ </test:case>
+
</test:suite>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org