Update ooo320-m1
[ooovba.git] / qadevOOo / runner / stats / Summarizer.java
blob4485ad8bdbba5b9d17bd288aebcba9ae379290c0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Summarizer.java,v $
10 * $Revision: 1.7 $
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 ************************************************************************/
31 package stats;
33 import java.util.Vector;
34 import share.DescEntry;
36 /**
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 {
43 /**
45 * gets the state for a SuperEntry according to its subentries
46 * @param entry
48 public void summarizeUp(DescEntry entry) {
49 if ( ( entry.State != null ) && !entry.State.equals("UNKNOWN")) return;
50 int count = entry.SubEntryCount;
51 int knownIssues = 0;
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";
60 knownIssues++;
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) {
68 String errMsg = "";
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";
73 } else errMsg +=
74 failures.elementAt(j)+" - "+states.elementAt(j)+"\r\n";
76 entry.hasErrorMsg=true;
77 entry.ErrorMsg = errMsg;
78 entry.State = state;
79 } else if (entry.EntryType.equals("component") && knownIssues > 0) {
80 entry.State = "PASSED(with known issues).OK";
81 } else {
82 entry.State = "PASSED.OK";
86 public static void summarizeDown(DescEntry entry, String state) {
87 if ( ( entry.State == null ) || entry.State.equals("UNKNOWN"))
88 entry.State = state;
89 for (int i=0; i<entry.SubEntryCount; i++) {
90 summarizeDown(entry.SubEntries[i], entry.State);