Skip to content
Permalink
Browse files

[JENKINS-26227] xUnit plugin doesn't use OS culture when reads time v…

…alues in xUnit.net output

To be aware from OS culture the junit-time function converts input from any type to string, replace comma with a dot and use its double value to format millisend time to the correct JUnit format.
  • Loading branch information...
nfalco79 committed May 20, 2018
1 parent c9cecd5 commit 850a7bbfb4ab2dfac188756652cdb19ab3d6ffd8
Showing with 367 additions and 253 deletions.
  1. +9 −2 src/main/resources/org/jenkinsci/plugins/xunit/types/cpptestunit-2.0-to-junit-1.0.xsl
  2. +9 −2 src/main/resources/org/jenkinsci/plugins/xunit/types/ctest-to-junit.xsl
  3. +9 −2 src/main/resources/org/jenkinsci/plugins/xunit/types/mbunit-to-junit-4.xsl
  4. +9 −2 src/main/resources/org/jenkinsci/plugins/xunit/types/mstest-1.0-to-junit-1.0.xsl
  5. +10 −3 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-1.0-to-junit-2.xsl
  6. +9 −2 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-3.0-to-junit.xsl
  7. +30 −24 src/main/resources/org/jenkinsci/plugins/xunit/types/phpunit-1.0-to-junit-4.0.xsl
  8. +9 −2 src/main/resources/org/jenkinsci/plugins/xunit/types/qtestlib-5.0-to-junit-1.0.xsl
  9. +101 −85 src/main/resources/org/jenkinsci/plugins/xunit/types/xunitdotnet-2.0-to-junit-2.xsl
  10. +23 −23 src/test/java/org/jenkinsci/plugins/xunit/types/PHPUnitTest.java
  11. +56 −0 src/test/java/org/jenkinsci/plugins/xunit/types/XUnitDotNetTest.java
  12. +0 −44 src/test/java/org/jenkinsci/plugins/xunit/types/XunitDotNetTest.java
  13. +52 −61 src/test/resources/org/jenkinsci/plugins/xunit/types/junit/testcase3/input.xml
  14. 0 .../resources/org/jenkinsci/plugins/xunit/types/xunitdotnet/testcase1/{xunit-simple.xml → input.xml}
  15. 0 ...resources/org/jenkinsci/plugins/xunit/types/xunitdotnet/testcase1/{junit-simple.xml → result.xml}
  16. 0 .../resources/org/jenkinsci/plugins/xunit/types/xunitdotnet/testcase2/{xunit-simple.xml → input.xml}
  17. +11 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/xunitdotnet/testcase2/result.xml
  18. +18 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/xunitdotnet/testcase3/input.xml
  19. +12 −1 ...org/jenkinsci/plugins/xunit/types/xunitdotnet/{testcase2/junit-simple.xml → testcase3/result.xml}
@@ -27,10 +27,17 @@ THE SOFTWARE.
<xsl:decimal-format decimal-separator="." grouping-separator=","/>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:double?" />
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate(string($value),',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>
@@ -27,10 +27,17 @@ THE SOFTWARE.
<xsl:decimal-format decimal-separator="." grouping-separator=","/>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:double?" />
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate(string($value),',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>
@@ -27,10 +27,17 @@ THE SOFTWARE.
<xsl:decimal-format decimal-separator="." grouping-separator=","/>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:double?" />
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate(string($value),',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>
@@ -29,10 +29,17 @@ THE SOFTWARE.
<xsl:decimal-format decimal-separator="." grouping-separator=","/>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:double?" />
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate(string($value),',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>
@@ -26,11 +26,18 @@ THE SOFTWARE.
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:decimal-format decimal-separator="." grouping-separator=","/>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:double?" />
<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate(string($value),',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>
@@ -27,10 +27,17 @@ THE SOFTWARE.
<xsl:decimal-format decimal-separator="." grouping-separator=","/>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:double?" />
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate(string($value),',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>
@@ -1,27 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*******************************************************************************
* Copyright (c) 2009 Thales Corporate Services SAS *
* Author : Gregory Boissinot *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy *
* of this software and associated documentation files (the "Software"), to deal*
* in the Software without restriction, including without limitation the rights *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,*
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN *
* THE SOFTWARE. *
*******************************************************************************/
The MIT License (MIT)
Copyright (c) 2018, Gregory Boissinot, Falco Nikolas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xunit="http://www.xunit.org">

@@ -35,10 +34,17 @@
</xsl:function>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:string?" />
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate($value,',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>
@@ -28,10 +28,17 @@ THE SOFTWARE.
<xsl:decimal-format decimal-separator="." grouping-separator=","/>

<xsl:function name="xunit:junit-time" as="xs:string">
<xsl:param name="value" as="xs:double?" />
<xsl:param name="value" as="xs:anyAtomicType?" />

<xsl:variable name="time" as="xs:double">
<xsl:value-of select="translate(string($value),',','.')" />
<xsl:choose>
<xsl:when test="$value instance of xs:double">
<xsl:value-of select="$value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(string($value), ',', '.')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="format-number($time, '0.000')" />
</xsl:function>

0 comments on commit 850a7bb

Please sign in to comment.
You can’t perform that action at this time.