Class EJBInjectionEnricher
- java.lang.Object
-
- org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher
-
- All Implemented Interfaces:
TestEnricher
public class EJBInjectionEnricher extends Object implements TestEnricher
Enricher that provide EJB class and setter method injection.- Version:
- $Revision: $
- Author:
- Aslak Knutsen
-
-
Constructor Summary
Constructors Constructor Description EJBInjectionEnricher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringattemptToGet31LookupField(jakarta.ejb.EJB annotation)protected ContextcreateContext()voidenrich(Object testCase)protected List<Field>getFieldsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)Obtains all field in the specified class which contain the specified annotationprotected String[]getJndiNamesForAnonymousEJB(Class<?> fieldType)protected voidinjectClass(Object testCase)protected ObjectlookupEJB(String[] jndiNames)Object[]resolve(Method method)protected String[]resolveJNDINames(Class<?> fieldType, String mappedName, String beanName, String lookup)Resolves the JNDI name of the given field.
-
-
-
Method Detail
-
enrich
public void enrich(Object testCase)
- Specified by:
enrichin interfaceTestEnricher
-
resolve
public Object[] resolve(Method method)
- Specified by:
resolvein interfaceTestEnricher
-
getFieldsWithAnnotation
protected List<Field> getFieldsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation) throws IllegalArgumentException
Obtains all field in the specified class which contain the specified annotation- Throws:
IllegalArgumentException- If either argument is not specified
-
injectClass
protected void injectClass(Object testCase)
-
attemptToGet31LookupField
protected String attemptToGet31LookupField(jakarta.ejb.EJB annotation) throws IllegalAccessException, InvocationTargetException
-
resolveJNDINames
protected String[] resolveJNDINames(Class<?> fieldType, String mappedName, String beanName, String lookup)
Resolves the JNDI name of the given field.If mappedName, lookup or beanName are specified, they're used to resolve JNDI name. Otherwise, default policy applies.
If more than one of the mappedName, lookup and beanName
EJBannotation attributes is specified at the same time, anIllegalStateExceptionwill be thrown.- Parameters:
fieldType- annotated field which JNDI name should be resolved.mappedName- Value ofEJB's mappedName attribute.beanName- Value ofEJB's beanName attribute.lookup- Value ofEJB's lookup attribute.- Returns:
- possible JNDI names which should be looked up to access the proper object.
-
-