Class SourceCodeFacade
- java.lang.Object
-
- com.parasoft.findings.jenkins.coverage.api.metrics.source.SourceCodeFacade
-
public class SourceCodeFacade extends Object
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
Constructors Constructor Description SourceCodeFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
calculateModifiedLinesCoverageSourceCode(String content, FileNode fileNode)
Filters the sourcecode coverage highlighting for analyzing the modified lines coverage only.boolean
canRead(File buildResults, String id, String path)
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.String
read(File buildResults, String id, String path)
Reads the contents of the source file of the given file into a String.
-
-
-
Method Detail
-
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
public boolean canRead(File buildResults, String id, String path)
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
public boolean hasStoredSourceCode(File buildResults, String id)
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
public String calculateModifiedLinesCoverageSourceCode(String content, FileNode fileNode)
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
-
-