Class AbstractCompoundTestResourceProvider
- java.lang.Object
-
- de.gebit.integrity.runner.providers.AbstractCompoundTestResourceProvider
-
- All Implemented Interfaces:
TestResourceProvider
- Direct Known Subclasses:
FilesystemArchiveTestResourceProvider
public abstract class AbstractCompoundTestResourceProvider extends Object implements TestResourceProvider
AAbstractCompoundTestResourceProviderwraps one or multiple otherTestResourceProviderinstances.- Author:
- Rene Schneider - initial API and implementation
-
-
Field Summary
Fields Modifier and Type Field Description protected List<TestResourceProvider>resourceProvidersThe resource providers wrapped by this compound provider.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCompoundTestResourceProvider(TestResourceProvider... someProviders)Creates a new compound provider, wrapping the given resource providers.protectedAbstractCompoundTestResourceProvider(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 voidcloseResource(TestResource aResourceName, InputStream aResourceStream)Closes a specified resources' stream (and all the stuff opened for this stream in the background).protected <T extends TestResourceProvider>
TfindProvider(Class<T> aProviderClass)Finds a specific provider instance by its type.ClassLoadergetClassLoader()Returns the classloader to use for all dynamic class resolving needs.TestResource[]getResourceNames()Returns all known resource names.InputStreamopenResource(TestResource aResourceName)Opens a specific named resource.
-
-
-
Field Detail
-
resourceProviders
protected List<TestResourceProvider> resourceProviders
The resource providers wrapped by this compound provider.
-
-
Constructor Detail
-
AbstractCompoundTestResourceProvider
protected AbstractCompoundTestResourceProvider(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:TestResourceProviderReturns all known resource names.- Specified by:
getResourceNamesin interfaceTestResourceProvider- Returns:
-
openResource
public InputStream openResource(TestResource aResourceName) throws IOException
Description copied from interface:TestResourceProviderOpens a specific named resource. This should return anInputStreamat 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:
openResourcein interfaceTestResourceProvider- Parameters:
aResourceName- the resource to be opened- Returns:
- an
InputStreamto read the resource - Throws:
IOException
-
closeResource
public void closeResource(TestResource aResourceName, InputStream aResourceStream) throws IOException
Description copied from interface:TestResourceProviderCloses a specified resources' stream (and all the stuff opened for this stream in the background).- Specified by:
closeResourcein interfaceTestResourceProvider- Parameters:
aResourceName- the resource to be closedaResourceStream- the resource stream to close- Throws:
IOException
-
getClassLoader
public ClassLoader getClassLoader()
Description copied from interface:TestResourceProviderReturns the classloader to use for all dynamic class resolving needs.- Specified by:
getClassLoaderin interfaceTestResourceProvider- Returns:
- the classloader to use
-
findProvider
protected <T extends TestResourceProvider> T findProvider(Class<T> aProviderClass)
Finds a specific provider instance by its type.- Parameters:
aProviderClass- the providers' class- Returns:
- the first instance matching the type
-
-