ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/types FilterSetTest.java
Date Fri, 27 Sep 2002 09:38:23 GMT
bodewig     2002/09/27 02:38:23

  Modified:    .        Tag: ANT_15_BRANCH WHATSNEW
               docs/manual/CoreTypes Tag: ANT_15_BRANCH filterset.html
               src/etc/testcases/types Tag: ANT_15_BRANCH filterset.xml
               src/main/org/apache/tools/ant/types Tag: ANT_15_BRANCH
                        FilterSet.java
               src/testcases/org/apache/tools/ant/types Tag: ANT_15_BRANCH
                        FilterSetTest.java
  Log:
  merge nested filtersets fix from CVS HEAD
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.263.2.83 +2 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.263.2.82
  retrieving revision 1.263.2.83
  diff -u -r1.263.2.82 -r1.263.2.83
  --- WHATSNEW	27 Sep 2002 06:59:16 -0000	1.263.2.82
  +++ WHATSNEW	27 Sep 2002 09:38:22 -0000	1.263.2.83
  @@ -12,6 +12,8 @@
   * <basename> would remove more than it should if the file name
     contained more than one dot.
   
  +* <filterset>s nested into <filterset>s didn't work.
  +
   Other changes:
   --------------
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.4   +8 -3      jakarta-ant/docs/manual/CoreTypes/filterset.html
  
  Index: filterset.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTypes/filterset.html,v
  retrieving revision 1.6.2.3
  retrieving revision 1.6.2.4
  diff -u -r1.6.2.3 -r1.6.2.4
  --- filterset.html	26 Sep 2002 16:21:50 -0000	1.6.2.3
  +++ filterset.html	27 Sep 2002 09:38:22 -0000	1.6.2.4
  @@ -14,9 +14,14 @@
   feature or at the same level as <CODE>&lt;target&gt;</CODE> - i.e.,
as
   children of 
   <CODE>&lt;project&gt;</CODE>.</P>
  -<P>FilterSets support the <code>id</code> and <code>refid</code>
attributes.
  -You can define a FilterSet with an <code>id</code> attribute and then refer
  -to that definition from another FilterSet with a <code>refid</code> attribute.
  +
  +<p>FilterSets support the <code>id</code> and <code>refid</code>
  +attributes.  You can define a FilterSet with an <code>id</code>
  +attribute and then refer to that definition from another FilterSet
  +with a <code>refid</code> attribute.  It is also possible to nest
  +filtersets into filtersets to get a set union of the contained
  +filters.</p>
  +
   <p>In addition, FilterSets can specify
   <code>begintoken</code> and/or 
   <code>endtoken</code> attributes to define what to match.</p>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +17 -0     jakarta-ant/src/etc/testcases/types/filterset.xml
  
  Index: filterset.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/types/filterset.xml,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- filterset.xml	6 Nov 2001 13:21:43 -0000	1.4
  +++ filterset.xml	27 Sep 2002 09:38:22 -0000	1.4.2.1
  @@ -31,6 +31,23 @@
       </copy>
     </target>
     
  +  <target name="test-nested-filtersets">
  +    <filterset id="1">
  +      <filter token="token1" value="value1"/>
  +    </filterset>
  +    <filterset id="2">
  +      <filterset refid="testset.one"/>
  +    </filterset>
  +    <filterset id="3">
  +      <filterset id="4">
  +        <filter token="token4" value="value4"/>
  +      </filterset>
  +    </filterset>
  +    <filterset id="5">
  +      <filterset refid="1"/>
  +    </filterset>
  +  </target>
  +
     <target name="cleanup">
       <delete file="dest1.txt" quiet="true" />
       <delete file="dest2.txt" quiet="true" />
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.13.2.1  +1 -1      jakarta-ant/src/main/org/apache/tools/ant/types/FilterSet.java
  
  Index: FilterSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/FilterSet.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- FilterSet.java	15 Apr 2002 14:56:34 -0000	1.13
  +++ FilterSet.java	27 Sep 2002 09:38:22 -0000	1.13.2.1
  @@ -418,7 +418,7 @@
       *
       * @param filterSet the filterset to be added to this filterset
       */
  -    public void addFilterSet(FilterSet filterSet) {
  +    public void addConfiguredFilterSet(FilterSet filterSet) {
           if (isReference()) {
               throw noChildrenAllowed();
           }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.1   +26 -0     jakarta-ant/src/testcases/org/apache/tools/ant/types/FilterSetTest.java
  
  Index: FilterSetTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/types/FilterSetTest.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- FilterSetTest.java	19 Mar 2002 07:02:12 -0000	1.6
  +++ FilterSetTest.java	27 Sep 2002 09:38:23 -0000	1.6.2.1
  @@ -62,6 +62,7 @@
   import junit.framework.AssertionFailedError;
   
   import java.io.*;
  +import java.util.Hashtable;
   
   /**
    * FilterSet testing
  @@ -100,6 +101,31 @@
           executeTarget("test3");
           assertTrue("Filterset 3 failed", compareFiles("src/etc/testcases/types/gold/filterset3.txt",
                                                         "src/etc/testcases/types/dest3.txt"));
  +    }
  +
  +    public void testNestedFilterSets() {
  +        executeTarget("test-nested-filtersets");
  +
  +        FilterSet fs = (FilterSet) getProject().getReference("1");
  +        Hashtable filters = fs.getFilterHash();
  +        assertEquals(1, filters.size());
  +        assertEquals("value1", filters.get("token1"));
  +
  +        fs = (FilterSet) getProject().getReference("2");
  +        filters = fs.getFilterHash();
  +        assertEquals(2, filters.size());
  +        assertEquals("1111", filters.get("aaaa"));
  +        assertEquals("2222", filters.get("bbbb"));
  +
  +        fs = (FilterSet) getProject().getReference("3");
  +        filters = fs.getFilterHash();
  +        assertEquals(1, filters.size());
  +        assertEquals("value4", filters.get("token4"));
  +
  +        fs = (FilterSet) getProject().getReference("5");
  +        filters = fs.getFilterHash();
  +        assertEquals(1, filters.size());
  +        assertEquals("value1", filters.get("token1"));
       }
   
       private boolean compareFiles(String name1, String name2) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message