Class CCEmptyResult

All Implemented Interfaces:
ICCBase, ICCCompareSource, ICCConstants, ICCCoverageDataBasic, ICCPercentItem, ICCResult, ICCResultInfo, ICCStatementDataBasic, ICCTreeItem

public final class CCEmptyResult extends CCAbstractTreeItem implements ICCResult, ICCResultInfo
Implementation of an empty result This implementation will always be compatible with the latest version of this API In v10.1 use CCResultsFactory.getInstance.createEmptyResult() to construct this class
Since:
9.0
  • Method Details

    • getPercentCoverage

      public int getPercentCoverage()
      Description copied from interface: ICCPercentItem
      Retrieves the percentage from the specified item
      Specified by:
      getPercentCoverage in interface ICCPercentItem
      Returns:
      the percent covered
    • getTags

      public String[] getTags()
      Description copied from interface: ICCResultInfo
      Returns an array of tags included in the merged results This returns the value(s) of the tag attribute in the included results
      Specified by:
      getTags in interface ICCResultInfo
      Returns:
      array of Strings
    • getElapsedTime

      public long getElapsedTime()
      Description copied from interface: ICCResultInfo
      Total elapsed time for all merged results This is calculated by adding the elapsed time of each testcase. It relies on the elapsed times being set in each testcase and older cc results may not be correct if some testcases don't have the value set. If the exact time is required then it is recommended that testcase be checked to determine it is has a valid (or non-zero) elapsed time
      Specified by:
      getElapsedTime in interface ICCResultInfo
      Returns:
      total elapsed time in milliseconds
    • getCompletedTime

      public long getCompletedTime()
      Description copied from interface: ICCResultInfo
      Returns the completed time This represents the time that the processing was completed
      Specified by:
      getCompletedTime in interface ICCResultInfo
      Returns:
      completed time in milliseconds
    • getImportInfo

      public ICCImportInfo[] getImportInfo(boolean successful)
      Description copied from interface: ICCResultInfo
      Returns an array of import information as discovered by the registered importers
      Specified by:
      getImportInfo in interface ICCResultInfo
      Parameters:
      successful - if true then only successful imports returned. If false then failed imports are returned
      Returns:
      zero or more import information objects
    • getInfo

      public ICCResultInfo getInfo()
      Description copied from interface: ICCResult
      Returns more detailed information about this result.
      Specified by:
      getInfo in interface ICCResult
      Returns:
      information ICCResultInfo about the result or results included
    • getNumFiles

      public int getNumFiles()
      Description copied from interface: ICCResult
      Returns the number of files in the merged results.
      Specified by:
      getNumFiles in interface ICCResult
      Returns:
      number of files or zero
    • getFiles

      public ICCFile[] getFiles()
      Description copied from interface: ICCResult
      Returns an array of files in the merged results. New in v9, the list will be sorted by file name. New in v10, the list is affected by ICCResult.addFilter(byte, String...) with ICCResult.EXCLUDE_ZEROLINES If ICCResult.EXCLUDE_ZEROLINES filter is active then the returned list will NOT contain files with zero executable lines
      Specified by:
      getFiles in interface ICCResult
      Returns:
      array of ICCFile or empty array
    • getFile

      public ICCFile getFile(String name)
      Description copied from interface: ICCResult
      Given a file name return an already added file.
      Specified by:
      getFile in interface ICCResult
      Parameters:
      name - file name
      Returns:
      ICCFile or null
    • getFile

      public ICCFile getFile(int id)
      Description copied from interface: ICCResult
      Returns the ICCFile with the matching ID or null.
      Specified by:
      getFile in interface ICCResult
      Parameters:
      id - unique id of the file
      Returns:
      ICCFile or null
    • getTestcases

      public ICCTestcase[] getTestcases()
      Description copied from interface: ICCResult
      Returns an array of testcases referenced in the merged results. The testcases may or may not have caused lines to be hit.
      Specified by:
      getTestcases in interface ICCCoverageDataBasic
      Specified by:
      getTestcases in interface ICCResult
      Returns:
      array of ICCTestcase or empty array
    • getTestcases

      public ICCTestcase[] getTestcases(String fileName)
      Description copied from interface: ICCResult
      Given a file name return the testcases that hit at least one executable line.
      Specified by:
      getTestcases in interface ICCResult
      Parameters:
      fileName - retrieve testcases for this file name
      Returns:
      array of ICCTestcase or empty array
    • getTestcases

      public ICCTestcase[] getTestcases(String[] fileNames)
      Description copied from interface: ICCResult
      Given 1 or more file names return a set of testcases (no duplicates) that hit at least 1 executable line. This is a union of all testcases that affect at least 1 of the passed files.
      Specified by:
      getTestcases in interface ICCResult
      Parameters:
      fileNames - array of fileNames
      Returns:
      array of ICCTestcase or empty array
    • getTestcase

      public ICCTestcase getTestcase(int id)
      Description copied from interface: ICCResult
      Get testcase by ID. Testcases are assigned a unique ID, this method returns a testcase given an ID.
      Specified by:
      getTestcase in interface ICCResult
      Parameters:
      id - testcase id
      Returns:
      testcase or null if not found
    • removeTestcase

      public ICCTestcase removeTestcase(int id)
      Description copied from interface: ICCResult
      Remove a testcase from this result.
      Specified by:
      removeTestcase in interface ICCResult
      Parameters:
      id - - testcase id
      Returns:
      removed testcase
    • getStatus

      public byte getStatus()
      Description copied from interface: ICCResult
      Returns a status value that represents an overall status. When merging results a single result can set this status to something other than OK. See ICCConstants.
      Specified by:
      getStatus in interface ICCResult
      Returns:
      ICCConstants
    • setName

      public void setName(String name)
      Description copied from class: CCAbstractItem
      Set the name of this artifact In version 10.1 this became part of the API
      Specified by:
      setName in interface ICCBase
      Specified by:
      setName in interface ICCResult
      Overrides:
      setName in class CCAbstractTreeItem
      Parameters:
      name - new name for this artifact
    • getLevel

      public ICCConstants.COVERAGE_LEVEL getLevel()
      Description copied from interface: ICCResult
      Return the coverage level. If this is a merged result then the coverage level of the first result is returned. to get the coverage level of an individual result use ICCTestcase.getLevel().
      Specified by:
      getLevel in interface ICCResult
      Returns:
      ICCConstants.COVERAGE_LEVEL
    • getPercentCoverage

      public int getPercentCoverage(ICCTestcase testcase)
      Description copied from interface: ICCResult
      Retrieves the coverage of a testcase.
      Specified by:
      getPercentCoverage in interface ICCResult
      Parameters:
      testcase - the testcase to compute coverage.
      Returns:
      the percent coverage for the testcase
    • isMerged

      public boolean isMerged()
      Description copied from interface: ICCResult
      If this result was created from 2 or more input results then it is considered "merged".
      Specified by:
      isMerged in interface ICCResult
      Returns:
      true if this result is considered merged
    • isComplete

      public boolean isComplete()
      Description copied from interface: ICCResult
      Return a simple boolean indicating if the results are valid. During import if an error occurs that could affect the validity of the merged result then a CCResultException will be thrown and it will contain this result and any exceptions encountered during the import. Use the ICCResultInfo to obtain a list of successful and unsuccessful import inputs.
      Specified by:
      isComplete in interface ICCResult
      Returns:
      true if all results were imported successfully, false if 1 or more results encountered errors that could affect the validity of the merged result
    • getModules

      public ICCModule[] getModules()
      Description copied from interface: ICCResult
      Returns an array of ICCModule. New in v9, only modules that have executable lines will be returned. If all modules/parts are needed then use the ICCResult.EXCLUDE_ZEROLINES filter.
      Specified by:
      getModules in interface ICCResult
      Returns:
      array of modules or an empty array
    • getModule

      public ICCModule getModule(String name)
      Description copied from interface: ICCResult
      Return a ICCModule that matches the name. New in v9 the returned value is affected by the ICCResult.EXCLUDE_ZEROLINES filter.
      Specified by:
      getModule in interface ICCResult
      Parameters:
      name - module name
      Returns:
      matching module or null
    • setUnZipOptions

      public void setUnZipOptions(String unZipDir)
      Description copied from interface: ICCResult
      When an unzip directory is set the API will use the directory to unzip and return a File when ICCFile.getFile() is called.
      Specified by:
      setUnZipOptions in interface ICCResult
      Parameters:
      unZipDir - path to a working directory that will be used to unzip files
    • getUnZipDir

      public String getUnZipDir()
      Description copied from interface: ICCResult
      Returns the directory to use when unzipping ICCFile contents.
      Specified by:
      getUnZipDir in interface ICCResult
      Returns:
      directory used to unzip
    • getParts

      public ICCPart[] getParts()
      Description copied from interface: ICCResult
      Returns an array of ICCPart. This will traverse all modules and return a complete list of unique parts. New in v9 the list will be sorted by the part name. New in v9 the list is affected by the ICCResult.EXCLUDE_ZEROLINES filter.
      Specified by:
      getParts in interface ICCResult
      Returns:
      array of parts or an empty array
    • getPart

      public ICCPart getPart(String name)
      Description copied from interface: ICCResult
      Returns a ICCPart that matches the name. Returns the first part that matches the name. New in v9 the returned value is affected by the ICCResult.EXCLUDE_ZEROLINES filter.
      Specified by:
      getPart in interface ICCResult
      Parameters:
      name - of the part
      Returns:
      null or the matching part
    • getTestcase

      public ICCTestcase getTestcase(String testName)
      Description copied from interface: ICCResult
      Returns the testcase with the passed name. If there is > 1 testcase with the same name only the first instance will be returned.
      Specified by:
      getTestcase in interface ICCResult
      Parameters:
      testName - name of the testcase
      Returns:
      testcase or null if not found
    • isHit

      public boolean isHit()
      Description copied from interface: ICCCoverageDataBasic
      Returns true if this artifact was hit Each artifact may have different interpretations of what it means to be hit (e.g could be the first line if a flowpoint)
      Specified by:
      isHit in interface ICCCoverageDataBasic
      Returns:
      true if hit
    • getNumHitLines

      public int getNumHitLines()
      Description copied from interface: ICCCoverageDataBasic
      Returns the number of hit lines
      Specified by:
      getNumHitLines in interface ICCCoverageDataBasic
      Returns:
      number of hit lines
    • getNumExecutableLines

      public int getNumExecutableLines()
      Description copied from interface: ICCCoverageDataBasic
      Returns the number of executable lines in this artifact
      Specified by:
      getNumExecutableLines in interface ICCCoverageDataBasic
      Returns:
      number of executable lines
    • getNumFlowPoints

      public int getNumFlowPoints()
      Description copied from interface: ICCCoverageDataBasic
      Return the number of flowpoints for this artifact and its children
      Specified by:
      getNumFlowPoints in interface ICCCoverageDataBasic
      Returns:
      number of flowpoints
    • getNumHitFlowPoints

      public int getNumHitFlowPoints()
      Description copied from interface: ICCCoverageDataBasic
      Return the number of flowpoints that were hit for this artifact and its children
      Specified by:
      getNumHitFlowPoints in interface ICCCoverageDataBasic
      Returns:
      number of hit flowpoints
    • getNumExecutableStatements

      public int getNumExecutableStatements()
      Description copied from interface: ICCStatementDataBasic
      Returns the number of executable statements
      Specified by:
      getNumExecutableStatements in interface ICCStatementDataBasic
      Returns:
      number of executable statements (hit or not)
    • getNumHitStatements

      public int getNumHitStatements()
      Description copied from interface: ICCStatementDataBasic
      Returns the number of hit statements
      Specified by:
      getNumHitStatements in interface ICCStatementDataBasic
      Returns:
      number of hit statements
    • hasStatements

      public boolean hasStatements()
      Description copied from interface: ICCStatementDataBasic
      Return true if artifact has statements. Returning false means that only lines are available
      Specified by:
      hasStatements in interface ICCStatementDataBasic
      Returns:
      true if artifact has statements
    • getCreatedTime

      public long getCreatedTime()
      Description copied from interface: ICCResultInfo
      If available this is the date/time that the result was created. For results that contain 1 testcase this is the time the original data was collected For merged results this is the time the merged result was created. Use ICCTestcase.getStartTime() to get a testcase capture time
      Specified by:
      getCreatedTime in interface ICCResultInfo
      Returns:
      creation time in milliseconds
    • addFilter

      public void addFilter(byte filter, String... args)
      Description copied from interface: ICCResult
      Adds a filter. The filter type will document if the order it is added can affect the results. To clear filters use ICCResult.clearFilters() Current list of filters: ICCResult.EXCLUDE_ZEROLINES This will include all modules and parts that have zero executable lines. There are no additional parameters. New in v10, this filter also works on files with zero executable lines Filters act on the content of the result. This means that clearing the filters will return the results returned back to the default. Filters do not remove what is stored internally.
      Specified by:
      addFilter in interface ICCResult
      Parameters:
      filter - filter type
      args - arguments as determined by the filter type
    • clearFilters

      public void clearFilters()
      Description copied from interface: ICCResult
      Clears any filters that have been added to the result.
      Specified by:
      clearFilters in interface ICCResult
    • getAnnotatedSource

      public InputStream getAnnotatedSource(ICCSource compareTo, boolean deltaOnly) throws IOException, CCAbstractException
      Description copied from interface: ICCCompareSource
      Given a result that contains the same source as the current result, compare the code coverage i.e. the previous result should call this method
      Specified by:
      getAnnotatedSource in interface ICCCompareSource
      Parameters:
      compareTo - the name of the source the user wants to examine. i.e. the current source
      deltaOnly - if true will return the inputStream annotated only with the code coverage delta between the two sources. Will return all code coverage annotation otherwise.
      Returns:
      input stream with markers indicating coverage of desired and current result, or null if source doesn't match.
      Throws:
      IOException - thrown when given file is invalid and cannot be read or the stream (used in the implementation, not the return stream) cannot be written properly.
      CCAbstractException - thrown when deltaOnly is true and a file has been removed between the two results or both results have identical code coverage.
    • setAnnotatedMarker

      public void setAnnotatedMarker(ICCCompareSource.MARKERTYPE type, String marker)
      Description copied from interface: ICCCompareSource
      Allow the user to change the annotation shown for a HitLine. Guarantees that spacing will remain consistent regardless of what marking is used. NOTE: Recommend adding a space after the desired marker to easier distinguish between marking columns and the source code.
      Specified by:
      setAnnotatedMarker in interface ICCCompareSource
      Parameters:
      type - the ICCCompareSource.MARKERTYPE of marker to be configured e.g. HITLINEMARKER
      marker - the character or string used to visualize the HitLine.
    • getUniqueID

      public String getUniqueID()
      Description copied from interface: ICCTreeItem
      The following API is added for backwards compatibility. When a UUID is not available in the result this call will be used to generate a temporary UUID (does not have to have a true UUID format) The returned value should
      • be the same for the same result.
      • be unique from any other artifact in the result
      • can be any string that uniquely represents this artifact
      Specified by:
      getUniqueID in interface ICCTreeItem
      Returns:
      globally unique string
    • supportsUUID

      public boolean supportsUUID()
      Description copied from interface: ICCTreeItem
      Return true if this artifact supports a UUID
      Specified by:
      supportsUUID in interface ICCTreeItem
      Returns:
      true if UUID is supported
    • getItem

      public ICCTreeItem getItem(String uuid)
      Description copied from interface: ICCResult
      Get an item by unique ID
      Specified by:
      getItem in interface ICCResult
      Parameters:
      uuid - UUID unique to the artifact
      Returns:
      item or null