craigmcc    01/08/20 14:59:44

  Modified:    digester build.xml
  Added:       digester/src/test/org/apache/commons/digester Address.java
                        Employee.java RuleTestCase.java Test1.xml
                        TestBean.java
  Log:
  Add some initial unit tests for actually processing an input file.
  
  Revision  Changes    Path
  1.7       +13 -2     jakarta-commons/digester/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/build.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- build.xml 2001/07/15 00:17:24     1.6
  +++ build.xml 2001/08/20 21:59:43     1.7
  @@ -3,7 +3,7 @@
   
   <!--
           "Digester" component of the Jakarta Commons Subproject
  -        $Id: build.xml,v 1.6 2001/07/15 00:17:24 craigmcc Exp $
  +        $Id: build.xml,v 1.7 2001/08/20 21:59:43 craigmcc Exp $
   -->
   
   
  @@ -224,7 +224,7 @@
   
     <target name="test" depends="compile.tests,
                                  test.digester,
  -                               test.rss
  +                               test.rule
                                 "
      description="Run all unit test cases">
     </target>
  @@ -249,6 +249,17 @@
         <classpath refid="rss.classpath"/>
       </java>
     </target>
  +
  +  <target name="test.rule" depends="compile.tests"
  +   description="Run rule Digester unit tests ...">
  +    <echo message="Running Rule tests ..."/>
  +    <java classname="${test.runner}" fork="yes"
  +        failonerror="${test.failonerror}">
  +      <arg value="org.apache.commons.digester.RuleTestCase"/>
  +      <classpath refid="test.classpath"/>
  +    </java>
  +  </target>
  +
   
   
   </project>
  
  
  
  1.1                  
jakarta-commons/digester/src/test/org/apache/commons/digester/Address.java
  
  Index: Address.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/digester/src/test/org/apache/commons/digester/Address.java,v 
1.1 2001/08/20 21:59:43 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/08/20 21:59:43 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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 acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 org.apache.commons.digester;
  
  
  /**
   * Bean for Digester testing.
   */
  
  
  public class Address {
  
      public Address() {
          this("My Street", "My City", "US", "MyZip");
      }
  
      public Address(String street, String city, String state, String zipCode) {
          super();
          setStreet(street);
          setCity(city);
          setState(state);
          setZipCode(zipCode);
      }
  
      private String city = null;
      public String getCity() {
          return (this.city);
      }
      public void setCity(String city) {
          this.city = city;
      }
  
      private String state = null;
      public String getState() {
          return (this.state);
      }
      public void setState(String state) {
          this.state = state;
      }
  
      private String street = null;
      public String getStreet() {
          return (this.street);
      }
      public void setStreet(String street) {
          this.street = street;
      }
  
      private String type = null;
      public String getType() {
          return (this.type);
      }
      public void setType(String type) {
          this.type = type;
      }
  
      private String zipCode = null;
      public String getZipCode() {
          return (this.zipCode);
      }
      public void setZipCode(String zipCode) {
          this.zipCode = zipCode;
      }
  
      public String toString() {
          StringBuffer sb = new StringBuffer("Address[");
          sb.append("street=");
          sb.append(street);
          sb.append(", city=");
          sb.append(city);
          sb.append(", state=");
          sb.append(state);
          sb.append(", zipCode=");
          sb.append(zipCode);
          sb.append("]");
          return (sb.toString());
      }
  
  }
  
  
  
  1.1                  
jakarta-commons/digester/src/test/org/apache/commons/digester/Employee.java
  
  Index: Employee.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/digester/src/test/org/apache/commons/digester/Employee.java,v
 1.1 2001/08/20 21:59:43 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/08/20 21:59:43 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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 acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 org.apache.commons.digester;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  
  /**
   * Bean for Digester testing.
   */
  
  public class Employee {
  
      public Employee() {
          this("My First Name", "My Last Name");
      }
  
      public Employee(String firstName, String lastName) {
          super();
          setFirstName(firstName);
          setLastName(lastName);
      }
  
      private ArrayList addresses = new ArrayList();
      public void addAddress(Address address) {
          addresses.add(address);
      }
      public Address getAddress(String type) {
          Iterator elements = addresses.iterator();
          while (elements.hasNext()) {
              Address element = (Address) elements.next();
              if (type.equals(element.getType()))
                  return (element);
          }
          return (null);
      }
      public void removeAddress(Address address) {
          addresses.remove(address);
      }
  
      private String firstName = null;
      public String getFirstName() {
          return (this.firstName);
      }
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      private String lastName = null;
      public String getLastName() {
          return (this.lastName);
      }
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public String toString() {
          StringBuffer sb = new StringBuffer("Employee[");
          sb.append("firstName=");
          sb.append(firstName);
          sb.append(", lastName=");
          sb.append(lastName);
          sb.append("]");
          return (sb.toString());
      }
  
  }
  
  
  
  1.1                  
