Class ResourceInjectionEnricher
java.lang.Object
org.jboss.arquillian.testenricher.resource.ResourceInjectionEnricher
- All Implemented Interfaces:
org.jboss.arquillian.test.spi.TestEnricher
public class ResourceInjectionEnricher
extends Object
implements org.jboss.arquillian.test.spi.TestEnricher
Enricher that provide @Resource field and method argument injection.
Field Resources will only be injected if the current value is NULL or primitive default value.
Field Resources will only be injected if the current value is NULL or primitive default value.
- Version:
- $Revision: $
- Author:
- Aslak Knutsen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected ContextObtains the appropriate context for the test.protected StringgetResourceName(jakarta.annotation.Resource resource) protected StringgetResourceName(Field field) protected voidinjectClass(Object testCase) protected ObjectObject[]protected ObjectresolveResource(AnnotatedElement element) Looks up the JNDI resource for any given annotated element.protected StringtryResourceLookup(jakarta.annotation.Resource resource)
-
Constructor Details
-
ResourceInjectionEnricher
public ResourceInjectionEnricher()
-
-
Method Details
-
enrich
- Specified by:
enrichin interfaceorg.jboss.arquillian.test.spi.TestEnricher
-
resolve
- Specified by:
resolvein interfaceorg.jboss.arquillian.test.spi.TestEnricher
-
injectClass
-
resolveResource
Looks up the JNDI resource for any given annotated element.- Parameters:
element- any annotated element (field, method, etc.)- Returns:
- the located resource
- Throws:
Exception
-
lookup
- Throws:
Exception
-
getContainerContext
Obtains the appropriate context for the test. Can be overriden by enrichers for each container to provide the correct context.- Returns:
- the test context
- Throws:
NamingException
-
getResourceName
-
getResourceName
-
tryResourceLookup
-