Class BuildFolderFacade
- java.lang.Object
-
- io.jenkins.plugins.analysis.core.util.BuildFolderFacade
-
- All Implemented Interfaces:
Serializable
public class BuildFolderFacade extends Object implements Serializable
Facade to files in the build folder of the Jenkins master. Encapsulates all calls to the running Jenkins server so that tests can replace this facade with a stub.- Author:
- Ullrich Hafner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BuildFolderFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canAccessAffectedFileOf(Run<?,?> build, edu.hm.hafner.analysis.Issue issue)
Returns whether the affected file of the specified issue can be accessed.Stream<String>
readConsoleLog(Run<?,?> build)
Returns the lines of the console log.Reader
readFile(Run<?,?> build, String fileName, Charset sourceEncoding)
Returns the affected file with the specified file name.
-
-
-
Method Detail
-
readConsoleLog
@MustBeClosed public Stream<String> readConsoleLog(Run<?,?> build)
Returns the lines of the console log. If the log cannot be read, then the exception message is returned as text.- Parameters:
build
- the build to get the console log for- Returns:
- the lines of the console log
-
readFile
@MustBeClosed public Reader readFile(Run<?,?> build, String fileName, Charset sourceEncoding) throws IOException
Returns the affected file with the specified file name.- Parameters:
build
- the build to read the files fromfileName
- the file to readsourceEncoding
- the encoding to use when reading the file- Returns:
- the affected file
- Throws:
IOException
- if the file could not be read
-
canAccessAffectedFileOf
public boolean canAccessAffectedFileOf(Run<?,?> build, edu.hm.hafner.analysis.Issue issue)
Returns whether the affected file of the specified issue can be accessed.- Parameters:
build
- the build to read the files fromissue
- the issue to check the affected file for- Returns:
true
if the affected file of the specified issue can be accessed,false
otherwise
-
-