Arquillian Persistence Extension Implementation 1.0.0.Alpha4

org.jboss.arquillian.persistence.metadata.provider
Class ResourceProvider<T extends ResourceDescriptor<?>>

java.lang.Object
  extended by org.jboss.arquillian.persistence.metadata.provider.ResourceProvider<T>
Type Parameters:
T - Concrete implementation of ResourceDescriptor providing necessary information for given resource type.
Direct Known Subclasses:
DataSetProvider, ExpectedDataSetProvider, SqlScriptProvider

public abstract class ResourceProvider<T extends ResourceDescriptor<?>>
extends Object

Handles metadata extraction from given test class or test method and provides descriptors for resources defined in given annotation type (such as UsingDataSet or ApplyScriptBefore).

Author:
Bartosz Majsak

Field Summary
protected  MetadataExtractor metadataExtractor
           
protected  Class<? extends Annotation> resourceAnnotation
           
 
Constructor Summary
ResourceProvider(Class<? extends Annotation> resourceAnnotation, MetadataExtractor metadataExtractor)
           
 
Method Summary
protected abstract  T createDescriptor(String dataFileName)
           
protected abstract  String defaultFileName()
           
protected  String defaultFolder()
           
protected abstract  String defaultLocation()
           
protected  String determineLocation(String location)
          Checks if file exists in the default location.
 Set<T> getDescriptors(org.jboss.arquillian.test.spi.TestClass testClass)
          Returns all resources defined for this test class including those defined on the test method level.
 Collection<T> getDescriptorsDefinedFor(Method testMethod)
           
abstract  Collection<String> getResourceFileNames(Method testMethod)
           
protected  List<T> obtainClassLevelDataSet(Annotation classLevelAnnotation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metadataExtractor

protected final MetadataExtractor metadataExtractor

resourceAnnotation

protected final Class<? extends Annotation> resourceAnnotation
Constructor Detail

ResourceProvider

public ResourceProvider(Class<? extends Annotation> resourceAnnotation,
                        MetadataExtractor metadataExtractor)
Method Detail

getDescriptors

public Set<T> getDescriptors(org.jboss.arquillian.test.spi.TestClass testClass)
Returns all resources defined for this test class including those defined on the test method level.

Parameters:
testClass -
Returns:

getDescriptorsDefinedFor

public Collection<T> getDescriptorsDefinedFor(Method testMethod)

getResourceFileNames

public abstract Collection<String> getResourceFileNames(Method testMethod)

createDescriptor

protected abstract T createDescriptor(String dataFileName)

defaultLocation

protected abstract String defaultLocation()

defaultFileName

protected abstract String defaultFileName()

obtainClassLevelDataSet

protected List<T> obtainClassLevelDataSet(Annotation classLevelAnnotation)

defaultFolder

protected String defaultFolder()

determineLocation

protected String determineLocation(String location)
Checks if file exists in the default location. If that's not the case, file is looked up starting from the root.

Returns:
determined file location

Arquillian Persistence Extension Implementation 1.0.0.Alpha4

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.