|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
2 | 2 | <!--
|
3 | 3 |
|
4 |
| - Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved. |
| 4 | + Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved. |
5 | 5 |
|
6 | 6 | This program and the accompanying materials are made available under the
|
7 | 7 | terms of the Eclipse Public License v. 2.0 which is available at
|
|
72 | 72 | <artifactId>maven-antrun-plugin</artifactId>
|
73 | 73 | <executions>
|
74 | 74 | <execution>
|
75 |
| - <phase>process-resources</phase> |
| 75 | + <phase>generate-resources</phase> |
76 | 76 | <goals>
|
77 | 77 | <goal>run</goal>
|
78 | 78 | </goals>
|
|
113 | 113 | <executions>
|
114 | 114 | <execution>
|
115 | 115 | <id>generate-test-summary-html-report</id>
|
116 |
| - <phase>package</phase> |
| 116 | + <phase>generate-resources</phase> |
117 | 117 | <goals>
|
118 | 118 | <goal>failsafe-report-only</goal>
|
119 | 119 | </goals>
|
|
123 | 123 | </reportsDirectories>
|
124 | 124 | <outputDirectory>${project.build.directory}/jpa-test-reports/${project.build.testReports.subdirectory}</outputDirectory>
|
125 | 125 | <outputName>${project.build.testReports.summaryFile}</outputName>
|
126 |
| - <title>EclipseLink JPA Test - Test Summary (more details on ${env.BUILD_URL} )</title> |
| 126 | + <customBundle>${project.basedir}/src/site/custom/surefire-report.properties</customBundle> |
| 127 | + </configuration> |
| 128 | + </execution> |
| 129 | + </executions> |
| 130 | + </plugin> |
| 131 | + <plugin> |
| 132 | + <groupId>org.apache.maven.plugins</groupId> |
| 133 | + <artifactId>maven-antrun-plugin</artifactId> |
| 134 | + <executions> |
| 135 | + <execution> |
| 136 | + <id>prepare-nightly-build-dir-test-reports-resources</id> |
| 137 | + <phase>generate-resources</phase> |
| 138 | + <goals> |
| 139 | + <goal>run</goal> |
| 140 | + </goals> |
| 141 | + <configuration> |
| 142 | + <target> |
| 143 | + <copy todir="${project.build.directory}${nightlyDir}/Eclipse/css/"> |
| 144 | + <fileset dir="../../foundation/eclipselink.core.test/target/${project.build.testReports.subdirectory}/css/"/> |
| 145 | + </copy> |
| 146 | + <copy todir="${project.build.directory}${nightlyDir}/Eclipse/images/"> |
| 147 | + <fileset dir="../../foundation/eclipselink.core.test/target/${project.build.testReports.subdirectory}/images/"/> |
| 148 | + </copy> |
| 149 | + </target> |
127 | 150 | </configuration>
|
128 | 151 | </execution>
|
129 | 152 | </executions>
|
|
134 | 157 | <executions>
|
135 | 158 | <execution>
|
136 | 159 | <id>prepare-nightly-build-dir-test-reports</id>
|
137 |
| - <phase>package</phase> |
| 160 | + <phase>generate-resources</phase> |
138 | 161 | <goals>
|
139 | 162 | <goal>copy</goal>
|
140 | 163 | </goals>
|
|
217 | 240 | </execution>
|
218 | 241 | <execution>
|
219 | 242 | <id>prepare-nightly-build-dir-binaries</id>
|
220 |
| - <phase>package</phase> |
| 243 | + <phase>process-resources</phase> |
221 | 244 | <goals>
|
222 | 245 | <goal>copy</goal>
|
223 | 246 | </goals>
|
|
273 | 296 | </execution>
|
274 | 297 | </executions>
|
275 | 298 | </plugin>
|
| 299 | + <plugin> |
| 300 | + <groupId>org.apache.maven.plugins</groupId> |
| 301 | + <artifactId>maven-antrun-plugin</artifactId> |
| 302 | + <executions> |
| 303 | + <execution> |
| 304 | + <id>fix-test-reports</id> |
| 305 | + <phase>package</phase> |
| 306 | + <goals> |
| 307 | + <goal>run</goal> |
| 308 | + </goals> |
| 309 | + <configuration> |
| 310 | + <target> |
| 311 | + <!-- Fix some non-XML valid sequence in test reports --> |
| 312 | + <replace dir="${project.build.directory}${nightlyDir}/Eclipse/"> |
| 313 | + <include name="**/*.html"/> |
| 314 | + <replacefilter> |
| 315 | + <replacetoken><![CDATA[&&]]></replacetoken> |
| 316 | + <replacevalue><![CDATA[&&]]></replacevalue> |
| 317 | + </replacefilter> |
| 318 | + </replace> |
| 319 | + </target> |
| 320 | + </configuration> |
| 321 | + </execution> |
| 322 | + </executions> |
| 323 | + </plugin> |
276 | 324 | <plugin>
|
277 | 325 | <groupId>org.codehaus.gmaven</groupId>
|
278 | 326 | <artifactId>groovy-maven-plugin</artifactId>
|
|
289 | 337 | import javax.xml.xpath.XPathFactory
|
290 | 338 | import javax.xml.parsers.DocumentBuilderFactory
|
291 | 339 |
|
292 |
| - final NO_OF_TESTS_XPATH = "/html/body/div[@id='bodyColumn']/div/section[2]/table/tr[2]/td[1]/text()" |
293 |
| - final NO_OF_ERRORS_XPATH = "/html/body/div[@id='bodyColumn']/div/section[2]/table/tr[2]/td[2]/text()" |
294 |
| - final NO_OF_FAILURES_XPATH = "/html/body/div[@id='bodyColumn']/div/section[2]/table/tr[2]/td[3]/text()" |
| 340 | + final NO_OF_TESTS_XPATH = "/html/body/div[@id='bodyColumn']/div[@id='contentBox']/section[2]/table/tr[2]/td[1]/text()" |
| 341 | + final NO_OF_ERRORS_XPATH = "/html/body/div[@id='bodyColumn']/div[@id='contentBox']/section[2]/table/tr[2]/td[2]/text()" |
| 342 | + final NO_OF_FAILURES_XPATH = "/html/body/div[@id='bodyColumn']/div[@id='contentBox']/section[2]/table/tr[2]/td[3]/text()" |
| 343 | +
|
295 | 344 | final OUTPUT_FILE = "ResultSummary.dat"
|
296 | 345 |
|
297 | 346 | def resultSummaryFile = new File(properties["nightlyTestReportsDir"] + "/" + OUTPUT_FILE)
|
|
318 | 367 | }
|
319 | 368 | File[] files = reportDir.listFiles()
|
320 | 369 | for (File file : files) {
|
321 |
| - try { |
322 |
| - noOfTests = processXml(file.text, NO_OF_TESTS_XPATH) |
323 |
| - noOfNewTests = noOfTests |
324 |
| - noOfErrors = processXml(file.text, NO_OF_ERRORS_XPATH) + |
325 |
| - processXml(file.text, NO_OF_FAILURES_XPATH) |
326 |
| - } catch (Exception e) { |
327 |
| - log.warn "File: " + file.getName() + " can't be parsed. Result will be marked as a failed test!" |
328 |
| - noOfTests = 1 |
329 |
| - noOfNewTests = 1 |
330 |
| - noOfErrors = 1 |
| 370 | + if (file.isFile()) { |
| 371 | + try { |
| 372 | + noOfTests = processXml(file.text, NO_OF_TESTS_XPATH) |
| 373 | + noOfNewTests = noOfTests |
| 374 | + noOfErrors = processXml(file.text, NO_OF_ERRORS_XPATH) + processXml(file.text, NO_OF_FAILURES_XPATH) |
| 375 | + } catch (Exception e) { |
| 376 | + log.warn "Error cause: ${e}" |
| 377 | + log.warn "File: " + file.getName() + " can't be parsed. Result will be marked as a failed test!" |
| 378 | + noOfTests = 1 |
| 379 | + noOfNewTests = 1 |
| 380 | + noOfErrors = 1 |
| 381 | + } |
| 382 | + resultSummaryFile.append file. |
| 383 | + getName() + ":" + noOfTests + ":" + noOfNewTests + ":" + noOfErrors + "\n" |
331 | 384 | }
|
332 |
| - resultSummaryFile.append file.getName() + ":" + noOfTests + ":" + noOfNewTests + ":" + noOfErrors + "\n" |
333 | 385 | }
|
334 | 386 | println resultSummaryFile.text
|
335 | 387 | ]]>
|
|
0 commit comments