You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/08/14 15:06:33 UTC

cvs commit: jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/spec TestComponentSpecification.java

hlship      2005/08/14 06:06:33

  Modified:    .        status.xml
               framework/src/java/org/apache/tapestry/spec
                        ComponentSpecification.java
                        IComponentSpecification.java
               framework/src/test/org/apache/tapestry/junit/spec
                        TestComponentSpecification.java
  Log:
  TAPESTRY-528: Add IComponentSpecification.getReservedParameterNames()
  
  Revision  Changes    Path
  1.207     +2 -1      jakarta-tapestry/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/status.xml,v
  retrieving revision 1.206
  retrieving revision 1.207
  diff -u -r1.206 -r1.207
  --- status.xml	13 Aug 2005 15:02:34 -0000	1.206
  +++ status.xml	14 Aug 2005 13:06:33 -0000	1.207
  @@ -52,7 +52,8 @@
     <changes>
       <release version="4.0-beta-5" date="unreleased">
         <action type="fix" dev="MB,HLS" fixes-bug="TAPESTRY-552">Improperly configured SerializableAdaptor (for DataSqueezer) prevents serialized objects from being de-serialized</action>
  -      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-554"> Hook needed on client side to control how validation errors are presented to the user</action>
  +      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-554">Hook needed on client side to control how validation errors are presented to the user</action>
  +      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-528">Add IComponentSpecification.getReservedParameterNames()</action>
       </release>
       <release version="4.0-beta-4" date="Aug 10 2005">
         <action type="fix" dev="HLS">Add getComponent() method to IComponent.</action>
  
  
  
  1.13      +8 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java
  
  Index: ComponentSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ComponentSpecification.java	9 Jun 2005 18:33:44 -0000	1.12
  +++ ComponentSpecification.java	14 Aug 2005 13:06:33 -0000	1.13
  @@ -689,4 +689,12 @@
       {
           _deprecated = deprecated;
       }
  +
  +    public Set getReservedParameterNames()
  +    {
  +        if (_reservedParameterNames == null)
  +            return Collections.EMPTY_SET;
  +
  +        return Collections.unmodifiableSet(_reservedParameterNames);
  +    }
   }
  \ No newline at end of file
  
  
  
  1.12      +13 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IComponentSpecification.java
  
  Index: IComponentSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IComponentSpecification.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- IComponentSpecification.java	6 Jun 2005 22:28:19 -0000	1.11
  +++ IComponentSpecification.java	14 Aug 2005 13:06:33 -0000	1.12
  @@ -16,6 +16,7 @@
   
   import java.util.Collection;
   import java.util.List;
  +import java.util.Set;
   
   import org.apache.hivemind.Locatable;
   import org.apache.hivemind.LocationHolder;
  @@ -298,4 +299,16 @@
        */
   
       public void setDeprecated(boolean deprecated);
  +
  +    /**
  +     * Returns a Set of Strings; the reserved parameter names for the component. This combines
  +     * explicit reserved names with formal parameter names. Each parameter name in the Set will be
  +     * all lower case (to facilitate a caseless comparison).
  +     * 
  +     * @returns an unmodifiable set (of String), possibly empty
  +     * @since 4.0
  +     */
  +
  +    public Set getReservedParameterNames();
  +
   }
  \ No newline at end of file
  
  
  
  1.4       +48 -0     jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/spec/TestComponentSpecification.java
  
  Index: TestComponentSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/spec/TestComponentSpecification.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestComponentSpecification.java	6 Jan 2005 02:17:29 -0000	1.3
  +++ TestComponentSpecification.java	14 Aug 2005 13:06:33 -0000	1.4
  @@ -14,11 +14,18 @@
   
   package org.apache.tapestry.junit.spec;
   
  +import java.util.Collections;
  +import java.util.HashSet;
  +import java.util.Set;
  +
   import org.apache.tapestry.junit.TapestryTestCase;
  +import org.apache.tapestry.spec.ComponentSpecification;
   import org.apache.tapestry.spec.IAssetSpecification;
   import org.apache.tapestry.spec.IBeanSpecification;
   import org.apache.tapestry.spec.IComponentSpecification;
   import org.apache.tapestry.spec.IContainedComponent;
  +import org.apache.tapestry.spec.IParameterSpecification;
  +import org.apache.tapestry.spec.ParameterSpecification;
   
   /**
    * Test cases for page and component specifications.
  @@ -74,4 +81,45 @@
   
           assertEquals("Property " + propertyName + ".", expectedValue, a.getProperty(propertyName));
       }
  +
  +    /** @since 4.0 */
  +
  +    public void testGetReservedParameterNames()
  +    {
  +        IComponentSpecification s = new ComponentSpecification();
  +
  +        assertEquals(Collections.EMPTY_SET, s.getReservedParameterNames());
  +
  +        s.addReservedParameterName("Fred");
  +
  +        Set expected = new HashSet();
  +
  +        expected.add("fred");
  +
  +        assertEquals(expected, s.getReservedParameterNames());
  +
  +        IParameterSpecification ps = new ParameterSpecification();
  +
  +        ps.setAliases("wilma,barney");
  +        ps.setParameterName("bambam");
  +
  +        s.addParameter(ps);
  +
  +        expected.add("wilma");
  +        expected.add("barney");
  +        expected.add("bambam");
  +
  +        assertEquals(expected, s.getReservedParameterNames());
  +
  +        try
  +        {
  +            s.getReservedParameterNames().clear();
  +            unreachable();
  +        }
  +        catch (UnsupportedOperationException ex)
  +        {
  +            // expected
  +        }
  +
  +    }
   }
  
  
  

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