ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs StyleTest.java
Date Sat, 06 Sep 2003 13:30:30 GMT
jhm         2003/09/06 06:30:30

  Modified:    src/etc/testcases/taskdefs/style build.xml
               src/testcases/org/apache/tools/ant/taskdefs StyleTest.java
  Log:
  Test if <style> generates new if the XSL is new.
  
  Revision  Changes    Path
  1.2       +13 -0     ant/src/etc/testcases/taskdefs/style/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/style/build.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.xml	5 Aug 2003 16:01:10 -0000	1.1
  +++ build.xml	6 Sep 2003 13:30:30 -0000	1.2
  @@ -42,4 +42,17 @@
         </style>
     </target>
   
  +  <target name="testNewerStylesheet">
  +      <antcall target="copyXsl"><param name="xsl.value" value="old-value"/></antcall>
  +      <style in="data.xml" out="${out.dir}/out.xml" style="tmp.xsl"/>
  +      <antcall target="copyXsl"><param name="xsl.value" value="new-value"/></antcall>
  +      <style in="data.xml" out="${out.dir}/out.xml" style="tmp.xsl"/>
  +      <delete file="tmp.xsl"/>
  +  </target>
  +  <target name="copyXsl" if="xsl.value">
  +      <copy file="testNewerStylesheet.xsl" tofile="tmp.xsl" overwrite="true">
  +          <filterchain><expandproperties/></filterchain>
  +      </copy>
  +  </target>
  +
   </project>
  
  
  
  1.5       +3 -51     ant/src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java
  
  Index: StyleTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/StyleTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StyleTest.java	6 Sep 2003 08:50:20 -0000	1.4
  +++ StyleTest.java	6 Sep 2003 13:30:30 -0000	1.5
  @@ -114,57 +114,9 @@
       }
   
       public void testNewerStylesheet() throws Exception {
  -        File xmlFile = new File("testNewerStylesheet.xml");
  -        File xslFile = new File("testNewerStylesheet.xsl");
  -        File outFile = new File("testNewerStylesheet.out");
  -
  -        // create the first version of xml and xsl
  -        String xml = "<data/>";
  -        StringBuffer xslHeader = new StringBuffer();
  -        StringBuffer xslFooter = new StringBuffer();
  -        xslHeader.append("<?xml version=\"1.0\"?>");
  -        xslHeader.append("<xsl:stylesheet");
  -        xslHeader.append("  version=\"1.0\"");
  -        xslHeader.append("  xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">");
  -        xslHeader.append("<xsl:template match=\"/\">");
  -        xslFooter.append("</xsl:template>");
  -        xslFooter.append("</xsl:stylesheet>");
  -
  -        FileWriter xmlWriter = new FileWriter(xmlFile);
  -        xmlWriter.write(xml);
  -        xmlWriter.close();
  -
  -        FileWriter xslWriter = new FileWriter(xslFile);
  -        xslWriter.write(xslHeader.toString());
  -        xslWriter.write("old-string");
  -        xslWriter.write(xslFooter.toString());
  -        xslWriter.close();
  -
  -        // make the first transformation
  -        XSLTProcess xslt = new XSLTProcess();
  -        xslt.setProject(getProject());
  -        System.out.println("Project : " + getProject());
  -        xslt.setBasedir(getProject().getBaseDir());
  -        xslt.setStyle(xslFile.toString());
  -        xslt.setOut(outFile);
  -        xslt.setIn(xmlFile);
  -        xslt.execute();
  -
  -        // modify the xsl
  -        xslWriter = new FileWriter(xslFile);
  -        xslWriter.write(xslHeader.toString());
  -        xslWriter.write("new-string");
  -        xslWriter.write(xslFooter.toString());
  -        xslWriter.close();
  -        xslt.perform();
  -
  -        // make the second transformation
  -
  -
  -        // test for 2nd transformation
  -        xmlFile.delete();
  -        xslFile.delete();
  -        outFile.delete();
  +        expectFileContains("testNewerStylesheet",
  +                           "out/out.xml",
  +                           "new-value");
       }
   
   
  
  
  

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


Mime
View raw message