Package de.gebit.integrity.providers
Interface TestResourceProvider
-
- All Known Implementing Classes:
AbstractCompoundTestResourceProvider
,AbstractTestResourceProvider
,ArchiveTestResourceProvider
,FilesystemArchiveTestResourceProvider
,FilesystemTestResourceProvider
,InMemoryTestResourceProvider
public interface TestResourceProvider
A test resource provider is used by the test runner to enumerate and retrieve the necessary resources, which are then parsed and linked into the test model. The classloader to use for resolving any Java references is also provided by the resource provider.Test resource providers must be thread-safe with regard to all methods defined in
TestResourceProvider
, as they are used in multi-threaded script loading, in which resources are opened and closed in parallel!- Author:
- Rene Schneider - initial API and implementation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.lang.ClassLoader
getClassLoader()
Returns the classloader to use for all dynamic class resolving needs.TestResource[]
getResourceNames()
Returns all known resource names.java.io.InputStream
openResource(TestResource aResourceName)
Opens a specific named resource.
-
-
-
Method Detail
-
getResourceNames
TestResource[] getResourceNames()
Returns all known resource names.- Returns:
-
openResource
java.io.InputStream openResource(TestResource aResourceName) throws java.io.IOException
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 togetResourceNames()
.- Parameters:
aResourceName
- the resource to be opened- Returns:
- an
InputStream
to read the resource - Throws:
java.io.IOException
-
closeResource
void closeResource(TestResource aResourceName, java.io.InputStream aResourceStream) throws java.io.IOException
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
-
getClassLoader
java.lang.ClassLoader getClassLoader()
Returns the classloader to use for all dynamic class resolving needs.- Returns:
- the classloader to use
-
-