01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.viewer.client;
17:
18: import com.google.gwt.user.client.rpc.IsSerializable;
19:
20: import java.util.Date;
21: import java.util.List;
22:
23: /**
24: * A data object for Report.
25: */
26: public class Report implements IsSerializable {
27:
28: /**
29: * @gwt.typeArgs <com.google.gwt.junit.viewer.client.Category>
30: */
31: private List/* <Category> */categories;
32:
33: private Date date;
34:
35: private String dateString; // Temporary addition until we get better date
36:
37: // formatting in GWT
38: private String gwtVersion;
39:
40: private String id;
41:
42: public List/* <Category> */getCategories() {
43: return categories;
44: }
45:
46: public Date getDate() {
47: return date;
48: }
49:
50: public String getDateString() {
51: return dateString;
52: }
53:
54: public String getGwtVersion() {
55: return gwtVersion;
56: }
57:
58: public String getId() {
59: return id;
60: }
61:
62: public ReportSummary getSummary() {
63: int numTests = 0;
64: boolean testsPassed = true;
65:
66: for (int i = 0; i < categories.size(); ++i) {
67: Category c = (Category) categories.get(i);
68: List benchmarks = c.getBenchmarks();
69: numTests += benchmarks.size();
70: }
71:
72: return new ReportSummary(id, date, dateString, numTests,
73: testsPassed);
74: }
75:
76: public void setCategories(List categories) {
77: this .categories = categories;
78: }
79:
80: public void setDate(Date date) {
81: this .date = date;
82: }
83:
84: public void setDateString(String dateString) {
85: this .dateString = dateString;
86: }
87:
88: public void setGwtVersion(String gwtVersion) {
89: this .gwtVersion = gwtVersion;
90: }
91:
92: public void setId(String id) {
93: this.id = id;
94: }
95: }
|