Class AbstractTestResourceProvider
- java.lang.Object
-
- de.gebit.integrity.runner.providers.AbstractTestResourceProvider
-
- All Implemented Interfaces:
TestResourceProvider
- Direct Known Subclasses:
ArchiveTestResourceProvider,FilesystemTestResourceProvider
public abstract class AbstractTestResourceProvider extends Object implements TestResourceProvider
Base class for test resource providers. Provides some convenience base implementations.- Author:
- Rene Schneider - initial API and implementation
-
-
Field Summary
Fields Modifier and Type Field Description static StringINTEGRITY_TEST_FILES_SUFFIXThe default suffix indicating a file is an Integrity test file.protected Set<TestResource>resourceFilesThe resources in this provider.
-
Constructor Summary
Constructors Constructor Description AbstractTestResourceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddResource(TestResource aResource)Adds a given resource to theresourceFiles.protected voidcreateAndAddResource(String aResourceName)Convenience method to create and add a newTestResource.protected TestResourcecreateResource(String aResourceName)Convenience method to create a newTestResourceinstance wrapping a certain test resource name.ClassLoadergetClassLoader()Returns the classloader to use for all dynamic class resolving needs.TestResource[]getResourceNames()Returns all known resource names.voidsetClassLoader(ClassLoader aClassLoader)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.gebit.integrity.providers.TestResourceProvider
closeResource, openResource
-
-
-
-
Field Detail
-
INTEGRITY_TEST_FILES_SUFFIX
public static final String INTEGRITY_TEST_FILES_SUFFIX
The default suffix indicating a file is an Integrity test file.- See Also:
- Constant Field Values
-
resourceFiles
protected Set<TestResource> resourceFiles
The resources in this provider. This abstract class supports an "early-evaluation" model: resources are discovered and added early, before they're actually requested. This thing does not have to be thread-safe, as the resource discovery phase is not expected to be run in parallel on multiple threads (and if an implementor would do such a thing, he is responsible to protect against thread interferences).
-
-
Method Detail
-
setClassLoader
public void setClassLoader(ClassLoader aClassLoader)
-
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
-
getResourceNames
public TestResource[] getResourceNames()
Description copied from interface:TestResourceProviderReturns all known resource names.- Specified by:
getResourceNamesin interfaceTestResourceProvider- Returns:
-
addResource
protected void addResource(TestResource aResource)
Adds a given resource to theresourceFiles.- Parameters:
aResource- the resource to add
-
createResource
protected TestResource createResource(String aResourceName)
Convenience method to create a newTestResourceinstance wrapping a certain test resource name.- Parameters:
aResourceName- the resource name to wrap- Returns:
- the resource instance
-
createAndAddResource
protected void createAndAddResource(String aResourceName)
Convenience method to create and add a newTestResource.- Parameters:
aResourceName- the resource name to wrap
-
-