001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.setup.comptest; 029 030/** 031 * Contains info about the result of a setup test.<p> 032 * 033 * @since 6.0.0 034 */ 035public class CmsSetupTestResult { 036 037 /** Test passed flag. */ 038 private boolean m_green; 039 040 /** A string offering some help in case a test failed.<p> */ 041 private String m_help; 042 043 /** A info string for the test result.<p> */ 044 private String m_info; 045 046 /** The clear text name of the test.<p> */ 047 private String m_name; 048 049 /** Test failed flag. */ 050 private boolean m_red; 051 052 /** A string describing the result of the test.<p> */ 053 private String m_result; 054 055 /** Test warning flag. */ 056 private boolean m_yellow; 057 058 /** 059 * Creates a new setup test result.<p> 060 * 061 * @param test the test to keep track of 062 */ 063 public CmsSetupTestResult(I_CmsSetupTest test) { 064 065 super(); 066 067 setGreen(); 068 setName(test.getName()); 069 setInfo(""); 070 setResult(""); 071 setHelp(""); 072 } 073 074 /** 075 * Returns the help string what to do if a test failed.<p> 076 * This string will be displayed in a help bubble.<p> 077 * 078 * @return the help string what to do if a test failed 079 */ 080 public String getHelp() { 081 082 return m_help; 083 } 084 085 /** 086 * Returns the description of the test, e.g. "Test xy failed due to...".<p> 087 * 088 * @return the description of the test 089 */ 090 public String getInfo() { 091 092 return m_info; 093 } 094 095 /** 096 * Returns the name of the test, e.g. "Operating system test".<p> 097 * 098 * @return the name of the test 099 */ 100 public String getName() { 101 102 return m_name; 103 } 104 105 /** 106 * Returns the result of the test, e.g. "Detected Apache Tomcat/4.1.24...".<p> 107 * 108 * @return the result of the test 109 */ 110 public String getResult() { 111 112 return m_result; 113 } 114 115 /** 116 * Returns true, if the conditions the test were fulfilled.<p> 117 * 118 * @return true, if the conditions the test were fulfilled 119 */ 120 public boolean isGreen() { 121 122 return m_green; 123 } 124 125 /** 126 * Returns true if the test found a violated condition. 127 * It is assumed that it will be impossible to run OpenCms.<p> 128 * 129 * @return true if the test found a violated a condition 130 */ 131 public boolean isRed() { 132 133 return m_red; 134 } 135 136 /** 137 * Returns true if the test found a questionable condition. 138 * It is possible that OpenCms will not run.<p> 139 * 140 * @return true if the test found a questionable condition 141 */ 142 public boolean isYellow() { 143 144 return m_yellow; 145 } 146 147 /** 148 * Sets if the conditions in the test were fulfilled.<p> 149 */ 150 protected void setGreen() { 151 152 m_green = true; 153 m_red = false; 154 m_yellow = false; 155 } 156 157 /** 158 * Sets the help string what to do if a test failed.<p> 159 * This string will be displayed in a help bubble.<p> 160 * 161 * @param help the help string what to do if a test failed 162 */ 163 protected void setHelp(String help) { 164 165 m_help = help; 166 } 167 168 /** 169 * Sets the description of the test, e.g. "Test xy failed due to...".<p> 170 * 171 * @param info the description of the test 172 */ 173 protected void setInfo(String info) { 174 175 m_info = info; 176 } 177 178 /** 179 * Sets the name of the test, e.g. "Operating system test".<p> 180 * 181 * @param name the name of the test 182 */ 183 protected void setName(String name) { 184 185 m_name = name; 186 } 187 188 /** 189 * Sets if the test found a violated condition.<p> 190 */ 191 protected void setRed() { 192 193 m_green = false; 194 m_red = true; 195 m_yellow = false; 196 } 197 198 /** 199 * Sets the result of the test, e.g. "Detected Apache Tomcat/4.1.24...".<p> 200 * 201 * @param result the result of the test 202 */ 203 protected void setResult(String result) { 204 205 m_result = result; 206 } 207 208 /** 209 * Sets if the test found a questionable condition.<p> 210 */ 211 protected void setYellow() { 212 213 m_green = false; 214 m_red = false; 215 m_yellow = true; 216 } 217}