1) Format and Organize Imports of all java files in benchmark-viewer. I don't know whether the Org Imports was necessary, but the formatting was off.
2) Adds a test directory to benchmark-viewer to stop build breakage.
3) tools/build.xml was not propagating anything other than 'build' targets to children. Mostly copied from platforms.ant.xml
4) Fixes an eclipse/user/.checkstyle problem introduced in r813.
5) Fixes a couple of checkstyle violations in ReportDatabase.java (from tobyr).
6) Sets svn:ignore in eclipse/tools/benchmark-viewer
Patch by: me (+tobyr)
Review by: mmendez
tobyr
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@849 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/eclipse/user/.checkstyle b/eclipse/user/.checkstyle
index a3f85e6..820029f 100644
--- a/eclipse/user/.checkstyle
+++ b/eclipse/user/.checkstyle
@@ -3,7 +3,7 @@
<fileset name="Java source for production code" enabled="true" check-config-name="GWT Checks" local="false">
<file-match-pattern match-pattern=".*src.*\.java" include-pattern="true"/>
</fileset>
- <fileset name="Java source for test cases" enabled="true" check-config-name="GWT Checks (Tests)" local="false">
+ <fileset name="Java source for test cases" enabled="true" check-config-name="GWT Checks for Tests" local="false">
<file-match-pattern match-pattern=".*test.*com[/\\]google[/\\].*\.java$" include-pattern="true"/>
<file-match-pattern match-pattern=".*test.*test[/\\].*\.java$" include-pattern="true"/>
</fileset>
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Benchmark.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Benchmark.java
index 7ff901c..d150928 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Benchmark.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Benchmark.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -33,7 +33,7 @@
/**
* @gwt.typeArgs <com.google.gwt.junit.viewer.client.Result>
*/
- private List/*<Result>*/ results;
+ private List/* <Result> */results;
private String sourceCode;
@@ -49,7 +49,7 @@
return name;
}
- public List/*<Result>*/ getResults() {
+ public List/* <Result> */getResults() {
return results;
}
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/BrowserInfo.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/BrowserInfo.java
index f40b85c..dd627f5 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/BrowserInfo.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/BrowserInfo.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -18,15 +18,15 @@
/**
* Provides information about a browser (vendor,version,operating system,etc...)
* based on user agent and other easily accessible information.
- *
+ *
* This is not meant to be a "detect script" to implement browser workarounds,
* but rather a "pretty printer" for the browser information.
- *
- * This code is a derivation of Browser Detect v2.1.6 documentation:
+ *
+ * This code is a derivation of Browser Detect v2.1.6 documentation:
* http://www.dithered.com/javascript/browser_detect/index.html license:
* http://creativecommons.org/licenses/by/1.0/ code by Chris Nott
* (chris[at]dithered[dot]com)
- *
+ *
* It has been transliterated from JavaScript to Java with additional changes
* along the way.
*/
@@ -34,7 +34,7 @@
/**
* Retrieves a "pretty" version of the browser version information.
- *
+ *
* @param userAgent - The HTTP user agent string.
* @return A pretty-printed version of the browser including the a) vendor b)
* version c) and operating system
@@ -50,25 +50,23 @@
// browser name
boolean isKonqueror = userAgent.indexOf("konqueror") != -1;
- boolean isSafari = userAgent.indexOf("safari") != - 1;
- boolean isOmniweb = userAgent.indexOf("omniweb") != - 1;
+ boolean isSafari = userAgent.indexOf("safari") != -1;
+ boolean isOmniweb = userAgent.indexOf("omniweb") != -1;
boolean isOpera = userAgent.indexOf("opera") != -1;
boolean isIcab = userAgent.indexOf("icab") != -1;
boolean isAol = userAgent.indexOf("aol") != -1;
- boolean isIE = userAgent.indexOf("msie") != -1 && !isOpera && (
- userAgent.indexOf("webtv") == -1);
- boolean isMozilla = isGecko && userAgent.indexOf("gecko/") + 14 == userAgent
- .length();
+ boolean isIE = userAgent.indexOf("msie") != -1 && !isOpera
+ && (userAgent.indexOf("webtv") == -1);
+ boolean isMozilla = isGecko
+ && userAgent.indexOf("gecko/") + 14 == userAgent.length();
boolean isFirefox = userAgent.indexOf("firefox/") != -1
|| userAgent.indexOf("firebird/") != -1;
- boolean isNS = isGecko ? userAgent.indexOf("netscape") != -1 :
- userAgent.indexOf("mozilla") != -1 &&
- ! isOpera &&
- ! isSafari &&
- userAgent.indexOf("spoofer") == -1 &&
- userAgent.indexOf("compatible") == -1 &&
- userAgent.indexOf("webtv") == -1 &&
- userAgent.indexOf("hotjava") == -1;
+ boolean isNS = isGecko ? userAgent.indexOf("netscape") != -1
+ : userAgent.indexOf("mozilla") != -1 && !isOpera && !isSafari
+ && userAgent.indexOf("spoofer") == -1
+ && userAgent.indexOf("compatible") == -1
+ && userAgent.indexOf("webtv") == -1
+ && userAgent.indexOf("hotjava") == -1;
// spoofing and compatible browsers
boolean isIECompatible = userAgent.indexOf("msie") != -1 && !isIE;
@@ -79,18 +77,18 @@
String geckoVersion = isGecko ? userAgent.substring(
userAgent.lastIndexOf("gecko/") + 6,
userAgent.lastIndexOf("gecko/") + 14) : "-1";
- String equivalentMozilla = isGecko ? userAgent
- .substring(userAgent.indexOf("rv:") + 3) : "-1";
- String appleWebKitVersion = isAppleWebKit ? userAgent
- .substring(userAgent.indexOf("applewebkit/") + 12) : "-1";
+ String equivalentMozilla = isGecko
+ ? userAgent.substring(userAgent.indexOf("rv:") + 3) : "-1";
+ String appleWebKitVersion = isAppleWebKit
+ ? userAgent.substring(userAgent.indexOf("applewebkit/") + 12) : "-1";
// float versionMinor = parseFloat(navigator.appVersion);
String versionMinor = "";
// correct version number
if (isGecko && !isMozilla) {
- versionMinor = userAgent.substring(
- userAgent.indexOf("/", userAgent.indexOf("gecko/") + 6) + 1);
+ versionMinor = userAgent.substring(userAgent.indexOf("/",
+ userAgent.indexOf("gecko/") + 6) + 1);
} else if (isMozilla) {
versionMinor = userAgent.substring(userAgent.indexOf("rv:") + 3);
} else if (isIE) {
@@ -111,65 +109,56 @@
// dom support
// boolean isDOM1 = (document.getElementById);
- // boolean isDOM2Event = (document.addEventListener && document.removeEventListener);
+ // boolean isDOM2Event = (document.addEventListener &&
+ // document.removeEventListener);
// css compatibility mode
// this.mode = document.compatMode ? document.compatMode : "BackCompat";
// platform
boolean isWin = userAgent.indexOf("win") != -1;
- boolean isWin32 = isWin && userAgent.indexOf("95") != -1 ||
- userAgent.indexOf("98") != -1 ||
- userAgent.indexOf("nt") != -1 ||
- userAgent.indexOf("win32") != -1 ||
- userAgent.indexOf("32bit") != -1 ||
- userAgent.indexOf("xp") != -1;
+ boolean isWin32 = isWin && userAgent.indexOf("95") != -1
+ || userAgent.indexOf("98") != -1 || userAgent.indexOf("nt") != -1
+ || userAgent.indexOf("win32") != -1 || userAgent.indexOf("32bit") != -1
+ || userAgent.indexOf("xp") != -1;
boolean isMac = userAgent.indexOf("mac") != -1;
- boolean isUnix = userAgent.indexOf("unix") != -1 ||
- userAgent.indexOf("sunos") != -1 ||
- userAgent.indexOf("bsd") != -1 ||
- userAgent.indexOf("x11") != -1;
+ boolean isUnix = userAgent.indexOf("unix") != -1
+ || userAgent.indexOf("sunos") != -1 || userAgent.indexOf("bsd") != -1
+ || userAgent.indexOf("x11") != -1;
boolean isLinux = userAgent.indexOf("linux") != -1;
// specific browser shortcuts
/*
- this.isNS4x = (this.isNS && this.versionMajor == 4);
- this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
- this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
- this.isNS4up = (this.isNS && this.versionMinor >= 4);
- this.isNS6x = (this.isNS && this.versionMajor == 6);
- this.isNS6up = (this.isNS && this.versionMajor >= 6);
- this.isNS7x = (this.isNS && this.versionMajor == 7);
- this.isNS7up = (this.isNS && this.versionMajor >= 7);
+ * this.isNS4x = (this.isNS && this.versionMajor == 4); this.isNS40x =
+ * (this.isNS4x && this.versionMinor < 4.5); this.isNS47x = (this.isNS4x &&
+ * this.versionMinor >= 4.7); this.isNS4up = (this.isNS && this.versionMinor >=
+ * 4); this.isNS6x = (this.isNS && this.versionMajor == 6); this.isNS6up =
+ * (this.isNS && this.versionMajor >= 6); this.isNS7x = (this.isNS &&
+ * this.versionMajor == 7); this.isNS7up = (this.isNS && this.versionMajor >=
+ * 7);
+ *
+ * this.isIE4x = (this.isIE && this.versionMajor == 4); this.isIE4up =
+ * (this.isIE && this.versionMajor >= 4); this.isIE5x = (this.isIE &&
+ * this.versionMajor == 5); this.isIE55 = (this.isIE && this.versionMinor ==
+ * 5.5); this.isIE5up = (this.isIE && this.versionMajor >= 5); this.isIE6x =
+ * (this.isIE && this.versionMajor == 6); this.isIE6up = (this.isIE &&
+ * this.versionMajor >= 6);
+ *
+ * this.isIE4xMac = (this.isIE4x && this.isMac);
+ */
- this.isIE4x = (this.isIE && this.versionMajor == 4);
- this.isIE4up = (this.isIE && this.versionMajor >= 4);
- this.isIE5x = (this.isIE && this.versionMajor == 5);
- this.isIE55 = (this.isIE && this.versionMinor == 5.5);
- this.isIE5up = (this.isIE && this.versionMajor >= 5);
- this.isIE6x = (this.isIE && this.versionMajor == 6);
- this.isIE6up = (this.isIE && this.versionMajor >= 6);
+ String name = isGecko ? "Gecko" : isAppleWebKit ? "Apple WebKit"
+ : isKonqueror ? "Konqueror" : isSafari ? "Safari" : isOpera ? "Opera"
+ : isIE ? "IE" : isMozilla ? "Mozilla" : isFirefox ? "Firefox"
+ : isNS ? "Netscape" : "";
- this.isIE4xMac = (this.isIE4x && this.isMac);
- */
-
- String name = isGecko ? "Gecko" :
- isAppleWebKit ? "Apple WebKit" :
- isKonqueror ? "Konqueror" :
- isSafari ? "Safari" :
- isOpera ? "Opera" :
- isIE ? "IE" :
- isMozilla ? "Mozilla" :
- isFirefox ? "Firefox" :
- isNS ? "Netscape" : "";
-
- name += " " + version + " on " +
- (isWin ? "Windows" :
- isMac ? "Mac" :
- isUnix ? "Unix" :
- isLinux ? "Linux" : "Unknown");
+ name += " "
+ + version
+ + " on "
+ + (isWin ? "Windows" : isMac ? "Mac" : isUnix ? "Unix" : isLinux
+ ? "Linux" : "Unknown");
return name;
}
@@ -179,7 +168,7 @@
private static String getVersion(String versionPlusCruft) {
for (int index = 0; index < versionPlusCruft.length(); ++index) {
char c = versionPlusCruft.charAt(index);
- if (c != '.' && ! Character.isDigit(c)) {
+ if (c != '.' && !Character.isDigit(c)) {
return versionPlusCruft.substring(0, index);
}
}
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Category.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Category.java
index 627a05f..8b94ae9 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Category.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Category.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Report.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Report.java
index 6429191..187bbfc 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Report.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Report.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -17,8 +17,8 @@
import com.google.gwt.user.client.rpc.IsSerializable;
-import java.util.List;
import java.util.Date;
+import java.util.List;
/**
* A data object for Report.
@@ -28,7 +28,7 @@
/**
* @gwt.typeArgs <com.google.gwt.junit.viewer.client.Category>
*/
- private List/*<Category>*/ categories;
+ private List/* <Category> */categories;
private Date date;
@@ -39,7 +39,7 @@
private String id;
- public List/*<Category>*/ getCategories() {
+ public List/* <Category> */getCategories() {
return categories;
}
@@ -92,4 +92,3 @@
this.id = id;
}
}
-
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServer.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServer.java
index a50e2c7..be1e5f7 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServer.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -22,7 +22,7 @@
/**
* Provides Benchmark report summaries and details. This service must be running
* in order to view the reports via ReportViewer.
- *
+ *
* @see com.google.gwt.junit.viewer.server.ReportServerImpl
* @see ReportViewer
*/
@@ -30,7 +30,7 @@
/**
* Returns the full details of the specified report.
- *
+ *
* @param reportId The id of the report. Originates from the ReportSummary.
* @return the matching Report, or null if the Report could not be found.
*/
@@ -38,8 +38,8 @@
/**
* Returns a list of summaries of all the Benchmark reports.
- *
+ *
* @return a non-null list of ReportSummary
*/
- public List/*<ReportSummary>*/ getReportSummaries();
+ public List/* <ReportSummary> */getReportSummaries();
}
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServerAsync.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServerAsync.java
index ccd4f1c..e669e19 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServerAsync.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportServerAsync.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -19,7 +19,7 @@
/**
* The asynchronous interface for ReportServer.
- *
+ *
* @see ReportServer
*/
public interface ReportServerAsync {
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportSummary.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportSummary.java
index 7e8d89e..889861e 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportSummary.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportSummary.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportViewer.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportViewer.java
index 33782c6..77e6b93 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportViewer.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/ReportViewer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -17,27 +17,27 @@
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.http.client.URL;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CellPanel;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.rpc.ServiceDefTarget;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.http.client.URL;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
-import java.util.List;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
/**
@@ -45,15 +45,15 @@
* to operate correctly, you must have both the {@link ReportServer} RPC and
* {@link com.google.gwt.junit.viewer.server.ReportImageServer} servlets up and
* running within a servlet container.
- *
+ *
* <code>ReportViewer's</code> GWT XML module is configured to start these
- * servlets by default. Just start <code>ReportViewer</code> in hosted mode, and
- * GWT will run them within its own embedded servlet engine. For example,
- *
+ * servlets by default. Just start <code>ReportViewer</code> in hosted mode,
+ * and GWT will run them within its own embedded servlet engine. For example,
+ *
* <pre>java -cp <classpath> com.google.gwt.dev.GWTShell -out
* ReportViewerShell/www
* com.google.gwt.junit.viewer.ReportViewer/ReportViewer.html</pre>
- *
+ *
* You can configure the location where ReportServer reads the benchmark reports
* from by setting the system property named in
* {@link com.google.gwt.junit.client.Benchmark#REPORT_PATH}.
@@ -85,7 +85,7 @@
HTML statusLabel;
- List/*<ReportSummary>*/ summaries;
+ List/* <ReportSummary> */summaries;
VerticalPanel summariesPanel;
@@ -104,17 +104,16 @@
reportServer.getReportSummaries(new AsyncCallback() {
public void onFailure(Throwable caught) {
- String msg = "<p>" + caught.toString() + "</p>" +
- "<p>Is your path to the reports correct?</p>";
+ String msg = "<p>" + caught.toString() + "</p>"
+ + "<p>Is your path to the reports correct?</p>";
statusLabel.setHTML(msg);
}
public void onSuccess(Object result) {
- summaries = (List/*<ReportSummary>*/) result;
+ summaries = (List/* <ReportSummary> */) result;
if (summaries != null) {
if (summaries.size() == 0) {
- statusLabel.setText(
- "There are no benchmark reports available in this folder.");
+ statusLabel.setText("There are no benchmark reports available in this folder.");
}
Collections.sort(summaries, new Comparator() {
public int compare(Object o1, Object o2) {
@@ -140,8 +139,8 @@
tempReportTable.setWidget(0, 1, new Label("GWT Version"));
if (report == null) {
- tempReportTable
- .setWidget(1, 0, new Label("No currently selected report."));
+ tempReportTable.setWidget(1, 0,
+ new Label("No currently selected report."));
tempReportTable.getFlexCellFormatter().setColSpan(1, 0, 3);
return tempReportTable;
}
@@ -169,8 +168,8 @@
categoryTable.setBorderWidth(0);
categoryTable.setCellPadding(5);
categoryTable.setText(0, 0, c.getName());
- categoryTable.getFlexCellFormatter()
- .setStyleName(0, 0, "benchmark-category");
+ categoryTable.getFlexCellFormatter().setStyleName(0, 0,
+ "benchmark-category");
categoryTable.setWidget(0, 1, new Label("Description"));
categoryTable.setWidget(1, 0, new Label(c.getName()));
@@ -195,32 +194,33 @@
benchmarkTable.setCellPadding(5);
benchmarkTable.setText(0, 0, benchmark.getName());
// benchmarkTable.setText( 0, 1, benchmark.getDescription());
- benchmarkTable.setWidget(1, 0,
- new HTML("<pre>" + benchmark.getSourceCode() + "</pre>"));
- benchmarkTable.getFlexCellFormatter()
- .setStyleName(0, 0, "benchmark-name");
- // benchmarkTable.getFlexCellFormatter().setStyleName( 0, 1, "benchmark-description" );
- benchmarkTable.getFlexCellFormatter()
- .setStyleName(1, 0, "benchmark-code");
+ benchmarkTable.setWidget(1, 0, new HTML("<pre>"
+ + benchmark.getSourceCode() + "</pre>"));
+ benchmarkTable.getFlexCellFormatter().setStyleName(0, 0,
+ "benchmark-name");
+ // benchmarkTable.getFlexCellFormatter().setStyleName( 0, 1,
+ // "benchmark-description" );
+ benchmarkTable.getFlexCellFormatter().setStyleName(1, 0,
+ "benchmark-code");
// TODO(tobyr) Provide detailed benchmark information.
- // Following commented code is a step in that direction.
-/*
- benchmarkTable.setWidget( 0, 1, new Label( "Description"));
- benchmarkTable.setWidget( 0, 2, new Label( "Class Name"));
- benchmarkTable.setWidget( 0, 3, new Label( "Source Code"));
- benchmarkTable.setWidget( 1, 0, new Label( benchmark.getName()));
- benchmarkTable.setWidget( 1, 1, new Label( benchmark.getDescription()));
- benchmarkTable.setWidget( 1, 2, new Label( benchmark.getClassName()));
- benchmarkTable.setWidget( 1, 3, new HTML( "<pre>" + benchmark.getSourceCode() + "</pre>"));
-*/
+ // Following commented code is a step in that direction.
+ /*
+ * benchmarkTable.setWidget( 0, 1, new Label( "Description"));
+ * benchmarkTable.setWidget( 0, 2, new Label( "Class Name"));
+ * benchmarkTable.setWidget( 0, 3, new Label( "Source Code"));
+ * benchmarkTable.setWidget( 1, 0, new Label( benchmark.getName()));
+ * benchmarkTable.setWidget( 1, 1, new Label(
+ * benchmark.getDescription())); benchmarkTable.setWidget( 1, 2, new
+ * Label( benchmark.getClassName())); benchmarkTable.setWidget( 1, 3,
+ * new HTML( "<pre>" + benchmark.getSourceCode() + "</pre>"));
+ */
topTable.setWidget(currentRow++, 0, benchmarkTable);
FlexTable resultsTable = new FlexTable();
resultsTable.setBorderWidth(0);
resultsTable.setCellPadding(5);
- FlexTable.FlexCellFormatter resultsFormatter = resultsTable
- .getFlexCellFormatter();
+ FlexTable.FlexCellFormatter resultsFormatter = resultsTable.getFlexCellFormatter();
topTable.setWidget(currentRow++, 0, resultsTable);
Collections.sort(benchmark.getResults(), new Comparator() {
@@ -250,33 +250,30 @@
Result result = (Result) benchmark.getResults().get(k);
/*
- resultsTable.setWidget( 0, 0, new Label( "Result Agent"));
- resultsTable.setWidget( 0, 1, new Label( "Host"));
- resultsTable.setWidget( 0, 2, new Label( "Graph"));
- resultsTable.setWidget( 1, 0, new Label( result.getAgent()));
- resultsTable.setWidget( 1, 1, new Label( result.getHost()));
- */
+ * resultsTable.setWidget( 0, 0, new Label( "Result Agent"));
+ * resultsTable.setWidget( 0, 1, new Label( "Host"));
+ * resultsTable.setWidget( 0, 2, new Label( "Graph"));
+ * resultsTable.setWidget( 1, 0, new Label( result.getAgent()));
+ * resultsTable.setWidget( 1, 1, new Label( result.getHost()));
+ */
resultsTable.setWidget(0, k, new Image(getImageUrl(report.getId(),
c.getName(), benchmark.getClassName(), benchmark.getName(),
result.getAgent())));
/*
- FlexTable allTrialsTable = new FlexTable();
- allTrialsTable.setBorderWidth(1);
- allTrialsTable.setCellPadding(5);
- FlexTable.CellFormatter allTrialsFormatter = allTrialsTable
- .getFlexCellFormatter();
- topTable.setWidget(currentRow++, 0, allTrialsTable);
- allTrialsTable.setWidget(0, k, trialsTable);
- allTrialsFormatter
- .setAlignment(0, k, HasHorizontalAlignment.ALIGN_CENTER,
- HasVerticalAlignment.ALIGN_TOP);
- */
+ * FlexTable allTrialsTable = new FlexTable();
+ * allTrialsTable.setBorderWidth(1); allTrialsTable.setCellPadding(5);
+ * FlexTable.CellFormatter allTrialsFormatter = allTrialsTable
+ * .getFlexCellFormatter(); topTable.setWidget(currentRow++, 0,
+ * allTrialsTable); allTrialsTable.setWidget(0, k, trialsTable);
+ * allTrialsFormatter .setAlignment(0, k,
+ * HasHorizontalAlignment.ALIGN_CENTER,
+ * HasVerticalAlignment.ALIGN_TOP);
+ */
- resultsFormatter
- .setAlignment(2, k, HasHorizontalAlignment.ALIGN_LEFT,
- HasVerticalAlignment.ALIGN_TOP);
+ resultsFormatter.setAlignment(2, k,
+ HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
// A table of straight data for all trials for an agent
FlexTable trialsTable = new FlexTable();
@@ -288,9 +285,9 @@
if (k == 0) {
resultsTable.setWidget(1, k, visibilityButton);
resultsFormatter.setColSpan(1, k, benchmark.getResults().size());
- resultsFormatter
- .setAlignment(1, k, HasHorizontalAlignment.ALIGN_LEFT,
- HasVerticalAlignment.ALIGN_MIDDLE);
+ resultsFormatter.setAlignment(1, k,
+ HasHorizontalAlignment.ALIGN_LEFT,
+ HasVerticalAlignment.ALIGN_MIDDLE);
}
resultsTable.setWidget(2, k, trialsTable);
@@ -366,11 +363,11 @@
}
});
tempSummariesTable.setWidget(index, 0, idLabel);
- tempSummariesTable
- .setWidget(index, 1, new Label(summary.getDateString()));
- tempSummariesTable
- .setWidget(index, 2, new Label(summary.getNumTests() + ""));
- // tempSummariesTable.setWidget( index, 3, new Label(summary.allTestsSucceeded() + ""));
+ tempSummariesTable.setWidget(index, 1, new Label(summary.getDateString()));
+ tempSummariesTable.setWidget(index, 2, new Label(summary.getNumTests()
+ + ""));
+ // tempSummariesTable.setWidget( index, 3, new
+ // Label(summary.allTestsSucceeded() + ""));
}
return tempSummariesTable;
@@ -383,10 +380,6 @@
reportPanel.insert(reportTable, 1);
}
-// private native String getDocumentLocation() /*-{
-// return window.location;
-// }-*/;
-
private void displaySummaries() {
FlexTable table = createSummariesTable();
summariesPanel.remove(summariesTable);
@@ -403,16 +396,13 @@
private String getImageUrl(String report, String category, String testClass,
String testMethod, String agent) {
- return imageServer + encode(report) + "/" +
- encode(category) + "/" +
- encode(testClass) + "/" +
- encode(testMethod) + "/" +
- encode(agent);
+ return imageServer + encode(report) + "/" + encode(category) + "/"
+ + encode(testClass) + "/" + encode(testMethod) + "/" + encode(agent);
}
/**
* Loads report details asynchronously for a given report.
- *
+ *
* @param id the non-null id of the report
*/
private void getReportDetails(String id) {
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Result.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Result.java
index 79453d5..70efccc 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Result.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Result.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Trial.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Trial.java
index b949db0..760e83f 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Trial.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/client/Trial.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -17,8 +17,8 @@
import com.google.gwt.user.client.rpc.IsSerializable;
-import java.util.Map;
import java.util.HashMap;
+import java.util.Map;
/**
* A data object for Trial.
@@ -29,7 +29,7 @@
double runTimeMillis;
- Map/*<String,String>*/ variables;
+ Map/* <String,String> */variables;
public Trial() {
this.variables = new HashMap();
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/BenchmarkXml.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/BenchmarkXml.java
index 184e7ed..b47ae72 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/BenchmarkXml.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/BenchmarkXml.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -24,25 +24,25 @@
/**
* Converts an XML element to a Benchmark object.
- *
+ *
*/
class BenchmarkXml {
- public static Benchmark fromXml( Element element ) {
+ public static Benchmark fromXml(Element element) {
Benchmark benchmark = new Benchmark();
- benchmark.setClassName(element.getAttribute( "class" ));
- benchmark.setName(element.getAttribute( "name" ));
- benchmark.setDescription(element.getAttribute( "description" ));
+ benchmark.setClassName(element.getAttribute("class"));
+ benchmark.setName(element.getAttribute("name"));
+ benchmark.setDescription(element.getAttribute("description"));
- List children = ReportXml.getElementChildren( element, "result" );
- benchmark.setResults( new ArrayList/*<Result>*/(children.size()));
- for ( int i = 0; i < children.size(); ++i ) {
- benchmark.getResults().add( ResultXml.fromXml( (Element) children.get( i )));
+ List children = ReportXml.getElementChildren(element, "result");
+ benchmark.setResults(new ArrayList/* <Result> */(children.size()));
+ for (int i = 0; i < children.size(); ++i) {
+ benchmark.getResults().add(ResultXml.fromXml((Element) children.get(i)));
}
- Element code = ReportXml.getElementChild( element, "source_code" );
- if ( code != null ) {
- benchmark.setSourceCode( ReportXml.getText(code) );
+ Element code = ReportXml.getElementChild(element, "source_code");
+ if (code != null) {
+ benchmark.setSourceCode(ReportXml.getText(code));
}
return benchmark;
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/CategoryXml.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/CategoryXml.java
index a06bbea..2c10a64 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/CategoryXml.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/CategoryXml.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -24,18 +24,20 @@
/**
* Converts an XML Element to a Category object.
- *
+ *
*/
class CategoryXml {
- public static Category fromXml( Element element ) {
+ public static Category fromXml(Element element) {
Category category = new Category();
- category.setName(element.getAttribute( "name" ));
- category.setDescription(element.getAttribute( "description" ));
+ category.setName(element.getAttribute("name"));
+ category.setDescription(element.getAttribute("description"));
- List/*<Element>*/ children = ReportXml.getElementChildren( element, "benchmark" );
- category.setBenchmarks(new ArrayList/*<Benchmark>*/( children.size()));
- for ( int i = 0; i < children.size(); ++i ) {
- category.getBenchmarks().add( BenchmarkXml.fromXml( (Element) children.get( i )));
+ List/* <Element> */children = ReportXml.getElementChildren(element,
+ "benchmark");
+ category.setBenchmarks(new ArrayList/* <Benchmark> */(children.size()));
+ for (int i = 0; i < children.size(); ++i) {
+ category.getBenchmarks().add(
+ BenchmarkXml.fromXml((Element) children.get(i)));
}
return category;
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportDatabase.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportDatabase.java
index b91a7d6..63fde7e 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportDatabase.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportDatabase.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -15,41 +15,44 @@
*/
package com.google.gwt.junit.viewer.server;
+import com.google.gwt.junit.client.Benchmark;
import com.google.gwt.junit.viewer.client.Report;
import com.google.gwt.junit.viewer.client.ReportSummary;
-import com.google.gwt.junit.client.Benchmark;
-import com.google.gwt.user.client.rpc.IsSerializable;
import org.w3c.dom.Document;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
import java.io.File;
import java.io.FilenameFilter;
-import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
/**
* Serves up benchmark reports created during JUnit execution.
- *
+ *
* The benchmark reports are read from the path specified by the system property
- * named <code>Benchmark.REPORT_PATH</code>. In the case the property is not set,
- * they are read from the user's current working directory.
- *
+ * named <code>Benchmark.REPORT_PATH</code>. In the case the property is not
+ * set, they are read from the user's current working directory.
*/
public class ReportDatabase {
+ /**
+ * Indicates that a supplied path was invalid.
+ *
+ */
public static class BadPathException extends RuntimeException {
String path;
- public BadPathException( String path ) {
- super("The path " + path + " does not exist." );
+
+ public BadPathException(String path) {
+ super("The path " + path + " does not exist.");
this.path = path;
}
+
public String getPath() {
return path;
}
@@ -59,7 +62,8 @@
private ReportSummary summary;
private Report report;
private long lastModified;
- public ReportEntry( Report report, ReportSummary summary, long lastModified ) {
+
+ public ReportEntry(Report report, ReportSummary summary, long lastModified) {
this.report = report;
this.summary = summary;
this.lastModified = lastModified;
@@ -69,7 +73,8 @@
private static class ReportFile {
File file;
long lastModified;
- ReportFile( File f ) {
+
+ ReportFile(File f) {
this.file = f;
this.lastModified = f.lastModified();
}
@@ -77,7 +82,6 @@
/**
* The amount of time to go between report updates.
- *
*/
private static final int UPDATE_DURATION_MILLIS = 30000;
@@ -87,95 +91,91 @@
return database;
}
- private static String getReportId( File f ) {
+ private static String getReportId(File f) {
return f.getName();
}
/**
* A list of all reports by id.
*/
- private Map/*<String,ReportEntry>*/ reports = new HashMap/*<String,ReportEntry>*/();
+ private Map/* <String,ReportEntry> */reports = new HashMap/* <String,ReportEntry> */();
/**
* The last time we updated our reports.
- *
*/
private long lastUpdateMillis = -1L;
/**
- * Lock for updating from file system.
- * (Guarantees a single update while not holding reportsLock open).
- *
+ * Lock for updating from file system. (Guarantees a single update while not
+ * holding reportsLock open).
*/
private Object updateLock = new Object();
/**
* Are we currently undergoing updating?
- *
*/
private boolean updating = false;
/**
* Lock for reports.
- *
*/
private Object reportsLock = new Object();
/**
* The path to read benchmark reports from.
- *
*/
private final String reportPath;
private ReportDatabase() throws BadPathException {
- String path = System.getProperty( Benchmark.REPORT_PATH );
- if ( path == null || path.trim().equals( "" ) ) {
- path = System.getProperty( "user.dir" );
+ String path = System.getProperty(Benchmark.REPORT_PATH);
+ if (path == null || path.trim().equals("")) {
+ path = System.getProperty("user.dir");
}
reportPath = path;
- if (! new File(reportPath).exists()) {
+ if (!new File(reportPath).exists()) {
throw new BadPathException(reportPath);
}
}
- public Report getReport( String reportId ) {
- synchronized ( reportsLock ) {
- ReportEntry entry = (ReportEntry)reports.get( reportId );
+ public Report getReport(String reportId) {
+ synchronized (reportsLock) {
+ ReportEntry entry = (ReportEntry) reports.get(reportId);
return entry == null ? null : entry.report;
}
}
- public List/*<ReportSummary>*/ getReportSummaries() {
+ public List/* <ReportSummary> */getReportSummaries() {
/**
- * There are probably ways to make this faster, but I've taken
- * basic precautions to try to make this scale ok with multiple clients.
+ * There are probably ways to make this faster, but I've taken basic
+ * precautions to try to make this scale ok with multiple clients.
*/
boolean update = false;
// See if we need to do an update
// Go ahead and let others continue reading, even if an update is required.
- synchronized ( updateLock ) {
- if ( ! updating ) {
+ synchronized (updateLock) {
+ if (!updating) {
long currentTime = System.currentTimeMillis();
- if ( currentTime > lastUpdateMillis + UPDATE_DURATION_MILLIS ) {
+ if (currentTime > lastUpdateMillis + UPDATE_DURATION_MILLIS) {
update = updating = true;
}
}
}
- if ( update ) {
+ if (update) {
updateReports();
}
- synchronized ( reportsLock ) {
- List/*<ReportSummary>*/ summaries = new ArrayList/*<ReportSummary>*/( reports.size() );
- for ( Iterator it = reports.values().iterator(); it.hasNext(); ) {
+ synchronized (reportsLock) {
+ List/* <ReportSummary> */summaries = new ArrayList/* <ReportSummary> */(
+ reports.size());
+ for (Iterator it = reports.values().iterator(); it.hasNext();) {
ReportEntry entry = (ReportEntry) it.next();
- summaries.add( entry.summary );
+ summaries.add(entry.summary);
}
return summaries;
}
@@ -183,40 +183,40 @@
private void updateReports() {
- File path = new File( reportPath );
+ File path = new File(reportPath);
- File[] files = path.listFiles( new FilenameFilter() {
- public boolean accept( File f, String name ) {
- return name.startsWith("report-") && name.endsWith( ".xml" );
+ File[] files = path.listFiles(new FilenameFilter() {
+ public boolean accept(File f, String name) {
+ return name.startsWith("report-") && name.endsWith(".xml");
}
- } );
+ });
Map filesToUpdate = new HashMap();
Map filesById = new HashMap();
- for ( int i = 0; i < files.length; ++i ) {
- File f = files[ i ];
- filesById.put( getReportId( f ), new ReportFile( f ) );
+ for (int i = 0; i < files.length; ++i) {
+ File f = files[i];
+ filesById.put(getReportId(f), new ReportFile(f));
}
// Lock temporarily so we can determine what needs updating
// (This could be a read-lock - not a general read-write lock,
// if we moved dead report removal outside of this critical section).
- synchronized ( reportsLock ) {
+ synchronized (reportsLock) {
// Add reports which need to be updated or are new
- for ( int i = 0; i < files.length; ++i ) {
- File file = files[ i ];
- String reportId = getReportId( file );
- ReportEntry entry = (ReportEntry) reports.get( reportId );
- if ( entry == null || entry.lastModified < file.lastModified() ) {
- filesToUpdate.put( reportId, null );
+ for (int i = 0; i < files.length; ++i) {
+ File file = files[i];
+ String reportId = getReportId(file);
+ ReportEntry entry = (ReportEntry) reports.get(reportId);
+ if (entry == null || entry.lastModified < file.lastModified()) {
+ filesToUpdate.put(reportId, null);
}
}
// Remove reports which no longer exist
- for ( Iterator it = reports.keySet().iterator(); it.hasNext(); ) {
- String id = (String)it.next();
- if ( filesById.get(id) == null) {
+ for (Iterator it = reports.keySet().iterator(); it.hasNext();) {
+ String id = (String) it.next();
+ if (filesById.get(id) == null) {
it.remove();
}
}
@@ -224,37 +224,37 @@
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setIgnoringElementContentWhitespace( true );
- factory.setIgnoringComments( true );
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
DocumentBuilder builder = factory.newDocumentBuilder();
- for ( Iterator it = filesToUpdate.keySet().iterator(); it.hasNext(); ) {
- String id = (String)it.next();
+ for (Iterator it = filesToUpdate.keySet().iterator(); it.hasNext();) {
+ String id = (String) it.next();
ReportFile reportFile = (ReportFile) filesById.get(id);
String filePath = reportFile.file.getAbsolutePath();
Document doc = builder.parse(filePath);
- Report report = ReportXml.fromXml( doc.getDocumentElement() );
+ Report report = ReportXml.fromXml(doc.getDocumentElement());
report.setId(id);
ReportSummary summary = report.getSummary();
long lastModified = new File(filePath).lastModified();
- filesToUpdate.put(id, new ReportEntry( report, summary, lastModified));
+ filesToUpdate.put(id, new ReportEntry(report, summary, lastModified));
}
// Update the reports
- synchronized ( reportsLock ) {
- for ( Iterator it = filesToUpdate.keySet().iterator(); it.hasNext(); ) {
- String id = (String)it.next();
- reports.put( id, filesToUpdate.get( id ));
+ synchronized (reportsLock) {
+ for (Iterator it = filesToUpdate.keySet().iterator(); it.hasNext();) {
+ String id = (String) it.next();
+ reports.put(id, filesToUpdate.get(id));
}
}
- } catch ( Exception e ) {
+ } catch (Exception e) {
// Even if we got an error, we'll just try again on the next update
// This might happen if a report has only been partially written, for
// example.
e.printStackTrace();
}
- synchronized ( updateLock ) {
+ synchronized (updateLock) {
updating = false;
lastUpdateMillis = System.currentTimeMillis();
}
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportImageServer.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportImageServer.java
index e8752bc..b72c9bfe 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportImageServer.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportImageServer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -15,65 +15,71 @@
*/
package com.google.gwt.junit.viewer.server;
-import com.google.gwt.junit.viewer.client.Report;
-import com.google.gwt.junit.viewer.client.Category;
import com.google.gwt.junit.viewer.client.Benchmark;
+import com.google.gwt.junit.viewer.client.BrowserInfo;
+import com.google.gwt.junit.viewer.client.Category;
+import com.google.gwt.junit.viewer.client.Report;
import com.google.gwt.junit.viewer.client.Result;
import com.google.gwt.junit.viewer.client.Trial;
-import com.google.gwt.junit.viewer.client.BrowserInfo;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.encoders.EncoderUtil;
import org.jfree.chart.encoders.ImageFormat;
import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.category.DefaultCategoryDataset;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.net.URLDecoder;
-import java.awt.image.BufferedImage;
import java.awt.Font;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.TreeMap;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URLDecoder;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
/**
* Serves up report images for the ReportViewer application. Generates the
* charts/graphs which contain the benchmarking data for a report.
- *
- * <p>This servlet requires the name of the report file, the category, the
- * benchmark class, the test method, and the browser agent.<p>
- *
- * <p>An Example URI:<pre>
+ *
+ * <p>
+ * This servlet requires the name of the report file, the category, the
+ * benchmark class, the test method, and the browser agent.
+ * <p>
+ *
+ * <p>
+ * An Example URI:
+ *
+ * <pre>
* /com.google.gwt.junit.viewer.ReportViewer/test_images/
* report-12345.xml/
* RemoveCategory/
* com.google.gwt.junit.client.ArrayListAndVectorBenchmark/
* testArrayListRemoves/
* Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920/
- * </pre></p>
+ * </pre>
+ *
+ * </p>
*/
public class ReportImageServer extends HttpServlet {
private static final String charset = "UTF-8";
- private static void copy(InputStream in, OutputStream out)
- throws IOException {
+ private static void copy(InputStream in, OutputStream out) throws IOException {
byte[] buf = new byte[512];
while (true) {
@@ -95,20 +101,22 @@
// Pick the domain and series variables for our graph.
// Right now we only handle up to two "user" variables.
- // We set the domain variable to the be the one containing the most unique values.
+ // We set the domain variable to the be the one containing the most unique
+ // values.
int numVariables = firstTrial.getVariables().size();
String domainVariable = null;
String seriesVariable = null;
- Map/*<String,Set<String>>*/ variableValues = null;
+ Map/* <String,Set<String>> */variableValues = null;
if (numVariables == 1) {
- domainVariable = (String) firstTrial.getVariables().keySet().iterator()
- .next();
+ domainVariable = (String) firstTrial.getVariables().keySet().iterator().next();
} else {
- // TODO(tobyr): Do something smarter, like allow the user to specify which variables
- // are domain and series, along with the variables which are held constant.
+ // TODO(tobyr): Do something smarter, like allow the user to specify which
+ // variables
+ // are domain and series, along with the variables which are held
+ // constant.
variableValues = new HashMap();
@@ -145,10 +153,8 @@
}
if (numValuesMap.values().size() > 0) {
- domainVariable = (String) ((List) numValuesMap
- .get(numValuesMap.lastKey())).get(0);
- seriesVariable = (String) ((List) numValuesMap
- .get(numValuesMap.firstKey())).get(0);
+ domainVariable = (String) ((List) numValuesMap.get(numValuesMap.lastKey())).get(0);
+ seriesVariable = (String) ((List) numValuesMap.get(numValuesMap.firstKey())).get(0);
}
}
@@ -162,12 +168,13 @@
DefaultCategoryDataset data = new DefaultCategoryDataset();
data.addValue(trial.getRunTimeMillis(), "result", "result");
- return ChartFactory.createBarChart(title, testName, valueTitle,
- data, PlotOrientation.VERTICAL, false, false, false);
+ return ChartFactory.createBarChart(title, testName, valueTitle, data,
+ PlotOrientation.VERTICAL, false, false, false);
} else if (numVariables == 1) {
// Show a line graph with only 1 series
- // Or.... choose between a line graph and a bar graph depending upon whether the
+ // Or.... choose between a line graph and a bar graph depending upon
+ // whether the
// type of the domain is numeric.
XYSeriesCollection data = new XYSeriesCollection();
@@ -176,7 +183,7 @@
for (Iterator it = trials.iterator(); it.hasNext();) {
Trial trial = (Trial) it.next();
- if ( trial.getException() != null) {
+ if (trial.getException() != null) {
continue;
}
double time = trial.getRunTimeMillis();
@@ -200,14 +207,14 @@
for (Iterator trialsIt = trials.iterator(); trialsIt.hasNext();) {
Trial trial = (Trial) trialsIt.next();
- if ( trial.getException() != null) {
+ if (trial.getException() != null) {
continue;
}
Map variables = trial.getVariables();
if (variables.get(seriesVariable).equals(seriesValue)) {
double time = trial.getRunTimeMillis();
- String domainValue = (String) trial.getVariables()
- .get(domainVariable);
+ String domainValue = (String) trial.getVariables().get(
+ domainVariable);
series.add(Double.parseDouble(domainValue), time);
}
}
@@ -224,46 +231,42 @@
// Leaving this around until we can handle multivariate charts in dimensions
// greater than two.
- // Code for creating a category data set - probably better with a bar chart instead of line chart
+ // Code for creating a category data set - probably better with a bar chart
+ // instead of line chart
/*
- DefaultCategoryDataset data = new DefaultCategoryDataset();
- String series = domainVariable;
-
- for ( Iterator it = trials.iterator(); it.hasNext(); ) {
- Trial trial = (Trial) it.next();
- double time = trial.getRunTimeMillis();
- String domainValue = (String) trial.getVariables().get( domainVariable );
- data.addValue( time, series, domainValue );
- }
-
- String title = "";
- String categoryTitle = domainVariable;
- PlotOrientation orientation = PlotOrientation.VERTICAL;
-
- chart = ChartFactory.createLineChart( title, categoryTitle, valueTitle, data, orientation, true, true, false );
- */
+ * DefaultCategoryDataset data = new DefaultCategoryDataset(); String series =
+ * domainVariable;
+ *
+ * for ( Iterator it = trials.iterator(); it.hasNext(); ) { Trial trial =
+ * (Trial) it.next(); double time = trial.getRunTimeMillis(); String
+ * domainValue = (String) trial.getVariables().get( domainVariable );
+ * data.addValue( time, series, domainValue ); }
+ *
+ * String title = ""; String categoryTitle = domainVariable; PlotOrientation
+ * orientation = PlotOrientation.VERTICAL;
+ *
+ * chart = ChartFactory.createLineChart( title, categoryTitle, valueTitle,
+ * data, orientation, true, true, false );
+ */
/*
- DefaultCategoryDataset data = new DefaultCategoryDataset();
- String series1 = "firefox";
- String series2 = "ie";
-
- data.addValue( 1.0, series1, "1024");
- data.addValue( 2.0, series1, "2048");
- data.addValue( 4.0, series1, "4096");
- data.addValue( 8.0, series1, "8192");
-
- data.addValue( 2.0, series2, "1024");
- data.addValue( 4.0, series2, "2048");
- data.addValue( 8.0, series2, "4096");
- data.addValue( 16.0, series2,"8192");
-
- String title = "";
- String categoryTitle = "size";
- PlotOrientation orientation = PlotOrientation.VERTICAL;
-
- chart = ChartFactory.createLineChart( title, categoryTitle, valueTitle, data, orientation, true, true, false );
- */
+ * DefaultCategoryDataset data = new DefaultCategoryDataset(); String
+ * series1 = "firefox"; String series2 = "ie";
+ *
+ * data.addValue( 1.0, series1, "1024"); data.addValue( 2.0, series1,
+ * "2048"); data.addValue( 4.0, series1, "4096"); data.addValue( 8.0,
+ * series1, "8192");
+ *
+ * data.addValue( 2.0, series2, "1024"); data.addValue( 4.0, series2,
+ * "2048"); data.addValue( 8.0, series2, "4096"); data.addValue( 16.0,
+ * series2,"8192");
+ *
+ * String title = ""; String categoryTitle = "size"; PlotOrientation
+ * orientation = PlotOrientation.VERTICAL;
+ *
+ * chart = ChartFactory.createLineChart( title, categoryTitle, valueTitle,
+ * data, orientation, true, true, false );
+ */
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
@@ -307,8 +310,7 @@
}
private void handleRequest(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
+ HttpServletResponse response) throws IOException, ServletException {
String uri = request.getRequestURI();
String requestString = uri.split("test_images/")[1];
@@ -345,9 +347,10 @@
chart.getTitle().setFont(Font.decode("Arial"));
- // Try to fit all the graphs into a 1024 window, with a min of 240 and a max of 480
- final int graphWidth = Math
- .max(240, Math.min(480, (1024 - 10 * results.size()) / results.size()));
+ // Try to fit all the graphs into a 1024 window, with a min of 240 and a max
+ // of 480
+ final int graphWidth = Math.max(240, Math.min(480,
+ (1024 - 10 * results.size()) / results.size()));
BufferedImage img = chart.createBufferedImage(graphWidth, 240);
byte[] image = EncoderUtil.encode(img, ImageFormat.PNG);
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportServerImpl.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportServerImpl.java
index f40ded6..1a0a8e8 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportServerImpl.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportServerImpl.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -15,17 +15,17 @@
*/
package com.google.gwt.junit.viewer.server;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-import com.google.gwt.junit.viewer.client.ReportServer;
import com.google.gwt.junit.viewer.client.Report;
+import com.google.gwt.junit.viewer.client.ReportServer;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import java.util.List;
/**
* Implements the ReportServer RPC interface.
*/
-public class ReportServerImpl extends RemoteServiceServlet
- implements ReportServer {
+public class ReportServerImpl extends RemoteServiceServlet implements
+ ReportServer {
public Report getReport(String reportId) {
return ReportDatabase.getInstance().getReport(reportId);
@@ -34,7 +34,7 @@
/**
* @gwt.typeArgs <com.google.gwt.junit.viewer.client.ReportSummary>
*/
- public List/*<ReportSummary>*/ getReportSummaries() {
+ public List/* <ReportSummary> */getReportSummaries() {
return ReportDatabase.getInstance().getReportSummaries();
}
}
\ No newline at end of file
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportXml.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportXml.java
index 6a3dee0..8ce5ddd 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportXml.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ReportXml.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -18,14 +18,14 @@
import com.google.gwt.junit.viewer.client.Report;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
-import java.util.List;
import java.util.Date;
+import java.util.List;
/**
* Hydrates a Report from its XML representation.
@@ -34,7 +34,7 @@
/**
* Hydrates a Report from its XML representation.
- *
+ *
* @param element The XML element to hydrate from.
* @return a new report (with null id)
*/
@@ -54,11 +54,10 @@
report.setGwtVersion(element.getAttribute("gwt_version"));
- List/*<Element>*/ children = getElementChildren(element, "category");
- report.setCategories(new ArrayList/*<Category>*/(children.size()));
+ List/* <Element> */children = getElementChildren(element, "category");
+ report.setCategories(new ArrayList/* <Category> */(children.size()));
for (int i = 0; i < children.size(); ++i) {
- report.getCategories()
- .add(CategoryXml.fromXml((Element) children.get(i)));
+ report.getCategories().add(CategoryXml.fromXml((Element) children.get(i)));
}
return report;
@@ -69,10 +68,10 @@
return children.getLength() == 0 ? null : (Element) children.item(0);
}
- static List/*<Element>*/ getElementChildren(Element e, String name) {
+ static List/* <Element> */getElementChildren(Element e, String name) {
NodeList children = e.getElementsByTagName(name);
int numElements = children.getLength();
- List/*<Element>*/ elements = new ArrayList/*<Element>*/(numElements);
+ List/* <Element> */elements = new ArrayList/* <Element> */(numElements);
for (int i = 0; i < children.getLength(); ++i) {
Node n = children.item(i);
elements.add((Element) n);
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ResultXml.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ResultXml.java
index cef6932..c15aaa2 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ResultXml.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/ResultXml.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -19,26 +19,26 @@
import org.w3c.dom.Element;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
/**
* Hydrates a benchmark Result from an XML Element.
- *
+ *
*/
public class ResultXml {
- public static Result fromXml( Element element ) {
+ public static Result fromXml(Element element) {
Result result = new Result();
- result.setAgent(element.getAttribute( "agent" ));
- result.setHost(element.getAttribute( "host" ));
+ result.setAgent(element.getAttribute("agent"));
+ result.setHost(element.getAttribute("host"));
- List/*<Element>*/ children = ReportXml.getElementChildren( element, "trial" );
+ List/* <Element> */children = ReportXml.getElementChildren(element, "trial");
- ArrayList trials = new ArrayList( children.size() );
+ ArrayList trials = new ArrayList(children.size());
result.setTrials(trials);
- for ( int i = 0; i < children.size(); ++i ) {
- trials.add( TrialXml.fromXml( (Element) children.get(i) ));
+ for (int i = 0; i < children.size(); ++i) {
+ trials.add(TrialXml.fromXml((Element) children.get(i)));
}
// TODO(tobyr) Put some type information in here for the variables
diff --git a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/TrialXml.java b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/TrialXml.java
index 530f8cd..001c13f 100644
--- a/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/TrialXml.java
+++ b/tools/benchmark-viewer/src/com/google/gwt/junit/viewer/server/TrialXml.java
@@ -1,12 +1,12 @@
/*
* Copyright 2007 Google Inc.
- *
+ *
* 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
@@ -19,41 +19,41 @@
import org.w3c.dom.Element;
-import java.util.List;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
/**
* Hydrates a benchmark Trial from an XML Element.
- *
+ *
*/
class TrialXml {
- public static Trial fromXml( Element element ) {
+ public static Trial fromXml(Element element) {
Trial trial = new Trial();
- String timing = element.getAttribute( "timing" );
+ String timing = element.getAttribute("timing");
- if ( timing != null ) {
- trial.setRunTimeMillis(Double.parseDouble( timing ));
+ if (timing != null) {
+ trial.setRunTimeMillis(Double.parseDouble(timing));
}
- Element exception = ReportXml.getElementChild( element, "exception" );
- if ( exception != null ) {
- trial.setException( ReportXml.getText( exception ) );
+ Element exception = ReportXml.getElementChild(element, "exception");
+ if (exception != null) {
+ trial.setException(ReportXml.getText(exception));
}
- List elements = ReportXml.getElementChildren( element, "variable" );
+ List elements = ReportXml.getElementChildren(element, "variable");
Map variables = trial.getVariables();
- for ( Iterator it = elements.iterator(); it.hasNext(); ) {
+ for (Iterator it = elements.iterator(); it.hasNext();) {
Element e = (Element) it.next();
- String name = e.getAttribute( "name" );
- String value = e.getAttribute( "value" );
- variables.put( name, value ) ;
+ String name = e.getAttribute("name");
+ String value = e.getAttribute("value");
+ variables.put(name, value);
}
-
+
return trial;
}
}
diff --git a/tools/build.xml b/tools/build.xml
index f17e778..065d592 100755
--- a/tools/build.xml
+++ b/tools/build.xml
@@ -6,10 +6,28 @@
<!-- "build" is the default when subprojects are directly targetted -->
<property name="target" value="build" />
- <target name="build" depends="benchmark-viewer" description="Builds all targets"/>
-
<target name="benchmark-viewer" depends="" description="Run benchmark-viewer">
<gwt.ant dir="benchmark-viewer" />
</target>
+
+ <target name="-do" depends="benchmark-viewer" description="Run all subfolders" />
+
+ <target name="build" description="Build each subfolder">
+ <antcall target="-do">
+ <param name="target" value="build" />
+ </antcall>
+ </target>
+
+ <target name="checkstyle" description="Static analysis of source for each subfolder">
+ <antcall target="-do">
+ <param name="target" value="checkstyle" />
+ </antcall>
+ </target>
+
+ <target name="test" depends="build" description="Test each subfolder">
+ <antcall target="-do">
+ <param name="target" value="test" />
+ </antcall>
+ </target>
</project>