Class AbstractCompoundTestResourceProvider
- java.lang.Object
-
- de.gebit.integrity.runner.providers.AbstractCompoundTestResourceProvider
-
- All Implemented Interfaces:
TestResourceProvider
- Direct Known Subclasses:
FilesystemArchiveTestResourceProvider
public abstract class AbstractCompoundTestResourceProvider extends java.lang.Object implements TestResourceProvider
AAbstractCompoundTestResourceProvider
wraps one or multiple otherTestResourceProvider
instances.- Author:
- Rene Schneider - initial API and implementation
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<TestResourceProvider>
resourceProviders
The resource providers wrapped by this compound provider.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCompoundTestResourceProvider(TestResourceProvider... someProviders)
Creates a new compound provider, wrapping the given resource providers.protected
AbstractCompoundTestResourceProvider(java.util.List<TestResourceProvider> someProviders)
Creates a new compound provider, wrapping the given resource providers.
-
Method Summary
All Methods Instance Methods Concrete 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).protected <T extends TestResourceProvider>
TfindProvider(java.lang.Class<T> aProviderClass)
Finds a specific provider instance by its type.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.
-
-
-
Field Detail
-
resourceProviders
protected java.util.List<TestResourceProvider> resourceProviders
The resource providers wrapped by this compound provider.
-
-
Constructor Detail
-
AbstractCompoundTestResourceProvider
protected AbstractCompoundTestResourceProvider(java.util.List<TestResourceProvider> someProviders)
Creates a new compound provider, wrapping the given resource providers.- Parameters:
someProviders
- the providers to wrap
-
AbstractCompoundTestResourceProvider
protected AbstractCompoundTestResourceProvider(TestResourceProvider... someProviders)
Creates a new compound provider, wrapping the given resource providers.- Parameters:
someProviders
- the providers to wrap
-
-
Method Detail
-
getResourceNames
public TestResource[] getResourceNames()
Description copied from interface:TestResourceProvider
Returns all known resource names.- Specified by:
getResourceNames
in interfaceTestResourceProvider
- Returns:
-
openResource
public java.io.InputStream openResource(TestResource aResourceName) throws java.io.IOException
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()
.- Specified by:
openResource
in interfaceTestResourceProvider
- Parameters:
aResourceName
- the resource to be opened- Returns:
- an
InputStream
to read the resource - Throws:
java.io.IOException
-
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).- Specified by:
closeResource
in interfaceTestResourceProvider
- Parameters:
aResourceName
- the resource to be closedaResourceStream
- the resource stream to close- Throws:
java.io.IOException
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:TestResourceProvider
Returns the classloader to use for all dynamic class resolving needs.- Specified by:
getClassLoader
in interfaceTestResourceProvider
- Returns:
- the classloader to use
-
findProvider
protected <T extends TestResourceProvider> T findProvider(java.lang.Class<T> aProviderClass)
Finds a specific provider instance by its type.- Parameters:
aProviderClass
- the providers' class- Returns:
- the first instance matching the type
-
-