Class SourceCodeFacade
java.lang.Object
com.parasoft.findings.jenkins.coverage.api.metrics.source.SourceCodeFacade
Facade to the source code file structure in Jenkins build folder. Access of those files should be done using an
instance of this class only.
- Author:
- Ullrich Hafner, Florian Orendi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncalculateModifiedLinesCoverageSourceCode
(String content, FileNode fileNode) Filters the sourcecode coverage highlighting for analyzing the modified lines coverage only.boolean
Returns whether the source code is available for the specified source file.boolean
hasStoredSourceCode
(File buildResults, String id) Checks whether any source files has been stored.Reads the contents of the source file of the given file into a String.
-
Constructor Details
-
SourceCodeFacade
public SourceCodeFacade()
-
-
Method Details
-
read
public String read(File buildResults, String id, String path) throws IOException, InterruptedException Reads the contents of the source file of the given file into a String.- Parameters:
buildResults
- Jenkins directory for build resultsid
- if of the coverage resultspath
- relative path to the coverage node base filename of the coverage node- Returns:
- the file content as String
- Throws:
IOException
InterruptedException
-
canRead
Returns whether the source code is available for the specified source file.- Parameters:
buildResults
- Jenkins directory for build resultsid
- if of the coverage resultspath
- relative path to the source code filename name- Returns:
- the file content as String
-
hasStoredSourceCode
Checks whether any source files has been stored. Even if it is wanted, there might have been errors which cause the absence of any source files.- Parameters:
buildResults
- Jenkins directory for build resultsid
- id of the coverage results- Returns:
true
whether source files has been stored, elsefalse
-
calculateModifiedLinesCoverageSourceCode
Filters the sourcecode coverage highlighting for analyzing the modified lines coverage only.- Parameters:
content
- The original HTML contentfileNode
- Thenode
which represents the coverage of the file- Returns:
- the filtered HTML sourcecode view
-