tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock TestListEdit.xml
Date Fri, 07 Feb 2003 04:25:25 GMT
hlship      2003/02/06 20:25:25

  Modified:    junit/src/net/sf/tapestry/junit/mock/lib ShowError.jwc
                        Border.jwc
  Added:       junit/src/net/sf/tapestry/junit/mock/c14 ListEditForm.java
                        Color.java ListEditResults.java
                        ColorStrings.properties ListEdit.java
                        ListEditArray.java
               junit/src/net/sf/tapestry/junit/mock TestListEdit.xml
  Log:
  Add tests for the ListEdit component.
  
  Revision  Changes    Path
  1.1                  jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/c14/ListEditForm.java
  
  Index: ListEditForm.java
  ===================================================================
  /*
   *  ====================================================================
   *  The Apache Software License, Version 1.1
   *
   *  Copyright (c) 2002 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://www.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" and
   *  "Apache 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",
   *  "Apache Tapestry", nor may "Apache" 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 APACHE SOFTWARE FOUNDATION OR
   *  ITS CONTRIBUTORS 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 net.sf.tapestry.junit.mock.c14;
  
  import net.sf.tapestry.BaseComponent;
  import net.sf.tapestry.IRequestCycle;
  import net.sf.tapestry.event.PageDetachListener;
  import net.sf.tapestry.event.PageEvent;
  
  /**
   *  Tests the use of the listener and index parameters
   *  of {@link net.sf.tapestry.form.ListEdit}, as well
   *  as using an array (not a list) as a ListEdit source.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: ListEditForm.java,v 1.1 2003/02/07 04:25:25 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public abstract class ListEditForm extends BaseComponent
  implements PageDetachListener
  {
  	private static int _syncCount;
  	
  	public int getSyncCount()
  	{
  		return _syncCount;
  	}
  	
  	public void synchronizeItem(IRequestCycle cycle)
  	{
  		_syncCount++;
  	}
  	
      public void pageDetached(PageEvent event)
      {
      	_syncCount = 0;
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/c14/Color.java
  
  Index: Color.java
  ===================================================================
  /*
   *  ====================================================================
   *  The Apache Software License, Version 1.1
   *
   *  Copyright (c) 2002 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://www.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" and
   *  "Apache 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",
   *  "Apache Tapestry", nor may "Apache" 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 APACHE SOFTWARE FOUNDATION OR
   *  ITS CONTRIBUTORS 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 net.sf.tapestry.junit.mock.c14;
  
  import org.apache.commons.lang.enum.Enum;
  
  public class Color extends Enum
  {
      public static final Color RED = new Color("RED");
      public static final Color GREEN = new Color("GREEN");
      public static final Color BLUE = new Color("BLUE");
      public static final Color PUECE = new Color("PUECE");
      public static final Color YELLOW = new Color("YELLOW");
      public static final Color BLACK = new Color("BLACK");
      public static final Color WHITE = new Color("WHITE");
  
      public static final Color[] ALL_COLORS = { RED, GREEN, BLUE, YELLOW, BLACK, WHITE, PUECE
};
  
      private Color(String name)
      {
          super(name);
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/c14/ListEditResults.java
  
  Index: ListEditResults.java
  ===================================================================
  /*
   *  ====================================================================
   *  The Apache Software License, Version 1.1
   *
   *  Copyright (c) 2002 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://www.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" and
   *  "Apache 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",
   *  "Apache Tapestry", nor may "Apache" 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 APACHE SOFTWARE FOUNDATION OR
   *  ITS CONTRIBUTORS 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 net.sf.tapestry.junit.mock.c14;
  
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.List;
  import java.util.Map;
  import java.util.ResourceBundle;
  
  import net.sf.tapestry.html.BasePage;
  
  /**
   *  Shows user's selected colors in a new page.  A bit of duplication with
   *  ListEdit, but such is testing.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: ListEditResults.java,v 1.1 2003/02/07 04:25:25 hlship Exp $
   *  @since 2.4
   *
   **/
  public abstract class ListEditResults extends BasePage
  {
      public abstract Map getColorMap();
      public abstract void setColorMap(Map colorMap);
  
      public abstract String getColorKey();
  
      private ResourceBundle _colorStrings;
  
      public List getSortedColorKeys()
      {
          Map map = getColorMap();
          List result = new ArrayList(map.keySet());
  
          Collections.sort(result);
  
          return result;
      }
  
      public String getColorName()
      {
          String key = getColorKey();
          Color color = (Color) getColorMap().get(key);
  
          return _colorStrings.getString(color.getName());
      }
  
      protected void finishLoad()
      {
          _colorStrings = ResourceBundle.getBundle(Color.class.getName() + "Strings", getLocale());
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/c14/ColorStrings.properties
  
  Index: ColorStrings.properties
  ===================================================================
  # $Id: ColorStrings.properties,v 1.1 2003/02/07 04:25:25 hlship Exp $
  
  RED=Red
  GREEN=Green
  BLUE=Blue
  PUECE=Puece
  YELLOW=Yellow
  BLACK=Black
  WHITE=White
  
  
  1.1                  jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/c14/ListEdit.java
  
  Index: ListEdit.java
  ===================================================================
  /*
   *  ====================================================================
   *  The Apache Software License, Version 1.1
   *
   *  Copyright (c) 2002 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://www.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" and
   *  "Apache 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",
   *  "Apache Tapestry", nor may "Apache" 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 APACHE SOFTWARE FOUNDATION OR
   *  ITS CONTRIBUTORS 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 net.sf.tapestry.junit.mock.c14;
  
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import java.util.ResourceBundle;
  
  import net.sf.tapestry.IRequestCycle;
  import net.sf.tapestry.form.EnumPropertySelectionModel;
  import net.sf.tapestry.form.IPropertySelectionModel;
  import net.sf.tapestry.html.BasePage;
  
  /**
   *  Page for testing the {@link net.sf.tapestry.form.ListEdit} component.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: ListEdit.java,v 1.1 2003/02/07 04:25:25 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public abstract class ListEdit extends BasePage
  {
      public abstract Map getColorMap();
      public abstract void setColorMap(Map colorMap);
  
  	public abstract String getColorKey();
  
      private IPropertySelectionModel _colorModel;
  
      public IPropertySelectionModel getColorModel()
      {
          if (_colorModel == null)
              _colorModel = buildColorModel();
  
          return _colorModel;
      }
  
      private IPropertySelectionModel buildColorModel()
      {
          ResourceBundle bundle =
              ResourceBundle.getBundle(Color.class.getName() + "Strings", getLocale());
  
          return new EnumPropertySelectionModel(Color.ALL_COLORS, bundle);
      }
  
      public List getSortedColorKeys()
      {
          Map map = getColorMap();
          List result = new ArrayList(map.keySet());
  
          Collections.sort(result);
  
          return result;
      }
  
      protected void finishLoad()
      {
          Map colorMap = new HashMap();
  
          colorMap.put("Food", Color.RED);
          colorMap.put("Clothing", Color.BLACK);
          colorMap.put("Eye Color", Color.BLUE);
  
          setColorMap(colorMap);
      }
      
      /**
       *  Had to implement these cause I couldn't remember the OGNL syntax
       *  for accessing a Map key.
       * 
       **/
      
      public void setColor(Color color)
      {
      	getColorMap().put(getColorKey(), color);	
      }
      
      public Color getColor()
      {
      	return (Color)getColorMap().get(getColorKey());
      }
      
  
  	public void formSubmit(IRequestCycle cycle)
  	{
  		ListEditResults results = (ListEditResults)cycle.getPage("ListEditResults");
  		
  		results.setColorMap(getColorMap());
  		
  		cycle.setPage(results);
  	}
  
  }
  
  
  
  1.1                  jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/c14/ListEditArray.java
  
  Index: ListEditArray.java
  ===================================================================
  /*
   *  ====================================================================
   *  The Apache Software License, Version 1.1
   *
   *  Copyright (c) 2002 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://www.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" and
   *  "Apache 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",
   *  "Apache Tapestry", nor may "Apache" 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 APACHE SOFTWARE FOUNDATION OR
   *  ITS CONTRIBUTORS 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 net.sf.tapestry.junit.mock.c14;
  
  import net.sf.tapestry.html.BasePage;
  
  /**
   *  Test {@link net.sf.tapestry.form.ListEdit} with an object array as a source.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: ListEditArray.java,v 1.1 2003/02/07 04:25:25 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public class ListEditArray extends BasePage
  {
  	public String[] getItems()
  	{
  		return new String[]
  		{
  			"Fred", "Dino", "Wilma"
  		};
  	}
  }
  
  
  
  1.3       +2 -2      jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/lib/ShowError.jwc
  
  Index: ShowError.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/lib/ShowError.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ShowError.jwc	26 Jan 2003 02:59:20 -0000	1.2
  +++ ShowError.jwc	7 Feb 2003 04:25:25 -0000	1.3
  @@ -8,7 +8,7 @@
     class="net.sf.tapestry.BaseComponent"
     allow-informal-parameters="no" allow-body="no">
     
  -  <parameter name="delegate" java-type="net.sf.tapestry.valid.IValidationDelegate" 
  +  <parameter name="delegate" type="net.sf.tapestry.valid.IValidationDelegate" 
     	required="yes"/>
     
     <component id="ifError" type="Conditional">
  
  
  
  1.5       +2 -2      jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/lib/Border.jwc
  
  Index: Border.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/lib/Border.jwc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Border.jwc	26 Jan 2003 02:59:20 -0000	1.4
  +++ Border.jwc	7 Feb 2003 04:25:25 -0000	1.5
  @@ -8,7 +8,7 @@
   	class="net.sf.tapestry.BaseComponent" 
   	allow-informal-parameters="no">
   	
  -  <parameter name="title" java-type="java.lang.String" required="yes"/>
  +  <parameter name="title" type="java.lang.String" required="yes"/>
   	
     <component id="shell" type="Shell">
       <inherited-binding name="title" parameter-name="title"/>
  
  
  
  1.1                  jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/TestListEdit.xml
  
  Index: TestListEdit.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!-- $Id: TestListEdit.xml,v 1.1 2003/02/07 04:25:25 hlship Exp $ -->
  
  <mock-test>
      <context name="c12" root="context14"/>
  
    	<servlet name="app" class="net.sf.tapestry.ApplicationServlet"/>
  
  	<request>
  		<parameter name="service" value="page"/>
  		<parameter name="context" value="ListEdit"/>
  		
  		<assert-output name="Page Title">
  <![CDATA[
  <title>ListEdit</title>
  ]]>	
  		</assert-output>
  		
  		<assert-output-matches name="Hidden Fields" subgroup="1">
  <![CDATA[
  <input type="hidden" (name="(.*?)" value="(.*?)")/>
  ]]>
  			<match>name="service" value="direct"</match>
  			<match>name="context" value="0/ListEdit/form"</match>
  			<match>name="sp" value="S0"</match>
  			<match>name="e" value="Clothing"</match>
  			<match>name="e" value="Eye Color"</match>
  			<match>name="e" value="SFood"</match>
  			<match>name="Form0" value="e,inputColor,inputColor_0,inputColor_1"</match>
  		</assert-output-matches>
  
  	
  		<assert-output-matches name="Selected Options">
  <![CDATA[
  <option value=".*?" selected="selected">.*?</option>
  ]]>
  			<match><![CDATA[ <option value="4" selected="selected">Black</option>
]]></match>
  			<match><![CDATA[ <option value="2" selected="selected">Blue</option>
]]></match>
  			<match><![CDATA[ <option value="0" selected="selected">Red</option>
]]></match>
  				
  		</assert-output-matches>
  	</request>
  	
  	<request>
  		<parameter name="service" value="direct"/>	
  		<parameter name="context" value="0/ListEdit/form"/>
  		<parameter name="sp" value="S0"/>
  		<parameter name="e">
  			<value>Clothing</value>
  			<value>Eye Color</value>
  			<value>SFood</value>
  		</parameter>
  		<parameter name="inputColor" value="3"/>
  		<parameter name="inputColor_0" value="0"/>
  		<parameter name="inputColor_1" value="2"/>
  		<parameter name="Form0" value="e,inputColor,inputColor_0,inputColor_1"/>
  		
  		<assert-output name="Page Title">
  <![CDATA[
  <title>ListEdit Results</title>
  ]]>	
  		</assert-output>
  		
  		<assert-output-matches name="Selected Colors" subgroup="1">
  <![CDATA[
  <td>(.*?)</td>
  ]]>
  			<match>Yellow</match>
  			<match>Red</match>
  			<match>Blue</match>
  		</assert-output-matches>
  	</request>	
  	
  	<!-- Hack the submission so that one of the values passed up can't be unsqueezed. -->
  	
  	<request>
  		<parameter name="service" value="direct"/>	
  		<parameter name="context" value="0/ListEdit/form"/>
  		<parameter name="sp" value="S0"/>
  		<parameter name="e">
  			<value>3Clothing</value>
  			<value>Eye Color</value>
  			<value>SFood</value>
  		</parameter>
  		<parameter name="inputColor" value="3"/>
  		<parameter name="inputColor_0" value="0"/>
  		<parameter name="inputColor_1" value="2"/>
  		<parameter name="Form0" value="e,inputColor,inputColor_0,inputColor_1"/>
  		
  		<assert-output name="Page Title">
  <![CDATA[
  <title>Exception</title>
  ]]>	
  		</assert-output>
  		
  		<assert-output name="Exception">
  		net.sf.tapestry.RequestCycleException
  		</assert-output>
  		
  		<assert-output name="Outer Message">
  		For input string: "3Clothing"	
  		</assert-output>
  		
  		<assert-output name="Inner Exception">
  		java.lang.NumberFormatException			
  		</assert-output>
  
  	</request>		
  	
  	<!-- Test the index and listener parameters, and using an array
  		 as the source. -->
  	
  	<request>
  		<parameter name="service" value="page"/>
  		<parameter name="context" value="ListEditArray"/>
  		
  		<assert-output name="Page Title">
  <![CDATA[
  <title>ListEdit Array</title>
  ]]>				
  		</assert-output>
  		
  		<assert-output-matches name="Hidden Fields" subgroup="1">
  <![CDATA[
  <input type="hidden" (name="(.*?)" value="(.*?)")/>
  ]]>
  			<match>name="service" value="direct"</match>
  			<match>name="context" value="0/ListEditArray/$ListEditForm.$Form"</match>
  			<match>name="sp" value="S0"</match>
  			<match>name="e" value="SFred"</match>
  			<match>name="e" value="Dino"</match>
  			<match>name="e" value="Wilma"</match>
  			<match>name="Form0" value="e"</match>
  		</assert-output-matches>			
  	</request>
  	
  	<!-- Test where the ListEdit gets a null source. -->
  	
  	<request>
  		<parameter name="service" value="page"/>
  		<parameter name="context" value="ListEditNull"/>
  		
  		<assert-output name="Page Title">
  <![CDATA[
  <title>ListEdit Null</title>
  ]]>				
  		</assert-output>
  		
  		<assert-output-matches name="Hidden Fields" subgroup="1">
  <![CDATA[
  <input type="hidden" (name="(.*?)" value="(.*?)")/>
  ]]>
  			<match>name="service" value="direct"</match>
  			<match>name="context" value="0/ListEditNull/$ListEditForm.$Form"</match>
  			<match>name="sp" value="S0"</match>
  			<match>name="Form0" value="e"</match>
  		</assert-output-matches>			
  	</request>	
  </mock-test>
  
  

Mime
View raw message