OpenKeyWord  Build_ID: 457, Datum: 01.02.2020 07:45:48
Dont repeat yourself. - Do it once and only once!
LogBaseNode.java
1 package okw.log.log2html;
2 
3 public class LogBaseNode 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  protected Integer TestcaseCount = 0;
14  protected Integer TestcaseFail = 0;
15  protected Integer TestcasePass = 0;
16 
17  protected Integer FunctionCount = 0;
18  protected Integer FunctionFail = 0;
19  protected Integer FunctionPass = 0;
20 
21  protected Integer KeyWordCount = 0;
22  protected Integer KeyWordFail = 0;
23  protected Integer KeyWordPass = 0;
24 
25  protected Integer StepCount = 0;
26  protected Integer StepFail = 0;
27  protected Integer StepPass = 0;
28 
29  protected Integer SequenceCount = 0;
30  protected Integer SequenceFail = 0;
31  protected Integer SequencePass = 0;
32 
33  // RemoteACCall
34  protected Integer RemoteACCallCount = 0;
35  protected Integer RemoteACCallFail = 0;
36  protected Integer RemoteACCallPass = 0;
37 
38  // LocalACCall
39  protected Integer LocalACCallCount = 0;
40  protected Integer LocalACCallFail = 0;
41  protected Integer LocalACCallPass = 0;
42 
43 
44  public LogBaseNode( )
45  {
46  }
47 
48 
49  public LogBaseNode( LogBase Parent )
50  {
51  setParent(Parent);
52  myID = AllCount;
53  }
54 
55  public void reset()
56  {
57  AllCount = 0;
58  myID = 0;
59 
60  // Global Statistics
61  ErrorCount = 0;
62  ExceptionCount = 0;
63  WarningCount = 0;
64  PassedCount = 0;
65  PrintCount = 0;
66 
67  TestcaseCount = 0;
68  TestcaseFail = 0;
69  TestcasePass = 0;
70 
71  FunctionCount = 0;
72  FunctionFail = 0;
73  FunctionPass = 0;
74 
75  KeyWordCount = 0;
76  KeyWordFail = 0;
77  KeyWordPass = 0;
78 
79  SequenceCount = 0;
80  SequenceFail = 0;
81  SequencePass = 0;
82 
83  // LocalACCall
84  StepCount = 0;
85  StepFail = 0;
86  StepPass = 0;
87 
88  // LocalACCall
89  LocalACCallCount = 0;
90  LocalACCallFail = 0;
91  LocalACCallPass = 0;
92 
93  // RemoteACCall
94  RemoteACCallCount = 0;
95  RemoteACCallFail = 0;
96  RemoteACCallPass = 0;
97 
98  PrintCount = 0;
99  }
100 
101 
102  // Node Statistics
103  protected void ErrorCount()
104  {
105  ErrorCount++;
106  bError = true;
107 
108  if ( myParent != null )
109  {
110  myParent.ErrorCount();
111  }
112  }
113 
114  protected void ExceptionCount()
115  {
116  ExceptionCount++;
117  this.bException = true;
118 
119  if ( myParent != null )
120  {
121  myParent.ExceptionCount();
122  }
123  }
124 
125  protected void WarningCount()
126  {
127  WarningCount++;
128  this.bWarning = true;
129 
130  if ( myParent != null )
131  {
132  myParent.WarningCount();
133  }
134  }
135 
136  protected void PassedCount()
137  {
138  PassedCount++;
139 
140  if ( myParent != null )
141  {
142  myParent.PassedCount();
143  }
144  }
145 
146  protected void PrintCount()
147  {
148  PrintCount++;
149 
150  if ( myParent != null )
151  {
152  myParent.PrintCount();
153  }
154  }
155 
156  @Override
157  protected void TestcaseCount()
158  {
159  this.TestcaseCount++;
160  myParent.TestcaseCount();
161  }
162 
163  @Override
164  protected void TestcaseFail()
165  {
166  this.TestcaseFail++;
167  myParent.TestcaseFail();
168  }
169 
170  @Override
171  protected void TestcasePass()
172  {
173  this.TestcasePass++;
174  myParent.TestcasePass();
175  }
176 
177  @Override
178  protected void FunctionCount()
179  {
180  this.FunctionCount++;
181  myParent.FunctionCount();
182  }
183 
184  @Override
185  protected void FunctionFail()
186  {
187  this.FunctionFail++;
188  myParent.FunctionFail();
189  }
190 
191  @Override
192  protected void FunctionPass()
193  {
194  this.FunctionPass++;
195  myParent.FunctionPass();
196  }
197 
198  @Override
199  protected void KeyWordCount()
200  {
201  this.KeyWordCount++;
202  myParent.KeyWordCount();
203  }
204 
205  @Override
206  protected void KeyWordFail()
207  {
208  this.KeyWordFail++;
209  myParent.KeyWordFail();
210  }
211 
212  @Override
213  protected void KeyWordPass()
214  {
215  this.KeyWordPass++;
216  myParent.KeyWordPass();
217  }
218 
219  @Override
220  protected void SequenceCount()
221  {
222  this.SequenceCount++;
223  myParent.SequenceCount();
224  }
225 
226  @Override
227  protected void SequenceFail()
228  {
229  this.SequenceFail++;
230  myParent.SequenceFail();
231  }
232 
233  @Override
234  protected void SequencePass()
235  {
236  this.SequencePass++;
237  myParent.SequencePass();
238  }
239 
240  @Override
241  protected void StepCount()
242  {
243  this.StepCount++;
244  myParent.StepCount();
245  }
246 
247  @Override
248  protected void StepFail()
249  {
250  this.StepFail++;
251  myParent.StepFail();
252  }
253 
254  @Override
255  protected void StepPass()
256  {
257  this.StepPass++;
258  myParent.StepPass();
259  }
260 
261  @Override
262  protected void LocalACCallCount()
263  {
264  this.LocalACCallCount++;
265  myParent.LocalACCallCount();
266  }
267 
268  @Override
269  protected void LocalACCallFail()
270  {
271  this.LocalACCallFail++;
272  myParent.LocalACCallFail();
273  }
274 
275  @Override
276  protected void LocalACCallPass()
277  {
278  this.LocalACCallPass++;
279  myParent.LocalACCallPass();
280  }
281 
282  @Override
283  protected void RemoteACCallCount()
284  {
285  this.RemoteACCallCount++;
286  myParent.RemoteACCallCount();
287  }
288 
289  @Override
290  protected void RemoteACCallFail()
291  {
292  this.RemoteACCallFail++;
293  myParent.RemoteACCallFail();
294  }
295 
296  @Override
297  protected void RemoteACCallPass()
298  {
299  this.RemoteACCallPass++;
300  myParent.RemoteACCallPass();
301  }
302 
303 
304  protected String getJSONStatistics()
305  {
306  StringBuilder myJSON = new StringBuilder();
307 
308  // local Statistics
309  myJSON.append( this.jsonElementComma( "ErrorCount", this.ErrorCount ) );
310  myJSON.append( this.jsonElementComma( "ExceptionCount", this.ExceptionCount ) );
311  myJSON.append( this.jsonElementComma( "WarningCount", this.WarningCount ) );
312  myJSON.append( this.jsonElementComma( "PassedCount", this.PassedCount ) );
313  myJSON.append( this.jsonElementComma( "PrintCount", this.PrintCount ) );
314 
315  myJSON.append( this.jsonElementComma( "FunctionCount", this.FunctionCount ) );
316  myJSON.append( this.jsonElementComma( "FunctionFail", this.FunctionFail ) );
317  myJSON.append( this.jsonElementComma( "FunctionPass", this.FunctionPass ) );
318 
319  myJSON.append( this.jsonElementComma( "SequenceCount", this.SequenceCount ) );
320  myJSON.append( this.jsonElementComma( "SequenceFail", this.SequenceFail ) );
321  myJSON.append( this.jsonElementComma( "SequencePass", this.SequencePass ) );
322 
323  myJSON.append( this.jsonElementComma( "LocalACCallCount", this.LocalACCallCount ) );
324  myJSON.append( this.jsonElementComma( "LocalACCallFail", this.LocalACCallFail ) );
325  myJSON.append( this.jsonElementComma( "LocalACCallPass", this.LocalACCallPass ) );
326 
327  myJSON.append( this.jsonElementComma( "RemoteACCallCount", this.RemoteACCallCount ) );
328  myJSON.append( this.jsonElementComma( "RemoteACCallFail", this.RemoteACCallFail ) );
329  myJSON.append( this.jsonElementComma( "RemoteACCallPass", this.RemoteACCallPass ) );
330 
331  myJSON.append( this.jsonElementComma( "StepCount", this.StepCount ) );
332  myJSON.append( this.jsonElementComma( "StepFail", this.StepFail ) );
333  myJSON.append( this.jsonElementComma( "StepPass", this.StepPass ) );
334 
335  myJSON.append( this.jsonElementComma( "KeyWordCount", this.KeyWordCount ) );
336  myJSON.append( this.jsonElementComma( "KeyWordFail", this.KeyWordFail ) );
337  myJSON.append( this.jsonElementComma( "KeyWordPass", this.KeyWordPass ) );
338 
339  // Timer:
340  // Für den Test wird das Abgeschaltet, weil veränderlich
341  if ( "false".equals( okw.OKW_Properties.getInstance().getProperty( "Log2HTML.Test", "false" ) ) )
342  {
343  myJSON.append( this.jsonElementComma( "startedAt", this.myDuration.getStartTimeMillis().toString() ) );
344  myJSON.append( this.jsonElementComma( "finishedAt", this.myDuration.getEndTimeMillis().toString() ) );
345  myJSON.append( this.jsonElement( "duration", this.myDuration.getSeconds("#0.000") ) );
346  }
347  else
348  {
349  myJSON.append( this.jsonElementComma( "startedAt", "Start time TestMode" ) );
350  myJSON.append( this.jsonElementComma( "finishedAt", "End time TestMode" ) );
351  myJSON.append( this.jsonElement( "duration", "Duration TestMode" ) );
352  }
353 
354  return myJSON.toString();
355  }
356 
357  protected String getJSONNodeProperties()
358  {
359  StringBuilder myJSON = new StringBuilder();
360 
361  myJSON.append(this.jsonElementComma( "info", this.Info ));
362 
363  return myJSON.toString();
364  }
365 
366  protected String getJSONResult()
367  {
368 
369  StringBuilder myJSON = new StringBuilder();
370  StringBuilder myJSONForLoop = new StringBuilder();
371 
372  myJSON.append( this.getJSONNodeProperties() );
373 
374  // Statistics...
375  myJSON.append( this.jsonStructure( "statistics", this.getJSONStatistics() ) );
376 
377  Boolean GreaterOne = false;
378 
379  for( LogBase myLog: this.myLogs )
380  {
381  if (GreaterOne) myJSONForLoop.append( ", " );
382  else GreaterOne = true;
383  myJSONForLoop.append( this.jsonArrayElement( myLog.getJSONResult() ) ) ;
384 
385  }
386 
387  if (GreaterOne) myJSON.append( ", " + this.jsonArray( "elements", myJSONForLoop.toString() ) );
388 
389  return myJSON.toString();
390  }
391 }
okw.log.log2html.LogBaseNode
Definition: LogBaseNode.java:3
okw.log.log2html.LogBase
Definition: LogBase.java:7