Class MapperBase
- java.lang.Object
-
- org.jenkinsci.plugins.benchmark.parsers.MapperBase
-
- Direct Known Subclasses:
JUnitJenkins
,MapJsonToPlugin
,MapXmlToPlugin
public class MapperBase extends Object
Base class for the mapper As-Is mapper to load the Jenkins plugin specific format As-Base mapper to load XML or JSON result format- Since:
- 6/20/2017.
- Author:
- Daniel Mercier
-
-
Field Summary
Fields Modifier and Type Field Description protected TreeSet<Integer>
builds
protected char
decimalSeparator
protected ContentDetected
detected
protected Map<Integer,TestGroup>
files
protected Map<Integer,TestGroup>
groups
protected boolean
hasHistoryThreshold
protected boolean
hasNumericResult
protected Map<Integer,TestValue>
parameters
protected Map<Integer,TestValue>
results
protected TestGroup
rootGroup
protected boolean
truncateStrings
-
Constructor Summary
Constructors Constructor Description MapperBase(Integer build, Boolean truncateStrings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllThresholds(List<? extends Threshold> thresholds)
Add a list of thresholds at the right location inside the tree.protected void
checkResult(TestValue result)
Detect if the result is a numericboolean
checkThresholds(MapperBase base)
Determine threshold for each resultsprotected void
checkThresholdType(Threshold threshold)
Detect if threshold requires historyboolean
exportCondensedToFile(String outputFile, String job, int build)
Export condensed results to fileboolean
exportToFile(String outputFile, String job, int build)
Export data to Jenkins stored fileInteger
getBuild()
TreeSet<Integer>
getBuilds()
String
getCSVCondensedTableBody()
Generate CSV table body for condensed content [CSV EXPORT]String
getCSVCondensedTableHeader()
Generate CSV table header for condensed content [CSV EXPORT]String
getCSVTableBody()
Get the CSV Table body of the raw table [CSV EXPORT]String
getCSVTableHeader()
Get the CSV Table header of the raw table [CSV EXPORT]String
getCSVTableStateBody()
Get the CSV Table body of the raw state table [CSV EXPORT]char
getDecimalSeparator()
ContentDetected
getDetected()
Map<Integer,TestGroup>
getFiles()
Map<Integer,TestGroup>
getGroups()
String
getHTMLCondensedTable()
Generate HTML table header + content [TABLE PAGE]String
getHTMLTable()
Get the HTML content to represent the result in a table [TABLE PAGE]int
getNumberOfFiles()
int
getNumberOfGroups()
int
getNumberOfParameters()
int
getNumberOfResults()
Map<Integer,TestValue>
getParameters()
Map<Integer,TestValue>
getResults()
TestGroup
getRootGroup()
void
importCondensedFromFile(File inputFile)
Import condensed results from fileboolean
importCondensedFromFile(String inputFilename)
Import condensed results from filevoid
importFromFile(File inputFile, ContentDetected detected)
Import data from Jenkins stored file using Java Filevoid
importFromFile(String inputFile)
Import data from Jenkins stored file using String filenamevoid
logKeyData(TaskListener listener, Integer numberOfAddedThresholds)
void
mergeWith(MapperBase mapper)
Merge the content from mapper into this MapperBAseboolean
requiresHistory()
Determine if active thresholds require build history to be validated.void
setBuild(Integer build)
-
-
-
Field Detail
-
rootGroup
protected final TestGroup rootGroup
-
decimalSeparator
protected final char decimalSeparator
-
truncateStrings
protected final boolean truncateStrings
-
hasNumericResult
protected boolean hasNumericResult
-
hasHistoryThreshold
protected boolean hasHistoryThreshold
-
detected
protected ContentDetected detected
-
-
Method Detail
-
mergeWith
public void mergeWith(MapperBase mapper) throws ValidationException
Merge the content from mapper into this MapperBAse- Parameters:
mapper
- to be merged in.- Throws:
ValidationException
- Validation exception
-
addAllThresholds
public void addAllThresholds(List<? extends Threshold> thresholds)
Add a list of thresholds at the right location inside the tree.- Parameters:
thresholds
- List of additional thresholds to add to the mapper content
-
checkThresholds
public boolean checkThresholds(MapperBase base)
Determine threshold for each results- Parameters:
base
- Mapper storing results to check- Returns:
- Boolean whether thresholds were crossed or not
-
importFromFile
public void importFromFile(String inputFile) throws NullPointerException, IOException, com.google.gson.JsonIOException, com.google.gson.JsonSyntaxException
Import data from Jenkins stored file using String filename- Parameters:
inputFile
- File name to be imported- Throws:
NullPointerException
- If null pointer detectedFileNotFoundException
- If file not foundcom.google.gson.JsonIOException
- If I/O errors occurcom.google.gson.JsonSyntaxException
- If JSON syntax invalidIOException
-
importFromFile
public void importFromFile(File inputFile, ContentDetected detected) throws NullPointerException, IOException, com.google.gson.JsonIOException, com.google.gson.JsonSyntaxException
Import data from Jenkins stored file using Java File- Parameters:
inputFile
- File name to be importeddetected
- Key characteristics about the set of results- Throws:
NullPointerException
- If null pointer detectedFileNotFoundException
- If file not foundcom.google.gson.JsonIOException
- If I/O errors occurcom.google.gson.JsonSyntaxException
- If JSON syntax invalidIOException
-
exportToFile
public boolean exportToFile(String outputFile, String job, int build)
Export data to Jenkins stored file- Parameters:
outputFile
- Output filejob
- Job namebuild
- Build number- Returns:
- Whether export succeeded or not
-
getHTMLTable
public String getHTMLTable()
Get the HTML content to represent the result in a table [TABLE PAGE]- Returns:
- HTML content to represent the result
-
getCSVTableHeader
public String getCSVTableHeader()
Get the CSV Table header of the raw table [CSV EXPORT]- Returns:
- CSV content to represent the result
-
getCSVTableBody
public String getCSVTableBody()
Get the CSV Table body of the raw table [CSV EXPORT]- Returns:
- CSV content to represent the result
-
getCSVTableStateBody
public String getCSVTableStateBody()
Get the CSV Table body of the raw state table [CSV EXPORT]- Returns:
- CSV content to represent the result
-
getHTMLCondensedTable
public String getHTMLCondensedTable()
Generate HTML table header + content [TABLE PAGE]- Returns:
- HTML content for condensed table
-
getCSVCondensedTableHeader
public String getCSVCondensedTableHeader()
Generate CSV table header for condensed content [CSV EXPORT]- Returns:
- CSV header content for condensed table
-
getCSVCondensedTableBody
public String getCSVCondensedTableBody()
Generate CSV table body for condensed content [CSV EXPORT]- Returns:
- CSV body content for condensed table
-
importCondensedFromFile
public boolean importCondensedFromFile(String inputFilename) throws NullPointerException, IOException, com.google.gson.JsonIOException, com.google.gson.JsonSyntaxException, ValidationException
Import condensed results from file- Parameters:
inputFilename
- File name- Returns:
- True if file detected and loaded.
- Throws:
NullPointerException
- If null pointer detectedFileNotFoundException
- If file not foundcom.google.gson.JsonIOException
- If I/O errors occurcom.google.gson.JsonSyntaxException
- If JSON syntax invalidValidationException
- If validation failedIOException
-
importCondensedFromFile
public void importCondensedFromFile(File inputFile) throws NullPointerException, IOException, com.google.gson.JsonIOException, com.google.gson.JsonSyntaxException, ValidationException
Import condensed results from file- Parameters:
inputFile
- Input file- Throws:
NullPointerException
- If null pointer detectedFileNotFoundException
- If file not foundcom.google.gson.JsonIOException
- If I/O errors occurcom.google.gson.JsonSyntaxException
- If JSON syntax invalidValidationException
- If validation failedIOException
-
exportCondensedToFile
public boolean exportCondensedToFile(String outputFile, String job, int build)
Export condensed results to file- Parameters:
outputFile
- Output filejob
- Job namebuild
- Build number- Returns:
- Whether export was successful
-
checkResult
protected void checkResult(TestValue result)
Detect if the result is a numeric- Parameters:
result
- Result to test
-
checkThresholdType
protected void checkThresholdType(Threshold threshold)
Detect if threshold requires history- Parameters:
threshold
- Threshold to test
-
requiresHistory
public boolean requiresHistory()
Determine if active thresholds require build history to be validated.- Returns:
- Whether active thresholds require build history
-
logKeyData
public void logKeyData(TaskListener listener, Integer numberOfAddedThresholds)
-
setBuild
public void setBuild(Integer build)
-
getRootGroup
public TestGroup getRootGroup()
-
getNumberOfResults
public int getNumberOfResults()
-
getNumberOfParameters
public int getNumberOfParameters()
-
getNumberOfFiles
public int getNumberOfFiles()
-
getNumberOfGroups
public int getNumberOfGroups()
-
getDetected
public ContentDetected getDetected()
-
getDecimalSeparator
public char getDecimalSeparator()
-
getBuild
public Integer getBuild()
-
-