Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
okw.log.log2html.Log2HTML Maven / Gradle / Ivy
/*
==============================================================================
Author: Zoltán Hrabovszki
Copyright © 2012 - 2020, IT-Beratung Hrabovszki
www.OpenKeyWord.de
==============================================================================
This file is part of OpenKeyWord.
OpenKeyWord is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenKeyWord is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenKeyWord. If not, see .
Diese Datei ist Teil von OpenKeyWord.
OpenKeyWord ist Freie Software: Sie können es unter den Bedingungen
der GNU General Public License, wie von der Free Software Foundation,
Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
veröffentlichten Version, weiterverbreiten und/oder modifizieren.
OpenKeyWord wird in der Hoffnung, dass es nützlich sein wird, aber
OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
Siehe die GNU General Public License für weitere Details.
Sie sollten eine Kopie der GNU General Public License zusammen mit
OpenKeyWord erhalten haben. Wenn nicht, siehe .
*/
package okw.log.log2html;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.List;
import java.util.Locale;
import java.util.Stack;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import okw.log.ILogger;
// http://www.java-blog-buch.de/d-plugin-entwicklung-in-java/
public class Log2HTML extends LogBaseNode implements ILogger
{
// Das ist das Root-Objekt, der Pointer wird im Konstruktor zuerst auf den root/Wurzel gesetzt,
// LogBase Point2LogObject;
private Stack Pointer2LogBaseStack = new Stack();
// name des Features, welches hier getestet wird.
private String name = "";
// result - das Ergebniss des Features welche hier representiert wird.
private String result = ""; // mögliche Werte "success"
public Log2HTML()
{
this.myDuration.startTimer();
Pointer2LogBaseStack.push(this);
}
public Log2HTML( String featereName )
{
this.myDuration.startTimer();;
this.name = featereName;
Pointer2LogBaseStack.push(this);
}
public void LogPass(String fpsMessage)
{
AllCount++;
Pointer2LogBaseStack.peek().myLogs.add( new LogPass(Pointer2LogBaseStack.peek(), fpsMessage) );
}
public void LogPrint(String fpsMessage)
{
AllCount++;
Pointer2LogBaseStack.peek().myLogs.add( new LogPrint(Pointer2LogBaseStack.peek(), fpsMessage) );
}
public void LogPrintDebug( String fpsMessage )
{
AllCount++;
Pointer2LogBaseStack.peek().myLogs.add( new LogPrintDebug(Pointer2LogBaseStack.peek(), fpsMessage) );
}
public void LogWarning(String fpsMessage)
{
AllCount++;
Pointer2LogBaseStack.peek().myLogs.add( new LogWarning(Pointer2LogBaseStack.peek(), fpsMessage) );
}
public void LogError(String fpsMessage)
{
AllCount++;
Pointer2LogBaseStack.peek().myLogs.add( new LogError(Pointer2LogBaseStack.peek(), fpsMessage) );
}
public void LogException(String fpsMessage)
{
AllCount++;
Pointer2LogBaseStack.peek().myLogs.add( new LogException(Pointer2LogBaseStack.peek(), fpsMessage) );
}
public void LogSourceLocation( String Start, String End, String featureName, String sourceType )
{
AllCount++;
Pointer2LogBaseStack.peek().myLogs.add( new LogSourceLocation(Pointer2LogBaseStack.peek(), Start, End, featureName, sourceType) );
}
public void LogFunctionStart(String fps_FunctionName, String... fpsParameter)
{
AllCount++;
LogBase myLog = new LogFunction( Pointer2LogBaseStack.peek(), fps_FunctionName, fpsParameter);
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add(myLog);
Pointer2LogBaseStack.push(myLog);
}
public void LogFunctionStartDebug( String fps_FunctionName, String... fpsParameter )
{
AllCount++;
LogBase myLog = new LogFunctionDebug( Pointer2LogBaseStack.peek(), fps_FunctionName, fpsParameter);
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add(myLog);
Pointer2LogBaseStack.push(myLog);
}
public void LogFunctionEnd()
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogFunction myLogFunction = (LogFunction)myLog;
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogFunctionEndDebug()
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogFunctionDebug myLogFunction = (LogFunctionDebug)myLog;
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogFunctionEndDebug( Boolean fpb_Return )
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
LogFunctionDebug myLogFunction = (LogFunctionDebug)myLog;
myLogFunction.setReturn( fpb_Return.toString());
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogFunctionEnd(Boolean Return)
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
LogFunction myLogFunction = (LogFunction)myLog;
myLogFunction.setReturn( Return.toString());
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogFunctionEnd( String fps_Return )
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
LogFunction myLogFunction = (LogFunction)myLog;
myLogFunction.setReturn( fps_Return);
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogFunctionEndDebug( String fps_Return )
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
LogFunctionDebug myLogFunction = (LogFunctionDebug)myLog;
myLogFunction.setReturn( fps_Return);
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogFunctionEnd( List fps_Return )
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
LogFunction myLogFunction = (LogFunction)myLog;
// TODO: ein ResultListstring hier einhängen
myLogFunction.setReturn( fps_Return.toString());
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogFunctionEndDebug( List fps_Return )
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
LogFunctionDebug myLogFunction = (LogFunctionDebug)myLog;
// TODO: ein ResultListstring hier einhängen
myLogFunction.setReturn( fps_Return.toString());
if ( !(myLog.bError || myLog.bException) )
{
FunctionPass++;
}
}
public void LogTestcaseStart(String fps_FunctionName)
{
AllCount++;
StopAllTimerAndEmptyStack();
Pointer2LogBaseStack.push( this );
LogBase myLog = new LogTestcase( Pointer2LogBaseStack.peek(), fps_FunctionName);
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add(myLog);
Pointer2LogBaseStack.push(myLog);
}
public void LogTestcaseEnd()
{
LogBase myLog = Pointer2LogBaseStack.pop();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogTestcase myCheck = (LogTestcase)myLog;
if ( !(myLog.bError || myLog.bException))
{
TestcasePass++;
}
StopAllTimerAndEmptyStack();
}
public void LogKeyWordStart(String fps_FunctionName, String... fpsParameter)
{
AllCount++;
LogBase myLog = new LogKeyword( Pointer2LogBaseStack.peek(), fps_FunctionName, fpsParameter);
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add(myLog);
Pointer2LogBaseStack.push(myLog);
}
public void LogKeyWordEnd()
{
LogBase myLog = Pointer2LogBaseStack.peek();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogKeyword myCheck = (LogKeyword)myLog;
if ( !(myLog.bError || myLog.bException))
{
myLog.KeyWordPass( );
}
Pointer2LogBaseStack.pop();
}
public void LogLocalACCallStart( String sourceExcerpt, String Type )
{
AllCount++;
LogBase myLog = new LogLocalACCall( Pointer2LogBaseStack.peek(), sourceExcerpt, Type );
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add(myLog);
Pointer2LogBaseStack.push(myLog);
}
public void LogLocalACCallEnd()
{
LogBase myLog = Pointer2LogBaseStack.peek();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogLocalACCall myCheck = (LogLocalACCall)myLog;
if ( !(myLog.bError || myLog.bException))
{
myLog.LocalACCallPass( );
}
Pointer2LogBaseStack.pop();
}
/**
* \~german
* Log markiert den Start eines Steps.
*
* Das ist ein [Harmony](https://cloud.4test.io/). spezifischer log
* und ist für den Code-Compiler von Harmony Reserviert
*
* @param categoryName Name der Kategorie (category)
* @param choiceValue Choice, also der zugeordnetter Wert der Categorie
* @param featureName
* @param localCategoryName Lokalar Name der Kategorie
* @param sourceExcerpt ist der Auszug, von der dieser Schritt abgeleitet wurde
*
* \~english
* Log marks the start of a step.
*
* Das ist ein [Harmony](https://cloud.4test.io/). spezifischer log
* und ist für den Code-Compiler von Harmony Reserviert
*
* @param categoryName Category name
* @param choiceValue Choice, i.e. the assigned value of the category
* @param featureName Feature Name
* @param localCategoryName Local name of category
* @param sourceExcerpt is the excerpt from which this step was derived
*
* \~
* @author Zoltán Hrabovszki
* \date 2019-08-05
*/
public void LogStepStart( String categoryName, String categoryType,
String choiceValue, String featureName,
String localCategoryName, String sourceExcerpt,
String type )
{
AllCount++;
LogBase myLog = new LogStep( Pointer2LogBaseStack.peek(), categoryName, categoryType, choiceValue, featureName, localCategoryName, sourceExcerpt, type );
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add( myLog );
Pointer2LogBaseStack.push( myLog );
}
public void LogStepEnd()
{
LogBase myLog = Pointer2LogBaseStack.peek();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogStep myCheck = (LogStep)myLog;
if ( !(myLog.bError || myLog.bException))
{
StepPass++;
}
Pointer2LogBaseStack.pop();
}
public void LogRemoteACCallStart( String sourceExcerpt, String Type )
{
AllCount++;
LogBase myLog = new LogRemoteACCall( Pointer2LogBaseStack.peek(), sourceExcerpt, Type );
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add(myLog);
Pointer2LogBaseStack.push(myLog);
}
public void LogRemoteACCallEnd()
{
LogBase myLog = Pointer2LogBaseStack.peek();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogRemoteACCall myCheck = (LogRemoteACCall)myLog;
if ( !(myLog.bError || myLog.bException))
{
StepPass++;
}
Pointer2LogBaseStack.pop();
}
public void LogSequenceStart( String fpsKeywordName, String fpsWindowFN, String fpsSequenceName, String... fpsParameter)
{
AllCount++;
LogBase myLog = new LogSequence( Pointer2LogBaseStack.peek(), fpsWindowFN, fpsSequenceName, fpsParameter);
// Timer starten
myLog.myDuration.startTimer();
Pointer2LogBaseStack.peek().myLogs.add(myLog);
Pointer2LogBaseStack.push(myLog);
}
public void LogSequenceEnd()
{
LogBase myLog = Pointer2LogBaseStack.peek();
// Timer Stoppen...
myLog.myDuration.stopTimer();
@SuppressWarnings( "unused" )
LogSequence myCheck = (LogSequence)myLog;
if ( !(myLog.bError || myLog.bException))
{
myLog.SequencePass();
}
Pointer2LogBaseStack.pop();
}
private String getHTMLFooter()
{
StringBuilder myResult = new StringBuilder();
myResult.append("