tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlewissh...@apache.org
Subject cvs commit: jakarta-tapestry/junit/mock-scripts TestValidField.xml
Date Wed, 17 Dec 2003 19:58:36 GMT
rlewisshell    2003/12/17 11:58:36

  Added:       junit/context29 Two.html Home.html README Three.html
               junit/context29/WEB-INF Three.page Two.page
               junit/src/org/apache/tapestry/junit/mock/c29 app.application
                        Two.java
               junit/mock-scripts TestValidField.xml
  Log:
  added test for bug 25585, and contrib.valid fields
  
  Revision  Changes    Path
  1.1                  jakarta-tapestry/junit/context29/Two.html
  
  Index: Two.html
  ===================================================================
  two
  <form jwcid="@Form" delegate="ognl:beans.delegate" listener="ognl:listeners.submit">
  <input type="text" jwcid="field"/>
  <span jwcid="@Conditional" condition="ognl:flag">
  <span jwcid="@FieldLabel" field="ognl:components.field2"/>: <input type="text"
jwcid="field2"/>
  </span>
  </form>
  
  
  1.1                  jakarta-tapestry/junit/context29/Home.html
  
  Index: Home.html
  ===================================================================
  home
  
  
  
  1.1                  jakarta-tapestry/junit/context29/README
  
  Index: README
  ===================================================================
  Tests for ValidField/ValidationDelegate and their subclasses
  
  See TestValidField.xml
  
  
  1.1                  jakarta-tapestry/junit/context29/Three.html
  
  Index: Three.html
  ===================================================================
  <form jwcid="intForm@Form" delegate="ognl:beans.delegate">
  intValue=<span jwcid="@Insert" value="ognl:intValue"/>|
  <input jwcid="intField@Contrib:NumericField" displayName="intValue" type="int" value="ognl:intValue"/>
  </form>
  
  <form jwcid="floatForm@Form" delegate="ognl:beans.delegate">
  floatValue=<span jwcid="@Insert" value="ognl:floatValue"/>|
  <input jwcid="floatField@Contrib:NumericField" displayName="floatValue" type="float"
value="ognl:floatValue"/>
  </form>
  
  <form jwcid="bigIntegerForm@Form" delegate="ognl:beans.delegate">
  bigIntegerValue=<span jwcid="@Insert" value="ognl:bigIntegerValue"/>|
  <input jwcid="bigIntegerField@Contrib:NumericField" displayName="bigIntegerValue" type="java.math.BigInteger"
value="ognl:bigIntegerValue"/>
  </form>
  
  <form jwcid="bigDecimalForm@Form" delegate="ognl:beans.delegate">
  bigDecimalValue=<span jwcid="@Insert" value="ognl:bigDecimalValue"/>|
  <input jwcid="bigDecimalField@Contrib:NumericField" displayName="bigDecimalValue" type="java.math.BigDecimal"