jakarta-commons/digester/src/test/org/apache/commons/digester/RuleTestCase.java
  
  Index: RuleTestCase.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/digester/src/test/org/apache/commons/digester/RuleTestCase.java,v
 1.1 2001/08/20 21:59:43 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/08/20 21:59:43 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 org.apache.commons.digester;
  
  
  import java.io.InputStream;
  import java.io.IOException;
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  
  
  /**
   * <p>Test Case for the Digester class.  These tests perform parsing of
   * XML documents to exercise the built-in rules.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/08/20 21:59:43 $
   */
  
  public class RuleTestCase extends TestCase {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The digester instance we will be processing.
       */
      protected Digester digester = null;
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Construct a new instance of this test case.
       *
       * @param name Name of the test case
       */
      public RuleTestCase(String name) {
  
          super(name);
  
      }
  
  
      // --------------------------------------------------- Overall Test Methods
  
  
      /**
       * Set up instance variables required by this test case.
       */
      public void setUp() {
  
          digester = new Digester();
  
      }
  
  
      /**
       * Return the tests included in this test suite.
       */
      public static Test suite() {
  
          return (new TestSuite(RuleTestCase.class));
  
      }
  
  
      /**
       * Tear down instance variables required by this test case.
       */
      public void tearDown() {
  
          digester = null;
  
      }
  
  
  
      // ------------------------------------------------ Individual Test Methods
  
  
      /**
       * Test object creation (and associated property setting) with nothing on
       * the stack, which should cause an appropriate Employee object to be
       * returned.
       */
      public void testObjectCreate1() {
  
          // Configure the digester as required
          digester.addObjectCreate("employee",
                                   "org.apache.commons.digester.Employee");
          digester.addSetProperties("employee");
  
          // Parse our test input.
          Object root = null;
          try {
              root = digester.parse(getInputStream("Test1.xml"));
          } catch (Throwable t) {
              fail("Digester threw IOException: " + t);
          }
          assertNotNull("Digester returned an object", root);
          assertTrue("Digester returned an Employee",
                     root instanceof Employee);
          Employee employee = (Employee) root;
          assertEquals("First name is correct",
                       "First Name",
                       employee.getFirstName());
          assertEquals("Last name is correct",
                       "Last Name",
                       employee.getLastName());
  
  
      }
  
  
      /**
       * Test object creation (and associated property setting) with nothing on
       * the stack, which should cause an appropriate Employee object to be
       * returned.  The processing rules will process the nested Address elements
       * as well, but will not attempt to add them to the Employee.
       */
      public void testObjectCreate2() {
  
          // Configure the digester as required
          digester.addObjectCreate("employee",
                                   "org.apache.commons.digester.Employee");
          digester.addSetProperties("employee");
          digester.addObjectCreate("employee/address",
                                   "org.apache.commons.digester.Address");
          digester.addSetProperties("employee/address");
  
          // Parse our test input.
          Object root = null;
          try {
              root = digester.parse(getInputStream("Test1.xml"));
          } catch (Throwable t) {
              fail("Digester threw IOException: " + t);
          }
          assertNotNull("Digester returned an object", root);
          assertTrue("Digester returned an Employee",
                     root instanceof Employee);
          Employee employee = (Employee) root;
          assertEquals("First name is correct",
                       "First Name",
                       employee.getFirstName());
          assertEquals("Last name is correct",
                       "Last Name",
                       employee.getLastName());
  
  
      }
  
  
      /**
       * Test object creation (and associated property setting) with nothing on
       * the stack, which should cause an appropriate Employee object to be
       * returned.  The processing rules will process the nested Address elements
       * as well, and will add them to the owning Employee.
       */
      public void testObjectCreate3() {
  
          // Configure the digester as required
          digester.addObjectCreate("employee",
                                   "org.apache.commons.digester.Employee");
          digester.addSetProperties("employee");
          digester.addObjectCreate("employee/address",
                                   "org.apache.commons.digester.Address");
          digester.addSetProperties("employee/address");
          digester.addSetNext("employee/address",
                              "addAddress");
  
          // Parse our test input.
          Object root = null;
          try {
              root = digester.parse(getInputStream("Test1.xml"));
          } catch (Throwable t) {
              fail("Digester threw IOException: " + t);
          }
  
          // Validate the retrieved Employee
          assertNotNull("Digester returned an object", root);
          assertTrue("Digester returned an Employee",
                     root instanceof Employee);
          Employee employee = (Employee) root;
          assertEquals("First name is correct",
                       "First Name",
                       employee.getFirstName());
          assertEquals("Last name is correct",
                       "Last Name",
                       employee.getLastName());
  
          // Validate the corresponding "home" Address
          Address home = employee.getAddress("home");
          assertNotNull("Retrieved home address", home);
          assertEquals("Home street", "Home Street",
                       home.getStreet());
          assertEquals("Home city", "Home City",
                       home.getCity());
          assertEquals("Home state", "HS",
                       home.getState());
          assertEquals("Home zip", "HmZip",
                       home.getZipCode());
  
          // Validate the corresponding "office" Address
          Address office = employee.getAddress("office");
          assertNotNull("Retrieved office address", office);
          assertEquals("Office street", "Office Street",
                       office.getStreet());
          assertEquals("Office city", "Office City",
                       office.getCity());
          assertEquals("Office state", "OS",
                       office.getState());
          assertEquals("Office zip", "OfZip",
                       office.getZipCode());
  
      }
  
  
      // ------------------------------------------------ Utility Support Methods
  
  
      /**
       * Return an appropriate InputStream for the specified test file (which
       * must be inside our current package.
       *
       * @param name Name of the test file we want
       *
       * @exception IOException if an input/output error occurs
       */
      protected InputStream getInputStream(String name) throws IOException {
  
          return (this.getClass().getResourceAsStream
                  ("/org/apache/commons/digester/" + name));
  
      }
  
  
  }
  
  
  
  1.1                  
