Class TestArtifactRegistry
java.lang.Object
dev.getelements.elements.sdk.test.TestArtifactRegistry
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
copyArtifactTo
(TestElementArtifact artifact, Path destination) Copies the specified artifact to the path.void
copyBundleTo
(TestElementBundle bundle, Path destination) Copies all artifacts in the bundle to the specified directory.void
copySpiTo
(TestElementSpi spi, Path destination) Copies the specified artifact to the path.findArtifactPath
(TestElementArtifact artifact) Finds the Path of the artifact with the artifact name.findArtifactUrl
(TestElementArtifact artifact) Finds the URL of the artifact with the artifact name.findBundlePath
(TestElementBundle bundle) Finds the Path of the bundle with the bundle name.Finds the SPI of the artifact with the artifact name.Finds the SPI of the artifact with the artifact name.static boolean
isArtifact
(TestElementArtifact artifact, String jarFile) Tests the artifact for the jar file name.static boolean
isArtifact
(String artifactName, String jarFile) Tests the jar file name for the artifact name.void
unpackArtifact
(TestElementArtifact artifact, Path destinationDirectory) Unpacks the artifact into the destination directory.
-
Constructor Details
-
TestArtifactRegistry
public TestArtifactRegistry()
-
-
Method Details
-
isArtifact
Tests the artifact for the jar file name.- Parameters:
artifact
- the artifactjarFile
- the jar file name- Returns:
- true if the artifact matches the jar file name
-
isArtifact
Tests the jar file name for the artifact name.- Parameters:
artifactName
- the artifact namejarFile
- the jar file name- Returns:
- the artifact name
-
findSpiUrls
Finds the SPI of the artifact with the artifact name.- Parameters:
spi
- the SPI- Returns:
- the URL of the artifact
- Throws:
NoSuchElementException
- if the artifact wasn't found
-
findSpiPaths
Finds the SPI of the artifact with the artifact name.- Parameters:
spi
- the SPI- Returns:
- the URL of the artifact
- Throws:
NoSuchElementException
- if the artifact wasn't found
-
findArtifactUrl
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
-
findArtifactPath
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
-
findBundlePath
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
-
copyBundleTo
Copies all artifacts in the bundle to the specified directory.- Parameters:
bundle
- the bundledestination
- the bundle destination- Throws:
NoSuchElementException
- if the artifact wasn't found
-
copySpiTo
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:
spi
- the spidestination
- the artifact destination- Throws:
NoSuchElementException
- if the artifact wasn't foundIOException
-
copyArtifactTo
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 namedestination
- the artifact destination- Throws:
NoSuchElementException
- if the artifact wasn't foundIOException
-
unpackArtifact
Unpacks the artifact into the destination directory.- Parameters:
artifact
- the artifact namedestinationDirectory
- the destination directory
-