1<?xml version="1.0"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22
23
24<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
25<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
26<xsl:template match="/">
27<html xmlns="http://www.w3.org/1999/xhtml">
28<head>
29<style>
30body,td,div { -webkit-text-size-adjust:none; font-size: 11px; font-family: verdana, arial, sans-serif; padding: 0; margin: 0}
31a.unchecked {text-decoration: none;padding: 0px 4px;color: #000000;font-weight: bold;border-bottom: 2px solid #AAAAAA;}
32a.checked {text-decoration: none;border-bottom: 2px solid #E6820E;padding: 0px 4px;color: #000000;font-weight: bold;}
33.container {width: 100%;float: left;margin-right: -300px;}
34.content {margin-right: 300px;}
35.sidebar {width: 300px;float: right;}
36.header {font-weight: bold; margin: 4px; border-radius: 3px;-moz-border-radius: 4px;-webkit-border-radius: 4px;background: #61B7CF;padding: 4px;}
37table {border-collapse:collapse; border: 1px solid #eeeeee;}
38td {border: 1px solid #eeeeee;padding:4px}
39th {border: 1px solid #eeeeee;background:#f5f5f5; padding:4px;text-align:left}
40tr.Success {color:#118811;}
41tr.Failure {color:#F27D15;}
42tr.Ignored {color:#F4C700;}
43tr.Error {color:#FC130F;}
44th.Success {background:#118811;}
45th.Failure {background: #FF8888;}
46th.Ignored {background:#F4C700;}
47th.Error {background:#FF0000;}
48	</style>
49	<title>JUnit Report</title>
50</head>
51<body onload="onload()">
52
53<div class="container">
54	<div class="content">
55		<div class="header">Information</div>
56		<div style="padding: 6px">
57		<table class="infoTable"  width="100%">
58		<tr><th>Test Date</th><td><span id="info.test.date">Unknown</span></td></tr>
59		<tr><th>Build ID</th><td><span id="info.app.buildid">Unknown</span> (<span id="info.app.AllLanguages"></span>)</td></tr>
60		<tr><th>Revision</th><td id="info.app.Revision">Unknown</td></tr>
61		<tr><th>OS</th><td><span id="info.os.name">Unknown</span>-<span id="info.os.version">Unknown</span>-<span id="info.os.arch">Unknown</span></td></tr>
62		<tr><th>Host Name</th><td><span id="info.hostname">Unknown</span> (<span id="info.ip"></span>)</td></tr>
63		<tr><th>Java</th><td id="java.runtime.version">Unknown</td></tr>
64		</table>
65		</div>
66	</div>
67</div>
68
69<div class="sidebar">
70	<div class="header">Summary</div>
71	<div style="padding: 6px">
72	<table class="summaryTable" width="100%">
73		<tr><th>All</th><td><a href="#" onclick="showAllRecord()" id="AllNo" class="checked" >0</a></td></tr>
74		<tr><th class="Success">Success</th><td><a href="#" onclick="toggleRecord('Success')" class="checked" id="SuccessNo">0</a></td></tr>
75		<tr><th class="Failure">Failure</th><td><a href="#" onclick="toggleRecord('Failure')" class="checked" id="FailureNo">0</a></td></tr>
76		<tr><th class="Error">Error</th><td><a href="#" onclick="toggleRecord('Error')" class="checked" id="ErrorNo">0</a></td></tr>
77		<tr><th class="Ignored">Ignored</th><td><a href="#" onclick="toggleRecord('Ignored')" class="checked" id="IgnoredNo">0</a></td></tr>
78	</table>
79	</div>
80</div>
81<div style="clear:both;" class="header">
82	<div style="float:left" >Record</div>
83	<div style="float:right;">
84	</div>
85	<div style="clear:both;"></div>
86</div>
87<div style="padding: 6px" id="recordTableContainer">
88</div>
89
90
91<script>
92<xsl:text disable-output-escaping='yes'>
93<![CDATA[
94function ajax(url, callback) {
95	var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
96	xmlhttp.onreadystatechange = callback;
97	xmlhttp.open("GET", url, true);
98	xmlhttp.send();
99}
100
101function text(s) {
102	return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
103}
104
105function $(id) {
106	return document.getElementById(id);
107}
108
109function $$(e, tag) {
110	var els = e.getElementsByTagName(tag);
111	return els[0] || null;
112}
113
114function $$s(e, tag) {
115	return e.getElementsByTagName(tag);
116}
117
118function refresh() {
119	var data = $('data');
120	var testsuiteEl = $$(data, 'testsuite');
121	var allNo = testsuiteEl.getAttribute("tests");
122	$('AllNo').innerHTML = allNo;
123	var failureNo = testsuiteEl.getAttribute("failures");
124	$('FailureNo').innerHTML = failureNo;
125	var errorNo = testsuiteEl.getAttribute("errors");
126	$('ErrorNo').innerHTML = errorNo;
127	var ignoredNo = testsuiteEl.getAttribute("ignored");
128	$('IgnoredNo').innerHTML = ignoredNo;
129	$('SuccessNo').innerHTML = parseInt(allNo) - parseInt(failureNo) - parseInt(errorNo) - parseInt(ignoredNo);
130
131	var propEls = $$s(testsuiteEl, "property");
132	var props = {};
133	for (var i = 0; i < propEls.length; i++) {
134		var e = propEls[i];
135		props[e.getAttribute("name")] = e.getAttribute("value");
136	}
137
138	$('info.test.date').innerHTML = props['info.test.date'] || 'Unknown';
139	$('info.app.buildid').innerHTML = props['info.app.buildid'] || 'Unknown';
140	$('info.app.AllLanguages').innerHTML = props['info.app.AllLanguages'] || '';
141	$('info.os.name').innerHTML = props['info.os.name'] || 'Unknown';
142	$('info.os.version').innerHTML = props['info.os.version'] || 'Unknown';
143	$('info.os.arch').innerHTML = props['info.os.arch'] || 'Unknown';
144	if (props['info.app.Revision'])
145		$('info.app.Revision').innerHTML = '<a href="http://svn.apache.org/viewvc?view=revision&revision=' + props['info.app.Revision'] + '">'  + props['info.app.Revision'] + '</a>';
146	$('info.hostname').innerHTML = props['info.hostname'] || 'Unknown';
147	$('info.ip').innerHTML = props['info.ip'] || '0.0.0.0';
148	$('java.runtime.version').innerHTML = props['java.runtime.version'] || 'Unknown';
149
150	var testcaseEls = $$s(data, 'testcase');
151	var html = '<table class="recordTable"><thead><tr><th>Class</th><th>Method</th><th>Status</th><th width="80%">Message</th><th>Time</th><th>Screenshot</th></tr></thead><tbody id="recordTable">';
152
153	for (var i = 0; i < testcaseEls.length; i++){
154		var e = testcaseEls[i], c = null;
155		var status = 'Success', message = '', screenshot= '';
156		if (c = $$(e, 'failure')) {
157			status = 'Failure';
158			message = '<div>' + text(c.getAttribute("message")) + '</div>';
159			message += '<pre>' + text(c.innerHTML) + '</pre>';
160			screenshot = '<a href="screenshot/' + e.getAttribute("name") + '.png">Screenshot</a>';
161		} else if (c = $$(e, 'error')) {
162			status = 'Error';
163			message = '<div>' + text(c.getAttribute("message")) + '</div>';
164			message += '<pre>' + text(c.innerHTML) + '</pre>';
165			screenshot = '<a href="screenshot/' + e.getAttribute("name") + '.png">Screenshot</a>';
166		} else if (c = $$(e, 'ignored')) {
167			status = 'Ignored';
168			message = text(c.getAttribute("message"));
169			var bugPattern = /(.*)#(\d+)(.*)/;
170			if( bugPattern.test(message) ) {
171				message = '<a href="https://issues.apache.org/ooo/show_bug.cgi?id=' + RegExp.$2 + '">' + RegExp.$1 + RegExp.$2 + '</a>' + RegExp.$3;
172			}
173		}
174
175		html += '<tr class="' + status + '"><td>'
176			+ e.getAttribute("classname") + '</td><td>'
177			+ e.getAttribute("methodname") + '</td><td>'
178			+ status + '</td><td>'
179			+ message + '</td><td>'
180			+ e.getAttribute("time") + '</td><td>'
181			+ screenshot + '</td></tr>';
182
183	}
184
185	$('recordTableContainer').innerHTML = html + '</tbody></table>';
186}
187
188function showAllRecord() {
189	var trEls = $$s($('recordTable'), 'tr');
190	for (var i = 0; i < trEls.length; i++){
191		var e = trEls[i];
192		e.style.display = '';
193	}
194	$("ErrorNo").className = 'checked';
195	$("FailureNo").className = 'checked';
196	$("IgnoredNo").className = 'checked';
197	$("SuccessNo").className = 'checked';
198}
199
200function toggleRecord(status) {
201	var display = '';
202	var el = $(status + "No");
203	if (el.className == 'unchecked') {
204		el.className = 'checked';
205	} else {
206		el.className = 'unchecked';
207		display = 'none';
208	}
209
210	var trEls = $$s($('recordTable'), 'tr');
211	for (var i = 0; i < trEls.length; i++){
212		var e = trEls[i];
213		if (e.className == status) {
214			e.style.display = display;
215		}
216	}
217}
218
219function onload() {
220	refresh();
221}
222
223
224]]>
225</xsl:text>
226</script>
227<div id="data" style="display:none">
228	<xsl:copy-of select="*" />
229</div>
230</body>
231</html>
232</xsl:template>
233</xsl:stylesheet>
234
235