value="ognl:bigDecimalValue"/>
  </form>
  
  <form jwcid="stringForm@Form" delegate="ognl:beans.delegate">
  stringValue=<span jwcid="@Insert" value="ognl:stringValue"/>|
  <input jwcid="stringField@Contrib:ValidatingTextField" displayName="stringValue" text="ognl:stringValue"/>
  </form>
  
  <form jwcid="dateForm@Form" delegate="ognl:beans.delegate">
  dateValue=<span jwcid="@Insert" value="ognl:dateValue" format='ognl:new java.text.SimpleDateFormat("yyyy-MM-dd")'/>|
  <input jwcid="dateField@Contrib:DateField" displayName="dateValue" date="ognl:dateValue"/>
  </form>
  
  
  1.1                  jakarta-tapestry/junit/context29/WEB-INF/Three.page
  
  Index: Three.page
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- $Id: Home.page,v 1.1 2003/06/29 18:23:26 mindbridge Exp $ -->
  <!DOCTYPE page-specification PUBLIC 
    "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
  
  <page-specification>
      <property-specification name="intValue" type="int" initial-value="0"/>
      <property-specification name="floatValue" type="float" initial-value="0.0"/>
      <property-specification name="bigIntegerValue" type="java.math.BigInteger"/>
      <property-specification name="bigDecimalValue" type="java.math.BigDecimal"/>
      <property-specification name="stringValue" type="java.lang.String"/>
      <property-specification name="dateValue" type="java.util.Date"/>
      
      <bean name="delegate" class="org.apache.tapestry.valid.ValidationDelegate"/>
      
  </page-specification>
  
  
  
  1.1                  jakarta-tapestry/junit/context29/WEB-INF/Two.page
  
  Index: Two.page
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- $Id: Home.page,v 1.1 2003/06/29 18:23:26 mindbridge Exp $ -->
  <!DOCTYPE page-specification PUBLIC 
    "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
  
  <page-specification class="org.apache.tapestry.junit.mock.c29.Two">
      <property-specification name="intValue" type="int" initial-value="0"/>
      <property-specification name="intValue2" type="int" initial-value="0"/>
      <property-specification name="flag" type="boolean"/>
      
      <bean name="delegate" class="org.apache.tapestry.valid.ValidationDelegate"/>
  
      <bean name="intValidator" lifecycle="render" class="org.apache.tapestry.valid.NumberValidator">
          <set-property name="valueType">"int"</set-property>
      </bean>
      
      <component id="field" type="ValidField">
          <binding name="validator" expression="beans.intValidator"/>
          <binding name="value" expression="intValue"/>
          <static-binding name="displayName">int</static-binding>
      </component>
  
      <component id="field2" type="ValidField">
          <binding name="validator" expression="beans.intValidator"/>
          <binding name="value" expression="intValue2"/>
          <static-binding name="displayName">int2</static-binding>
      </component>
  
  </page-specification>
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c29/app.application
  
  Index: app.application
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- $Id: app.application,v 1.2 2003/06/01 05:05:08 hlship Exp $ -->
  <!DOCTYPE application PUBLIC 
    "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
  	
  <application>
      <library specification-path="/org/apache/tapestry/contrib/Contrib.library" id="Contrib"/>
  </application>
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c29/Two.java
  
  Index: Two.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation", "Tapestry" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache" 
   *    or "Tapestry", nor may "Apache" or "Tapestry" appear in their 
   *    name, without prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE TAPESTRY CONTRIBUTOR COMMUNITY
   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.tapestry.junit.mock.c29;
  
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.html.BasePage;
  
  public abstract class Two extends BasePage {
  	
  	public abstract void setFlag(boolean value);
  	public abstract boolean isFlag();
  	
      public void submit(IRequestCycle cycle) {
      	this.setFlag(!this.isFlag());
      }
  }
  
  
  
  1.1                  jakarta-tapestry/junit/mock-scripts/TestValidField.xml
  
  Index: TestValidField.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!-- $Id: TestValidField.xml,v 1.1 2003/12/17 19:58:36 rlewisshell Exp $ -->
  
  <mock-test>
      <context name="c29" root="context29"/>
  
    	<servlet name="app" class="org.apache.tapestry.ApplicationServlet">
    		<init-parameter name="org.apache.tapestry.application-specification"
    				value="/org/apache/tapestry/junit/mock/c29/app.application"/>
    	</servlet>
  
  <!--    <request>
      	<parameter name="service" value="page/Two"/>
      	
  		<assert-output>two</assert-output>
  	
  	</request> -->
  	
  	<!-- can use the above request output to find values for the next request -->
      <request>
      	<parameter name="service" value="direct/0/Two/$Form"/>
      	<parameter name="sp" value="S0"/>
      	<parameter name="Form0" value="field"/>
      	<parameter name="field" value="1"/> <!-- verify the form submission is working
-->
  
          <!-- we are really asserting that we did not get an exception page -->
  		<assert-output>two</assert-output>
  	
  	</request>
  	
  	<!-- Simple contrib.valid component tests -->
  	<!-- test the NumericField field -->
      <request>
      	<parameter name="service" value="page/Three"/>
      	
  		<assert-output>intValue=0|</assert-output>
  		<assert-output>floatValue=0.0|</assert-output>
  		<assert-output>bigIntegerValue=|</assert-output>
  		<assert-output>bigDecimalValue=|</assert-output>
  		<assert-output>stringValue=|</assert-output>
  		<assert-output>dateValue=|</assert-output>
  	</request>
  	
      <request>
      	<parameter name="service" value="direct/0/Three/intForm"/>
      	<parameter name="sp" value="S0"/>
      	<parameter name="Form0" value="intField"/>
      	<parameter name="intField" value="1"/>
  
  		<assert-output>intValue=1|</assert-output>
  	</request>
  	
      <request>
      	<parameter name="service" value="direct/0/Three/floatForm"/>
      	<parameter name="sp" value="S0"/>
      	<parameter name="Form0" value="floatField"/>
      	<parameter name="floatField" value="1.23"/>
  
  		<assert-output>floatValue=1.23|</assert-output>
  	</request>
  	
      <request>
      	<parameter name="service" value="direct/0/Three/bigIntegerForm"/>
      	<parameter name="sp" value="S0"/>
      	<parameter name="Form0" value="bigIntegerField"/>
      	<parameter name="bigIntegerField" value="12345678901234567890"/>
  
  		<assert-output>bigIntegerValue=12345678901234567890|</assert-output>
  	</request>
  	
      <request>
      	<parameter name="service" value="direct/0/Three/bigDecimalForm"/>
      	<parameter name="sp" value="S0"/>
      	<parameter name="Form0" value="bigDecimalField"/>
      	<parameter name="bigDecimalField" value="1234567890.1234567890"/>
  
  		<assert-output>bigDecimalValue=1234567890.1234567890|</assert-output>
  	</request>
  	
      <request>
      	<parameter name="service" value="direct/0/Three/stringForm"/>
      	<parameter name="sp" value="S0"/>
      	<parameter name="Form0" value="stringField"/>
      	<parameter name="stringField" value="Tapestry Rocks"/>
  
  		<assert-output>stringValue=Tapestry Rocks|</assert-output>
  	</request>
  	
      <request>
      	<parameter name="service" value="direct/0/Three/dateForm"/>
      	<parameter name="sp" value="S0"/>
      	<parameter name="Form0" value="dateField"/>
      	<parameter name="dateField" value="3/20/1974"/>
  
  		<assert-output>dateValue=1974-03-20|</assert-output>
  	</request>
  	
  </mock-test>
  
  

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


Mime
View raw message