Class TestArtifactRegistry

java.lang.Object
dev.getelements.elements.sdk.test.TestArtifactRegistry

public class TestArtifactRegistry extends Object
A helper class to find the test artifacts in the project. Not intended to be used outside the SDK integration tests. This searches the current working directory for "test-element-artifacts" and works it way upward until it can find a set of test artifacts.
  • Constructor Details

    • TestArtifactRegistry

      public TestArtifactRegistry()
  • Method Details

    • isArtifact

      public static boolean isArtifact(String artifactName, String jarFile)
      Tests the jar file name for the artifact name.
      Parameters:
      artifactName - the artifact name
      jarFile - the jar file name
      Returns:
      the artifact name
    • findJarUrl

      public URL findJarUrl(TestElementArtifact artifact)
      Finds the URL of the artifact with the artifact name.
      Parameters:
      artifact - the artifact name
      Returns:
      the URL of the artifact
      Throws:
      NoSuchElementException - if the artifact wasn't found
    • findBundlePath

      public Path findBundlePath(TestElementBundle bundle)
      Finds the Path of the bundle with the bundle name.
      Parameters:
      bundle - the artifact
      Returns:
      the Path of the artifact
      Throws:
      NoSuchElementException - if the artifact wasn't found
    • findArtifactPath

      public Path findArtifactPath(TestElementArtifact artifact)
      Finds the Path of the artifact with the artifact name.
      Parameters:
      artifact - the artifact
      Returns:
      the Path of the artifact
      Throws:
      NoSuchElementException - if the artifact wasn't found
    • copyBundleTo

      public void copyBundleTo(TestElementBundle bundle, Path destination)
      Copies all artifacts in the bundle to the specified directory.
      Parameters:
      bundle - the bundle
      destination - the bundle destination
      Throws:
      NoSuchElementException - if the artifact wasn't found
    • copyArtifactTo

      public void copyArtifactTo(TestElementArtifact artifact, Path destination) throws IOException
      Copies the specified artifact to the path. If the destination path is a directory it will be copied into that directory. Otherwise, it will be copied to the destination exactly as it is.
      Parameters:
      artifact - the artifact name
      destination - the artifact destination
      Throws:
      NoSuchElementException - if the artifact wasn't found
      IOException
    • unpackArtifact

      public void unpackArtifact(TestElementArtifact artifact, Path destinationDirectory)
      Unpacks the artifact into the destination directory.
      Parameters:
      artifact - the artifact name
      destinationDirectory - the destination directory