1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Summarizer.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import java
.util
.Vector
;
34 import share
.DescEntry
;
38 * this class summs up the results of the subentries of a given DescEntry<br>
39 * and fills the subentries in cases of SKIPPED states
41 public class Summarizer
{
45 * gets the state for a SuperEntry according to its subentries
48 public void summarizeUp(DescEntry entry
) {
49 if ( ( entry
.State
!= null ) && !entry
.State
.equals("UNKNOWN")) return;
50 int count
= entry
.SubEntryCount
;
52 Vector failures
= new Vector();
53 Vector states
= new Vector();
54 for (int i
=0; i
<count
; i
++) {
55 if (entry
.SubEntries
[i
].State
== null) {
56 entry
.SubEntries
[i
].State
= "PASSED.FAILED";
58 if (entry
.SubEntries
[i
].State
.equals("known issue")) {
59 entry
.SubEntries
[i
].State
= "PASSED.OK";
62 if (!entry
.SubEntries
[i
].State
.endsWith("OK")) {
63 failures
.add(entry
.SubEntries
[i
].entryName
);
64 states
.add(entry
.SubEntries
[i
].State
);
67 if (failures
.size()>0) {
69 String state
= "PASSED.FAILED";
70 for (int j
=0; j
<failures
.size();j
++) {
71 if (states
.elementAt(j
).equals("not part of the job")) {
72 state
= "Not possible since not all Interfaces/Services have been checked";
74 failures
.elementAt(j
)+" - "+states
.elementAt(j
)+"\r\n";
76 entry
.hasErrorMsg
=true;
77 entry
.ErrorMsg
= errMsg
;
79 } else if (entry
.EntryType
.equals("component") && knownIssues
> 0) {
80 entry
.State
= "PASSED(with known issues).OK";
82 entry
.State
= "PASSED.OK";
86 public static void summarizeDown(DescEntry entry
, String state
) {
87 if ( ( entry
.State
== null ) || entry
.State
.equals("UNKNOWN"))
89 for (int i
=0; i
<entry
.SubEntryCount
; i
++) {
90 summarizeDown(entry
.SubEntries
[i
], entry
.State
);