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:14:39 UTC

cvs commit: jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/mock suite.jelly service.jelly

dion        2004/09/07 22:14:39

  Modified:    jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/define
                        suite.jelly beanSample.jelly jellyBeanSample.jelly
               jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/mock
                        suite.jelly service.jelly
  Log:
  detab
  
  Revision  Changes    Path
  1.3       +35 -35    jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/define/suite.jelly
  
  Index: suite.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/define/suite.jelly,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- suite.jelly	25 Feb 2004 06:24:11 -0000	1.2
  +++ suite.jelly	8 Sep 2004 05:14:39 -0000	1.3
  @@ -15,18 +15,18 @@
     limitations under the License.
   -->
   <test:suite 
  -	xmlns:j="jelly:core" 
  -	xmlns:x="jelly:xml" 
  -	xmlns:test="jelly:junit" 
  -	xmlns:log="jelly:log" 
  -	xmlns:define="jelly:define"
  -	xmlns:dynamicTest="dynamicTest">
  +    xmlns:j="jelly:core" 
  +    xmlns:x="jelly:xml" 
  +    xmlns:test="jelly:junit" 
  +    xmlns:log="jelly:log" 
  +    xmlns:define="jelly:define"
  +    xmlns:dynamicTest="dynamicTest">
   
   <test:case name="invoke">
   
     <define:script var="fooScript">
  -  	<log:info>Generating some XML</log:info>
  -  	
  +      <log:info>Generating some XML</log:info>
  +      
       <foo id="1">
         <bar>some XML</bar>
       </foo>
  @@ -37,17 +37,17 @@
     
     
     <x:parse var="doc">
  -  	<log:info>About to invoke the script!</log:info>
  -  	
  -  	<define:invoke script="${fooScript}"/>
  +      <log:info>About to invoke the script!</log:info>
  +      
  +      <define:invoke script="${fooScript}"/>
     </x:parse>
  -  	   	
  -  	   	
  +             
  +             
     <x:forEach select="$doc//foo">
       <test:assert xpath="bar"/>
     </x:forEach>
       
  -    			  	   	
  +                             
     <test:assert xpath="$doc/foo/bar"/>
     
   </test:case>
  @@ -77,14 +77,14 @@
      
   
   <test:case name="dynaBeans" 
  -	xmlns:dynabean="jelly:dynabean"
  -	xmlns:my="dynamicDynaBeanTest">
  +    xmlns:dynabean="jelly:dynabean"
  +    xmlns:my="dynamicDynaBeanTest">
   
  -	<!-- create a DynaClass -->
  +    <!-- create a DynaClass -->
     <dynabean:dynaclass var="CustomerType" name="CustomerDynaClass"> 
  -		<dynabean:property name="name" type="String" />
  -		<dynabean:property name="address" type="String" />
  -	</dynabean:dynaclass>
  +        <dynabean:property name="name" type="String" />
  +        <dynabean:property name="address" type="String" />
  +    </dynabean:dynaclass>
   
     <!-- Create a new tag library binding the dynabeans. -->
     <define:taglib uri="dynamicDynaBeanTest">
  @@ -94,22 +94,22 @@
       />
     </define:taglib>
   
  -	<!-- now lets create a customer -->
  -	<my:customer var="customer" name="Customer 1" address="Address of Customer 1" />
  +    <!-- now lets create a customer -->
  +    <my:customer var="customer" name="Customer 1" address="Address of Customer 1" />
   
  -	<test:assert test="${customer != null}">Created a customer DynaBean</test:assert>
  -	
  -	<test:assertEquals 
  -		expected="Customer 1" 
  -		actual="${customer.name}"/>
  -		
  -	<test:assertEquals 
  -		expected="Address of Customer 1" 
  -		actual="${customer.address}"/>
  -		
  -	<test:assertEquals 
  -		expected="CustomerDynaClass" 
  -		actual="${customer.dynaClass.name}"/>
  +    <test:assert test="${customer != null}">Created a customer DynaBean</test:assert>
  +    
  +    <test:assertEquals 
  +        expected="Customer 1" 
  +        actual="${customer.name}"/>
  +        
  +    <test:assertEquals 
  +        expected="Address of Customer 1" 
  +        actual="${customer.address}"/>
  +        
  +    <test:assertEquals 
  +        expected="CustomerDynaClass" 
  +        actual="${customer.dynaClass.name}"/>
   
   </test:case>
   
  
  
  
  1.3       +18 -18    jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/define/beanSample.jelly
  
  Index: beanSample.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/define/beanSample.jelly,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- beanSample.jelly	25 Feb 2004 06:24:11 -0000	1.2
  +++ beanSample.jelly	8 Sep 2004 05:14:39 -0000	1.3
  @@ -17,27 +17,27 @@
   
   <!-- creates a Bean -->
   <j:jelly 
  -	xmlns:j="jelly:core" 
  -	xmlns:define="jelly:define" 
  -	xmlns:log="jelly:log" 
  -	xmlns:my="myDummyTagLib">
  -	
  +    xmlns:j="jelly:core" 
  +    xmlns:define="jelly:define" 
  +    xmlns:log="jelly:log" 
  +    xmlns:my="myDummyTagLib">
  +    
   <testcase>
   
     <log:info>Lets define a new tag library</log:info>
     
     <define:taglib uri="myDummyTagLib">  
     
  -  	<!-- 
  -  	  || map the given bean to a jelly tag 
  -  	  || we'll specify some required attributes and some default values
  -  	  -->
  -  	  
  +      <!-- 
  +        || map the given bean to a jelly tag 
  +        || we'll specify some required attributes and some default values
  +        -->
  +        
       <define:bean name="customer" className="org.apache.commons.jelly.core.Customer">
  -	  <define:attribute name="name" required="true"/>
  -	  <define:attribute name="location" defaultValue="UK"/>
  -	</define:bean>    	
  -	
  +      <define:attribute name="name" required="true"/>
  +      <define:attribute name="location" defaultValue="UK"/>
  +    </define:bean>        
  +    
     </define:taglib>
   
     <log:info>Now lets invoke the new Jelly bean tag</log:info>
  @@ -50,19 +50,19 @@
     
     <log:info>Created a customer with name ${c2.name} and location ${c2.location}</log:info>
   
  -		
  +        
     <j:catch var="exception">
  -  	<my:customer location="UK"/>
  +      <my:customer location="UK"/>
     </j:catch>
     
     <log:info>Caught exception ${exception} with reason: ${exception.reason}</log:info>
     
     <j:if test="${exception == null}">
  -  	<log:error>Failed! I should have an exception since I didn't specify a 'name' attribute</log:error>
  +      <log:error>Failed! I should have an exception since I didn't specify a 'name' attribute</log:error>
     </j:if>
     
     
   </testcase>
  -  		
  +          
   </j:jelly>
   
  
  
  
  1.3       +7 -7      jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/define/jellyBeanSample.jelly
  
  Index: jellyBeanSample.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/define/jellyBeanSample.jelly,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jellyBeanSample.jelly	25 Feb 2004 06:24:11 -0000	1.2
  +++ jellyBeanSample.jelly	8 Sep 2004 05:14:39 -0000	1.3
  @@ -17,12 +17,12 @@
   
   <!-- uses a JellyBean, which invokes the run() method -->
   <j:jelly 
  -	xmlns:j="jelly:core" 
  -	xmlns:define="jelly:define" 
  -	xmlns:log="jelly:log" 
  -	xmlns:my="myDummyTagLib"
  -	xmlns="jelly:ant">
  -	
  +    xmlns:j="jelly:core" 
  +    xmlns:define="jelly:define" 
  +    xmlns:log="jelly:log" 
  +    xmlns:my="myDummyTagLib"
  +    xmlns="jelly:ant">
  +    
   <testcase>
   
     <log:info>Lets define a new tag library</log:info>
  @@ -77,6 +77,6 @@
     <my:bar/>
     
   </testcase>
  -  		
  +          
   </j:jelly>
   
  
  
  
  1.3       +52 -52    jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/mock/suite.jelly
  
  Index: suite.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/mock/suite.jelly,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- suite.jelly	25 Feb 2004 06:24:11 -0000	1.2
  +++ suite.jelly	8 Sep 2004 05:14:39 -0000	1.3
  @@ -16,68 +16,68 @@
   -->
   <test:suite xmlns:j="jelly:core" xmlns:test="jelly:junit" xmlns:mock="jelly:define" xmlns:log="jelly:log">
   
  -	<!-- lets create some mock tags and test a sample script that it evaluates the 
  -		|| mock tags as we'd expect
  -		-->
  -		
  -	<test:case name="testMockTags">
  +    <!-- lets create some mock tags and test a sample script that it evaluates the 
  +        || mock tags as we'd expect
  +        -->
  +        
  +    <test:case name="testMockTags">
   
  -		<!-- lets create the Mock Tags to simulate the database and the web service -->
  -		
  +        <!-- lets create the Mock Tags to simulate the database and the web service -->
  +        
       <!-- note that the mock library will only be in effiect in this JellyContext. 
  -    	|| Each test:case has its own context
  +        || Each test:case has its own context
         -->
  -		<j:set var="foodKind" value="pizza"/>
  -	      
  -<!--	  <mock:taglib uri="jelly:sql">      
  -	    <mock:tag name="query">
  --->	    	
  -	      <!-- generate a mock result set   
  -	      <sql:resultSet var="results">
  +        <j:set var="foodKind" value="pizza"/>
  +          
  +<!--      <mock:taglib uri="jelly:sql">      
  +        <mock:tag name="query">
  +-->            
  +          <!-- generate a mock result set   
  +          <sql:resultSet var="results">
             <sql:row id="abc"/>
             <sql:row id="def"/>
  -	      </sql:resultSet>
  -	       --> 
  -	      <!-- since we are inside a Tag Context, lets export the results variable to the parent context 
  -	      <j:set var="${var}" scope="parent" value="${results}"/>-->
  +          </sql:resultSet>
  +           --> 
  +          <!-- since we are inside a Tag Context, lets export the results variable to the parent context 
  +          <j:set var="${var}" scope="parent" value="${results}"/>-->
   <!--      </mock:tag>
         
  -	    <mock:tag name="param">
  -	    	<test:equals expects="pizza" value="${value}"/>
  +        <mock:tag name="param">
  +            <test:equals expects="pizza" value="${value}"/>
         </mock:tag>
  -		</mock:taglib>
  +        </mock:taglib>
   -->
  -		<mock:taglib uri="myFoodWebService">
  -		  <mock:tag name="eat">
  -		  	<log:info>Invoking the eat web service with ${cheese}</log:info>
  -		  	
  -		  	
  -		  	<!-- increment the counter, in the parent scope so not to use a local variable -->
  -		  	<j:set var="eatServiceCount" scope="parent" value="${1+eatServiceCount}"/>
  -		  	
  -		  	<j:choose>
  -					<j:when test="${eatServiceCount == 1}">  			
  -						<test:assertEquals expected="abc" actual="${cheese}"/>
  -					</j:when>  			
  +        <mock:taglib uri="myFoodWebService">
  +          <mock:tag name="eat">
  +              <log:info>Invoking the eat web service with ${cheese}</log:info>
  +              
  +              
  +              <!-- increment the counter, in the parent scope so not to use a local variable -->
  +              <j:set var="eatServiceCount" scope="parent" value="${1+eatServiceCount}"/>
  +              
  +              <j:choose>
  +                    <j:when test="${eatServiceCount == 1}">              
  +                        <test:assertEquals expected="abc" actual="${cheese}"/>
  +                    </j:when>              
   
  -					<j:when test="${eatServiceCount == 2}">  			
  -						<test:assertEquals expected="def" actual="${cheese}"/>
  -					</j:when>  			
  -											
  -					<j:otherwise>
  -						<test:fail>Invoked eat web service too many times!</test:fail>
  -					</j:otherwise>
  -		  	</j:choose>
  -			</mock:tag>
  -		</mock:taglib>
  +                    <j:when test="${eatServiceCount == 2}">              
  +                        <test:assertEquals expected="def" actual="${cheese}"/>
  +                    </j:when>              
  +                                            
  +                    <j:otherwise>
  +                        <test:fail>Invoked eat web service too many times!</test:fail>
  +                    </j:otherwise>
  +              </j:choose>
  +            </mock:tag>
  +        </mock:taglib>
   
  -		<!-- now lets invoke the service using the Mock Tags -->		
  -		<j:include uri="service.jelly"/>
  -		
  -	
  -		<!-- lets assert that the mock objects have been invoked correctly -->
  -		<test:assert test="${eatServiceCount == 2}">Should have invoked the eat web service twice</test:assert>
  -		
  -	</test:case>
  +        <!-- now lets invoke the service using the Mock Tags -->        
  +        <j:include uri="service.jelly"/>
  +        
  +    
  +        <!-- lets assert that the mock objects have been invoked correctly -->
  +        <test:assert test="${eatServiceCount == 2}">Should have invoked the eat web service twice</test:assert>
  +        
  +    </test:case>
   
   </test:suite>
  
  
  
  1.3       +24 -24    jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/mock/service.jelly
  
  Index: service.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/define/src/test/org/apache/commons/jelly/tags/mock/service.jelly,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- service.jelly	25 Feb 2004 06:24:11 -0000	1.2
  +++ service.jelly	8 Sep 2004 05:14:39 -0000	1.3
  @@ -16,30 +16,30 @@
   -->
   
   <!-- this script represents some sample service that we will test
  -	|| via Mock Tags
  -	-->
  -	
  +    || via Mock Tags
  +    -->
  +    
   <j:jelly xmlns:j="jelly:core" xmlns:my="myFoodWebService" xmlns:log="jelly:log">
   
  -<!--	<sql:query var="results"> 
  -	  select * from food where kind = ?
  --->	  
  -	  <!-- lets pass in some parametrized value -->
  -<!--	  <sql:param value="${foodKind}"/>
  -	</sql:query>
  --->	
  -	<!-- invoke some service 
  -	<j:forEach items="${results.rows}" var="row">
  -	
  -		<log:info>Found row with ID ${row.id}</log:info>
  --->	
  -	  <!-- this tag could invoke a web service etc
  -	  <my:eat cheese="${row.id}"/> -->
  -	  <!-- FIXME: Commented code above and repeated line are a 
  -	              workaround as the sql taglib has been removed
  -	    -->
  -	  <my:eat cheese="abc"/>
  -	  <my:eat cheese="def"/>
  -<!--	</j:forEach> -->
  -	
  +<!--    <sql:query var="results"> 
  +      select * from food where kind = ?
  +-->      
  +      <!-- lets pass in some parametrized value -->
  +<!--      <sql:param value="${foodKind}"/>
  +    </sql:query>
  +-->    
  +    <!-- invoke some service 
  +    <j:forEach items="${results.rows}" var="row">
  +    
  +        <log:info>Found row with ID ${row.id}</log:info>
  +-->    
  +      <!-- this tag could invoke a web service etc
  +      <my:eat cheese="${row.id}"/> -->
  +      <!-- FIXME: Commented code above and repeated line are a 
  +                  workaround as the sql taglib has been removed
  +        -->
  +      <my:eat cheese="abc"/>
  +      <my:eat cheese="def"/>
  +<!--    </j:forEach> -->
  +    
   </j:jelly>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org