public interface ArtifactClient
extends org.apache.beam.it.common.ResourceManager
It is the responsibility of implementations to make sure that artifacts are kept separate from
each other. Using a GCS path, this isolation would create a path like the following: gs://test-class-name/run-id/test-method-name
. Each directory means:
Separate input/output directories are optional and the responsibility of the test writer to maintain.
Modifier and Type | Method and Description |
---|---|
void |
cleanupAll()
Deletes all the files located under test-class-name/run-id.
|
Artifact |
createArtifact(java.lang.String artifactName,
byte[] contents)
Creates a new artifact in whatever service is being used to store them.
|
Artifact |
createArtifact(java.lang.String artifactName,
java.lang.String contents)
Creates a new artifact in whatever service is being used to store them.
|
java.lang.String |
getPathForArtifact(java.lang.String artifactName)
Returns a path the artifact will be created at.
|
java.util.List<Artifact> |
listArtifacts(java.lang.String prefix,
java.util.regex.Pattern regex)
Lists all artifacts under test-class-name/run-id/
prefix . |
java.util.List<Artifact> |
listArtifacts(TestName testName,
java.util.regex.Pattern regex)
Lists all artifacts under test-class-name/run-id/
prefix . |
java.lang.String |
runId()
Returns the id associated with the particular run of the test class.
|
Artifact |
uploadArtifact(java.lang.String artifactName,
java.nio.file.Path localPath)
Uploads a local file to the service being used for storing artifacts.
|
Artifact |
uploadArtifact(java.lang.String artifactName,
java.lang.String localPath)
Uploads a local file to the service being used for storing artifacts.
|
java.lang.String runId()
java.lang.String getPathForArtifact(java.lang.String artifactName)
artifactName
- Artifact nameArtifact createArtifact(java.lang.String artifactName, java.lang.String contents)
artifactName
- the name of the artifact. If this is supposed to go under an input/output
directory, then it should include that (example: input/artifact.txt)contents
- the contents of the artifact in String formatArtifact createArtifact(java.lang.String artifactName, byte[] contents)
artifactName
- the name of the artifact. If this is supposed to go under an input/output
directory, then it should include that (example: input/artifact.txt)contents
- the contents of the artifact in byte array formatArtifact uploadArtifact(java.lang.String artifactName, java.lang.String localPath) throws java.io.IOException
artifactName
- the name of the artifact. If this is supposed to go under an input/output
directory, then it should include that (example: input/artifact.txt)localPath
- the absolute local path to the file to uploadjava.io.IOException
- if there is an issue reading the local fileArtifact uploadArtifact(java.lang.String artifactName, java.nio.file.Path localPath) throws java.io.IOException
artifactName
- the name of the artifact. If this is supposed to go under an input/output
directory, then it should include that (example: input/artifact.txt)localPath
- the local path to the file to uploadjava.io.IOException
- if there is an issue reading the local filejava.util.List<Artifact> listArtifacts(TestName testName, java.util.regex.Pattern regex)
prefix
.testName
- the test name to use as the prefix on the testing artifacts.regex
- a regex to use for filtering out unwanted artifactsjava.util.List<Artifact> listArtifacts(java.lang.String prefix, java.util.regex.Pattern regex)
prefix
.prefix
- the prefix to use along with the fixed values method above. This must include the
test-method-name value, but it can include other directories or files under it.regex
- a regex to use for filtering out unwanted artifactsvoid cleanupAll()
cleanupAll
in interface org.apache.beam.it.common.ResourceManager