Class FilesystemTestResourceProvider
- java.lang.Object
-
- de.gebit.integrity.runner.providers.AbstractTestResourceProvider
-
- de.gebit.integrity.runner.providers.FilesystemTestResourceProvider
-
- All Implemented Interfaces:
TestResourceProvider
public class FilesystemTestResourceProvider extends AbstractTestResourceProvider
A resource provider which reads test files from the filesystem, either from one or more flat directories or optionally in a recursive way.- Author:
- Rene Schneider - initial API and implementation
-
-
Field Summary
-
Fields inherited from class de.gebit.integrity.runner.providers.AbstractTestResourceProvider
INTEGRITY_TEST_FILES_SUFFIX, resourceFiles
-
-
Constructor Summary
Constructors Constructor Description FilesystemTestResourceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllRecursively(java.util.Collection<? extends java.io.File> someResourceFiles)
Adds the given resources recursively, that is if one of them is a directory all enclosed directories and files of it are recursively included as well.void
addFile(java.io.File aResourceFile)
Adds the given resource if it is a file.void
addRecursively(java.io.File aResourceFile)
Adds the given resource recursively, that is if it is a directory all enclosed directories and files are recursively included as well.void
closeResource(TestResource aResourceName, java.io.InputStream aResourceStream)
Closes a specified resources' stream (and all the stuff opened for this stream in the background).java.io.InputStream
openResource(TestResource aResourceName)
Opens a specific named resource.-
Methods inherited from class de.gebit.integrity.runner.providers.AbstractTestResourceProvider
addResource, createAndAddResource, createResource, getClassLoader, getResourceNames, setClassLoader
-
-
-
-
Method Detail
-
addRecursively
public void addRecursively(java.io.File aResourceFile)
Adds the given resource recursively, that is if it is a directory all enclosed directories and files are recursively included as well.- Parameters:
aResourceFile
- Resource to be added.
-
addAllRecursively
public void addAllRecursively(java.util.Collection<? extends java.io.File> someResourceFiles)
Adds the given resources recursively, that is if one of them is a directory all enclosed directories and files of it are recursively included as well.- Parameters:
someResourceFiles
- Resources to be added.
-
addFile
public void addFile(java.io.File aResourceFile)
Adds the given resource if it is a file.- Parameters:
aResourceFile
-
-
openResource
public java.io.InputStream openResource(TestResource aResourceName)
Description copied from interface:TestResourceProvider
Opens a specific named resource. This should return anInputStream
at the start of the data of the respective resources, and it is only expected to work if the resource is one of those enumerated by a call toTestResourceProvider.getResourceNames()
.- Parameters:
aResourceName
- the resource to be opened- Returns:
- an
InputStream
to read the resource
-
closeResource
public void closeResource(TestResource aResourceName, java.io.InputStream aResourceStream) throws java.io.IOException
Description copied from interface:TestResourceProvider
Closes a specified resources' stream (and all the stuff opened for this stream in the background).- Parameters:
aResourceName
- the resource to be closedaResourceStream
- the resource stream to close- Throws:
java.io.IOException
-
-