Class AttachmentPublisher

java.lang.Object
hudson.model.AbstractDescribableImpl<hudson.tasks.junit.TestDataPublisher>
hudson.tasks.junit.TestDataPublisher
hudson.plugins.junitattachments.AttachmentPublisher
All Implemented Interfaces:
ExtensionPoint, Describable<hudson.tasks.junit.TestDataPublisher>

public class AttachmentPublisher extends hudson.tasks.junit.TestDataPublisher
  • Field Details

    • ARTIFACT_NAMESPACE

      public static final String ARTIFACT_NAMESPACE
      Name of the directory, relative to a build's artifact root, under which attachments published via ArtifactManager are stored.

      Historical attachments predating this feature are instead stored directly under the build's root directory (see getAttachmentPath(Run)) and are not affected.

      See Also:
  • Constructor Details

    • AttachmentPublisher

      @DataBoundConstructor public AttachmentPublisher()
  • Method Details

    • isShowAttachmentsAtClassLevel

      public boolean isShowAttachmentsAtClassLevel()
    • isShowAttachmentsInStdOut

      public boolean isShowAttachmentsInStdOut()
    • setShowAttachmentsAtClassLevel

      @DataBoundSetter public void setShowAttachmentsAtClassLevel(Boolean showAttachmentsAtClassLevel)
    • setShowAttachmentsInStdOut

      @DataBoundSetter public void setShowAttachmentsInStdOut(Boolean showAttachmentsInStdOut)
    • getAttachmentPath

      public static FilePath getAttachmentPath(Run<?,?> build)
      Returns the legacy, filesystem-based root under which attachments were stored directly in the build's root directory before this plugin started publishing through the build's ArtifactManager.

      Retained so that historical attachments remain readable; new attachments are no longer written here.

    • getAttachmentPath

      public static FilePath getAttachmentPath(FilePath root, String className, String testName)
    • getAttachmentPath

      public static VirtualFile getAttachmentPath(VirtualFile root, String className, String testName)
      Resolves the directory for a given test class/test case underneath a VirtualFile root, mirroring getAttachmentPath(FilePath, String, String) for attachments stored through an ArtifactManager.
    • getStorageName

      public static String getStorageName(String name)
      The name of the directory that holds the attachments of the given test case.

      Attachments are stored under a sanitised form of the name, so any URL pointing at them has to be built from the same sanitised form rather than from the raw name.

      Parameters:
      name - the raw test case name
      Returns:
      the directory name used to store its attachments
    • contributeTestData

      public AttachmentPublisher.Data contributeTestData(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener, hudson.tasks.junit.TestResult testResult) throws IOException, InterruptedException
      Overrides:
      contributeTestData in class hudson.tasks.junit.TestDataPublisher
      Throws:
      IOException
      InterruptedException