KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > verifier > Result


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.admin.verifier;
24
25 import java.util.*;
26 import com.sun.enterprise.util.LocalStringManagerImpl;
27
28 public class Result {
29
30     public static final int PASSED = 0;
31     public static final int FAILED = 1;
32     public static final int WARNING = 2;
33     public static final int NOT_APPLICABLE = 3;
34     public static final int NOT_RUN = 4;
35     public static final int NOT_IMPLEMENTED = 5;
36     private int status = NOT_RUN;
37     private String JavaDoc componentName;
38     private String JavaDoc assertion;
39     private String JavaDoc testName;
40     private Vector errorDetails = new Vector();
41     private Vector goodDetails = new Vector();
42     private Vector warningDetails = new Vector();
43     private Vector naDetails = new Vector();
44     //boolean debug = Verifier.getDebug();
45
boolean debug = false;
46
47     /**
48      * Result Constructor
49      *
50      */

51     public void Result(){
52     }
53
54
55     /**
56      * Initialize the Result object
57      *
58      * @param c Class of the current test/assertion
59      */

60     public void init(Class JavaDoc c){
61     //setAssertion(StringManagerHelper.getLocalStringsManager().getLocalString((c.getName() + ".assertion"), ""));
62
String JavaDoc this_package = "com.sun.enterprise.admin.verifier.";
63         //START OF IASRI 4686336 verifier tool for S1AS
64
if(c.getName().indexOf("com.iplanet.ias")!=-1)
65             this_package = "com.sun.enterprise.admin.verifier.";
66         //END OF IASRI 4686336
67
setTestName(c.getName().substring(this_package.length()));
68     }
69
70     /**
71      * Store passed info
72      *
73      * @param detail Details of passed test
74      */

75     public void passed(String JavaDoc detail){
76     setStatus(PASSED);
77     addGoodDetails(detail);
78     }
79
80     /**
81      * Store warning info
82      *
83      * @param detail Details of warning test
84      */

85     public void warning(String JavaDoc detail){
86     setStatus(WARNING);
87     addWarningDetails(detail);
88     }
89
90     /**
91      * Store Not Applicable info
92      *
93      * @param detail Details of not applicable test
94      */

95     public void notApplicable(String JavaDoc detail){
96     setStatus(NOT_APPLICABLE);
97     addNaDetails(detail);
98     }
99
100     /**
101      * Store Failed info
102      *
103      * @param detail Details of failed test
104      */

105     public void failed(String JavaDoc detail){
106     setStatus(FAILED);
107     addErrorDetails(detail);
108     }
109
110     /**
111      * Retrieve Not Applicable details
112      *
113      * @return <code>Vector</code> not applicable details
114      */

115     public Vector getNaDetails(){
116     return naDetails;
117     }
118
119     /**
120      * Retrieve Warning details
121      *
122      * @return <code>Vector</code> warning details
123      */

124     public Vector getWarningDetails(){
125     return warningDetails;
126     }
127
128     /**
129      * Retrieve Not Applicable details
130      *
131      * @param s not applicable details
132      */

133     public void addNaDetails(String JavaDoc s){
134     naDetails.addElement(s);
135     if (debug) {
136         System.out.println (s);
137         }
138     }
139
140     /**
141      * Retrieve Good details
142      *
143      * @return <code>Vector</code> good details
144      */

145     public Vector getGoodDetails(){
146     return goodDetails;
147     }
148
149     /**
150      * Fill in Good details
151      *
152      * @param s good detail string
153      */

154     public void addGoodDetails(String JavaDoc s){
155     goodDetails.addElement(s);
156     if (debug)
157         System.out.println (s);
158     }
159
160     /**
161      * Fill in Warning details
162      *
163      * @param s warning detail string
164      */

165     public void addWarningDetails(String JavaDoc s){
166     warningDetails.addElement(s);
167     if (debug)
168         System.out.println (s);
169     }
170
171     /**
172      * Retrieve Error details
173      *
174      * @return <code>Vector</code> error details
175      */

176     public Vector getErrorDetails(){
177     return errorDetails;
178     }
179
180     /**
181      * Fill in Error details
182      *
183      * @param s error detail string
184      */

185     public void addErrorDetails(String JavaDoc s){
186     errorDetails.addElement(s);
187     if (debug)
188         System.out.println (s);
189     }
190
191     /**
192      * Retrieve test result status
193      *
194      * @return <code>int</code> test result status
195      */

196     public int getStatus(){
197     return status;
198     }
199
200     /**
201      * Set test result status
202      *
203      * @param s test result status
204      */

205     public void setStatus(int s){
206     status = s;
207     }
208
209     /**
210      * Retrieve assertion
211      *
212      * @return <code>String</code> assertion string
213      */

214     public String JavaDoc getAssertion(){
215     return assertion;
216     }
217
218     /**
219      * Set assertion
220      *
221      * @param s assertion string
222      */

223     public void setAssertion(String JavaDoc s){
224     assertion = s;
225     }
226
227     /**
228      * Retrieve component/module name
229      *
230      * @return <code>String</code> component/module name
231      */

232     public String JavaDoc getComponentName(){
233     return componentName;
234     }
235
236     /**
237      * Set component/module name
238      *
239      * @param s component/module name
240      */

241     public void setComponentName(String JavaDoc s){
242     componentName = s;
243     }
244
245     /**
246      * Retrieve test name
247      *
248      * @return <code>String</code> test name
249      */

250     public String JavaDoc getTestName(){
251     return testName;
252     }
253
254     /**
255      * Set test name
256      *
257      * @param s test name
258      */

259     public void setTestName(String JavaDoc s){
260     testName = s;
261     }
262
263 } // Result class
264
Popular Tags