ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r421327 - in /ant/core/trunk/src: etc/testcases/taskdefs/optional/ main/org/apache/tools/ant/taskdefs/optional/junit/ main/org/apache/tools/ant/types/resources/ testcases/org/apache/tools/ant/taskdefs/optional/junit/
Date Wed, 12 Jul 2006 17:18:06 GMT
Author: antoine
Date: Wed Jul 12 10:18:06 2006
New Revision: 421327

URL: http://svn.apache.org/viewvc?rev=421327&view=rev
Log:
Bug Report 40021. The noframes option was not working at all.

Modified:
    ant/core/trunk/src/etc/testcases/taskdefs/optional/junitreport.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java
    ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java

Modified: ant/core/trunk/src/etc/testcases/taskdefs/optional/junitreport.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/optional/junitreport.xml?rev=421327&r1=421326&r2=421327&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/optional/junitreport.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/optional/junitreport.xml Wed Jul 12 10:18:06
2006
@@ -115,6 +115,16 @@
         </junitreport>
     </target>
 
+    <target name="testNoFrames">
+        <mkdir dir="${outputdir}/html"/>
+        <junitreport todir="${outputdir}">
+            <fileset dir="${jrdir}">
+                <include name="TEST-*.xml"/>
+            </fileset>
+            <report todir="${outputdir}/html" format="noframes"/>
+        </junitreport>
+    </target>
+
     <target name="testWithStyleFromDir">
         <mkdir dir="${outputdir}/html"/>
         <junitreport todir="${outputdir}">
@@ -126,7 +136,7 @@
                 format="frames"/>
         </junitreport>
     </target>
-    
+
     <!-- bug report 40022 -->
     <target name="testWithStyleFromDirAndXslImport">
         <mkdir dir="${outputdir}/html"/>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java?rev=421327&r1=421326&r2=421327&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
Wed Jul 12 10:18:06 2006
@@ -224,12 +224,6 @@
 
         TempFile tempFileTask = new TempFile();
         tempFileTask.bindToOwner(task);
-        String tempFileProperty = getClass().getName() + String.valueOf(counter++);
-        File tmp = FILE_UTILS.resolveFile(project.getBaseDir(),
-                project.getProperty("java.io.tmpdir"));
-        tempFileTask.setDestDir(tmp);
-        tempFileTask.setProperty(tempFileProperty);
-        tempFileTask.execute();
 
         XSLTProcess xsltTask = new XSLTProcess();
         xsltTask.bindToOwner(task);
@@ -237,8 +231,19 @@
         xsltTask.addConfigured(getStylesheet());
         // acrobatic cast.
         xsltTask.setIn(((XMLResultAggregator) task).getDestinationFile());
-        File dummyFile = new File(project.getProperty(tempFileProperty));
-        xsltTask.setOut(dummyFile);
+        File outputFile = null;
+        if (format.equals(FRAMES)) {
+            String tempFileProperty = getClass().getName() + String.valueOf(counter++);
+            File tmp = FILE_UTILS.resolveFile(project.getBaseDir(),
+                    project.getProperty("java.io.tmpdir"));
+            tempFileTask.setDestDir(tmp);
+            tempFileTask.setProperty(tempFileProperty);
+            tempFileTask.execute();
+            outputFile = new File(project.getProperty(tempFileProperty));
+        } else {
+            outputFile = new File(toDir, "junit-noframes.html");
+        }
+        xsltTask.setOut(outputFile);
         for (Iterator i = params.iterator(); i.hasNext();) {
             XSLTProcess.Param param = (XSLTProcess.Param) i.next();
             XSLTProcess.Param newParam = xsltTask.createParam();
@@ -259,10 +264,12 @@
         }
         final long dt = System.currentTimeMillis() - t0;
         task.log("Transform time: " + dt + "ms");
-        Delete delete = new Delete();
-        delete.bindToOwner(task);
-        delete.setFile(dummyFile);
-        delete.execute();
+        if (format.equals(FRAMES)) {
+            Delete delete = new Delete();
+            delete.bindToOwner(task);
+            delete.setFile(outputFile);
+            delete.execute();
+        }
     }
 
     /**

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java?rev=421327&r1=421326&r2=421327&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java Wed Jul
12 10:18:06 2006
@@ -38,7 +38,7 @@
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
     private static final int NULL_FILE
         = Resource.getMagicNumber("null file".getBytes());
-
+                               
     private File file;
     private File baseDir;
 

Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java?rev=421327&r1=421326&r2=421327&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
(original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
Wed Jul 12 10:18:06 2006
@@ -150,6 +150,19 @@
         assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
     }
 
+    //Bugzilla Report 40021
+    public void testNoFrames() throws Exception {
+        executeTarget("testNoFrames");
+        File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html");
+        // tests one the file object
+        assertTrue("No junit-noframes.html present. Not generated?", reportFile.exists()
);
+        assertTrue("Cant read the report file.", reportFile.canRead() );
+        assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
+        // conversion to URL via FileUtils like in XMLResultAggregator, not as suggested
in the bug report
+        URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath())
);
+        InputStream reportStream = reportUrl.openStream();
+        assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
+    }
     //Bugzilla Report 39708
     public void testWithStyleFromDirAndXslImport() throws Exception {
         executeTarget("testWithStyleFromDirAndXslImport");



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


Mime
View raw message