jakarta-commons/digester/src/test/org/apache/commons/digester/Test1.xml
  
  Index: Test1.xml
  ===================================================================
  <?xml version="1.0"?>
  <employee firstName="First Name" lastName="Last Name">
    <address type="home" street="Home Street" city="Home City"
                          state="HS" zipCode="HmZip"/>
    <address type="office" street="Office Street" city="Office City"
                            state="OS" zipCode="OfZip"/>
  </employee>
  
  
  
  1.1                  
jakarta-commons/digester/src/test/org/apache/commons/digester/TestBean.java
  
  Index: TestBean.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons/digester/src/test/org/apache/commons/digester/TestBean.java,v
 1.1 2001/08/20 21:59:43 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/08/20 21:59:43 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 org.apache.commons.digester;
  
  
  /**
   * General purpose test bean for Digester tests.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/08/20 21:59:43 $
   */
  
  public class TestBean {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * A boolean property whose initial value is true.
       */
      private boolean booleanProperty = true;
  
      public boolean getBooleanProperty() {
          return (booleanProperty);
      }
  
      public void setBooleanProperty(boolean booleanProperty) {
          this.booleanProperty = booleanProperty;
      }
  
  
      /**
       * A double property.
       */
      private double doubleProperty = 321.0;
  
      public double getDoubleProperty() {
          return (this.doubleProperty);
      }
  
      public void setDoubleProperty(double doubleProperty) {
          this.doubleProperty = doubleProperty;
      }
  
  
      /**
       * A boolean property whose initial value is false
       */
      private boolean falseProperty = false;
  
      public boolean getFalseProperty() {
          return (falseProperty);
      }
  
      public void setFalseProperty(boolean falseProperty) {
          this.falseProperty = falseProperty;
      }
  
  
      /**
       * A float property.
       */
      private float floatProperty = (float) 123.0;
  
      public float getFloatProperty() {
          return (this.floatProperty);
      }
  
      public void setFloatProperty(float floatProperty) {
          this.floatProperty = floatProperty;
      }
  
  
      /**
       * Integer arrays that are accessed as an array as well as indexed.
       */
      private int intArray[] = { 0, 10, 20, 30, 40 };
  
      public int[] getIntArray() {
          return (this.intArray);
      }
  
      public void setIntArray(int intArray[]) {
          this.intArray = intArray;
      }
  
      private int intIndexed[] = { 0, 10, 20, 30, 40 };
  
      public int getIntIndexed(int index) {
          return (intIndexed[index]);
      }
  
      public void setIntIndexed(int index, int value) {
          intIndexed[index] = value;
      }
  
  
      private int intMultibox[] = new int[0];
  
      public int[] getIntMultibox() {
          return (this.intMultibox);
      }
  
      public void setIntMultibox(int intMultibox[]) {
          this.intMultibox = intMultibox;
      }
  
      /**
       * An integer property.
       */
      private int intProperty = 123;
  
      public int getIntProperty() {
          return (this.intProperty);
      }
  
      public void setIntProperty(int intProperty) {
          this.intProperty = intProperty;
      }
  
  
      /**
       * A long property.
       */
      private long longProperty = 321;
  
      public long getLongProperty() {
          return (this.longProperty);
      }
  
      public void setLongProperty(long longProperty) {
          this.longProperty = longProperty;
      }
  
  
      /**
       * A multiple-String SELECT element.
       */
      private String[] multipleSelect = { "Multiple 3", "Multiple 5",
                                          "Multiple 7" };
  
      public String[] getMultipleSelect() {
          return (this.multipleSelect);
      }
  
      public void setMultipleSelect(String multipleSelect[]) {
          this.multipleSelect = multipleSelect;
      }
  
  
      /**
       * A nested reference to another test bean (populated as needed).
       */
      private TestBean nested = null;
  
      public TestBean getNested() {
          if (nested == null)
              nested = new TestBean();
          return (nested);
      }
  
  
      /**
       * A String property with an initial value of null.
       */
      private String nullProperty = null;
  
      public String getNullProperty() {
          return (this.nullProperty);
      }
  
      public void setNullProperty(String nullProperty) {
          this.nullProperty = nullProperty;
      }
  
  
      /**
       * A short property.
       */
      private short shortProperty = (short) 987;
  
      public short getShortProperty() {
          return (this.shortProperty);
      }
  
      public void setShortProperty(short shortProperty) {
          this.shortProperty = shortProperty;
      }
  
  
      /**
       * A single-String value for a SELECT element.
       */
      private String singleSelect = "Single 5";
  
      public String getSingleSelect() {
          return (this.singleSelect);
      }
  
      public void setSingleSelect(String singleSelect) {
          this.singleSelect = singleSelect;
      }
  
  
      /**
       * String arrays that are accessed as an array as well as indexed.
       */
      private String stringArray[] =
      { "String 0", "String 1", "String 2", "String 3", "String 4" };
  
      public String[] getStringArray() {
          return (this.stringArray);
      }
  
      public void setStringArray(String stringArray[]) {
          this.stringArray = stringArray;
      }
  
      private String stringIndexed[] =
      { "String 0", "String 1", "String 2", "String 3", "String 4" };
  
      public String getStringIndexed(int index) {
          return (stringIndexed[index]);
      }
  
      public void setStringIndexed(int index, String value) {
          stringIndexed[index] = value;
      }
  
  
      /**
       * A String property.
       */
      private String stringProperty = "This is a string";
  
      public String getStringProperty() {
          return (this.stringProperty);
      }
  
      public void setStringProperty(String stringProperty) {
          this.stringProperty = stringProperty;
      }
  
      /**
       * An empty String property.
       */
      private String emptyStringProperty = "";
  
      public String getEmptyStringProperty() {
          return (this.emptyStringProperty);
      }
  
      public void setEmptyStringProperty(String emptyStringProperty) {
          this.emptyStringProperty = emptyStringProperty;
      }
  
  
  }
  
  
  

Reply via email to