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

      • BuildFolderFacade

        public BuildFolderFacade()
    • 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 from
        fileName - the file to read
        sourceEncoding - 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 from
        issue - the issue to check the affected file for
        Returns:
        true if the affected file of the specified issue can be accessed, false otherwise