KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > junit > client > TestResults


1 /*
2  * Copyright 2007 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.junit.client;
17
18 import com.google.gwt.user.client.rpc.IsSerializable;
19
20 import java.util.List JavaDoc;
21 import java.util.ArrayList JavaDoc;
22
23 /**
24  * Encapsulates the results of the execution of a single benchmark. A TestResult
25  * is constructed transparently within a benchmark and reported back to the
26  * JUnit RPC server, JUnitHost. It's then shared (via JUnitMessageQueue) with
27  * JUnitShell and aggregated in BenchmarkReport with other TestResults.
28  *
29  * @skip
30  * @see com.google.gwt.junit.client.impl.JUnitHost
31  * @see com.google.gwt.junit.JUnitMessageQueue
32  * @see com.google.gwt.junit.JUnitShell
33  * @see com.google.gwt.junit.benchmarks.BenchmarkReport
34  */

35 public class TestResults implements IsSerializable {
36
37   // Computed at the server, via http header
38
String JavaDoc agent;
39
40   String JavaDoc host;
41
42   /**
43    * The URL of the document on the browser (document.location). This is used to
44    * locate the *cache.html document containing the generated JavaScript for the
45    * test. In the case of hosted mode, this points (uselessly) to the nocache
46    * file, because there is no generated JavaScript.
47    *
48    * Apparently, we can't get this value on the server-side because of the goofy
49    * way HTTP_REFERER is set by different browser implementations of
50    * XMLHttpRequest.
51    */

52   String JavaDoc sourceRef;
53
54   /**
55    * @gwt.typeArgs <com.google.gwt.junit.client.Trial>
56    */

57   List JavaDoc/*<Trial>*/ trials;
58
59   public TestResults() {
60     trials = new ArrayList JavaDoc();
61   }
62
63   public String JavaDoc getAgent() {
64     return agent;
65   }
66
67   public String JavaDoc getHost() {
68     return host;
69   }
70
71   public String JavaDoc getSourceRef() {
72     return sourceRef;
73   }
74
75   public List JavaDoc getTrials() {
76     return trials;
77   }
78
79   public void setAgent(String JavaDoc agent) {
80     this.agent = agent;
81   }
82
83   public void setHost(String JavaDoc host) {
84     this.host = host;
85   }
86
87   public void setSourceRef(String JavaDoc sourceRef) {
88     this.sourceRef = sourceRef;
89   }
90
91   public void setTrials(List JavaDoc trials) {
92     this.trials = trials;
93   }
94
95   public String JavaDoc toString() {
96     return "trials: " + trials + ", sourceRef: " + sourceRef + ", agent: "
97         + agent + ", host: " + host;
98   }
99 }
Popular Tags