Class 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
    • Constructor Detail

      • MapperBase

        public MapperBase​(Integer build,
                          Boolean truncateStrings)
    • Method Detail

      • 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 detected
        FileNotFoundException - If file not found
        com.google.gson.JsonIOException - If I/O errors occur
        com.google.gson.JsonSyntaxException - If JSON syntax invalid
        IOException
      • 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 imported
        detected - Key characteristics about the set of results
        Throws:
        NullPointerException - If null pointer detected
        FileNotFoundException - If file not found
        com.google.gson.JsonIOException - If I/O errors occur
        com.google.gson.JsonSyntaxException - If JSON syntax invalid
        IOException
      • exportToFile

        public boolean exportToFile​(String outputFile,
                                    String job,
                                    int build)
        Export data to Jenkins stored file
        Parameters:
        outputFile - Output file
        job - Job name
        build - 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
      • exportCondensedToFile

        public boolean exportCondensedToFile​(String outputFile,
                                             String job,
                                             int build)
        Export condensed results to file
        Parameters:
        outputFile - Output file
        job - Job name
        build - 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()
      • getDecimalSeparator

        public char getDecimalSeparator()
      • getBuild

        public Integer getBuild()