You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kato-commits@incubator.apache.org by mo...@apache.org on 2009/11/23 15:54:15 UTC
svn commit: r883384 [23/47] - in /incubator/kato/trunk/org.apache.kato: ./
kato.anttasks/src/main/java/org/apache/kato/anttasks/
kato.anttasks/src/main/java/org/apache/kato/anttasks/sitebuilder/
kato.anttasks/src/main/java/org/apache/kato/anttasks/tck/...
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/ConsoleOutputResultsReader.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/ConsoleOutputResultsReader.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/ConsoleOutputResultsReader.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/ConsoleOutputResultsReader.java Mon Nov 23 15:53:48 2009
@@ -1,268 +1,268 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.kato.tck.harness.ConsoleOutputConstants;
-
-
-/**
- * Class to scrape the tck test results from a text stream
- *
- */
-public class ConsoleOutputResultsReader implements ConsoleOutputConstants{
-
- private int lineNo=0;
- private int count=0;
-
- public TCKResultMatrix getResultSet(InputStream in ) throws IOException {
-
- InputStreamReader reader=new InputStreamReader(in);
- return getResultSet(reader);
-
- }
-
- public TCKResultMatrix getResultSet(Reader reader) throws IOException {
-
- BufferedReader br=new BufferedReader(reader);
-
- int findEyeCatcher=findEyeCatcher(br);
- if(findEyeCatcher<0) throw new IOException("TCK results eyecatcher not found");
-
-
-
- TCKResultMatrix matrix=new TCKResultMatrix(new FullSortedProvider());
-
-
- while(true) {
- // process results
- System.out.println("Eyecatcher on line "+lineNo);
- TCKResultSet set=getTCKResultSet(findEyeCatcher,br);
- System.out.println("Read "+set.getTestcaseCount()+" testcases");
- if(set!=null) matrix.addResultSet(set);
- // get next result
- findEyeCatcher=findEyeCatcher(br);
- if(findEyeCatcher<0) break; // finished
-
- }
-
- return matrix;
-
- }
-
- private TCKResultSet getTCKResultSet(int offset,BufferedReader br) throws IOException {
-
-
-
- // skip line of equals
- String line=readLine(offset,br);
-
- TestExecutionConfig config=new TestExecutionConfig();
-
- // read dump type
- line=readLine(offset,br);
- config.dumptype=line.substring(DUMPTYPE.length()).trim();
-
- // vendor
- line=readLine(offset,br);
- config.vendor=line.substring(VENDOR.length()).trim();
-
- // vmtype
- line=readLine(offset,br);
- config.jvm=line.substring(VMTYPE.length()).trim();
-
- // version
- line=readLine(offset,br);
- config.version=line.substring(VERSION.length()).trim();
-
- line=readLine(offset,br);
- config.wordsize=line.substring(WORDSIZE.length()).trim();
-
- // testsuite
- line=readLine(offset,br);
- config.testsuite=line.substring(TESTSUITE.length()).trim();
-
- // os
- line=readLine(offset,br);
- config.os=line.substring(OS.length()).trim();
-
- // arch
- line=readLine(offset,br);
- config.arch=line.substring(ARCH.length()).trim();
-
- // build
- line=readLine(offset,br);
- config.build=line.substring(BUILD.length()).trim();
-
- // date
- line=readLine(offset,br);
- String date=line.substring(DATE.length()).trim();
-
- // skip line of equals
- line=readLine(offset,br);
-
- TCKResultSet set=new TCKResultSet(config,date,null);
-
- report(config);
-
- loadResults(set,br,offset);
-
- return set;
- }
-
-
- private void report(TestExecutionConfig config) {
- System.out.print("Loading tests for config ");
- System.out.print(" arch="+config.arch);
- System.out.print(" build="+config.build);
- System.out.print(" dumptype="+config.dumptype);
- System.out.print(" jvm="+config.jvm);
- System.out.print(" os="+config.os);
- System.out.println("testsuite="+config.testsuite);
- }
-
- private void loadResults(TCKResultSet set, BufferedReader br, int offset) throws IOException {
-
- while(true) {
- String line=readLine(offset,br);
- if(line.indexOf(ConsoleOutputConstants.TCK_TEST_SUITE_EXECUTION_ENDS)>=0) break; // done
- TestcaseResult result=null;
- if(line.startsWith(TCK_TEST_PASSED)) {
- TestData data=getTestData(line.substring(TCK_TEST_PASSED.length()));
- fillInData(data,br,offset);
- result=new TestcaseResultPass(data.className,data.methodname,0);
- result.setOutput(data.lines);
-
- }
- else if(line.startsWith(TCK_TEST_FAILED)) {
- TestData data=getTestData(line.substring(TCK_TEST_FAILED.length()));
- fillInData(data,br,offset);
- result=new TestcaseResultFailure(data.className,data.methodname,0,"fail",data.stack);
- result.setOutput(data.lines);
- }
- else if(line.startsWith(TCK_TEST_ERROR)) {
- TestData data=getTestData(line.substring(TCK_TEST_ERROR.length()));
- fillInData(data,br,offset);
- result=new TestcaseResultFailure(data.className,data.methodname,0,"error",data.stack);
- result.setOutput(data.lines);
- }
- else {
- System.out.println("ignoring "+line);
- continue;
- }
-
- if(result!=null) {
- count++;
- set.addTestcaseResult(result);
-
- }
-
- }
- }
-
-
- private void fillInData(TestData data, BufferedReader br, int offset) throws IOException {
- // load any lines mentioned...
- if(data.outputLines>0) {
- data.lines=new LinkedList();
- data.stack=new LinkedList();
- List target=data.lines;
-
- for(int i=0;i<data.outputLines;i++) {
- String line=readLine(offset, br);
- if(line.indexOf(STACK_TRACE_START)>=0) {
- target=data.stack;
- }
- else if(line.indexOf(STACK_TRACE_END)>=0) {
- target=data.lines;
- }
- else {
- target.add(line);
- }
- }
-
- }
-
- }
-
- private TestData getTestData(String fullname) {
-
- int openBracket=fullname.indexOf("(");
- if(openBracket<0) return null;
- int closeBracket=fullname.indexOf(")");
- if(closeBracket<0) return null;
-
- TestData data=new TestData();
- data.methodname=fullname.substring(0,openBracket);
- data.className=fullname.substring(openBracket+1,closeBracket);
- try {
- data.outputLines=Integer.parseInt(fullname.substring(closeBracket+1).trim());
- } catch(NumberFormatException e) {
- ;
- }
-
-
- return data;
- }
-
- private String readLine(int offset, BufferedReader br) throws IOException {
-
- String line=br.readLine();
- if(line==null) throw new IOException("unexpected end of TCK results");
- lineNo++;
- if(line.length()>offset) return line.substring(offset);
- return line;
- }
-
- private int findEyeCatcher(BufferedReader reader) throws IOException {
-
- while(true) {
- String line=reader.readLine();
- if(line==null) return -1;
- lineNo++;
- int offset=line.indexOf(TCK_TEST_SUITE_EXECUTION_BEGINS);
- if(offset>=0) return offset;
-
-
- }
-
-
- }
-
- public TCKResultMatrix getResultSet(URL source) throws IOException {
- InputStream in=source.openStream();
- TCKResultMatrix result=getResultSet(in);
- in.close();
- System.out.println("count="+count);
- return result;
-
- }
-
- class TestData {
- String className;
- String methodname;
- int outputLines=0;
- List lines=null;
- List stack=null;
-
- }
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.kato.tck.harness.ConsoleOutputConstants;
+
+
+/**
+ * Class to scrape the tck test results from a text stream
+ *
+ */
+public class ConsoleOutputResultsReader implements ConsoleOutputConstants{
+
+ private int lineNo=0;
+ private int count=0;
+
+ public TCKResultMatrix getResultSet(InputStream in ) throws IOException {
+
+ InputStreamReader reader=new InputStreamReader(in);
+ return getResultSet(reader);
+
+ }
+
+ public TCKResultMatrix getResultSet(Reader reader) throws IOException {
+
+ BufferedReader br=new BufferedReader(reader);
+
+ int findEyeCatcher=findEyeCatcher(br);
+ if(findEyeCatcher<0) throw new IOException("TCK results eyecatcher not found");
+
+
+
+ TCKResultMatrix matrix=new TCKResultMatrix(new FullSortedProvider());
+
+
+ while(true) {
+ // process results
+ System.out.println("Eyecatcher on line "+lineNo);
+ TCKResultSet set=getTCKResultSet(findEyeCatcher,br);
+ System.out.println("Read "+set.getTestcaseCount()+" testcases");
+ if(set!=null) matrix.addResultSet(set);
+ // get next result
+ findEyeCatcher=findEyeCatcher(br);
+ if(findEyeCatcher<0) break; // finished
+
+ }
+
+ return matrix;
+
+ }
+
+ private TCKResultSet getTCKResultSet(int offset,BufferedReader br) throws IOException {
+
+
+
+ // skip line of equals
+ String line=readLine(offset,br);
+
+ TestExecutionConfig config=new TestExecutionConfig();
+
+ // read dump type
+ line=readLine(offset,br);
+ config.dumptype=line.substring(DUMPTYPE.length()).trim();
+
+ // vendor
+ line=readLine(offset,br);
+ config.vendor=line.substring(VENDOR.length()).trim();
+
+ // vmtype
+ line=readLine(offset,br);
+ config.jvm=line.substring(VMTYPE.length()).trim();
+
+ // version
+ line=readLine(offset,br);
+ config.version=line.substring(VERSION.length()).trim();
+
+ line=readLine(offset,br);
+ config.wordsize=line.substring(WORDSIZE.length()).trim();
+
+ // testsuite
+ line=readLine(offset,br);
+ config.testsuite=line.substring(TESTSUITE.length()).trim();
+
+ // os
+ line=readLine(offset,br);
+ config.os=line.substring(OS.length()).trim();
+
+ // arch
+ line=readLine(offset,br);
+ config.arch=line.substring(ARCH.length()).trim();
+
+ // build
+ line=readLine(offset,br);
+ config.build=line.substring(BUILD.length()).trim();
+
+ // date
+ line=readLine(offset,br);
+ String date=line.substring(DATE.length()).trim();
+
+ // skip line of equals
+ line=readLine(offset,br);
+
+ TCKResultSet set=new TCKResultSet(config,date,null);
+
+ report(config);
+
+ loadResults(set,br,offset);
+
+ return set;
+ }
+
+
+ private void report(TestExecutionConfig config) {
+ System.out.print("Loading tests for config ");
+ System.out.print(" arch="+config.arch);
+ System.out.print(" build="+config.build);
+ System.out.print(" dumptype="+config.dumptype);
+ System.out.print(" jvm="+config.jvm);
+ System.out.print(" os="+config.os);
+ System.out.println("testsuite="+config.testsuite);
+ }
+
+ private void loadResults(TCKResultSet set, BufferedReader br, int offset) throws IOException {
+
+ while(true) {
+ String line=readLine(offset,br);
+ if(line.indexOf(ConsoleOutputConstants.TCK_TEST_SUITE_EXECUTION_ENDS)>=0) break; // done
+ TestcaseResult result=null;
+ if(line.startsWith(TCK_TEST_PASSED)) {
+ TestData data=getTestData(line.substring(TCK_TEST_PASSED.length()));
+ fillInData(data,br,offset);
+ result=new TestcaseResultPass(data.className,data.methodname,0);
+ result.setOutput(data.lines);
+
+ }
+ else if(line.startsWith(TCK_TEST_FAILED)) {
+ TestData data=getTestData(line.substring(TCK_TEST_FAILED.length()));
+ fillInData(data,br,offset);
+ result=new TestcaseResultFailure(data.className,data.methodname,0,"fail",data.stack);
+ result.setOutput(data.lines);
+ }
+ else if(line.startsWith(TCK_TEST_ERROR)) {
+ TestData data=getTestData(line.substring(TCK_TEST_ERROR.length()));
+ fillInData(data,br,offset);
+ result=new TestcaseResultFailure(data.className,data.methodname,0,"error",data.stack);
+ result.setOutput(data.lines);
+ }
+ else {
+ System.out.println("ignoring "+line);
+ continue;
+ }
+
+ if(result!=null) {
+ count++;
+ set.addTestcaseResult(result);
+
+ }
+
+ }
+ }
+
+
+ private void fillInData(TestData data, BufferedReader br, int offset) throws IOException {
+ // load any lines mentioned...
+ if(data.outputLines>0) {
+ data.lines=new LinkedList();
+ data.stack=new LinkedList();
+ List target=data.lines;
+
+ for(int i=0;i<data.outputLines;i++) {
+ String line=readLine(offset, br);
+ if(line.indexOf(STACK_TRACE_START)>=0) {
+ target=data.stack;
+ }
+ else if(line.indexOf(STACK_TRACE_END)>=0) {
+ target=data.lines;
+ }
+ else {
+ target.add(line);
+ }
+ }
+
+ }
+
+ }
+
+ private TestData getTestData(String fullname) {
+
+ int openBracket=fullname.indexOf("(");
+ if(openBracket<0) return null;
+ int closeBracket=fullname.indexOf(")");
+ if(closeBracket<0) return null;
+
+ TestData data=new TestData();
+ data.methodname=fullname.substring(0,openBracket);
+ data.className=fullname.substring(openBracket+1,closeBracket);
+ try {
+ data.outputLines=Integer.parseInt(fullname.substring(closeBracket+1).trim());
+ } catch(NumberFormatException e) {
+ ;
+ }
+
+
+ return data;
+ }
+
+ private String readLine(int offset, BufferedReader br) throws IOException {
+
+ String line=br.readLine();
+ if(line==null) throw new IOException("unexpected end of TCK results");
+ lineNo++;
+ if(line.length()>offset) return line.substring(offset);
+ return line;
+ }
+
+ private int findEyeCatcher(BufferedReader reader) throws IOException {
+
+ while(true) {
+ String line=reader.readLine();
+ if(line==null) return -1;
+ lineNo++;
+ int offset=line.indexOf(TCK_TEST_SUITE_EXECUTION_BEGINS);
+ if(offset>=0) return offset;
+
+
+ }
+
+
+ }
+
+ public TCKResultMatrix getResultSet(URL source) throws IOException {
+ InputStream in=source.openStream();
+ TCKResultMatrix result=getResultSet(in);
+ in.close();
+ System.out.println("count="+count);
+ return result;
+
+ }
+
+ class TestData {
+ String className;
+ String methodname;
+ int outputLines=0;
+ List lines=null;
+ List stack=null;
+
+ }
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/ConsoleOutputResultsReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/FullSortedProvider.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/FullSortedProvider.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/FullSortedProvider.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/FullSortedProvider.java Mon Nov 23 15:53:48 2009
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-
-public class FullSortedProvider implements SortKeyProvider {
-
- public String getkey(TestExecutionConfig config) {
-
- return
- config.os+"/"+
- config.arch+"-"+config.wordsize+"/"+
- config.version+"/"+
- config.jvm+"/"+
- config.dumptype+"/"+
- config.testsuite;
- }
-
-
- public int keyDepth() {
-
- return 6;
- }
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+
+public class FullSortedProvider implements SortKeyProvider {
+
+ public String getkey(TestExecutionConfig config) {
+
+ return
+ config.os+"/"+
+ config.arch+"-"+config.wordsize+"/"+
+ config.version+"/"+
+ config.jvm+"/"+
+ config.dumptype+"/"+
+ config.testsuite;
+ }
+
+
+ public int keyDepth() {
+
+ return 6;
+ }
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/FullSortedProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/HTMLWriter.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/HTMLWriter.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/HTMLWriter.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/HTMLWriter.java Mon Nov 23 15:53:48 2009
@@ -1,125 +1,125 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-import java.io.PrintWriter;
-
-public class HTMLWriter {
-
- private PrintWriter out=null;
-
- public HTMLWriter(PrintWriter pw) {
- this.out=pw;
- }
-
- public void endRow() {
- out.print("</tr>");
-
- }
-
- public void startRow() {
- out.print("<tr>");
-
- }
-
- public void writeRow(String[] row) {
-
- out.print("<tr>");
-
-
- for(int i=0;i<row.length;i++) {
- String s=row[i];
- out.print("<tr>"+s+"</tr>");
- }
- out.println("</tr>");
-
- }
-
- public void writeDocHeader(String title) {
- out.println("<head>");
- out.println("<META http-equiv=\"Content-Type\" content=\"text/html; charset=US-ASCII\">");
- out.println("<title>"+title+"</title>");
- out.println("<link rel=\"stylesheet\" type=\"text/css\" title=\"Style\" href=\"resources/stylesheet.css\">");
- out.println("</head>");
- out.println("<body>");
-
- }
-
- public void startDetailTable() {
- out.println("<table class=\"details\" border=\"0\" cellpadding=\"5\" cellspacing=\"2\" width=\"95%\">");
-
- }
-
- public void writeTableHeaderCell(String contents) {
- out.print("<th>"+contents+"</th>");
-
- }
-
- public void writeSpanningtableHeader(int width, String name) {
- out.print("<th colspan="+width+">"+name+"</th>");
-
- }
-
- public void writeTableCell(String contents) {
- out.print("<td>"+contents+"</td>");
-
- }
-
- public void writeEndTable() {
- out.println("</table>");
- }
-
- public void writeDocEnd() {
-
- out.println("</body>");
- }
-
- public String createLink(String href, String data) {
-
- return "<a href=\""+href+"\">"+data+"</a>";
- }
-
- public void writeHead2(String data) {
- out.print("<h2>"+data+"</h2>");
-
- }
-
- public void startDetailTable(String caption) {
- startDetailTable();
- out.print("<caption>"+caption+"</caption>");
-
- }
-
- public void writeCode(String outLog) {
- out.print("<code>"+outLog+"</code>");
-
- }
-
- public void startTableCell() {
- out.print("<td>");
-
- }
-
- public void endTableCell() {
- out.print("</td>");
-
- }
-
- public String createImage(String imageName) {
- return "<img src=\""+imageName+"\">";
- }
-
-
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+import java.io.PrintWriter;
+
+public class HTMLWriter {
+
+ private PrintWriter out=null;
+
+ public HTMLWriter(PrintWriter pw) {
+ this.out=pw;
+ }
+
+ public void endRow() {
+ out.print("</tr>");
+
+ }
+
+ public void startRow() {
+ out.print("<tr>");
+
+ }
+
+ public void writeRow(String[] row) {
+
+ out.print("<tr>");
+
+
+ for(int i=0;i<row.length;i++) {
+ String s=row[i];
+ out.print("<tr>"+s+"</tr>");
+ }
+ out.println("</tr>");
+
+ }
+
+ public void writeDocHeader(String title) {
+ out.println("<head>");
+ out.println("<META http-equiv=\"Content-Type\" content=\"text/html; charset=US-ASCII\">");
+ out.println("<title>"+title+"</title>");
+ out.println("<link rel=\"stylesheet\" type=\"text/css\" title=\"Style\" href=\"resources/stylesheet.css\">");
+ out.println("</head>");
+ out.println("<body>");
+
+ }
+
+ public void startDetailTable() {
+ out.println("<table class=\"details\" border=\"0\" cellpadding=\"5\" cellspacing=\"2\" width=\"95%\">");
+
+ }
+
+ public void writeTableHeaderCell(String contents) {
+ out.print("<th>"+contents+"</th>");
+
+ }
+
+ public void writeSpanningtableHeader(int width, String name) {
+ out.print("<th colspan="+width+">"+name+"</th>");
+
+ }
+
+ public void writeTableCell(String contents) {
+ out.print("<td>"+contents+"</td>");
+
+ }
+
+ public void writeEndTable() {
+ out.println("</table>");
+ }
+
+ public void writeDocEnd() {
+
+ out.println("</body>");
+ }
+
+ public String createLink(String href, String data) {
+
+ return "<a href=\""+href+"\">"+data+"</a>";
+ }
+
+ public void writeHead2(String data) {
+ out.print("<h2>"+data+"</h2>");
+
+ }
+
+ public void startDetailTable(String caption) {
+ startDetailTable();
+ out.print("<caption>"+caption+"</caption>");
+
+ }
+
+ public void writeCode(String outLog) {
+ out.print("<code>"+outLog+"</code>");
+
+ }
+
+ public void startTableCell() {
+ out.print("<td>");
+
+ }
+
+ public void endTableCell() {
+ out.print("</td>");
+
+ }
+
+ public String createImage(String imageName) {
+ return "<img src=\""+imageName+"\">";
+ }
+
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/HTMLWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/Key.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/Key.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/Key.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/Key.java Mon Nov 23 15:53:48 2009
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-public class Key {
-
- private String name=null;
- private Key parentKey=null;
-
- public Key(String name) {
- this.name=name;
- }
- private Key() {
-
- }
- public Key(Key key, String name) {
- parentKey=key;
- this.name=name;
- }
-
- public static final Key EMPTYKEY = new Key();
-
-
- public String toString() {
- return getPath();
- }
- public String getName() {
- return name;
- }
- public String getPath() {
- if(parentKey!=null) return parentKey.toString()+"/"+name;
- return name;
- }
- public static Key parse(String path) {
-
- if(path.equals("")) return Key.EMPTYKEY;
- if(path.indexOf('/')<0) return new Key(path);
-
- String[] key=path.split("/");
- Key top=new Key(key[0]);
-
- for(int i=1;i<key.length;i++) {
- top=new Key(top,key[i]);
- }
-
- return top;
-
-
- }
- public String[] parts() {
-
- String path=getPath();
- return path.split("/");
- }
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+public class Key {
+
+ private String name=null;
+ private Key parentKey=null;
+
+ public Key(String name) {
+ this.name=name;
+ }
+ private Key() {
+
+ }
+ public Key(Key key, String name) {
+ parentKey=key;
+ this.name=name;
+ }
+
+ public static final Key EMPTYKEY = new Key();
+
+
+ public String toString() {
+ return getPath();
+ }
+ public String getName() {
+ return name;
+ }
+ public String getPath() {
+ if(parentKey!=null) return parentKey.toString()+"/"+name;
+ return name;
+ }
+ public static Key parse(String path) {
+
+ if(path.equals("")) return Key.EMPTYKEY;
+ if(path.indexOf('/')<0) return new Key(path);
+
+ String[] key=path.split("/");
+ Key top=new Key(key[0]);
+
+ for(int i=1;i<key.length;i++) {
+ top=new Key(top,key[i]);
+ }
+
+ return top;
+
+
+ }
+ public String[] parts() {
+
+ String path=getPath();
+ return path.split("/");
+ }
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/Key.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/OSVersionJVMTestSuiteSortedProvider.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/OSVersionJVMTestSuiteSortedProvider.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/OSVersionJVMTestSuiteSortedProvider.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/OSVersionJVMTestSuiteSortedProvider.java Mon Nov 23 15:53:48 2009
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-
-public class OSVersionJVMTestSuiteSortedProvider implements SortKeyProvider {
-
- public String getkey(TestExecutionConfig config) {
-
- return config.os+"/"+
- config.version+"/"+config.jvm+"/"+config.testsuite;
- }
-
-
- public int keyDepth() {
-
- return 4;
- }
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+
+public class OSVersionJVMTestSuiteSortedProvider implements SortKeyProvider {
+
+ public String getkey(TestExecutionConfig config) {
+
+ return config.os+"/"+
+ config.version+"/"+config.jvm+"/"+config.testsuite;
+ }
+
+
+ public int keyDepth() {
+
+ return 4;
+ }
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/OSVersionJVMTestSuiteSortedProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/SortKeyProvider.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/SortKeyProvider.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/SortKeyProvider.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/SortKeyProvider.java Mon Nov 23 15:53:48 2009
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-public interface SortKeyProvider {
-
-
- public String getkey(TestExecutionConfig set);
- public int keyDepth();
-
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+public interface SortKeyProvider {
+
+
+ public String getkey(TestExecutionConfig set);
+ public int keyDepth();
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/SortKeyProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKConsoleReportsAggregator.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKConsoleReportsAggregator.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKConsoleReportsAggregator.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKConsoleReportsAggregator.java Mon Nov 23 15:53:48 2009
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-public class TCKConsoleReportsAggregator {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
-
-
- File out=new File(args[0]);
- out.mkdirs();
-
- ConsoleOutputResultsReader reader=new ConsoleOutputResultsReader();
-
- TCKResultMatrix mainMatrix=new TCKResultMatrix(new FullSortedProvider());
-
- System.out.println("output to "+out.getAbsolutePath());
- int returnCode=0;
-
- for(int i=1;i<args.length;i++) {
- String parm=args[i];
- try {
- System.out.println("reading "+parm);
- URL u=new URL(parm);
- TCKResultMatrix matrix=reader.getResultSet(u);
- System.out.println("Resulting matrix has "+matrix.rowCount()+" testcases * "+matrix.columnCount()+" result sets ");
- mainMatrix.addMatrix(matrix);
-
- } catch (IOException e) {
- e.printStackTrace();
- returnCode=-1;
- }
-
- }
-
- System.out.println("Final tally: "+mainMatrix.rowCount()+" testcases * "+mainMatrix.columnCount());
-
-
- TCKResultMatrixHTMLWriter writer=new TCKResultMatrixHTMLWriter(out);
- writer.setVerbose(true);
-
- try {
- writer.print(mainMatrix);
- } catch (IOException e) {
-
- e.printStackTrace();
- returnCode=-2;
- }
-
- System.exit(returnCode);
- }
-
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+public class TCKConsoleReportsAggregator {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+
+ File out=new File(args[0]);
+ out.mkdirs();
+
+ ConsoleOutputResultsReader reader=new ConsoleOutputResultsReader();
+
+ TCKResultMatrix mainMatrix=new TCKResultMatrix(new FullSortedProvider());
+
+ System.out.println("output to "+out.getAbsolutePath());
+ int returnCode=0;
+
+ for(int i=1;i<args.length;i++) {
+ String parm=args[i];
+ try {
+ System.out.println("reading "+parm);
+ URL u=new URL(parm);
+ TCKResultMatrix matrix=reader.getResultSet(u);
+ System.out.println("Resulting matrix has "+matrix.rowCount()+" testcases * "+matrix.columnCount()+" result sets ");
+ mainMatrix.addMatrix(matrix);
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ returnCode=-1;
+ }
+
+ }
+
+ System.out.println("Final tally: "+mainMatrix.rowCount()+" testcases * "+mainMatrix.columnCount());
+
+
+ TCKResultMatrixHTMLWriter writer=new TCKResultMatrixHTMLWriter(out);
+ writer.setVerbose(true);
+
+ try {
+ writer.print(mainMatrix);
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ returnCode=-2;
+ }
+
+ System.exit(returnCode);
+ }
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKConsoleReportsAggregator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrix.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrix.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrix.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrix.java Mon Nov 23 15:53:48 2009
@@ -1,374 +1,374 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-public class TCKResultMatrix {
-
- private TCKGroup root=new TCKGroup();
- private int passes=0;
-
- private SortKeyProvider keyProvider=new VersionSortKeyProvider();
-
- private TreeSet testnames=new TreeSet();
-
- public TCKResultMatrix(SortKeyProvider sortKeyProvider) {
- keyProvider=sortKeyProvider;
- }
- public TCKResultMatrix() {
-
- }
-
-
- public Iterator getTCKResultSets() {
- List data=new LinkedList();
- root.addResultSets(data);
- return data.iterator();
-
- }
- public void addResultSet(TCKResultSet resultSet) {
-
- // add testnames to matrix lefthand side
-
- Iterator ri=resultSet.iterator();
- while(ri.hasNext()) {
- TestcaseResult result=(TestcaseResult) ri.next();
-
-
- testnames.add(result.getLabel());
- if(result instanceof TestcaseResultPass) passes++;
- }
-
- // store results at right level in tree
-
- String key=keyProvider.getkey(resultSet.getConfig());
- TCKGroup versionGroup=root.makeChildGroup(key);
- versionGroup.addResults(resultSet);
-
-
-
- }
-
- public int columnCount() {
- if(root.isNode()) return 0;
- return root.columnCount();
- }
- public String[] getRowNames() {
- return (String[]) testnames.toArray(new String[0]);
- }
-
- public boolean hasColumns() {
-
- return root.hasChildren();
- }
-
-
-
- class TCKGroup {
- private Key key=null;
-
-
- private TreeMap childGroups=new TreeMap();
- private TCKGroup parent=null;
- private int errors=0;
- private int failures=0;
- private Map data=new TreeMap();
- private List results=new LinkedList();
-
- public TCKGroup(TCKGroup parent,String name) {
- this.parent=parent;
- if(parent!=null) {
- Key pKey=parent.getKey();
- key=new Key(pKey,name);
- }
- else this.key=new Key(name);
- }
-
- public boolean isNode() {
- return childGroups.isEmpty();
- }
- public void addResultSets(List list) {
-
- list.addAll(results);
- Iterator i=childGroups.values().iterator();
- while(i.hasNext()) {
- TCKGroup kids=(TCKGroup) i.next();
- kids.addResultSets(list);
- }
-
-
- }
-
-
- public TCKGroup() {
-
- }
-
- public String toString() {
- return getKey().toString();
- }
- public int columnCount() {
-
- if(childGroups.isEmpty()) {
- return 1;
- }
- else {
- int count=0;
- Iterator i=childGroups.values().iterator();
- while(i.hasNext()) {
- TCKGroup kids=(TCKGroup) i.next();
- count+=kids.columnCount();
- }
-
- return count;
- }
-
- }
- public boolean hasChildren() {
- return childGroups.isEmpty()==false;
- }
-
- public void addResults(TCKResultSet resultSet) {
-
- results.add(resultSet);
-
- Iterator ri=resultSet.iterator();
- while(ri.hasNext()) {
- TestcaseResult r=(TestcaseResult) ri.next();
-
- data.put(r.getLabel(),r);
- if(r instanceof TestcaseResultFailure) failures++;
- if(r instanceof TestcaseResultError) errors++;
- }
-
-
- }
-
- public Key getKey() {
- return key;
-
-
- }
- public TCKGroup makeChildGroup(String keyPath) {
- if(keyPath==null) keyPath="";
- String[] key=keyPath.split("/");
- TCKGroup top=this;
- for(int k=0;k<key.length;k++) {
- String keySegment=key[k];
- TCKGroup childGroup=null;
- if(top.childGroups.containsKey(keySegment)==false) {
- childGroup=new TCKGroup(top,keySegment);
- top.childGroups.put(keySegment,childGroup);
- }
- else {
- childGroup=(TCKGroup) top.childGroups.get(keySegment);
- }
- top=childGroup;
- }
-
- return top;
- }
- public TCKGroup getChildGroup(String name) {
-
- return (TCKGroup) childGroups.get(name);
- }
- public String[] getkeyValues(Key key) {
-
- TCKGroup group=getNode(key);
- return (String[]) group.childGroups.keySet().toArray(new String[0]);
- }
-
- public TCKGroup getNode(Key k) {
-
- if(k==key) return this;
-
- String[] keyParts=k.parts();
-
- TCKGroup top=this;
- for(int i=0;i<keyParts.length;i++) {
- String keySegment=keyParts[i];
- if(top.childGroups.containsKey(keySegment)) {
- top=(TCKGroup) top.childGroups.get(keySegment);
- }
- else {
- return null;
- }
-
- }
-
- return top;
- }
- public int getKeyColumnWidth(Key keyPath) {
-
-
- TCKGroup group=getNode(keyPath);
- return group.countAllNodeChildren();
- }
- private int countAllNodeChildren() {
-
-
-
- if(childGroups.isEmpty()) {
- return 1;
- }
- else {
- int count=0;
- Iterator gi=childGroups.values().iterator();
- while(gi.hasNext()) {
- TCKGroup group= (TCKGroup) gi.next();
- count+=group.countAllNodeChildren();
- }
- return count;
- }
-
- }
- public void addKeys(List keys, int depth) {
-
- if(depth==0) {
- Iterator gi=childGroups.values().iterator();
- while(gi.hasNext()) {
- TCKGroup group= (TCKGroup) gi.next();
-
- keys.add(group.getKey());
- }
- }
- else {
- Iterator gi=childGroups.values().iterator();
- while(gi.hasNext()) {
- TCKGroup group= (TCKGroup) gi.next();
-
- group.addKeys(keys,depth-1);
- }
- }
-
- }
-
- public int getTestcaseCount(Key value) {
- TCKGroup group=getNode(value);
- if(group==null) return 0;
-
- return group.data.size();
-
- }
-
- public int getErrorCount(Key value) {
- TCKGroup group=getNode(value);
- if(group==null) return 0;
-
- return group.errors;
- }
- public int getFailureCount(Key value) {
- TCKGroup group=getNode(value);
- if(group==null) return 0;
- return group.failures;
-
- }
-
- public TestcaseResult getTestcaseResult(Key value, String rowName) {
-
- TCKGroup group=getNode(value);
- if(group==null) return null;
-
- TestcaseResult result=(TestcaseResult) group.data.get(rowName);
- return result;
- }
-
- public TCKResultSet getResultSet(Key value, String rowName) {
- TCKGroup group=getNode(value);
- if(group==null) return null;
- TestcaseResult result=(TestcaseResult) group.data.get(rowName);
- if(result==null) return null;
- return result.getResultSet();
- }
-
-
-
- }
-
-
-
- public int getkeyDepth() {
- return keyProvider.keyDepth();
- }
-
- public String[] getKeyValues(Key key) {
-
- return root.getkeyValues(key);
- }
-
- public int getKeyColumnWidth(Key keyPath) {
-
- return root.getKeyColumnWidth(keyPath);
- }
-
-
- public Key[] getKeys(int depth) {
-
-
- List keys=new LinkedList();
- root.addKeys(keys,depth);
-
- return (Key[]) keys.toArray(new Key[0]);
-
- }
-
- public SortKeyProvider getKeyProvider() {
- return keyProvider;
- }
-
-
- public int getTestcaseFailureCount(Key value) {
- return root.getFailureCount(value);
- }
- public int getTestcaseErrorCount(Key value) {
- return root.getErrorCount(value);
- }
-
-
- public int getTestcaseCount(Key value) {
- return root.getTestcaseCount(value);
- }
-public TestcaseResult getTestcaseResult(Key value, String rowName) {
-
- return root.getTestcaseResult(value,rowName);
- }
-public TCKResultSet getResultSet(Key value, String rowName) {
- return root.getResultSet(value,rowName);
-}
-public int getTestcasePassCount() {
- return passes;
-}
-public int rowCount() {
- return testnames.size();
-}
-public void addMatrix(TCKResultMatrix matrix) {
-
- Iterator i=matrix.getTCKResultSets();
- while(i.hasNext()) {
- TCKResultSet set=(TCKResultSet) i.next();
- addResultSet(set);
- }
-
-}
-
-
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+public class TCKResultMatrix {
+
+ private TCKGroup root=new TCKGroup();
+ private int passes=0;
+
+ private SortKeyProvider keyProvider=new VersionSortKeyProvider();
+
+ private TreeSet testnames=new TreeSet();
+
+ public TCKResultMatrix(SortKeyProvider sortKeyProvider) {
+ keyProvider=sortKeyProvider;
+ }
+ public TCKResultMatrix() {
+
+ }
+
+
+ public Iterator getTCKResultSets() {
+ List data=new LinkedList();
+ root.addResultSets(data);
+ return data.iterator();
+
+ }
+ public void addResultSet(TCKResultSet resultSet) {
+
+ // add testnames to matrix lefthand side
+
+ Iterator ri=resultSet.iterator();
+ while(ri.hasNext()) {
+ TestcaseResult result=(TestcaseResult) ri.next();
+
+
+ testnames.add(result.getLabel());
+ if(result instanceof TestcaseResultPass) passes++;
+ }
+
+ // store results at right level in tree
+
+ String key=keyProvider.getkey(resultSet.getConfig());
+ TCKGroup versionGroup=root.makeChildGroup(key);
+ versionGroup.addResults(resultSet);
+
+
+
+ }
+
+ public int columnCount() {
+ if(root.isNode()) return 0;
+ return root.columnCount();
+ }
+ public String[] getRowNames() {
+ return (String[]) testnames.toArray(new String[0]);
+ }
+
+ public boolean hasColumns() {
+
+ return root.hasChildren();
+ }
+
+
+
+ class TCKGroup {
+ private Key key=null;
+
+
+ private TreeMap childGroups=new TreeMap();
+ private TCKGroup parent=null;
+ private int errors=0;
+ private int failures=0;
+ private Map data=new TreeMap();
+ private List results=new LinkedList();
+
+ public TCKGroup(TCKGroup parent,String name) {
+ this.parent=parent;
+ if(parent!=null) {
+ Key pKey=parent.getKey();
+ key=new Key(pKey,name);
+ }
+ else this.key=new Key(name);
+ }
+
+ public boolean isNode() {
+ return childGroups.isEmpty();
+ }
+ public void addResultSets(List list) {
+
+ list.addAll(results);
+ Iterator i=childGroups.values().iterator();
+ while(i.hasNext()) {
+ TCKGroup kids=(TCKGroup) i.next();
+ kids.addResultSets(list);
+ }
+
+
+ }
+
+
+ public TCKGroup() {
+
+ }
+
+ public String toString() {
+ return getKey().toString();
+ }
+ public int columnCount() {
+
+ if(childGroups.isEmpty()) {
+ return 1;
+ }
+ else {
+ int count=0;
+ Iterator i=childGroups.values().iterator();
+ while(i.hasNext()) {
+ TCKGroup kids=(TCKGroup) i.next();
+ count+=kids.columnCount();
+ }
+
+ return count;
+ }
+
+ }
+ public boolean hasChildren() {
+ return childGroups.isEmpty()==false;
+ }
+
+ public void addResults(TCKResultSet resultSet) {
+
+ results.add(resultSet);
+
+ Iterator ri=resultSet.iterator();
+ while(ri.hasNext()) {
+ TestcaseResult r=(TestcaseResult) ri.next();
+
+ data.put(r.getLabel(),r);
+ if(r instanceof TestcaseResultFailure) failures++;
+ if(r instanceof TestcaseResultError) errors++;
+ }
+
+
+ }
+
+ public Key getKey() {
+ return key;
+
+
+ }
+ public TCKGroup makeChildGroup(String keyPath) {
+ if(keyPath==null) keyPath="";
+ String[] key=keyPath.split("/");
+ TCKGroup top=this;
+ for(int k=0;k<key.length;k++) {
+ String keySegment=key[k];
+ TCKGroup childGroup=null;
+ if(top.childGroups.containsKey(keySegment)==false) {
+ childGroup=new TCKGroup(top,keySegment);
+ top.childGroups.put(keySegment,childGroup);
+ }
+ else {
+ childGroup=(TCKGroup) top.childGroups.get(keySegment);
+ }
+ top=childGroup;
+ }
+
+ return top;
+ }
+ public TCKGroup getChildGroup(String name) {
+
+ return (TCKGroup) childGroups.get(name);
+ }
+ public String[] getkeyValues(Key key) {
+
+ TCKGroup group=getNode(key);
+ return (String[]) group.childGroups.keySet().toArray(new String[0]);
+ }
+
+ public TCKGroup getNode(Key k) {
+
+ if(k==key) return this;
+
+ String[] keyParts=k.parts();
+
+ TCKGroup top=this;
+ for(int i=0;i<keyParts.length;i++) {
+ String keySegment=keyParts[i];
+ if(top.childGroups.containsKey(keySegment)) {
+ top=(TCKGroup) top.childGroups.get(keySegment);
+ }
+ else {
+ return null;
+ }
+
+ }
+
+ return top;
+ }
+ public int getKeyColumnWidth(Key keyPath) {
+
+
+ TCKGroup group=getNode(keyPath);
+ return group.countAllNodeChildren();
+ }
+ private int countAllNodeChildren() {
+
+
+
+ if(childGroups.isEmpty()) {
+ return 1;
+ }
+ else {
+ int count=0;
+ Iterator gi=childGroups.values().iterator();
+ while(gi.hasNext()) {
+ TCKGroup group= (TCKGroup) gi.next();
+ count+=group.countAllNodeChildren();
+ }
+ return count;
+ }
+
+ }
+ public void addKeys(List keys, int depth) {
+
+ if(depth==0) {
+ Iterator gi=childGroups.values().iterator();
+ while(gi.hasNext()) {
+ TCKGroup group= (TCKGroup) gi.next();
+
+ keys.add(group.getKey());
+ }
+ }
+ else {
+ Iterator gi=childGroups.values().iterator();
+ while(gi.hasNext()) {
+ TCKGroup group= (TCKGroup) gi.next();
+
+ group.addKeys(keys,depth-1);
+ }
+ }
+
+ }
+
+ public int getTestcaseCount(Key value) {
+ TCKGroup group=getNode(value);
+ if(group==null) return 0;
+
+ return group.data.size();
+
+ }
+
+ public int getErrorCount(Key value) {
+ TCKGroup group=getNode(value);
+ if(group==null) return 0;
+
+ return group.errors;
+ }
+ public int getFailureCount(Key value) {
+ TCKGroup group=getNode(value);
+ if(group==null) return 0;
+ return group.failures;
+
+ }
+
+ public TestcaseResult getTestcaseResult(Key value, String rowName) {
+
+ TCKGroup group=getNode(value);
+ if(group==null) return null;
+
+ TestcaseResult result=(TestcaseResult) group.data.get(rowName);
+ return result;
+ }
+
+ public TCKResultSet getResultSet(Key value, String rowName) {
+ TCKGroup group=getNode(value);
+ if(group==null) return null;
+ TestcaseResult result=(TestcaseResult) group.data.get(rowName);
+ if(result==null) return null;
+ return result.getResultSet();
+ }
+
+
+
+ }
+
+
+
+ public int getkeyDepth() {
+ return keyProvider.keyDepth();
+ }
+
+ public String[] getKeyValues(Key key) {
+
+ return root.getkeyValues(key);
+ }
+
+ public int getKeyColumnWidth(Key keyPath) {
+
+ return root.getKeyColumnWidth(keyPath);
+ }
+
+
+ public Key[] getKeys(int depth) {
+
+
+ List keys=new LinkedList();
+ root.addKeys(keys,depth);
+
+ return (Key[]) keys.toArray(new Key[0]);
+
+ }
+
+ public SortKeyProvider getKeyProvider() {
+ return keyProvider;
+ }
+
+
+ public int getTestcaseFailureCount(Key value) {
+ return root.getFailureCount(value);
+ }
+ public int getTestcaseErrorCount(Key value) {
+ return root.getErrorCount(value);
+ }
+
+
+ public int getTestcaseCount(Key value) {
+ return root.getTestcaseCount(value);
+ }
+public TestcaseResult getTestcaseResult(Key value, String rowName) {
+
+ return root.getTestcaseResult(value,rowName);
+ }
+public TCKResultSet getResultSet(Key value, String rowName) {
+ return root.getResultSet(value,rowName);
+}
+public int getTestcasePassCount() {
+ return passes;
+}
+public int rowCount() {
+ return testnames.size();
+}
+public void addMatrix(TCKResultMatrix matrix) {
+
+ Iterator i=matrix.getTCKResultSets();
+ while(i.hasNext()) {
+ TCKResultSet set=(TCKResultSet) i.next();
+ addResultSet(set);
+ }
+
+}
+
+
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrix.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixHTMLWriter.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixHTMLWriter.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixHTMLWriter.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixHTMLWriter.java Mon Nov 23 15:53:48 2009
@@ -1,349 +1,349 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeMap;
-
-public class TCKResultMatrixHTMLWriter extends TCKResultMatrixWriter {
-
- public static final String RESOURCES_STYLESHEET_CSS = "/resources/stylesheet.css";
- public static final String RESOURCES_PURPLE_PNG = "/resources/purple.png";
- public static final String RESOURCES_RED_PNG = "/resources/red.png";
- public static final String RESOURCES_BLUE_PNG = "/resources/blue.png";
- private static final String BR = "<br>";
- private boolean verbose=false;
-
-
- public TCKResultMatrixHTMLWriter(File dir) {
- super(dir);
-
-
- }
- public void init() throws IOException{
- dir.mkdir();
- writeStyleSheet(dir);
- writeBinFile(dir,RESOURCES_BLUE_PNG);
- writeBinFile(dir,RESOURCES_RED_PNG);
- writeBinFile(dir,RESOURCES_PURPLE_PNG);
- }
-
-
- private void writeStyleSheet(File targetDir) throws IOException {
-
- writeTextFile(targetDir,RESOURCES_STYLESHEET_CSS);
-
-
-
- }
-
- private void writeTextFile(File targetDir, String name) throws IOException {
- File target=new File(targetDir,name);
- target.getParentFile().mkdirs();
-
- InputStream in=getClass().getResourceAsStream(name);
- if(in==null) {
- log("can't find file "+name);
- return;
- }
- log("writing "+name+" to "+target.getAbsolutePath());
- FileWriter fw=new FileWriter(target);
- PrintWriter pw=new PrintWriter(fw);
- InputStreamReader ist=new InputStreamReader(in);
- BufferedReader br=new BufferedReader(ist);
-
- while(true) {
- String line=br.readLine();
- if(line==null) break;
- pw.println(line);
- }
-
- br.close();
- pw.close();
- }
- private void writeBinFile(File targetDir, String name) throws IOException {
-
- File target=new File(targetDir,name);
- target.getParentFile().mkdirs();
-
- InputStream in=getClass().getResourceAsStream(name);
- if(in==null) {
- log("can't find file "+name);
- return;
- }
-
- log("writing "+name+" to "+target.getAbsolutePath());
-
- OutputStream out=new FileOutputStream(target);
-
- byte[] buffer=new byte[10000];
- while(true) {
- int read=in.read(buffer);
- if(read<1) break;
- out.write(buffer,0,read);
- }
-
- out.close();
- in.close();
-
-
- }
- private void log(String msg) {
- System.out.println(msg);
-
- }
- protected void writeDetailFiles(TCKResultMatrix matrix) throws IOException {
-
- File detail=new File(dir,"detail");
- boolean b=detail.mkdirs();
- log("Creating results dir "+detail.getAbsolutePath()+" returned "+b);
-
- SortKeyProvider provider=matrix.getKeyProvider();
-
- Iterator i=matrix.getTCKResultSets();
-
- while(i.hasNext()) {
- TCKResultSet set=(TCKResultSet) i.next();
- String key=provider.getkey(set.getConfig());
-
- File file=new File(detail,key+".html");
- File parent=file.getParentFile();
- b=parent.mkdirs();
- log("creating results child dir "+parent+" (returned "+b+")");
-
- writeStyleSheet(parent);
-
- FileWriter fw=new FileWriter(file);
- PrintWriter pw=new PrintWriter(fw);
- HTMLWriter out=new HTMLWriter(pw);
-
- out.writeDocHeader("detailed output");
-
- out.startDetailTable("standard output");
- out.startRow();
- out.startTableCell();
- out.writeCode(set.getOutLog());
- out.endTableCell();
-
- out.writeEndTable();
-
- out.startDetailTable("standard error");
- out.startRow();
- out.startTableCell();
- out.writeCode(set.getErrLog());
- out.endTableCell();
- out.writeEndTable();
-
- Iterator ri=set.iterator();
- while(ri.hasNext()) {
- TestcaseResult result=(TestcaseResult) ri.next();
-
- String anchor=out.createLink("#"+result.getLabel(),result.getLabel() );
- out.writeHead2(anchor);
-
- if(result instanceof TestcaseResultError) {
- TestcaseResultError err=(TestcaseResultError) result;
- String[] stack=err.getErrorStack();
- out.startDetailTable("Error stack");
- for(int j=0;j<stack.length;j++) {
- String s=stack[j];
- out.startRow();
- out.writeTableCell(s);
- out.endRow();
- }
- out.writeEndTable();
- }
- else if(result instanceof TestcaseResultFailure) {
- TestcaseResultFailure err=(TestcaseResultFailure) result;
- String[] stack=err.getFailureStack();
- out.startDetailTable("Failure stack");
- for(int j=0;j<stack.length;j++) {
- String s=stack[j];
- out.startRow();
- out.writeTableCell(s);
- out.endRow();
- }
- out.writeEndTable();
- }
-
-
-
- }
- out.writeDocEnd();
-
- pw.close();
- }
-
-
- }
-
- private void writeIndex(TCKResultMatrix matrix) throws IOException {
-
- SortKeyProvider provider=matrix.getKeyProvider();
-
- FileWriter fw=new FileWriter(new File(dir,"index.html"));
- PrintWriter out=new PrintWriter(fw);
- HTMLWriter writer=new HTMLWriter(out);
- writer.writeDocHeader("TCK Results Comparision");
-
- writer.startDetailTable();
-
- // class="Failure"
-
- TreeMap map=new TreeMap();
-
- // how many header rows.
- int depth=matrix.getkeyDepth();
-
- // for each one work out total number of leaf children
- // this gives span of table cell for heading
-
-
- for(int d=0;d<depth;d++) {
- // get values for root headings
- writer.startRow();
- writer.writeTableHeaderCell("");
-
- Key[] keyValues=matrix.getKeys(d);
-
- for(int k=0;k<keyValues.length;k++) {
- Key value=keyValues[k];
- int width=matrix.getKeyColumnWidth(value);
- writer.writeSpanningtableHeader(width,value.getName());
-
-
- }
-
- writer.endRow();
-
- }
-
- // summary
- writer.startRow();
- writer.writeTableCell("");
-
-
- Key[] keyValues=matrix.getKeys(depth-1);
- if(verbose) log(""+keyValues.length+" columns");
- for(int k=0;k<keyValues.length;k++) {
- Key value=keyValues[k];
- String background="";
-
- String fails="";
-
- int testcases=matrix.getTestcaseCount(value);
- int failures=matrix.getTestcaseFailureCount(value);
- int errors=matrix.getTestcaseErrorCount(value);
- int bad=failures+errors;
- if(bad>0) {
- background="class=\"Failure\" ";
-
- fails=" ("+bad+")";
- }
- String data=""+testcases+fails;
- if(bad>0) {
-
- data="<a href=\""+value.getPath()+"\">"+data+"</a>";
- }
-
- out.print("<td "+background+">"+data+"</td>");
- }
-
- // get leaf node width for each value
-
- writer.endRow();
-
- String[] rowNames=matrix.getRowNames();
- if(verbose) log(""+rowNames.length+" rows");
- for(int j=0;j<rowNames.length;j++) {
- String rowName=rowNames[j];
-
- writer.startRow();
- writer.writeTableCell(rowName);
-
- for(int k=0;k<keyValues.length;k++) {
- Key value=keyValues[k];
- String fails="";
- TestcaseResult r=matrix.getTestcaseResult(value, rowName);
- String result="";
- if(r!=null) {
- result=r.getType();
- }
- String imageName=null;
-
- if(result.equals("failed")) {
- fails="class=\"Failure\" ";
- imageName="resources/purple.png";
-
- } else if(result.equals("error")) {
- fails="class=\"Error\" ";
- imageName="resources/red.png";
- }
- else if(result.equals("passed")) {
- imageName="resources/blue.png";
- }
- String link=result;
- TCKResultSet parentSet=matrix.getResultSet(value,rowName);
- if(parentSet!=null) {
- TestExecutionConfig config=parentSet.getConfig();
-
-
- String key=provider.getkey(config);
- String path="detail/"+key+".html#"+rowName;
- if(imageName!=null) {
- link=writer.createImage(imageName);
- link=writer.createLink(path, link);
- }
- else {
- link=writer.createLink(path,result);
- }
- }
- out.print("<td " +fails+ ">"+link+"</td>");
- }
- writer.endRow();
- }
-
- writer.writeEndTable();
-
- writer.writeDocEnd();
-
-
-
- out.close();
- }
-
-
-
- private void writeOutput(File output, List outputData) {
- // TODO Auto-generated method stub
-
- }
- public boolean isVerbose() {
- return verbose;
- }
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+
+public class TCKResultMatrixHTMLWriter extends TCKResultMatrixWriter {
+
+ public static final String RESOURCES_STYLESHEET_CSS = "/resources/stylesheet.css";
+ public static final String RESOURCES_PURPLE_PNG = "/resources/purple.png";
+ public static final String RESOURCES_RED_PNG = "/resources/red.png";
+ public static final String RESOURCES_BLUE_PNG = "/resources/blue.png";
+ private static final String BR = "<br>";
+ private boolean verbose=false;
+
+
+ public TCKResultMatrixHTMLWriter(File dir) {
+ super(dir);
+
+
+ }
+ public void init() throws IOException{
+ dir.mkdir();
+ writeStyleSheet(dir);
+ writeBinFile(dir,RESOURCES_BLUE_PNG);
+ writeBinFile(dir,RESOURCES_RED_PNG);
+ writeBinFile(dir,RESOURCES_PURPLE_PNG);
+ }
+
+
+ private void writeStyleSheet(File targetDir) throws IOException {
+
+ writeTextFile(targetDir,RESOURCES_STYLESHEET_CSS);
+
+
+
+ }
+
+ private void writeTextFile(File targetDir, String name) throws IOException {
+ File target=new File(targetDir,name);
+ target.getParentFile().mkdirs();
+
+ InputStream in=getClass().getResourceAsStream(name);
+ if(in==null) {
+ log("can't find file "+name);
+ return;
+ }
+ log("writing "+name+" to "+target.getAbsolutePath());
+ FileWriter fw=new FileWriter(target);
+ PrintWriter pw=new PrintWriter(fw);
+ InputStreamReader ist=new InputStreamReader(in);
+ BufferedReader br=new BufferedReader(ist);
+
+ while(true) {
+ String line=br.readLine();
+ if(line==null) break;
+ pw.println(line);
+ }
+
+ br.close();
+ pw.close();
+ }
+ private void writeBinFile(File targetDir, String name) throws IOException {
+
+ File target=new File(targetDir,name);
+ target.getParentFile().mkdirs();
+
+ InputStream in=getClass().getResourceAsStream(name);
+ if(in==null) {
+ log("can't find file "+name);
+ return;
+ }
+
+ log("writing "+name+" to "+target.getAbsolutePath());
+
+ OutputStream out=new FileOutputStream(target);
+
+ byte[] buffer=new byte[10000];
+ while(true) {
+ int read=in.read(buffer);
+ if(read<1) break;
+ out.write(buffer,0,read);
+ }
+
+ out.close();
+ in.close();
+
+
+ }
+ private void log(String msg) {
+ System.out.println(msg);
+
+ }
+ protected void writeDetailFiles(TCKResultMatrix matrix) throws IOException {
+
+ File detail=new File(dir,"detail");
+ boolean b=detail.mkdirs();
+ log("Creating results dir "+detail.getAbsolutePath()+" returned "+b);
+
+ SortKeyProvider provider=matrix.getKeyProvider();
+
+ Iterator i=matrix.getTCKResultSets();
+
+ while(i.hasNext()) {
+ TCKResultSet set=(TCKResultSet) i.next();
+ String key=provider.getkey(set.getConfig());
+
+ File file=new File(detail,key+".html");
+ File parent=file.getParentFile();
+ b=parent.mkdirs();
+ log("creating results child dir "+parent+" (returned "+b+")");
+
+ writeStyleSheet(parent);
+
+ FileWriter fw=new FileWriter(file);
+ PrintWriter pw=new PrintWriter(fw);
+ HTMLWriter out=new HTMLWriter(pw);
+
+ out.writeDocHeader("detailed output");
+
+ out.startDetailTable("standard output");
+ out.startRow();
+ out.startTableCell();
+ out.writeCode(set.getOutLog());
+ out.endTableCell();
+
+ out.writeEndTable();
+
+ out.startDetailTable("standard error");
+ out.startRow();
+ out.startTableCell();
+ out.writeCode(set.getErrLog());
+ out.endTableCell();
+ out.writeEndTable();
+
+ Iterator ri=set.iterator();
+ while(ri.hasNext()) {
+ TestcaseResult result=(TestcaseResult) ri.next();
+
+ String anchor=out.createLink("#"+result.getLabel(),result.getLabel() );
+ out.writeHead2(anchor);
+
+ if(result instanceof TestcaseResultError) {
+ TestcaseResultError err=(TestcaseResultError) result;
+ String[] stack=err.getErrorStack();
+ out.startDetailTable("Error stack");
+ for(int j=0;j<stack.length;j++) {
+ String s=stack[j];
+ out.startRow();
+ out.writeTableCell(s);
+ out.endRow();
+ }
+ out.writeEndTable();
+ }
+ else if(result instanceof TestcaseResultFailure) {
+ TestcaseResultFailure err=(TestcaseResultFailure) result;
+ String[] stack=err.getFailureStack();
+ out.startDetailTable("Failure stack");
+ for(int j=0;j<stack.length;j++) {
+ String s=stack[j];
+ out.startRow();
+ out.writeTableCell(s);
+ out.endRow();
+ }
+ out.writeEndTable();
+ }
+
+
+
+ }
+ out.writeDocEnd();
+
+ pw.close();
+ }
+
+
+ }
+
+ private void writeIndex(TCKResultMatrix matrix) throws IOException {
+
+ SortKeyProvider provider=matrix.getKeyProvider();
+
+ FileWriter fw=new FileWriter(new File(dir,"index.html"));
+ PrintWriter out=new PrintWriter(fw);
+ HTMLWriter writer=new HTMLWriter(out);
+ writer.writeDocHeader("TCK Results Comparision");
+
+ writer.startDetailTable();
+
+ // class="Failure"
+
+ TreeMap map=new TreeMap();
+
+ // how many header rows.
+ int depth=matrix.getkeyDepth();
+
+ // for each one work out total number of leaf children
+ // this gives span of table cell for heading
+
+
+ for(int d=0;d<depth;d++) {
+ // get values for root headings
+ writer.startRow();
+ writer.writeTableHeaderCell("");
+
+ Key[] keyValues=matrix.getKeys(d);
+
+ for(int k=0;k<keyValues.length;k++) {
+ Key value=keyValues[k];
+ int width=matrix.getKeyColumnWidth(value);
+ writer.writeSpanningtableHeader(width,value.getName());
+
+
+ }
+
+ writer.endRow();
+
+ }
+
+ // summary
+ writer.startRow();
+ writer.writeTableCell("");
+
+
+ Key[] keyValues=matrix.getKeys(depth-1);
+ if(verbose) log(""+keyValues.length+" columns");
+ for(int k=0;k<keyValues.length;k++) {
+ Key value=keyValues[k];
+ String background="";
+
+ String fails="";
+
+ int testcases=matrix.getTestcaseCount(value);
+ int failures=matrix.getTestcaseFailureCount(value);
+ int errors=matrix.getTestcaseErrorCount(value);
+ int bad=failures+errors;
+ if(bad>0) {
+ background="class=\"Failure\" ";
+
+ fails=" ("+bad+")";
+ }
+ String data=""+testcases+fails;
+ if(bad>0) {
+
+ data="<a href=\""+value.getPath()+"\">"+data+"</a>";
+ }
+
+ out.print("<td "+background+">"+data+"</td>");
+ }
+
+ // get leaf node width for each value
+
+ writer.endRow();
+
+ String[] rowNames=matrix.getRowNames();
+ if(verbose) log(""+rowNames.length+" rows");
+ for(int j=0;j<rowNames.length;j++) {
+ String rowName=rowNames[j];
+
+ writer.startRow();
+ writer.writeTableCell(rowName);
+
+ for(int k=0;k<keyValues.length;k++) {
+ Key value=keyValues[k];
+ String fails="";
+ TestcaseResult r=matrix.getTestcaseResult(value, rowName);
+ String result="";
+ if(r!=null) {
+ result=r.getType();
+ }
+ String imageName=null;
+
+ if(result.equals("failed")) {
+ fails="class=\"Failure\" ";
+ imageName="resources/purple.png";
+
+ } else if(result.equals("error")) {
+ fails="class=\"Error\" ";
+ imageName="resources/red.png";
+ }
+ else if(result.equals("passed")) {
+ imageName="resources/blue.png";
+ }
+ String link=result;
+ TCKResultSet parentSet=matrix.getResultSet(value,rowName);
+ if(parentSet!=null) {
+ TestExecutionConfig config=parentSet.getConfig();
+
+
+ String key=provider.getkey(config);
+ String path="detail/"+key+".html#"+rowName;
+ if(imageName!=null) {
+ link=writer.createImage(imageName);
+ link=writer.createLink(path, link);
+ }
+ else {
+ link=writer.createLink(path,result);
+ }
+ }
+ out.print("<td " +fails+ ">"+link+"</td>");
+ }
+ writer.endRow();
+ }
+
+ writer.writeEndTable();
+
+ writer.writeDocEnd();
+
+
+
+ out.close();
+ }
+
+
+
+ private void writeOutput(File output, List outputData) {
+ // TODO Auto-generated method stub
+
+ }
+ public boolean isVerbose() {
+ return verbose;
+ }
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixHTMLWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixWriter.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixWriter.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixWriter.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/results/reporter/TCKResultMatrixWriter.java Mon Nov 23 15:53:48 2009
@@ -1,185 +1,185 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tck.results.reporter;
-
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.TreeMap;
-
-public abstract class TCKResultMatrixWriter {
-
-
- protected File dir=null;
-
- public TCKResultMatrixWriter(File root) {
- this.dir=root;
- }
-
- public final void print(TCKResultMatrix matrix) throws IOException {
-
- init();
- writeIndex(matrix);
- writeDetailFiles(matrix);
-
- }
-
- protected void writeDetailFiles(TCKResultMatrix matrix) throws IOException {
-
-
- }
-
- public void init() throws IOException{
-
- }
-
-private void writeIndex(TCKResultMatrix matrix) throws IOException {
-
-
- SortKeyProvider provider=matrix.getKeyProvider();
-
- FileWriter fw=new FileWriter(new File(dir,"index.html"));
- PrintWriter out=new PrintWriter(fw);
- HTMLWriter writer=new HTMLWriter(out);
- writer.writeDocHeader("TCK Results Comparision");
-
- writer.startDetailTable();
-
- // class="Failure"
-
- TreeMap map=new TreeMap();
-
- // how many header rows.
- int depth=matrix.getkeyDepth();
-
- // for each one work out total number of leaf children
- // this gives span of table cell for heading
-
-
- for(int d=0;d<depth;d++) {
- // get values for root headings
- writer.startRow();
- writer.writeTableHeaderCell("");
-
- Key[] keyValues=matrix.getKeys(d);
-
-
- for(int k=0;k<keyValues.length;k++) {
- Key value=keyValues[k];
- int width=matrix.getKeyColumnWidth(value);
- writer.writeSpanningtableHeader(width,value.getName());
-
-
- }
-
- writer.endRow();
-
- }
-
- // summary
- writer.startRow();
- writer.writeTableCell("");
-
-
- Key[] keyValues=matrix.getKeys(depth-1);
-
-
- for(int k=0;k<keyValues.length;k++) {
- Key value=keyValues[k];
- String background="";
-
- String fails="";
-
- int testcases=matrix.getTestcaseCount(value);
- int failures=matrix.getTestcaseFailureCount(value);
- int errors=matrix.getTestcaseErrorCount(value);
- int bad=failures+errors;
- if(bad>0) {
- background="class=\"Failure\" ";
-
- fails=" ("+bad+")";
- }
- String data=""+testcases+fails;
- if(bad>0) {
-
- data="<a href=\""+value.getPath()+"\">"+data+"</a>";
- }
-
- out.print("<td "+background+">"+data+"</td>");
- }
-
- // get leaf node width for each value
-
- writer.endRow();
-
- String[] rowNames=matrix.getRowNames();
- for(int r=0;r<rowNames.length;r++) {
- String rowName=rowNames[r];
- writer.startRow();
- writer.writeTableCell(rowName);
-
- for(int k=0;k<keyValues.length;k++) {
- Key value=keyValues[k];
- String fails="";
- TestcaseResult testresult=matrix.getTestcaseResult(value, rowName);
- String result="";
- if(testresult!=null) {
- result=testresult.getType();
- }
- String imageName=null;
-
- if(result.equals("failed")) {
- fails="class=\"Failure\" ";
- imageName="resources/purple.png";
-
- } else if(result.equals("error")) {
- fails="class=\"Error\" ";
- imageName="resources/red.png";
- }
- else if(result.equals("passed")) {
- imageName="resources/blue.png";
- }
- String link=result;
- TCKResultSet parentSet=matrix.getResultSet(value,rowName);
- if(parentSet!=null) {
- TestExecutionConfig config=parentSet.getConfig();
-
-
- String key=provider.getkey(config);
- String path="detail/"+key+".html#"+rowName;
- if(imageName!=null) {
- link=writer.createImage(imageName);
- link=writer.createLink(path, link);
- }
- else {
- link=writer.createLink(path,result);
- }
- }
- out.print("<td " +fails+ ">"+link+"</td>");
- }
- writer.endRow();
- }
-
- writer.writeEndTable();
-
- writer.writeDocEnd();
-
-
-
- out.close();
- }
-
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tck.results.reporter;
+
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.TreeMap;
+
+public abstract class TCKResultMatrixWriter {
+
+
+ protected File dir=null;
+
+ public TCKResultMatrixWriter(File root) {
+ this.dir=root;
+ }
+
+ public final void print(TCKResultMatrix matrix) throws IOException {
+
+ init();
+ writeIndex(matrix);
+ writeDetailFiles(matrix);
+
+ }
+
+ protected void writeDetailFiles(TCKResultMatrix matrix) throws IOException {
+
+
+ }
+
+ public void init() throws IOException{
+
+ }
+
+private void writeIndex(TCKResultMatrix matrix) throws IOException {
+
+
+ SortKeyProvider provider=matrix.getKeyProvider();
+
+ FileWriter fw=new FileWriter(new File(dir,"index.html"));
+ PrintWriter out=new PrintWriter(fw);
+ HTMLWriter writer=new HTMLWriter(out);
+ writer.writeDocHeader("TCK Results Comparision");
+
+ writer.startDetailTable();
+
+ // class="Failure"
+
+ TreeMap map=new TreeMap();
+
+ // how many header rows.
+ int depth=matrix.getkeyDepth();
+
+ // for each one work out total number of leaf children
+ // this gives span of table cell for heading
+
+
+ for(int d=0;d<depth;d++) {
+ // get values for root headings
+ writer.startRow();
+ writer.writeTableHeaderCell("");
+
+ Key[] keyValues=matrix.getKeys(d);
+
+
+ for(int k=0;k<keyValues.length;k++) {
+ Key value=keyValues[k];
+ int width=matrix.getKeyColumnWidth(value);
+ writer.writeSpanningtableHeader(width,value.getName());
+
+
+ }
+
+ writer.endRow();
+
+ }
+
+ // summary
+ writer.startRow();
+ writer.writeTableCell("");
+
+
+ Key[] keyValues=matrix.getKeys(depth-1);
+
+
+ for(int k=0;k<keyValues.length;k++) {
+ Key value=keyValues[k];
+ String background="";
+
+ String fails="";
+
+ int testcases=matrix.getTestcaseCount(value);
+ int failures=matrix.getTestcaseFailureCount(value);
+ int errors=matrix.getTestcaseErrorCount(value);
+ int bad=failures+errors;
+ if(bad>0) {
+ background="class=\"Failure\" ";
+
+ fails=" ("+bad+")";
+ }
+ String data=""+testcases+fails;
+ if(bad>0) {
+
+ data="<a href=\""+value.getPath()+"\">"+data+"</a>";
+ }
+
+ out.print("<td "+background+">"+data+"</td>");
+ }
+
+ // get leaf node width for each value
+
+ writer.endRow();
+
+ String[] rowNames=matrix.getRowNames();
+ for(int r=0;r<rowNames.length;r++) {
+ String rowName=rowNames[r];
+ writer.startRow();
+ writer.writeTableCell(rowName);
+
+ for(int k=0;k<keyValues.length;k++) {
+ Key value=keyValues[k];
+ String fails="";
+ TestcaseResult testresult=matrix.getTestcaseResult(value, rowName);
+ String result="";
+ if(testresult!=null) {
+ result=testresult.getType();
+ }
+ String imageName=null;
+
+ if(result.equals("failed")) {
+ fails="class=\"Failure\" ";
+ imageName="resources/purple.png";
+
+ } else if(result.equals("error")) {
+ fails="class=\"Error\" ";
+ imageName="resources/red.png";
+ }
+ else if(result.equals("passed")) {
+ imageName="resources/blue.png";
+ }
+ String link=result;
+ TCKResultSet parentSet=matrix.getResultSet(value,rowName);
+ if(parentSet!=null) {
+ TestExecutionConfig config=parentSet.getConfig();
+
+
+ String key=provider.getkey(config);
+ String path="detail/"+key+".html#"+rowName;
+ if(imageName!=null) {
+ link=writer.createImage(imageName);
+ link=writer.createLink(path, link);
+ }
+ else {
+ link=writer.createLink(path,result);
+ }
+ }
+ out.print("<td " +fails+ ">"+link+"</td>");
+ }
+ writer.endRow();
+ }
+
+ writer.writeEndTable();
+
+ writer.writeDocEnd();
+
+
+
+ out.close();
+ }
+
+}