tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock TestMocks.java MockTestCase.java
Date Wed, 03 Dec 2003 15:45:59 GMT
ehatcher    2003/12/03 07:45:59

  Modified:    junit/src/org/apache/tapestry/junit/spec
                        BasicExtension.application BeanProperty.jwc
                        ExtensionProperty.application
                        TestApplicationSpecification.java
               junit/src/org/apache/tapestry/junit BasicTestSuite.java
                        TapestrySuite.java
               junit/src/org/apache/tapestry/junit/mock/c11 Four.java
               junit/context11/WEB-INF Home.page Three.page Two.page
               junit/src/org/apache/tapestry/junit/valid
                        TestDateValidator.java TestEmailValidator.java
                        TestNumberValidator.java TestPatternValidator.java
                        TestStringValidator.java TestUrlValidator.java
                        TestValidationDelegate.java
               junit/src/org/apache/tapestry/junit/script TestScript.java
  Added:       junit/src/org/apache/tapestry/junit/spec PropertyBean.java
               junit/src/org/apache/tapestry/junit
                        TestTapestryCheckMethodInvocation.java
               junit/src/org/apache/tapestry/junit/mock/c11
                        PersistentSelectPage.java SelectPage.java
               junit/src/org/apache/tapestry/junit/valid MockField.java
                        MockForm.java
               junit/src/org/apache/tapestry/junit/script
                        MockScriptProcessor.java
               junit/src/org/apache/tapestry/junit/mock TestMocks.java
  Removed:     junit/src/org/apache/tapestry/junit/spec TestBean.java
               junit/src/org/apache/tapestry/junit
                        TapestryCheckMethodInvocation.java
               junit/src/org/apache/tapestry/junit/mock/c11
                        TestPersistentSelect.java TestSelect.java
               junit/src/org/apache/tapestry/junit/valid TestingField.java
                        TestingForm.java
               junit/src/org/apache/tapestry/junit/script
                        TestScriptProcessor.java
               junit/src/org/apache/tapestry/junit/mock MockTestCase.java
  Log:
  standardize test case names.  tests (and only tests) should begin with Test* to make it <junit> friendly in Ant.
  
  Revision  Changes    Path
  1.3       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/BasicExtension.application
  
  Index: BasicExtension.application
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/BasicExtension.application,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicExtension.application	1 Jun 2003 05:05:08 -0000	1.2
  +++ BasicExtension.application	3 Dec 2003 15:45:58 -0000	1.3
  @@ -6,7 +6,7 @@
   	
   <application name="Test Basic Extension">
     
  -  <extension name="testBean" class="org.apache.tapestry.junit.spec.TestBean">
  +  <extension name="testBean" class="org.apache.tapestry.junit.spec.PropertyBean">
     	<configure property-name="booleanProperty" type="boolean">true</configure>
     	<configure property-name="intProperty" type="int">18</configure>
     	<configure property-name="longProperty" type="long">383838</configure>
  
  
  
  1.3       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/BeanProperty.jwc
  
  Index: BeanProperty.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/BeanProperty.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BeanProperty.jwc	1 Jun 2003 05:05:08 -0000	1.2
  +++ BeanProperty.jwc	3 Dec 2003 15:45:58 -0000	1.3
  @@ -6,7 +6,7 @@
   	
   <component-specification class="org.apache.tapestry.BaseComponent">
   
  -	<bean name="fred" class="org.apache.tapestry.junit.spec.TestBean">
  +	<bean name="fred" class="org.apache.tapestry.junit.spec.PropertyBean">
   		<property name="zeta">jones</property>
   		<property name="bruce">wayne</property>
   		<property name="nicole">kidman</property>
  
  
  
  1.3       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/ExtensionProperty.application
  
  Index: ExtensionProperty.application
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/ExtensionProperty.application,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExtensionProperty.application	1 Jun 2003 05:05:08 -0000	1.2
  +++ ExtensionProperty.application	3 Dec 2003 15:45:58 -0000	1.3
  @@ -6,7 +6,7 @@
   	
   <application name="Test Extension Property">
     
  -  <extension name="testBean" class="org.apache.tapestry.junit.spec.TestBean">
  +  <extension name="testBean" class="org.apache.tapestry.junit.spec.PropertyBean">
   		<property name="fred">flintstone</property>
     </extension>
       
  
  
  
  1.4       +3 -3      jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/TestApplicationSpecification.java
  
  Index: TestApplicationSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/TestApplicationSpecification.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestApplicationSpecification.java	15 May 2003 12:34:54 -0000	1.3
  +++ TestApplicationSpecification.java	3 Dec 2003 15:45:58 -0000	1.4
  @@ -83,7 +83,7 @@
       {
           IApplicationSpecification spec = parseApp("BasicExtension.application");
   
  -        TestBean extension = (TestBean) spec.getExtension("testBean");
  +        PropertyBean extension = (PropertyBean) spec.getExtension("testBean");
   
           assertEquals("booleanProperty", true, extension.getBooleanProperty());
           assertEquals("intProperty", 18, extension.getIntProperty());
  @@ -99,7 +99,7 @@
       {
           IApplicationSpecification spec = parseApp("BasicExtension.application");
   
  -        TestBean extension = (TestBean) spec.getExtension("testBean", Object.class);
  +        PropertyBean extension = (PropertyBean) spec.getExtension("testBean", Object.class);
   
           assertNotNull(extension);
       }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/spec/PropertyBean.java
  
  Index: PropertyBean.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.spec;
  
  /**
   *  Bean used to test extensions.
   *
   *
   *  @author Howard Lewis Ship
   *  @version $Id: PropertyBean.java,v 1.1 2003/12/03 15:45:58 ehatcher Exp $
   *
   **/
  
  public class PropertyBean
  {
      private boolean _booleanProperty;
      private int _intProperty;
      private long _longProperty;
      private String _stringProperty;
      private double _doubleProperty;
      
      public boolean getBooleanProperty()
      {
          return _booleanProperty;
      }
  
      public double getDoubleProperty()
      {
          return _doubleProperty;
      }
  
      public int getIntProperty()
      {
          return _intProperty;
      }
  
      public long getLongProperty()
      {
          return _longProperty;
      }
  
      public String getStringProperty()
      {
          return _stringProperty;
      }
  
      public void setBooleanProperty(boolean booleanProperty)
      {
          _booleanProperty = booleanProperty;
      }
  
      public void setDoubleProperty(double doubleProperty)
      {
          _doubleProperty = doubleProperty;
      }
  
      public void setIntProperty(int intProperty)
      {
          _intProperty = intProperty;
      }
  
      public void setLongProperty(long longProperty)
      {
          _longProperty = longProperty;
      }
  
      public void setStringProperty(String stringProperty)
      {
          _stringProperty = stringProperty;
      }
  
  }
  
  
  
  1.9       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/BasicTestSuite.java
  
  Index: BasicTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/BasicTestSuite.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BasicTestSuite.java	1 Jul 2003 18:49:49 -0000	1.8
  +++ BasicTestSuite.java	3 Dec 2003 15:45:58 -0000	1.9
  @@ -95,7 +95,7 @@
           TestSuite suite = new TestSuite("Basic Tapestry Test Suite");
   
           suite.addTestSuite(TestTapestryFindLocation.class);
  -        suite.addTestSuite(TapestryCheckMethodInvocation.class);
  +        suite.addTestSuite(TestTapestryCheckMethodInvocation.class);
           suite.addTestSuite(TestStaticLink.class);
           suite.addTestSuite(TestEngineServiceLink.class);
           suite.addTestSuite(TestAdaptorRegistry.class);
  
  
  
  1.7       +3 -3      jakarta-tapestry/junit/src/org/apache/tapestry/junit/TapestrySuite.java
  
  Index: TapestrySuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/TapestrySuite.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TapestrySuite.java	30 Mar 2003 17:04:56 -0000	1.6
  +++ TapestrySuite.java	3 Dec 2003 15:45:58 -0000	1.7
  @@ -58,7 +58,7 @@
   import junit.framework.Test;
   import junit.framework.TestSuite;
   
  -import org.apache.tapestry.junit.mock.MockTestCase;
  +import org.apache.tapestry.junit.mock.TestMocks;
   
   /**
    *  Master suite of Tapestry tests, combining all other test suites.
  @@ -75,7 +75,7 @@
           TestSuite suite = new TestSuite("Master Tapestry Test Suite");
   
   		suite.addTest(BasicTestSuite.suite());	
  -        suite.addTest(MockTestCase.suite());
  +        suite.addTest(TestMocks.suite());
   
           return suite;
       }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/TestTapestryCheckMethodInvocation.java
  
  Index: TestTapestryCheckMethodInvocation.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;
  
  import org.apache.tapestry.ApplicationRuntimeException;
  import org.apache.tapestry.Tapestry;
  
  /**
   * Tests for the methods 
   * {@link org.apache.tapestry.Tapestry#checkMethodInvocation(Object, String, Object)},
   * {@link org.apache.tapestry.Tapestry#addMethodInvocation(Object)} and
   * {@link org.apache.tapestry.Tapestry#clearMethodInvocations()}.
   *
   * @author Howard Lewis Ship
   * @version $Id: TestTapestryCheckMethodInvocation.java,v 1.1 2003/12/03 15:45:58 ehatcher Exp $
   * @since 3.0
   **/
  public class TestTapestryCheckMethodInvocation extends TapestryTestCase
  {
  
      public TestTapestryCheckMethodInvocation(String name)
      {
          super(name);
      }
  
      public void testSuccess()
      {
          Tapestry.clearMethodInvocations();
          Tapestry.addMethodInvocation("alpha");
          Tapestry.addMethodInvocation("beta");
  
          Tapestry.checkMethodInvocation("alpha", "alpha()", this);
          Tapestry.checkMethodInvocation("beta", "beta()", this);
      }
  
      public void testFail()
      {
          Tapestry.clearMethodInvocations();
  
          try
          {
              Tapestry.checkMethodInvocation("gamma", "gamma()", this);
              unreachable();
          }
          catch (ApplicationRuntimeException ex)
          {
              assertEquals(
                  "Class org.apache.tapestry.junit.TestTapestryCheckMethodInvocation overrides method 'gamma()' but does not invoke the super-class implementation.",
                  ex.getMessage());
          }
      }
  
  }
  
  
  
  1.3       +1 -1      jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c11/Four.java
  
  Index: Four.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c11/Four.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Four.java	21 Apr 2003 15:39:59 -0000	1.2
  +++ Four.java	3 Dec 2003 15:45:58 -0000	1.3
  @@ -57,7 +57,7 @@
   
   import org.apache.tapestry.IRequestCycle;
   
  -public class Four extends TestSelect
  +public class Four extends SelectPage
   {
   	public void secondFormListener(IRequestCycle cycle)
   	{
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c11/PersistentSelectPage.java
  
  Index: PersistentSelectPage.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.c11;
  
  
  /**
   *  Makes the three properties persistent.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: PersistentSelectPage.java,v 1.1 2003/12/03 15:45:58 ehatcher Exp $
   *  @since 3.0
   **/
  
  public class PersistentSelectPage extends SelectPage
  {
      public void setAnimal(boolean animal)
      {
      	super.setAnimal(animal);
      	
          fireObservedChange("animal", animal);
      }
  
  
      public void setMineral(boolean mineral)
      {
      	super.setMineral(mineral);
      	
      	fireObservedChange("mineral", mineral);
      }
  
  
      public void setVegetable(boolean vegetable)
      {
        	super.setVegetable(vegetable);
        	
        	fireObservedChange("vegetable", vegetable);
      }
  
  
  
  }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c11/SelectPage.java
  
  Index: SelectPage.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.c11;
  
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.html.BasePage;
  
  /**
   *  Used to test the Select and Option elements.
   * 
   *
   *  @author Howard Lewis Ship
   *  @version $Id: SelectPage.java,v 1.1 2003/12/03 15:45:58 ehatcher Exp $
   *  @since 3.0
   **/
  
  public class SelectPage extends BasePage
  {
  	private boolean _animal;
  	private boolean _mineral;
  	private boolean _vegetable;
  	
  	public void initialize()
  	{
  		_animal = false;
  		_mineral = false;
  		_vegetable = false;
  	}
  	
      public boolean isAnimal()
      {
          return _animal;
      }
  
      public boolean isMineral()
      {
          return _mineral;
      }
  
      public boolean isVegetable()
      {
          return _vegetable;
      }
  
      public void setAnimal(boolean animal)
      {
          _animal = animal;
      }
  
      public void setMineral(boolean mineral)
      {
          _mineral = mineral;
      }
  
      public void setVegetable(boolean vegetable)
      {
          _vegetable = vegetable;
      }
  
  	public void formSubmit(IRequestCycle cycle)
  	{
  		StringBuffer buffer = new StringBuffer("Selections: ");
  		boolean needComma = false;
  		
  		if (_animal)
  		{
  			buffer.append("animal");
  			needComma = true;
  		}
  		
  		if (_vegetable)
  		{
  			if (needComma)
  			buffer.append(", ");
  			
  			buffer.append("vegetable");
  			
  			needComma = true;
  		}
  		
  		if (_mineral)
  		{
  			if (needComma) buffer.append(", ");
  			
  			buffer.append("mineral");
  			
  			needComma = true;
  		}
  			
  			if (!needComma)
  			buffer.append("none");
  			
  		buffer.append(".");
  		
  		Result result = (Result)cycle.getPage("Result");
  		
  		String message = buffer.toString();
  		
  		result.setMessage(message);
  		
  		cycle.activate(result);
  	}
  }
  
  
  
  1.4       +2 -2      jakarta-tapestry/junit/context11/WEB-INF/Home.page
  
  Index: Home.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/context11/WEB-INF/Home.page,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Home.page	1 Jun 2003 05:05:10 -0000	1.3
  +++ Home.page	3 Dec 2003 15:45:58 -0000	1.4
  @@ -4,4 +4,4 @@
     "-//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.c11.TestSelect"/>
  +<page-specification class="org.apache.tapestry.junit.mock.c11.SelectPage"/>
  
  
  
  1.4       +2 -2      jakarta-tapestry/junit/context11/WEB-INF/Three.page
  
  Index: Three.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/context11/WEB-INF/Three.page,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Three.page	1 Jun 2003 05:05:10 -0000	1.3
  +++ Three.page	3 Dec 2003 15:45:58 -0000	1.4
  @@ -4,4 +4,4 @@
     "-//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.c11.TestSelect"/>
  +<page-specification class="org.apache.tapestry.junit.mock.c11.SelectPage"/>
  
  
  
  1.4       +2 -2      jakarta-tapestry/junit/context11/WEB-INF/Two.page
  
  Index: Two.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/context11/WEB-INF/Two.page,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Two.page	1 Jun 2003 05:05:10 -0000	1.3
  +++ Two.page	3 Dec 2003 15:45:58 -0000	1.4
  @@ -4,4 +4,4 @@
     "-//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.c11.TestPersistentSelect"/>
  +<page-specification class="org.apache.tapestry.junit.mock.c11.PersistentSelectPage"/>
  
  
  
  1.4       +9 -9      jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestDateValidator.java
  
  Index: TestDateValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestDateValidator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestDateValidator.java	12 May 2003 20:22:59 -0000	1.3
  +++ TestDateValidator.java	3 Dec 2003 15:45:58 -0000	1.4
  @@ -128,14 +128,14 @@
   
       public void testToObjectNull() throws ValidatorException
       {
  -        Object out = v.toObject(new TestingField("toObjectNull"), null);
  +        Object out = v.toObject(new MockField("toObjectNull"), null);
   
           assertNull(out);
       }
   
       public void testToObjectEmpty() throws ValidatorException
       {
  -        Object out = v.toObject(new TestingField("toObjectNull"), "");
  +        Object out = v.toObject(new MockField("toObjectNull"), "");
   
           assertNull(out);
       }
  @@ -144,7 +144,7 @@
       {
           try
           {
  -            v.toObject(new TestingField("badDatesIndy"), "frankenhooker");
  +            v.toObject(new MockField("badDatesIndy"), "frankenhooker");
   
               unreachable();
           }
  @@ -163,7 +163,7 @@
   
           try
           {
  -            v.toObject(new TestingField("badDatesIndy"), "frankenhooker");
  +            v.toObject(new MockField("badDatesIndy"), "frankenhooker");
   
               unreachable();
           }
  @@ -196,7 +196,7 @@
   
           try
           {
  -            v.toObject(new TestingField("toObjectMinimum"), "12/8/2001");
  +            v.toObject(new MockField("toObjectMinimum"), "12/8/2001");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -212,7 +212,7 @@
   
           try
           {
  -            v.toObject(new TestingField("inputDate"), "12/8/2001");
  +            v.toObject(new MockField("inputDate"), "12/8/2001");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -237,7 +237,7 @@
   
           try
           {
  -            v.toObject(new TestingField("toObjectMaximum"), "12/8/2002");
  +            v.toObject(new MockField("toObjectMaximum"), "12/8/2002");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -254,7 +254,7 @@
   
           try
           {
  -            v.toObject(new TestingField("toObjectMaximum"), "12/8/2002");
  +            v.toObject(new MockField("toObjectMaximum"), "12/8/2002");
               unreachable();
           }
           catch (ValidatorException ex)
  
  
  
  1.2       +6 -6      jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestEmailValidator.java
  
  Index: TestEmailValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestEmailValidator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestEmailValidator.java	18 Apr 2003 16:14:25 -0000	1.1
  +++ TestEmailValidator.java	3 Dec 2003 15:45:58 -0000	1.2
  @@ -80,7 +80,7 @@
   
       public void testValidEmail() throws ValidatorException
       {
  -        Object result = v.toObject(new TestingField("email"), "foo@bar.com");
  +        Object result = v.toObject(new MockField("email"), "foo@bar.com");
           assertEquals("foo@bar.com", result);
       }
   
  @@ -88,7 +88,7 @@
       {
           try
           {
  -            v.toObject(new TestingField("email"), "fred");
  +            v.toObject(new MockField("email"), "fred");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -107,7 +107,7 @@
   
           try
           {
  -            v.toObject(new TestingField("email"), "fred");
  +            v.toObject(new MockField("email"), "fred");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -124,7 +124,7 @@
   
           try
           {
  -            v.toObject(new TestingField("short"), "foo@bar.com");
  +            v.toObject(new MockField("short"), "foo@bar.com");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -141,7 +141,7 @@
   
           try
           {
  -            v.toObject(new TestingField("short"), "foo@bar.com");
  +            v.toObject(new MockField("short"), "foo@bar.com");
               unreachable();
           }
           catch (ValidatorException ex)
  
  
  
  1.3       +4 -4      jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestNumberValidator.java
  
  Index: TestNumberValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestNumberValidator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestNumberValidator.java	18 Apr 2003 16:14:24 -0000	1.2
  +++ TestNumberValidator.java	3 Dec 2003 15:45:58 -0000	1.3
  @@ -85,7 +85,7 @@
       private void testPassThru(String displayName, Class valueTypeClass, Number input)
           throws ValidatorException
       {
  -        testPassThru(new TestingField(displayName), valueTypeClass, input);
  +        testPassThru(new MockField(displayName), valueTypeClass, input);
       }
   
       private void testPassThru(IFormComponent field, Class valueTypeClass, Number input)
  @@ -211,7 +211,7 @@
       public void testInvalidFormat()
       {
           v.setValueTypeClass(Integer.class);
  -        IFormComponent field = new TestingField("invalidFormat");
  +        IFormComponent field = new MockField("invalidFormat");
   
           try
           {
  @@ -230,7 +230,7 @@
           v.setValueTypeClass(Integer.class);
           v.setInvalidNumericFormatMessage("Dude, gimme a number for {0}.");
   
  -        IFormComponent field = new TestingField("invalidFormat");
  +        IFormComponent field = new MockField("invalidFormat");
   
           try
           {
  
  
  
  1.3       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestPatternValidator.java
  
  Index: TestPatternValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestPatternValidator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestPatternValidator.java	20 Oct 2003 18:00:14 -0000	1.2
  +++ TestPatternValidator.java	3 Dec 2003 15:45:58 -0000	1.3
  @@ -73,7 +73,7 @@
   public class TestPatternValidator extends TapestryTestCase
   {
       PatternValidator pv = new PatternValidator();
  -    IFormComponent pf = new TestingField("PatternField");
  +    IFormComponent pf = new MockField("PatternField");
   
       public TestPatternValidator(String name)
       {
  
  
  
  1.4       +10 -10    jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestStringValidator.java
  
  Index: TestStringValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestStringValidator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestStringValidator.java	18 Apr 2003 16:14:24 -0000	1.3
  +++ TestStringValidator.java	3 Dec 2003 15:45:58 -0000	1.4
  @@ -81,14 +81,14 @@
       public void testToString()
       {
           String in = "Foo";
  -        String out = v.toString(new TestingField("myField"), in);
  +        String out = v.toString(new MockField("myField"), in);
   
           assertEquals("Result.", in, out);
       }
   
       public void testToStringNull()
       {
  -        String out = v.toString(new TestingField("nullField"), null);
  +        String out = v.toString(new MockField("nullField"), null);
   
           assertNull("Null expected.", out);
       }
  @@ -99,7 +99,7 @@
   
           try
           {
  -            v.toObject(new TestingField("requiredField"), "");
  +            v.toObject(new MockField("requiredField"), "");
   
               fail("Exception expected.");
           }
  @@ -117,7 +117,7 @@
   
           try
           {
  -            v.toObject(new TestingField("overrideMessage"), "");
  +            v.toObject(new MockField("overrideMessage"), "");
           }
           catch (ValidatorException ex)
           {
  @@ -129,7 +129,7 @@
       {
           v.setRequired(true);
   
  -        Object result = v.toObject(new TestingField("requiredField"), "stuff");
  +        Object result = v.toObject(new MockField("requiredField"), "stuff");
   
           assertEquals("Result.", "stuff", result);
       }
  @@ -140,7 +140,7 @@
   
           try
           {
  -            v.toObject(new TestingField("minimumLength"), "short");
  +            v.toObject(new MockField("minimumLength"), "short");
   
               fail("Exception expected.");
           }
  @@ -161,7 +161,7 @@
   
           try
           {
  -            v.toObject(new TestingField("overrideMessage"), "");
  +            v.toObject(new MockField("overrideMessage"), "");
           }
           catch (ValidatorException ex)
           {
  @@ -177,7 +177,7 @@
   
           String in = "ambidexterous";
   
  -        Object out = v.toObject(new TestingField("minimum"), in);
  +        Object out = v.toObject(new MockField("minimum"), in);
   
           assertEquals("Result", in, out);
       }
  @@ -193,7 +193,7 @@
   
           String in = "";
   
  -        Object out = v.toObject(new TestingField("minimum"), in);
  +        Object out = v.toObject(new MockField("minimum"), in);
   
           assertNull("Result", out);
       }
  
  
  
  1.2       +7 -7      jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestUrlValidator.java
  
  Index: TestUrlValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestUrlValidator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestUrlValidator.java	24 Oct 2003 12:21:03 -0000	1.1
  +++ TestUrlValidator.java	3 Dec 2003 15:45:58 -0000	1.2
  @@ -83,7 +83,7 @@
   
       public void testValidUrl() throws ValidatorException
       {
  -        Object result = v.toObject(new TestingField("url"), "http://www.google.com");
  +        Object result = v.toObject(new MockField("url"), "http://www.google.com");
           assertEquals("http://www.google.com", result);
       }
   
  @@ -91,7 +91,7 @@
       {
           try
           {
  -            v.toObject(new TestingField("url"), "fred");
  +            v.toObject(new MockField("url"), "fred");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -110,7 +110,7 @@
   
           try
           {
  -            v.toObject(new TestingField("url"), "fred");
  +            v.toObject(new MockField("url"), "fred");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -127,7 +127,7 @@
   
           try
           {
  -            v.toObject(new TestingField("short"), "http://www.test.com");
  +            v.toObject(new MockField("short"), "http://www.test.com");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -144,7 +144,7 @@
   
           try
           {
  -            v.toObject(new TestingField("short"), "http://www.test.com");
  +            v.toObject(new MockField("short"), "http://www.test.com");
               unreachable();
           }
           catch (ValidatorException ex)
  @@ -159,7 +159,7 @@
       		
       		try
       		{
  -    				v.toObject(new TestingField("short"), "ftp://ftp.test.com");
  +    				v.toObject(new MockField("short"), "ftp://ftp.test.com");
               unreachable();
       		}
       		catch (ValidatorException ex) {
  
  
  
  1.2       +11 -11    jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestValidationDelegate.java
  
  Index: TestValidationDelegate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/TestValidationDelegate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestValidationDelegate.java	5 Mar 2003 23:19:55 -0000	1.1
  +++ TestValidationDelegate.java	3 Dec 2003 15:45:58 -0000	1.2
  @@ -97,7 +97,7 @@
   
       public void testInvalidInput()
       {
  -        IFormComponent f = new TestingField("testAdd");
  +        IFormComponent f = new MockField("testAdd");
           String errorMessage = "Need a bigger one.";
   
           d.setFormComponent(f);
  @@ -122,7 +122,7 @@
   
       public void testValidatorErrorRenderer()
       {
  -        IFormComponent f = new TestingField("testValidatorErrorRenderer");
  +        IFormComponent f = new MockField("testValidatorErrorRenderer");
   
           IRender errorRenderer = new RenderString("Just don't like it.");
   
  @@ -152,7 +152,7 @@
   
       public void testNoError()
       {
  -        IFormComponent f = new TestingField("testNoError");
  +        IFormComponent f = new MockField("testNoError");
   
           d.setFormComponent(f);
           d.recordFieldInputValue("Futurama");
  @@ -174,7 +174,7 @@
   
       public void testUnassociatedErrors()
       {
  -        IFormComponent f = new TestingField("testUnassociatedErrors");
  +        IFormComponent f = new MockField("testUnassociatedErrors");
   
           d.setFormComponent(f);
           d.recordFieldInputValue("Bender");
  @@ -221,9 +221,9 @@
   
       public void testMultipleInvalidInput()
       {
  -        IFormComponent f1 = new TestingField("input1");
  +        IFormComponent f1 = new MockField("input1");
           String e1 = "And now for something completely different.";
  -        IFormComponent f2 = new TestingField("input2");
  +        IFormComponent f2 = new MockField("input2");
           String e2 = "A man with three buttocks.";
   
           d.setFormComponent(f1);
  @@ -250,9 +250,9 @@
   
       public void testReset()
       {
  -        IFormComponent f1 = new TestingField("input1");
  +        IFormComponent f1 = new MockField("input1");
           String e1 = "And now for something completely different.";
  -        IFormComponent f2 = new TestingField("input2");
  +        IFormComponent f2 = new MockField("input2");
           String e2 = "A man with three buttocks.";
   
           d.setFormComponent(f1);
  @@ -279,9 +279,9 @@
   
       public void testResetAll()
       {
  -        IFormComponent f1 = new TestingField("input1");
  +        IFormComponent f1 = new MockField("input1");
           String e1 = "And now for something completely different.";
  -        IFormComponent f2 = new TestingField("input2");
  +        IFormComponent f2 = new MockField("input2");
           String e2 = "A man with three buttocks.";
   
           d.setFormComponent(f1);
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/MockField.java
  
  Index: MockField.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.valid;
  
  import java.util.Locale;
  
  import org.apache.tapestry.IForm;
  import org.apache.tapestry.IMarkupWriter;
  import org.apache.tapestry.IPage;
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.form.AbstractFormComponent;
  import org.apache.tapestry.form.IFormComponent;
  import org.apache.tapestry.html.BasePage;
  
  
  /**
   *  Used as a stand-in for a real component when testing the 
   *  {@link org.apache.tapestry.valid.IValidator}
   *  implementations.
   *
   *  @author Howard Lewis Ship
   *  @version $Id: MockField.java,v 1.1 2003/12/03 15:45:58 ehatcher Exp $
   *  @since 1.0.8
   *
   **/
  
  public class MockField extends AbstractFormComponent implements IFormComponent
  {
  	private String _displayName;
      private IForm _form;
  
      public MockField(String displayName)
      {
          this(displayName, new MockForm());
      }
      
  
  	public MockField(String displayName, IForm form)
  	{
  		_displayName = displayName;
          _form = form;
          
          IPage page = new BasePage();
          page.setLocale(Locale.ENGLISH);
          page.addComponent(this);
          
          setPage(page);
  	}
  	
  	public void setForm(IForm form)
  	{
  		_form = form;
  	}
  
  	public String getDisplayName()
  	{
  		return _displayName;
  	}
  
  	public String getName()
  	{
  		return _displayName;
  	}
  
  
      protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
      {
      }
  
      public IForm getForm()
      {
          return _form;
      }
  
      public boolean isDisabled()
      {
          return false;
      }
  
  	public String toString()
  	{
  		return "MockField[" + _displayName + "]";
  	}
  	
      public void setName(String name)
      {
      }
  
  }
  
  
  1.2       +302 -0    jakarta-tapestry/junit/src/org/apache/tapestry/junit/valid/MockForm.java
  
  
  
  
  1.7       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/script/TestScript.java
  
  Index: TestScript.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/script/TestScript.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestScript.java	11 Jul 2003 20:50:57 -0000	1.6
  +++ TestScript.java	3 Dec 2003 15:45:59 -0000	1.7
  @@ -86,7 +86,7 @@
   
   public class TestScript extends TapestryTestCase
   {
  -    private TestScriptProcessor _processor = new TestScriptProcessor();
  +    private MockScriptProcessor _processor = new MockScriptProcessor();
   
       public TestScript(String name)
       {
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/script/MockScriptProcessor.java
  
  Index: MockScriptProcessor.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.script;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import org.apache.tapestry.IResourceLocation;
  import org.apache.tapestry.IScriptProcessor;
  import org.apache.tapestry.util.IdAllocator;
  
  /**
   * Used by {@link org.apache.tapestry.junit.script.TestScript}.
   *
   * @author Howard Lewis Ship
   * @version $Id: MockScriptProcessor.java,v 1.1 2003/12/03 15:45:59 ehatcher Exp $
   * @since 3.0
   **/
  public class MockScriptProcessor implements IScriptProcessor
  {
      private StringBuffer _body;
      private StringBuffer _initialization;
      private List _externalScripts;
      private IdAllocator _idAllocator = new IdAllocator();
  
      public void addBodyScript(String script)
      {
          if (_body == null)
              _body = new StringBuffer();
  
          _body.append(script);
      }
  
  	public String getBody()
  	{
  		if (_body == null)
  			return null;
  			
  			return _body.toString();
  	}
  
      public void addInitializationScript(String script)
      {
          if (_initialization == null)
              _initialization = new StringBuffer();
  
          _initialization.append(script);
      }
  
  	public String getInitialization()
  	{
  		if (_initialization == null)return null;
  		
  		return _initialization.toString();
  	}
  
      public void addExternalScript(IResourceLocation scriptLocation)
      {
          if (_externalScripts == null)
              _externalScripts = new ArrayList();
  
          _externalScripts.add(scriptLocation);
      }
      
      public IResourceLocation[] getExternalScripts()
      {
      	if (_externalScripts == null)return null;
      	
      	int count = _externalScripts.size();
      	
      	return (IResourceLocation[])_externalScripts.toArray(new IResourceLocation[count]);
      }
  
      public String getUniqueString(String baseValue)
      {
      	return _idAllocator.allocateId(baseValue);
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/TestMocks.java
  
  Index: TestMocks.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;
  
  import java.io.File;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.tapestry.junit.TapestryTestCase;
  
  /**
   *  Test case for Mock Servlet API tests using the Simple application.
   *
   *
   *  @author Howard Lewis Ship
   *  @version $Id: TestMocks.java,v 1.1 2003/12/03 15:45:59 ehatcher Exp $
   *  @since 2.2
   * 
   **/
  
  public class TestMocks extends TapestryTestCase
  {
      public static final String SCRIPTS_DIR = "mock-scripts";
  
      public TestMocks(String name)
      {
          super(name);
      }
  
      protected void runTest() throws Throwable
      {
          String path = SCRIPTS_DIR + "/" + getName();
  
          MockTester tester = new MockTester(path);
  
          tester.execute();
      }
  
      public static Test suite()
      {
          TestSuite suite = new TestSuite("Mock Unit Test Suite");
  
          addScripts(suite);
  
          // Handy place to perform one-time 
          deleteDir(".private");
  
          return suite;
      }
  
      private static void addScripts(TestSuite suite)
      {
          File scriptsDir = new File(SCRIPTS_DIR);
  
          String[] names = scriptsDir.list();
  
          for (int i = 0; i < names.length; i++)
          {
              String name = names[i];
  
              if (name.endsWith(".xml"))
              {
                  Test test = new TestMocks(name);
  
                  suite.addTest(test);
              }
          }
      }
  
      private static void deleteDir(String path)
      {
          File file = new File(path);
  
          if (!file.exists())
              return;
  
          deleteRecursive(file);
      }
  
      private static void deleteRecursive(File file)
      {
          if (file.isFile())
          {
              file.delete();
              return;
          }
  
          String[] names = file.list();
  
          for (int i = 0; i < names.length; i++)
          {
              File f = new File(file, names[i]);
              deleteRecursive(f);
          }
  
          file.delete();
      }
  
  }
  
  
  

---------------------------------------------------------------------
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