jstrachan 2002/09/24 04:39:50 Modified: jelly/src/test/org/apache/commons/jelly suite.jelly Log: Added a <j:useBean> tag to both mimick the similar JSP tag but also to combine it with the <j:setProperties> tag so that a fully configured bean can be created easily by a single tag. <j:useBean var="foo" class="com.acme.MyCustomer" name="James" location="London" role="Hacker"/> Where the above will create a new variable called 'foo' of type com.acme.MyCustomer and then will set the name, location and role properties to the values given. This tag is also useful as a base class for constructing arbitrary objects of certain kinds that can be configured and used in some script - such as to plug in arbitrary Actions into a workflow style script or in a simple testing framework etc. Revision Changes Path 1.3 +21 -1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/suite.jelly Index: suite.jelly =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/suite.jelly,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- suite.jelly 24 Sep 2002 11:04:56 -0000 1.2 +++ suite.jelly 24 Sep 2002 11:39:50 -0000 1.3 @@ -72,7 +72,27 @@ <log:info>Created a new bean: ${customer}</log:info> - <test:assert test="${customer != null}">Created a customer DynaBean</test:assert> + <test:assert test="${customer != null}">Created a customer bean</test:assert> + + <test:assertEquals + expected="James" + actual="${customer.name}"/> + + <test:assertEquals + expected="London" + actual="${customer.city}"/> + + <test:assertEquals + expected="org.apache.commons.jelly.define.Customer" + actual="${customer.class.name}"/> + </test:case> + + <test:case name="testUseBean"> + <j:useBean var="customer" class="org.apache.commons.jelly.define.Customer" name="James" city="London" /> + + <log:info>Created a new bean: ${customer}</log:info> + + <test:assert test="${customer != null}">Created a customer bean</test:assert> <test:assertEquals expected="James"
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>