OpenKeyWord  Build_ID: 457, Datum: 01.02.2020 07:45:48
Dont repeat yourself. - Do it once and only once!
LogBaseLeaf.java
1 package okw.log.log2html;
2 
3 public class LogBaseLeaf extends LogBase
4 {
5  // Statistics of a Node
6 
7  protected Integer ErrorCount = 0;
8  protected Integer ExceptionCount = 0;
9  protected Integer WarningCount = 0;
10  protected Integer PassedCount = 0;
11  protected Integer PrintCount = 0;
12 
13  public LogBaseLeaf( )
14  {
15  }
16 
17 
18  public LogBaseLeaf( LogBase Parent )
19  {
20  setParent(Parent);
21  myID = AllCount;
22  }
23 
24  protected Boolean bWarning = false;
25 
26  protected void setWarning()
27  {
28  if (!bWarning)
29  {
30  bWarning = true;
31 
32 
33  if (myParent != null)
34  {
35  myParent.setWarning();
36  }
37  }
38  }
39 
40  protected Boolean getWarning()
41  {
42  return bWarning;
43  }
44 
45 
46  protected Boolean bException = false;
47 
48  protected void setException()
49  {
50  if (!bException)
51  {
52  //SetFail();
53  bException = true;
54 
55  if (myParent != null)
56  {
57  myParent.setException();
58  }
59  }
60  }
61 
62 
63  protected Boolean getException()
64  {
65  return bException;
66  }
67 
68 
69  protected Boolean bError = false;
70 
71  protected void setError()
72  {
73  if (!bError)
74  {
75  // SetFail();
76  bError = true;
77 
78  if (myParent != null)
79  {
80  myParent.setError();
81  }
82  }
83  }
84 
85  protected Boolean getError()
86  {
87  return bError;
88  }
89 
90 
91  public void reset()
92  {
93  AllCount = 0;
94  myID = 0;
95 
96  // Global Statistics
97  ErrorCount = 0;
98  ExceptionCount = 0;
99  WarningCount = 0;
100  PassedCount = 0;
101  PrintCount = 0;
102  }
103 
104 
105  // Node Statistics
106  @Override
107  protected void ErrorCount()
108  {
109  ErrorCount++;
110  bError = true;
111 
112  if ( myParent != null )
113  {
114  myParent.ErrorCount();
115  }
116  }
117 
118  @Override
119  protected void ExceptionCount()
120  {
121  ExceptionCount++;
122  this.bException = true;
123 
124  if ( myParent != null )
125  {
126  myParent.ExceptionCount();
127  }
128  }
129 
130  @Override
131  protected void WarningCount()
132  {
133  WarningCount++;
134  this.bWarning = true;
135 
136  if ( myParent != null )
137  {
138  myParent.WarningCount();
139  }
140  }
141 
142  @Override
143  protected void PassedCount()
144  {
145  PassedCount++;
146 
147  if ( myParent != null )
148  {
149  myParent.PassedCount();
150  }
151  }
152 
153  @Override
154  protected void PrintCount()
155  {
156  PrintCount++;
157 
158  if ( myParent != null )
159  {
160  myParent.PrintCount();
161  }
162  }
163 
164  @Override
165  protected void TestcaseCount()
166  {
167  }
168 
169  @Override
170  protected void TestcaseFail()
171  {
172  }
173 
174  @Override
175  protected void TestcasePass()
176  {
177  }
178 
179  @Override
180  protected void FunctionCount()
181  {
182  }
183 
184  @Override
185  protected void FunctionFail()
186  {
187  }
188 
189  @Override
190  protected void FunctionPass()
191  {
192  }
193 
194  @Override
195  protected void KeyWordCount()
196  {
197  }
198 
199  @Override
200  protected void KeyWordFail()
201  {
202  }
203 
204  @Override
205  protected void KeyWordPass()
206  {
207  }
208 
209  @Override
210  protected void SequenceCount()
211  {
212  }
213 
214  @Override
215  protected void SequenceFail()
216  {
217  }
218 
219  @Override
220  protected void SequencePass()
221  {
222  }
223 
224 
225  @Override
226  protected void StepCount()
227  {
228  }
229 
230  @Override
231  protected void StepFail()
232  {
233  }
234 
235  @Override
236  protected void StepPass()
237  {
238  }
239 
240  // LocalACCall
241  @Override
242  protected void LocalACCallCount()
243  {
244  }
245 
246  @Override
247  protected void LocalACCallFail()
248  {
249  }
250 
251  @Override
252  protected void LocalACCallPass()
253  {
254  }
255 
256  // RemoteACCall
257  @Override
258  protected void RemoteACCallCount()
259  {
260  }
261 
262  @Override
263  protected void RemoteACCallFail()
264  {
265  }
266 
267  @Override
268  protected void RemoteACCallPass()
269  {
270  }
271 
272 
273  protected String getJSONStatistics()
274  {
275  StringBuilder myJSON = new StringBuilder();
276 
277  // local Statistics
278  myJSON.append( this.jsonElement( "ErrorCount", this.ErrorCount ) );
279  myJSON.append( this.jsonElement( "ExceptionCount", this.ExceptionCount ) );
280  myJSON.append( this.jsonElement( "WarningCount", this.WarningCount ) );
281  myJSON.append( this.jsonElement( "PassedCount", this.PassedCount ) );
282  myJSON.append( this.jsonElement( "PrintCount", this.PrintCount ) );
283 
284  return myJSON.toString();
285  }
286 
287 
288  protected String getJSONResult()
289  {
290 
291  StringBuilder myJSON = new StringBuilder();
292 
293  // Statistics...
294  myJSON.append( this.jsonArray( "statistics", this.getJSONStatistics() ) );
295 
296  // Timer:
297  // Für den Test wird das Abgeschaltet, weil veränderlich
298  if ( "false".equals( okw.OKW_Properties.getInstance().getProperty( "Log2HTML.Test", "false" ) ) )
299  {
300  myJSON.append( this.jsonElement( "Start time", this.myDuration.getStartTime() ) );
301  myJSON.append( this.jsonElement( "End time", this.myDuration.getEndTime() ) );
302  myJSON.append( this.jsonElement( "duration", this.myDuration.getSeconds("#0.000") ) );
303  }
304  else
305  {
306  myJSON.append( this.jsonElement( "Start time", "Start time TestMode" ) );
307  myJSON.append( this.jsonElement( "End time", "End time TestMode" ) );
308  myJSON.append( this.jsonElement( "duration", "Duration TestMode" ) );
309  }
310 
311 
312  Integer EC = 0;
313 
314  for( LogBase myLog: this.myLogs )
315  {
316  EC++;
317  // String Element = myLog.getClass().getSimpleName();
318  myJSON.append( this.jsonArrayElement( myLog.getJSONResult() ) );
319  }
320 
321  return myJSON.toString();
322  }
323 }
okw.log.log2html.LogBase
Definition: LogBase.java:7
okw.log.log2html.LogBaseLeaf
Definition: LogBaseLeaf.java:3