[webbeans-commits] Webbeans SVN: r3359 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-29 19:15:49 -0400 (Wed, 29 Jul 2009)
New Revision: 3359
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java
Log:
Now working
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java 2009-07-29 23:12:05 UTC (rev 3358)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java 2009-07-29 23:15:49 UTC (rev 3359)
@@ -35,10 +35,8 @@
public class InterceptorNotResolvedTest extends AbstractJSR299Test
{
- @Test(groups = { "ri-broken", "resolution" })
+ @Test(groups = { "resolution" })
@SpecAssertion(section = "5.3", id = "hq")
- // WBRI-260
- // WBRI-321
public void testInterceptorNotResolved()
{
Set<Type> types = new HashSet<Type>();
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3358 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-29 19:12:05 -0400 (Wed, 29 Jul 2009)
New Revision: 3358
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/CowShed.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator1.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator2.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooImpl.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
Log:
WBRI-298 WBRI-310 WBRI-327
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -277,7 +277,7 @@
List<Class<?>> defaultEnabledDecoratorClasses = new ArrayList<Class<?>>();
ListMultimap<Class<? extends Annotation>, Context> contexts = Multimaps.newListMultimap(new ConcurrentHashMap<Class<? extends Annotation>, Collection<Context>>(), new Supplier<List<Context>>()
- {
+ {
public List<Context> get()
{
@@ -883,22 +883,29 @@
return getReference(bean, creationalContext);
}
- @SuppressWarnings("unchecked")
- public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
+
+ /**
+ * Get a reference, registering the injection point used.
+ *
+ * @param injectionPoint the injection point to register
+ * @param resolvedBean the bean to get a reference to
+ * @param creationalContext the creationalContext
+ * @return
+ */
+ public Object getReference(InjectionPoint injectionPoint, Bean<?> resolvedBean, CreationalContext<?> creationalContext)
{
- boolean registerInjectionPoint = !injectionPoint.getType().equals(InjectionPoint.class);
+ boolean registerInjectionPoint = (injectionPoint != null && !injectionPoint.getType().equals(InjectionPoint.class));
try
{
if (registerInjectionPoint)
{
currentInjectionPoint.get().push(injectionPoint);
}
- WBAnnotated<?, ?> element = ResolvableWBClass.of(injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0]), this);
- Bean<?> resolvedBean = getBean(element, element.getBindingsAsArray());
if (getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScopeType()).isNormal() && !Proxies.isTypeProxyable(injectionPoint.getType()))
{
throw new UnproxyableResolutionException("Attempting to inject an unproxyable normal scoped bean " + resolvedBean + " into " + injectionPoint);
}
+ // TODO Can we move this logic to getReference?
if (creationalContext instanceof CreationalContextImpl)
{
CreationalContextImpl<?> creationalContextImpl = (CreationalContextImpl<?>) creationalContext;
@@ -924,6 +931,14 @@
}
}
}
+
+
+ public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
+ {
+ WBAnnotated<?, ?> element = ResolvableWBClass.of(injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0]), this);
+ Bean<?> resolvedBean = getBean(element, element.getBindingsAsArray());
+ return getReference(injectionPoint, resolvedBean, creationalContext);
+ }
/**
* Returns an instance by API type and binding types
@@ -1080,12 +1095,11 @@
}
/**
- * Accesses the factory used to create each instance of InjectionPoint that
- * is injected into web beans.
+ * The injection point being operated on for this thread
*
- * @return the factory
+ * @return the current injection point
*/
- public InjectionPoint getInjectionPoint()
+ public InjectionPoint getCurrentInjectionPoint()
{
if (!currentInjectionPoint.get().empty())
{
@@ -1096,6 +1110,29 @@
return null;
}
}
+
+ /**
+ * Replaces (or adds) the current injection point. If a current injection
+ * point exists, it will be replaced. If no current injection point exists,
+ * one will be added.
+ *
+ * @param injectionPoint the injection point to use
+ * @return the injection point added, or null if non previous existed
+ */
+ public InjectionPoint replaceOrPushCurrentInjectionPoint(InjectionPoint injectionPoint)
+ {
+ InjectionPoint originalInjectionPoint = null;
+ if (!currentInjectionPoint.get().empty())
+ {
+ originalInjectionPoint = currentInjectionPoint.get().pop();
+ }
+ else
+ {
+ log.trace("No current injection point to replace #0", injectionPoint);
+ }
+ currentInjectionPoint.get().push(injectionPoint);
+ return originalInjectionPoint;
+ }
/**
*
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -105,17 +105,18 @@
// The API types
protected Set<Type> types;
// The injection points
- protected Set<WBInjectionPoint<?, ?>> injectionPoints;
+ private Set<WBInjectionPoint<?, ?>> injectionPoints;
+ private Set<WBInjectionPoint<?, ?>> delegateInjectionPoints;
// If the type a primitive?
private boolean primitive;
// The Web Beans manager
protected BeanManagerImpl manager;
- protected boolean _serializable;
+ private boolean _serializable;
private boolean initialized;
- private Set<WBInjectionPoint<?, ?>> decoratesInjectionPoint;
+
protected boolean isInitialized()
{
@@ -131,7 +132,8 @@
{
super(manager);
this.manager = manager;
- injectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
+ this.injectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
+ this.delegateInjectionPoints = new HashSet<WBInjectionPoint<?,?>>();
}
/**
@@ -156,34 +158,37 @@
initScopeType();
initSerializable();
initProxyable();
- initInjectionPoints();
- initDecorates();
- checkDecorates();
+ checkDelegateInjectionPoints();
}
- protected void checkDecorates()
+ protected void checkDelegateInjectionPoints()
{
- if (this.decoratesInjectionPoint.size() > 0)
+ if (this.delegateInjectionPoints.size() > 0)
{
throw new DefinitionException("Cannot place @Decorates at an injection point which is not on a Decorator " + this);
}
}
-
- protected void initDecorates()
+
+ protected void addInjectionPoint(WBInjectionPoint<?, ?> injectionPoint)
{
- this.decoratesInjectionPoint = new HashSet<WBInjectionPoint<?, ?>>();
- for (WBInjectionPoint<?, ?> injectionPoint : getAnnotatedInjectionPoints())
+ if (injectionPoint.isAnnotationPresent(Decorates.class))
{
- if (injectionPoint.isAnnotationPresent(Decorates.class))
- {
- this.decoratesInjectionPoint.add(injectionPoint);
- }
+ this.delegateInjectionPoints.add(injectionPoint);
}
+ injectionPoints.add(injectionPoint);
}
+
+ protected void addInjectionPoints(Iterable<? extends WBInjectionPoint<?, ?>> injectionPoints)
+ {
+ for (WBInjectionPoint<?, ?> injectionPoint : injectionPoints)
+ {
+ addInjectionPoint(injectionPoint);
+ }
+ }
- protected Set<WBInjectionPoint<?, ?>> getDecoratesInjectionPoint()
+ protected Set<WBInjectionPoint<?, ?>> getDelegateInjectionPoints()
{
- return decoratesInjectionPoint;
+ return delegateInjectionPoints;
}
/**
@@ -205,8 +210,6 @@
log.trace("Using binding types " + bindings + " specified by annotations");
}
- protected abstract void initInjectionPoints();
-
protected void initDefaultBindings()
{
if (bindings.size() == 0)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -39,6 +39,7 @@
import javax.enterprise.inject.deployment.DeploymentType;
import javax.enterprise.inject.deployment.Production;
import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.DefinitionException;
@@ -113,6 +114,7 @@
public void initialize(BeanDeployerEnvironment environment)
{
initInitializerMethods();
+ initInjectableFields();
super.initialize(environment);
checkBeanImplementation();
initDecorators();
@@ -149,55 +151,55 @@
}
}
- protected T applyDecorators(T instance, CreationalContext<T> creationalContext)
+ protected T applyDecorators(T instance, CreationalContext<T> creationalContext, InjectionPoint originalInjectionPoint)
{
- if (hasDecorators())
+ List<SerializableBeanInstance<DecoratorBean<Object>, Object>> decoratorInstances = new ArrayList<SerializableBeanInstance<DecoratorBean<Object>,Object>>();
+ InjectionPoint ip = originalInjectionPoint;
+ boolean outside = decoratorStackPosition.get().intValue() == 0;
+ try
{
- List<SerializableBeanInstance<DecoratorBean<Object>, Object>> decoratorInstances = new ArrayList<SerializableBeanInstance<DecoratorBean<Object>,Object>>();
- boolean outside = decoratorStackPosition.get().intValue() == 0;
- try
+ int i = decoratorStackPosition.get();
+ while (i < decorators.size())
{
- int i = decoratorStackPosition.get();
- while (i < decorators.size())
+ Decorator<?> decorator = decorators.get(i);
+ if (decorator instanceof DecoratorBean<?>)
{
- Decorator<?> decorator = decorators.get(i);
- if (decorator instanceof DecoratorBean)
- {
- decoratorStackPosition.set(++i);
- decoratorInstances.add(new SerializableBeanInstance<DecoratorBean<Object>, Object>((DecoratorBean) decorator, getManager().getReference(decorator, Object.class, creationalContext)));
- }
- else
- {
- throw new IllegalStateException("Cannot operate on non container provided decorator " + decorator);
- }
+ decoratorStackPosition.set(++i);
+
+ @SuppressWarnings("unchecked")
+ DecoratorBean<Object> decoratorBean = (DecoratorBean<Object>) decorator;
+
+ Object decoratorInstance = getManager().getReference(ip, decorator, creationalContext);
+ decoratorInstances.add(new SerializableBeanInstance<DecoratorBean<Object>, Object>(decoratorBean, decoratorInstance));
+ ip = decoratorBean.getDelegateInjectionPoint();
}
- }
- finally
- {
- if (outside)
+ else
{
- decoratorStackPosition.remove();
+ throw new IllegalStateException("Cannot operate on non container provided decorator " + decorator);
}
}
- try
+ }
+ finally
+ {
+ if (outside)
{
- T proxy = proxyClassForDecorators.newInstance();
- ((ProxyObject) proxy).setHandler(new DecoratorProxyMethodHandler(decoratorInstances, instance));
- return proxy;
+ decoratorStackPosition.remove();
}
- catch (InstantiationException e)
- {
- throw new RuntimeException("Could not instantiate decorator proxy for " + toString(), e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException("Could not access bean correctly when creating decorator proxy for " + toString(), e);
- }
}
- else
+ try
{
- return instance;
+ T proxy = proxyClassForDecorators.newInstance();
+ ((ProxyObject) proxy).setHandler(new DecoratorProxyMethodHandler(decoratorInstances, instance));
+ return proxy;
}
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException("Could not instantiate decorator proxy for " + toString(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Could not access bean correctly when creating decorator proxy for " + toString(), e);
+ }
}
public List<Decorator<?>> getDecorators()
@@ -248,17 +250,10 @@
/**
* Initializes the injection points
*/
- protected void initInjectionPoints()
+ protected void initInjectableFields()
{
injectableFields = new HashSet<FieldInjectionPoint<?>>(Beans.getFieldInjectionPoints(annotatedItem, this));
- super.injectionPoints.addAll(injectableFields);
- for (WBMethod<?> initializer : getInitializerMethods())
- {
- for (WBParameter<?> parameter : initializer.getParameters())
- {
- injectionPoints.add(ParameterInjectionPoint.of(this, parameter));
- }
- }
+ addInjectionPoints(injectableFields);
}
/**
@@ -287,7 +282,12 @@
}
else
{
- initializerMethods.add(MethodInjectionPoint.of(this, method));
+ MethodInjectionPoint<?> initializerMethod = MethodInjectionPoint.of(this, method);
+ initializerMethods.add(initializerMethod);
+ for (WBParameter<?> parameter : initializerMethod.getParameters())
+ {
+ addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
+ }
}
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -198,7 +198,7 @@
{
throw new IllegalProductException("Producers cannot declare passivating scope and return a non-serializable class");
}
- InjectionPoint injectionPoint = manager.getInjectionPoint();
+ InjectionPoint injectionPoint = manager.getCurrentInjectionPoint();
if (injectionPoint == null)
{
return;
@@ -280,13 +280,19 @@
return;
}
}
-
+
@Override
protected void initSerializable()
{
- _serializable = true;
+ // No-op
}
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
/**
* Creates an instance of the bean
*
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -32,7 +32,6 @@
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.injection.WBInjectionPoint;
-import org.jboss.webbeans.introspector.WBAnnotated;
import org.jboss.webbeans.introspector.WBClass;
public class DecoratorBean<T> extends SimpleBean<T> implements Decorator<T>
@@ -77,7 +76,7 @@
return new DecoratorBean<T>(clazz, manager);
}
- private WBAnnotated<?, ?> decorates;
+ private WBInjectionPoint<?, ?> delegateInjectionPoint;
private Set<Annotation> delegateBindings;
private Type delegateType;
private Set<Type> delegateTypes;
@@ -94,7 +93,7 @@
if (!isInitialized())
{
super.initialize(environment);
- initDelegate();
+ initDelegateInjectionPoint();
initDecoratedTypes();
initDelegateBindings();
initDelegateType();
@@ -109,40 +108,40 @@
this.decoratedTypes.remove(Serializable.class);
}
- protected void initDelegate()
+ protected void initDelegateInjectionPoint()
{
- this.decorates = getDecoratesInjectionPoint().iterator().next();
+ this.delegateInjectionPoint = getDelegateInjectionPoints().iterator().next();
}
@Override
- protected void checkDecorates()
+ protected void checkDelegateInjectionPoints()
{
- for (WBInjectionPoint<?, ?> injectionPoint : getDecoratesInjectionPoint())
+ for (WBInjectionPoint<?, ?> injectionPoint : getDelegateInjectionPoints())
{
- if (injectionPoint instanceof MethodInjectionPoint && !injectionPoint.isAnnotationPresent(Initializer.class))
+ if (injectionPoint instanceof MethodInjectionPoint<?> && !injectionPoint.isAnnotationPresent(Initializer.class))
{
throw new DefinitionException("Method with @Decorates parameter must be an initializer method " + injectionPoint);
}
}
- if (getDecoratesInjectionPoint().size() == 0)
+ if (getDelegateInjectionPoints().size() == 0)
{
- throw new DefinitionException("No @Decorates injection point defined " + this);
+ throw new DefinitionException("No delegate injection points defined " + this);
}
- else if (getDecoratesInjectionPoint().size() > 1)
+ else if (getDelegateInjectionPoints().size() > 1)
{
- throw new DefinitionException("Too many @Decorates injection point defined " + this);
+ throw new DefinitionException("Too many delegate injection point defined " + this);
}
}
protected void initDelegateBindings()
{
this.delegateBindings = new HashSet<Annotation>();
- this.delegateBindings.addAll(this.decorates.getBindings());
+ this.delegateBindings.addAll(this.delegateInjectionPoint.getBindings());
}
protected void initDelegateType()
{
- this.delegateType = this.decorates.getBaseType();
+ this.delegateType = this.delegateInjectionPoint.getBaseType();
this.delegateTypes = new HashSet<Type>();
delegateTypes.add(delegateType);
}
@@ -153,7 +152,7 @@
{
if (decoratedType instanceof Class)
{
- if (!((Class<?>) decoratedType).isAssignableFrom(decorates.getJavaClass()))
+ if (!((Class<?>) decoratedType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
{
throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
}
@@ -161,13 +160,13 @@
else if (decoratedType instanceof ParameterizedType)
{
ParameterizedType parameterizedType = (ParameterizedType) decoratedType;
- if (!decorates.isParameterizedType())
+ if (!delegateInjectionPoint.isParameterizedType())
{
throw new DefinitionException("The decorated type is parameterized, but the delegate type isn't. Delegate type " + delegateType + "." + this);
}
- if (!Arrays.equals(decorates.getActualTypeArguments(), parameterizedType.getActualTypeArguments()));
+ if (!Arrays.equals(delegateInjectionPoint.getActualTypeArguments(), parameterizedType.getActualTypeArguments()));
Type rawType = ((ParameterizedType) decoratedType).getRawType();
- if (rawType instanceof Class && !((Class<?>) rawType).isAssignableFrom(decorates.getJavaClass()))
+ if (rawType instanceof Class && !((Class<?>) rawType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
{
throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
}
@@ -194,6 +193,11 @@
{
return decoratedTypes;
}
+
+ public WBInjectionPoint<?, ?> getDelegateInjectionPoint()
+ {
+ return delegateInjectionPoint;
+ }
/**
* The type closure of the delegate type
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -33,7 +33,6 @@
import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.MethodInjectionPoint;
-import org.jboss.webbeans.injection.WBInjectionPoint;
import org.jboss.webbeans.introspector.WBMethod;
public class DisposalMethodBean<T> extends AbstractReceiverBean<T, Method>
@@ -55,7 +54,7 @@
@Override
public void initialize(BeanDeployerEnvironment environment)
{
- // TODO Auto-generated method stub
+ addInjectionPoint(disposalMethodInjectionPoint);
super.initialize(environment);
checkDisposalMethod();
}
@@ -77,11 +76,6 @@
return new DisposalMethodBean<T>(manager, disposalMethod, declaringBean);
}
- protected void initInjectionPoints()
- {
- injectionPoints.add(disposalMethodInjectionPoint);
- }
-
@Override
protected void initBindings()
{
@@ -105,12 +99,6 @@
}
@Override
- public Set<WBInjectionPoint<?, ?>> getAnnotatedInjectionPoints()
- {
- return injectionPoints;
- }
-
- @Override
public String getName()
{
return null;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -231,7 +231,11 @@
creationalContext.push(instance);
((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler<T>(this, creationalContext));
log.trace("Enterprise bean instance created for bean {0}", this);
- return applyDecorators(instance, creationalContext);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, null);
+ }
+ return instance;
}
catch (InstantiationException e)
{
@@ -315,12 +319,18 @@
{
creationalContext.release();
}
-
+
@Override
protected void initSerializable()
{
- super._serializable = true;
+ // No-op
}
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
public InternalEjbDescriptor<T> getEjbDescriptor()
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -156,12 +156,6 @@
return id;
}
- @Override
- protected void initInjectionPoints()
- {
-
- }
-
public Set<Class<? extends Annotation>> getStereotypes()
{
return Collections.emptySet();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -98,6 +98,7 @@
{
if (!isInitialized())
{
+ initProducerMethodInjectableParameters();
super.initialize(environment);
checkProducerMethod();
initDisposalMethod(environment);
@@ -107,11 +108,11 @@
/**
* Initializes the injection points
*/
- protected void initInjectionPoints()
+ protected void initProducerMethodInjectableParameters()
{
for (WBParameter<?> parameter : method.getParameters())
{
- injectionPoints.add(ParameterInjectionPoint.of(this, parameter));
+ addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -27,6 +27,7 @@
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.DefinitionException;
@@ -49,6 +50,7 @@
import org.jboss.webbeans.persistence.spi.JpaServices;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.util.Names;
+import org.jboss.webbeans.util.Reflections;
/**
* Represents a simple bean
@@ -112,16 +114,43 @@
*/
public T create(CreationalContext<T> creationalContext)
{
- T instance = null;
- instance = constructor.newInstance(manager, creationalContext);
- instance = applyDecorators(instance, creationalContext);
- creationalContext.push(instance);
+ InjectionPoint originalInjectionPoint = null;
+ if (hasDecorators())
+ {
+ originalInjectionPoint = attachCorrectInjectionPoint();
+ }
+ T instance = constructor.newInstance(manager, creationalContext);
+ if (!hasDecorators())
+ {
+ // This should be safe, but needs verification PLM
+ // Without this, the chaining of decorators will fail as the incomplete instance will be resolved
+ creationalContext.push(instance);
+ }
injectEjbAndCommonFields(instance);
injectBoundFields(instance, creationalContext);
callInitializers(instance, creationalContext);
callPostConstruct(instance);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, originalInjectionPoint);
+ }
return instance;
}
+
+ protected InjectionPoint attachCorrectInjectionPoint()
+ {
+ Decorator<?> decorator = getDecorators().get(getDecorators().size() - 1);
+ if (decorator instanceof DecoratorBean<?>)
+ {
+ DecoratorBean<?> decoratorBean = (DecoratorBean<?>) decorator;
+ InjectionPoint outerDelegateInjectionPoint = decoratorBean.getDelegateInjectionPoint();
+ return getManager().replaceOrPushCurrentInjectionPoint(outerDelegateInjectionPoint);
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot operate on user defined decorator");
+ }
+ }
/**
* Destroys an instance of the bean
@@ -293,19 +322,6 @@
}
/**
- * Initializes the injection points
- */
- @Override
- protected void initInjectionPoints()
- {
- super.initInjectionPoints();
- for (WBParameter<?> parameter : constructor.getParameters())
- {
- injectionPoints.add(ParameterInjectionPoint.of(this, parameter));
- }
- }
-
- /**
* Validates the type
*/
protected void checkType()
@@ -319,7 +335,7 @@
throw new DefinitionException("Simple bean " + type + " cannot be a parameterized type");
}
boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isPassivating();
- if (passivating && !_serializable)
+ if (passivating && !Reflections.isSerializable(getBeanClass()))
{
throw new DefinitionException("Simple bean declaring a passivating scope must have a serializable implementation class " + toString());
}
@@ -331,7 +347,7 @@
}
for (Decorator<?> decorator : getDecorators())
{
- if (decorator instanceof DecoratorBean)
+ if (decorator instanceof DecoratorBean<?>)
{
DecoratorBean<?> decoratorBean = (DecoratorBean<?>) decorator;
for (WBMethod<?> decoratorMethod : decoratorBean.getAnnotatedItem().getMethods())
@@ -426,18 +442,25 @@
{
this.constructor = ConstructorInjectionPoint.of(this, initializerAnnotatedConstructors.iterator().next());
log.trace("Exactly one constructor (" + constructor + ") annotated with @Initializer defined, using it as the bean constructor for " + getType());
- return;
}
-
- if (getAnnotatedItem().getNoArgsConstructor() != null)
+ else if (getAnnotatedItem().getNoArgsConstructor() != null)
{
this.constructor = ConstructorInjectionPoint.of(this, getAnnotatedItem().getNoArgsConstructor());
log.trace("Exactly one constructor (" + constructor + ") defined, using it as the bean constructor for " + getType());
- return;
}
-
- throw new DefinitionException("Cannot determine constructor to use for " + getType());
+
+ if (this.constructor == null)
+ {
+ throw new DefinitionException("Cannot determine constructor to use for " + getType());
+ }
+ else
+ {
+ for (WBParameter<?> parameter : constructor.getParameters())
+ {
+ addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
+ }
+ }
}
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -40,7 +40,7 @@
public T create(CreationalContext<T> creationalContext)
{
- InjectionPoint injectionPoint = this.getManager().getInjectionPoint();
+ InjectionPoint injectionPoint = this.getManager().getCurrentInjectionPoint();
if (injectionPoint != null)
{
Type genericType = injectionPoint.getType();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -59,7 +59,7 @@
public InjectionPoint create(CreationalContext<InjectionPoint> creationalContext)
{
- return getManager().getInjectionPoint();
+ return getManager().getCurrentInjectionPoint();
}
public void destroy(InjectionPoint instance, CreationalContext<InjectionPoint> creationalContext)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -28,9 +28,11 @@
import java.util.List;
import java.util.Set;
+import javax.decorator.Decorates;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.introspector.ForwardingWBConstructor;
@@ -65,6 +67,7 @@
private final Bean<?> declaringBean;
private final WBConstructor<T> constructor;
+ private final boolean delegate;
public static <T> ConstructorInjectionPoint<T> of(Bean<?> declaringBean, WBConstructor<T> constructor)
{
@@ -75,6 +78,7 @@
{
this.declaringBean = declaringBean;
this.constructor = constructor;
+ this.delegate = isAnnotationPresent(Decorates.class) && declaringBean instanceof Decorator<?>;
}
@Override
@@ -189,8 +193,7 @@
public boolean isDelegate()
{
- // TODO Auto-generated method stub
- return false;
+ return delegate;
}
public boolean isTransient()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -24,9 +24,11 @@
import java.lang.reflect.Type;
import java.util.Set;
+import javax.decorator.Decorates;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.introspector.ForwardingWBField;
@@ -39,6 +41,7 @@
private final Bean<?> declaringBean;
private final WBField<T> field;
+ private final boolean delegate;
public static <T> FieldInjectionPoint<T> of(Bean<?> declaringBean, WBField<T> field)
{
@@ -49,6 +52,7 @@
{
this.declaringBean = declaringBean;
this.field = field;
+ this.delegate = isAnnotationPresent(Decorates.class) && declaringBean instanceof Decorator<?>;
}
@Override
@@ -106,8 +110,7 @@
public boolean isDelegate()
{
- // TODO Auto-generated method stub
- return false;
+ return delegate;
}
public Type getType()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -28,9 +28,11 @@
import java.util.List;
import java.util.Set;
+import javax.decorator.Decorates;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.introspector.ForwardingWBMethod;
@@ -65,6 +67,7 @@
private final Bean<?> declaringBean;
private final WBMethod<T> method;
+ private final boolean delegate;
public static <T> MethodInjectionPoint<T> of(Bean<?> declaringBean, WBMethod<T> method)
{
@@ -75,6 +78,7 @@
{
this.declaringBean = declaringBean;
this.method = method;
+ this.delegate = isAnnotationPresent(Decorates.class) && declaringBean instanceof Decorator<?>;
}
@Override
@@ -271,8 +275,7 @@
public boolean isDelegate()
{
- // TODO Auto-generated method stub
- return false;
+ return delegate;
}
public boolean isTransient()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -21,9 +21,11 @@
import java.lang.reflect.Type;
import java.util.Set;
+import javax.decorator.Decorates;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.introspector.ForwardingWBParameter;
@@ -41,11 +43,13 @@
private final Bean<?> declaringBean;
private final WBParameter<T> parameter;
+ private final boolean delegate;
private ParameterInjectionPoint(Bean<?> declaringBean, WBParameter<T> parameter)
{
this.declaringBean = declaringBean;
this.parameter = parameter;
+ this.delegate = isAnnotationPresent(Decorates.class) && declaringBean instanceof Decorator<?>;
}
@Override
@@ -87,8 +91,7 @@
public boolean isDelegate()
{
- // TODO Auto-generated method stub
- return false;
+ return delegate;
}
public boolean isTransient()
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/CowShed.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/CowShed.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/CowShed.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -28,14 +28,14 @@
public static final String MESSAGE = "cowShed";
@Current Logger logger;
-
- @Current Foo foo;
public void milk()
{
logger.log(MESSAGE);
}
+ @Current Foo foo;
+
public void washDown()
{
foo.log(MESSAGE);
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -45,11 +45,11 @@
})
public void testDecoratorInvocation()
{
- TimestampLogger.setMessage(null);
+ TimestampLogger.reset();
MockLogger.setMessage(null);
getInstanceByType(CowShed.class).milk();
assert TimestampLogger.getMessage().equals(CowShed.MESSAGE);
- assert MockLogger.getMessage().equals(CowShed.MESSAGE);
+ assert MockLogger.getMessage().equals(TimestampLogger.PREFIX + CowShed.MESSAGE);
}
@Test
@@ -64,13 +64,19 @@
})
public void testChainedDecoratorInvocation()
{
- FooDecorator1.setMessage(null);
- FooDecorator2.setMessage(null);
- FooImpl.setMessage(null);
+ FooDecorator1.reset();
+ FooDecorator2.reset();
+ FooImpl.reset();
getInstanceByType(CowShed.class).washDown();
assert FooDecorator1.getMessage().equals(CowShed.MESSAGE);
+ assert FooDecorator1.getInjectionPoint().getBean().getBeanClass().equals(CowShed.class);
+ assert !FooDecorator1.getInjectionPoint().isDelegate();
assert FooDecorator2.getMessage().equals(CowShed.MESSAGE + FooDecorator1.SUFFIX);
+ assert FooDecorator2.getInjectionPoint().getBean().getBeanClass().equals(FooDecorator1.class);
+ assert FooDecorator2.getInjectionPoint().isDelegate();
assert FooImpl.getMessage().equals(CowShed.MESSAGE + FooDecorator1.SUFFIX + FooDecorator2.SUFFIX);
+ assert FooImpl.getInjectionPoint().getBean().getBeanClass().equals(FooDecorator2.class);
+ assert FooImpl.getInjectionPoint().isDelegate();
}
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.decorators.invocation;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+@Artifact
+@BeansXml("beans.xml")
+@SpecVersion("20090625")
+@IntegrationTest
+public class EJBDecoratorInvocationTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="8.5", id="a"),
+ @SpecAssertion(section="8.5", id="c"),
+ @SpecAssertion(section="8.5", id="b"),
+ @SpecAssertion(section="8.1.3", id="d"),
+ @SpecAssertion(section="8.1.2", id="f"),
+ @SpecAssertion(section="8.1.2", id="b")
+ })
+ public void testDecoratorInvocation()
+ {
+ TimestampLogger.reset();
+ MockLogger.setMessage(null);
+ getInstanceByType(PigSty.class).clean();
+ assert TimestampLogger.getMessage().equals(PigSty.MESSAGE);
+ assert MockLogger.getMessage().equals(TimestampLogger.PREFIX + PigSty.MESSAGE);
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="8.5", id="d"),
+ @SpecAssertion(section="8.5", id="e"),
+ @SpecAssertion(section="8.5", id="f"),
+ @SpecAssertion(section="8.4", id="a"),
+ @SpecAssertion(section="8.1.3", id="d"),
+ @SpecAssertion(section="8.1.2", id="f"),
+ @SpecAssertion(section="8.1.2", id="b")
+ })
+ public void testChainedDecoratorInvocation()
+ {
+ FooDecorator1.reset();
+ FooDecorator2.reset();
+ FooImpl.reset();
+ getInstanceByType(PigSty.class).washDown();
+ assert FooDecorator1.getMessage().equals(PigSty.MESSAGE);
+ assert FooDecorator1.getInjectionPoint().getBean().getBeanClass().equals(PigStyImpl.class);
+ assert !FooDecorator1.getInjectionPoint().isDelegate();
+ assert FooDecorator2.getMessage().equals(PigSty.MESSAGE + FooDecorator1.SUFFIX);
+ assert FooDecorator2.getInjectionPoint().getBean().getBeanClass().equals(FooDecorator1.class);
+ assert FooDecorator2.getInjectionPoint().isDelegate();
+ assert FooImpl.getMessage().equals(PigSty.MESSAGE + FooDecorator1.SUFFIX + FooDecorator2.SUFFIX);
+ assert FooImpl.getInjectionPoint().getBean().getBeanClass().equals(FooDecorator2.class);
+ assert FooImpl.getInjectionPoint().isDelegate();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator1.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator1.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator1.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -18,6 +18,8 @@
import javax.decorator.Decorates;
import javax.decorator.Decorator;
+import javax.enterprise.inject.Initializer;
+import javax.enterprise.inject.spi.InjectionPoint;
/**
* @author pmuir
@@ -27,6 +29,19 @@
public class FooDecorator1
{
+ private static InjectionPoint injectionPoint;
+
+ @Initializer
+ public void setInjectionPoint(InjectionPoint injectionPoint)
+ {
+ FooDecorator1.injectionPoint = injectionPoint;
+ }
+
+ public static InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
public static final String SUFFIX = "fooDecorator1";
private static String message;
@@ -42,9 +57,10 @@
/**
* @param message the message to set
*/
- public static void setMessage(String message)
+ public static void reset()
{
- FooDecorator1.message = message;
+ FooDecorator1.message = null;
+ FooDecorator1.injectionPoint = null;
}
@Decorates Foo foo;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator2.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator2.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooDecorator2.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -18,6 +18,8 @@
import javax.decorator.Decorates;
import javax.decorator.Decorator;
+import javax.enterprise.inject.Current;
+import javax.enterprise.inject.spi.InjectionPoint;
/**
* @author pmuir
@@ -27,6 +29,15 @@
public class FooDecorator2
{
+ private static InjectionPoint injectionPoint;
+
+ @Current InjectionPoint ip;
+
+ public static InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
public static final String SUFFIX = "fooDecorator2";
private static String message;
@@ -42,9 +53,10 @@
/**
* @param message the message to set
*/
- public static void setMessage(String message)
+ public static void reset()
{
- FooDecorator2.message = message;
+ FooDecorator2.message = null;
+ FooDecorator2.injectionPoint = null;
}
@Decorates Foo foo;
@@ -53,6 +65,7 @@
{
FooDecorator2.message = message;
foo.log(message + SUFFIX);
+ injectionPoint = ip;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooImpl.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooImpl.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/FooImpl.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -16,6 +16,9 @@
*/
package org.jboss.jsr299.tck.tests.decorators.invocation;
+import javax.enterprise.inject.Initializer;
+import javax.enterprise.inject.spi.InjectionPoint;
+
/**
* @author pmuir
*
@@ -23,6 +26,23 @@
public class FooImpl implements Foo
{
+ private static InjectionPoint injectionPoint;
+
+ public FooImpl()
+ {
+ }
+
+ @Initializer
+ public FooImpl(InjectionPoint injectionPoint)
+ {
+ FooImpl.injectionPoint = injectionPoint;
+ }
+
+ public static InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
private static String message;
/**
@@ -36,9 +56,10 @@
/**
* @param message the message to set
*/
- public static void setMessage(String message)
+ public static void reset()
{
- FooImpl.message = message;
+ FooImpl.message = null;
+ FooImpl.injectionPoint = null;
}
public void log(String message)
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.decorators.invocation;
+
+/**
+ * @author pmuir
+ *
+ */
+public interface PigSty
+{
+
+ public static final String MESSAGE = "smelly work!";
+
+ public void clean();
+
+ public void washDown();
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.decorators.invocation;
+
+import javax.enterprise.inject.Current;
+
+/**
+ * @author pmuir
+ *
+ */
+public class PigStyImpl implements PigSty
+{
+
+ @Current Logger logger;
+
+ public void clean()
+ {
+ logger.log(PigSty.MESSAGE);
+ }
+
+ @Current Foo foo;
+
+ public void washDown()
+ {
+ foo.log(MESSAGE);
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/TimestampLogger.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -27,7 +27,9 @@
@Decorator
public class TimestampLogger
{
-
+
+ public static final String PREFIX = TimestampLogger.class.getSimpleName();
+
private static String message;
@Decorates
@@ -36,7 +38,7 @@
public void log(String message)
{
TimestampLogger.message = message;
- logger.log(message);
+ logger.log(PREFIX + message);
}
/**
@@ -50,9 +52,9 @@
/**
* @param message the message to set
*/
- public static void setMessage(String message)
+ public static void reset()
{
- TimestampLogger.message = message;
+ TimestampLogger.message = null;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectableReferenceTest.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -62,11 +62,10 @@
}
@SuppressWarnings("unchecked")
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertions({
@SpecAssertion(section = "11.3.2", id = "b")
})
- // WBRI-296
public void testGetInjectableReferenceReturnsDelegateForDelegateInjectionPoint()
{
// Get hold of the correct IP by inspecting the ones the container created for LoggerConsumer
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-07-29 22:38:33 UTC (rev 3357)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-07-29 23:12:05 UTC (rev 3358)
@@ -20,8 +20,6 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.HashSet;
import java.util.Set;
import javax.enterprise.context.Dependent;
@@ -31,11 +29,11 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.literals.CurrentLiteral;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.CurrentLiteral;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.testng.annotations.Test;
@@ -206,9 +204,8 @@
assert ip2.isTransient();
}
- @Test(groups = { "injectionPoint", "ri-broken" })
+ @Test(groups = { "injectionPoint" })
@SpecAssertion(section = "5.6.9", id="dba")
- // WBRI-310
public void testIsDelegate()
{
assert !getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral()).getInjectedBean().getInjectedMetadata().isDelegate();
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3357 - ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-07-29 18:38:33 -0400 (Wed, 29 Jul 2009)
New Revision: 3357
Modified:
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
Log:
clarify
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java 2009-07-29 22:25:02 UTC (rev 3356)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java 2009-07-29 22:38:33 UTC (rev 3357)
@@ -119,9 +119,13 @@
* Get the bean deployment archives which are accessible by this deployment
* and adjacent to it in the deployment archive graph.
*
- * The bean deployment archives will be processed in the order specified.
+ * The bean deployment archives will be processed in using the natural order
+ * of the list.
*
- * Circular dependencies will be detected and ignored by the container
+ * Cycles in the accessible BeanDeploymentArchive graph are allowed. If a
+ * cycle is detected by Web Beans, it will be automatically removed by Web
+ * Beans. This means any implementor of this interface don't need to worry
+ * about circularities.
*
* @return the ordered accessible bean deployment archives
*
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3356 - in tck/trunk/doc/reference/en-US: images and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-07-29 18:25:02 -0400 (Wed, 29 Jul 2009)
New Revision: 3356
Added:
tck/trunk/doc/reference/en-US/images/testng-emailable-report.png
tck/trunk/doc/reference/en-US/images/testng-plugin-report.png
tck/trunk/doc/reference/en-US/images/testng-suite-detail-report.png
tck/trunk/doc/reference/en-US/images/testng-summary-report.png
Modified:
tck/trunk/doc/reference/en-US/reporting.xml
Log:
initial draft of reporting chapter
Added: tck/trunk/doc/reference/en-US/images/testng-emailable-report.png
===================================================================
(Binary files differ)
Property changes on: tck/trunk/doc/reference/en-US/images/testng-emailable-report.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tck/trunk/doc/reference/en-US/images/testng-plugin-report.png
===================================================================
(Binary files differ)
Property changes on: tck/trunk/doc/reference/en-US/images/testng-plugin-report.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tck/trunk/doc/reference/en-US/images/testng-suite-detail-report.png
===================================================================
(Binary files differ)
Property changes on: tck/trunk/doc/reference/en-US/images/testng-suite-detail-report.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: tck/trunk/doc/reference/en-US/images/testng-summary-report.png
===================================================================
(Binary files differ)
Property changes on: tck/trunk/doc/reference/en-US/images/testng-summary-report.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: tck/trunk/doc/reference/en-US/reporting.xml
===================================================================
--- tck/trunk/doc/reference/en-US/reporting.xml 2009-07-29 22:24:40 UTC (rev 3355)
+++ tck/trunk/doc/reference/en-US/reporting.xml 2009-07-29 22:25:02 UTC (rev 3356)
@@ -2,7 +2,356 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="reporting">
<title>Reporting</title>
- <para>TODO</para>
+ <para>
+ This chapter covers the two types of reports that can be generated from
+ the TCK, an assertion coverage report and the test execution results. The
+ chapter also justifies why the TCK is good indicator of how accurately an
+ implementation conforms to the JSR 299 specification.
+ </para>
+ <section>
+ <title>CDI TCK Coverage Report</title>
+ <para>
+ A specification can be distilled into a collection of assertions that
+ define the behavior of the software. This section introduces the CDI
+ TCK coverage report, which documents the relationship between the
+ assertions that have been identified in the JSR 299 specification
+ document and the tests in the TCK test suite.
+ </para>
+ <para>
+ The structure of this report is controlled by the assertion document,
+ so we'll start there.
+ </para>
+ <section>
+ <title>CDK TCK Assertions</title>
+ <para>
+ The CDI TCK developers have analyzed the JSR 299 specification
+ document and identified the assertions that are present in each
+ chapter. Here's an example of one such assertion found in section
+ 2.3.3:
+ </para>
+ <blockquote>A bean may declare multiple binding types.</blockquote>
+ <para>
+ The assertions are listed in the XML file
+ impl/src/main/resources/tck-audit.xml in the CDI TCK distribution.
+ Each assertion is identified by the section of the specification
+ document in which it resides and assigned a unique paragraph
+ identifier to narrow down the location of the assertion further. To
+ continue with the example, the assertion shown above is listed in the
+ tck-audit.xml file using this XML fragment:
+ </para>
+ <programlisting role="XML"><![CDATA[<section id="2.3.3" title="Declare the bindings of a bean">
+ ...
+ <assertion id="d">
+ <text>A bean may declare multiple binding types.</type>
+ </assertion>
+ ...
+</section>]]></programlisting>
+
+ <para>
+ The strategy of the CDI TCK is to write a test which validates this
+ assertion when run against an implementation. A test case (a method
+ annotated with <literal>@Test</literal> in an
+ <literal>@Artifact</literal> class) is correlated with an assertion
+ using the
+ <literal>@org.jboss.test.audit.annotations.SpecAssertion</literal>
+ annotation as follows:
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[@Test
+@SpecAssertion(section = "2.3.3", id = "d")
+public void testMultipleBindings()
+{
+ Bean<?> model = getBeans(Cod.class, new ChunkyBinding(true), new WhitefishBinding()).iterator().next();
+ assert model.getBindings().size() == 3;
+}]]></programlisting>
+
+ <para>
+ The CDI TCK matches tests to 75% of these assertions, which is
+ proposed as sufficient coverage to certify a CDI implementation.
+ </para>
+
+ <para>
+ To help evaluate the distribution of coverage for these assertions,
+ the TCK provides a detailed coverage report. This report is also
+ useful to help implementors match tests with the language in the
+ specification that supports the behavior being tested.
+ </para>
+
+ </section>
+
+ <section>
+ <title>Producing the Coverage Report</title>
+
+ <para>
+ The coverage report is an HTML report generated as part of the TCK
+ project build. Specifically, it is generated by an annotation
+ processor that attaches to the compilation of the classes in the TCK
+ test suite, another tool from the JBoss Test Utils project. You can
+ enable this report by setting the commandline property tck-audit to
+ true when running the Maven 2 build in the tck directory.
+ </para>
+
+ <programlisting>mvn clean install -Dtck-audit=true</programlisting>
+
+ <note>
+ <para>
+ You must run clean first because the annotation processor
+ performs it's work when the test class is being compiled. If
+ compilation is unnecessary, then the assertions referenced in
+ that class will not be discovered.
+ </para>
+ </note>
+
+ <para>
+ The report is written to the file target/coverage.html in the same
+ project. The report has five sections:
+ </para>
+
+ <orderedlist>
+ <listitem>
+ <para>
+ <emphasis role="bold">Chapter Summary</emphasis> - List the
+ chapters (that contain assertions) in the specification
+ document along with total assertions, tests and coverage
+ percentage.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">Section Summary</emphasis> - Lists the
+ sections (that contain assertions) in the specification
+ document along with total assertions, tests and coverage
+ percentage.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">Coverage Detail</emphasis> - Each
+ assertion and the test that covers it, if any.
+ </para>
+ </listitem>
+ <listitem>
+ <para><emphasis role="bold">Unmatched Tests</emphasis> - A list
+ of tests for which there is no matching assertion (useful during
+ TCK development).</para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">Unversioned Tests</emphasis> - A list of
+ tests for which there is no <literal>@SpecVersion</literal>
+ annotation on the test class (useful during TCK development).
+ </para>
+ </listitem>
+ </orderedlist>
+
+ <para>
+ The coverage report is color coded to indicate the status of an
+ assertion, or group of assertions. The status codes are as follows:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Covered</para>
+ </listitem>
+ <listitem>
+ <para>Not covered</para>
+ </listitem>
+ <listitem>
+ <para>Unimplemented</para>
+ </listitem>
+ <listitem>
+ <para>Untestable</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ For reasons provided in the tck-audit.xml document and presented in
+ the coverage report, some assertions are not testable.
+ </para>
+
+ <para>
+ The coverage report does not give any indication as to whether the
+ tests are passing. That's where the TestNG reports come in.
+ </para>
+
+ </section>
+
+ <section>
+ <title>TestNG Reports</title>
+
+ <para>
+ As you know well by now, the CDI TCK test suite is really just a
+ TestNG test suite. That means an execution of the CDI TCK test
+ suite produces all the same reports that TestNG produces. This
+ section will go over those reports and show you were to go
+ to find each of them.
+ </para>
+
+ <section>
+ <title>Maven 2, Surefire and TestNG</title>
+
+ <para>
+ When the CDI TCK test suite is executed during the Maven 2 test
+ phase of the TCK runner project, TestNG is invoked indirectly
+ through the Maven Surefire plugin. Surefire is a test execution
+ abstraction layer capable of executing a mix of tests written for
+ JUnit, TestNG, and other supported test frameworks.
+ </para>
+ <para>
+ Why is this relevant? It means two things. First, it means
+ that you are going to get a summary of the test run on the
+ commandline. Here's the output generated when the tests are
+ run using standalone mode.
+ </para>
+
+ <programlisting><![CDATA[-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running TestSuite
+[XmlMethodSelector] CLASSNAME:org.jboss.testharness.impl.testng.DisableIntegrationTestsMethodSelector
+[XmlMethodSelector] SETTING PRIORITY:0
+[XmlMethodSelector] CLASSNAME:org.jboss.testharness.impl.testng.ExcludeIncontainerUnderInvestigationMethodSelector
+[XmlMethodSelector] SETTING PRIORITY:0
+Tests run: 441, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 22.816 sec
+
+Results :
+
+Tests run: 441, Failures: 0, Errors: 0, Skipped: 0]]></programlisting>
+
+ <note>
+ <para>
+ The number of tests executed, the execution time, and the
+ output will differ when you run the tests using in-container
+ mode as the CDI TCK requires.
+ </para>
+ </note>
+
+ <para>
+ If the Maven reporting plugin that compliments Surefire is
+ configured properly, Maven will also generate a generic HTML test
+ result report. That report is written to the file
+ test-report.html in the target/surefire-reports directory of the
+ TCK runner project. It shows how many tests were run, how many
+ failed and the success rate of the test run.
+ </para>
+
+ <para>
+ The one drawback of the Maven Surefire report plugin is that it
+ buffers the test failures and puts them in the HTML report rather
+ than outputting them to the commandline. If you are running
+ the test suite to determine if there are any failures, it may
+ be more useful to get this information in the foreground. You
+ can prevent the failures from being redirected to the report
+ using the following commandline switch:
+ </para>
+
+ <programlisting>mvn test -Dsurefire.useFile=false</programlisting>
+
+ <para>
+ The information that the Surefire provides is fairly basic and
+ the detail pales in comparison to what the native TestNG
+ reports provide.
+ </para>
+ </section>
+
+ <section>
+ <title>TestNG HTML Reports</title>
+
+ <para>
+ TestNG produces several HTML reports for a given test run. All
+ the reports can be found in the target/surefire-reports directory
+ in the TCK runner project. Below is a list of the three types of
+ reports:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Test Summary Report</para>
+ </listitem>
+ <listitem>
+ <para>Test Suite Detail Report</para>
+ </listitem>
+ <listitem>
+ <para>Emailable Report</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ The first report, the test summary report, show below, is written
+ to the file index.html. It produces the same information as the
+ generic Surefire report.
+ </para>
+
+ <graphic fileref="images/testng-summary-report.png" align="center"/>
+
+ <para>
+ The summary report links to the test suite detail report, which
+ has a wealth of information. It shows a complete list of test
+ groups along with the classes in each group, which groups were
+ included and excluded, and any exceptions that were raised,
+ whether from a passed or failed test. A partial view of the
+ test suite detail report is shown below.
+ </para>
+
+ <graphic fileref="images/testng-suite-detail-report.png" align="center"/>
+
+ <para>
+ The test suite detail report is very useful, but it borderlines
+ on complex. As an alternative, you can have a look at the
+ emailable report, which is a single HTML document that shows
+ much of the same information as the test suite detail report
+ in a more compact layout. A partial view of the emailable
+ report is shown below.
+ </para>
+
+ <graphic fileref="images/testng-emailable-report.png" align="center"/>
+
+ <para>
+ Now that you have seen two ways to get test results from the
+ Maven test execution, let's switch over to the IDE, specifically
+ Eclipse, and see how it presents TestNG test results.
+ </para>
+
+ </section>
+
+ <section>
+ <title>Test Results in the TestNG Plugin View</title>
+
+ <para>
+ Aftering running a test in Eclipse, as described in <xhref
+ linkend="eclipse-standalone"/> and <xref
+ linkend="eclipse-in-container"/>, the test results are displayed
+ in the TestNG plugin view, as shown below.
+ </para>
+
+ <graphic fileref="images/testng-plugin-report.png" align="center"/>
+
+ <para>
+ The view offers two lists. The first is a list of all methods
+ (tests) in the class flagged as either passed or failed. The
+ second is a list of methods (tests) in the class that failed. If
+ there is a test failure, you can click on the method name to get
+ the stacktrace leading up to the failure to display in the lower
+ frame.
+ </para>
+
+ <para>
+ You can also find the raw output of the TestNG execution in the
+ IDE console view. In that view, you can click on a test in the
+ stacktrace to open it in the editor pane.
+ </para>
+
+ <para>
+ One of the nice features of TestNG is that it can keep track of
+ which tests failed and offer to run only those tests again. You
+ can also rerun the entire class. Buttons are available for both
+ functions at the top of the view.
+ </para>
+
+ </section>
+
+ </section>
+ </section>
<!--
vim: ts=3:sw=3:tw=80:set expandtab
-->
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3355 - tck/trunk/doc/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-07-29 18:24:40 -0400 (Wed, 29 Jul 2009)
New Revision: 3355
Modified:
tck/trunk/doc/reference/en-US/eclipse-running.xml
Log:
add id
Modified: tck/trunk/doc/reference/en-US/eclipse-running.xml
===================================================================
--- tck/trunk/doc/reference/en-US/eclipse-running.xml 2009-07-29 21:41:12 UTC (rev 3354)
+++ tck/trunk/doc/reference/en-US/eclipse-running.xml 2009-07-29 22:24:40 UTC (rev 3355)
@@ -209,7 +209,7 @@
Let's start with a test artifact capable of running in standalone mode.
</para>
</section>
- <section>
+ <section id="eclipse-standalone">
<title>Running a test in standalone mode</title>
<para>
A standalone test artifact is a class which extends
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3354 - tck/trunk/doc/reference/en-US/images.
by webbeans-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-07-29 17:41:12 -0400 (Wed, 29 Jul 2009)
New Revision: 3354
Removed:
tck/trunk/doc/reference/en-US/images/in-container-execution.png
Log:
move to harness doc
Deleted: tck/trunk/doc/reference/en-US/images/in-container-execution.png
===================================================================
(Binary files differ)
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3352 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-07-29 15:32:58 -0400 (Wed, 29 Jul 2009)
New Revision: 3352
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
Log:
Finished implementation of getStereotypes() on Bean
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-07-29 14:45:28 UTC (rev 3351)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-07-29 19:32:58 UTC (rev 3352)
@@ -539,4 +539,14 @@
return getAnnotatedItem().isAnnotationPresent(Specializes.class);
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ Set<Class<? extends Annotation>> stereotypes = new HashSet<Class<? extends Annotation>>();
+ for (Annotation stereotypeAnnotation : getAnnotatedItem().getMetaAnnotations(Stereotype.class))
+ {
+ stereotypes.add(stereotypeAnnotation.annotationType());
+ }
+ return stereotypes;
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-07-29 14:45:28 UTC (rev 3351)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-07-29 19:32:58 UTC (rev 3352)
@@ -61,11 +61,6 @@
return decorator;
}
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return decorator.getStereotypes();
- }
-
};
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java 2009-07-29 14:45:28 UTC (rev 3351)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java 2009-07-29 19:32:58 UTC (rev 3352)
@@ -113,6 +113,16 @@
}
/**
+ * The stereotypes applied to this bean
+ *
+ * @return stereotypes if any
+ */
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return delegate().getStereotypes();
+ }
+
+ /**
* Gets the scope type of the delegate
*
* @return The scope type
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-29 14:45:28 UTC (rev 3351)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-29 19:32:58 UTC (rev 3352)
@@ -553,10 +553,4 @@
return false;
}
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
}
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3351 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-07-29 10:45:28 -0400 (Wed, 29 Jul 2009)
New Revision: 3351
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java
Log:
Updated Bean to latest spec 20090625 for real this time.
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -63,6 +63,13 @@
public String getName();
/**
+ * The stereotypes applied to this bean
+ *
+ * @return stereotypes if any
+ */
+ public Set<Class<? extends Annotation>> getStereotypes();
+
+ /**
* The bean class of the managed bean or session bean or of the bean that
* declares the producer method or field
*
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -61,6 +61,11 @@
return decorator;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return decorator.getStereotypes();
+ }
+
};
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -19,6 +19,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -280,4 +281,9 @@
// TODO sort out ordering of init, then we can use initDeploymentType and hence checkDeploymentType
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -17,9 +17,11 @@
package org.jboss.webbeans.bean;
import java.io.Serializable;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -382,6 +384,11 @@
{
return false;
}
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -16,7 +16,10 @@
*/
package org.jboss.webbeans.bean;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
@@ -159,4 +162,9 @@
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -16,8 +16,10 @@
*/
package org.jboss.webbeans.bean;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.util.Collections;
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
@@ -275,4 +277,9 @@
return id;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -553,4 +553,10 @@
return false;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -79,6 +79,11 @@
return null;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
@Override
public Set<WBInjectionPoint<?, ?>> getAnnotatedInjectionPoints()
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -3,6 +3,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
import java.lang.reflect.Type;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -107,6 +108,11 @@
return false;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
};
InjectionPoint injectionPoint = new InjectionPoint()
{
@@ -269,6 +275,11 @@
return bindingTypes;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
});
createContextualInstance(Field.class).get();
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -2,6 +2,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -100,6 +101,11 @@
return false;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
};
return bean;
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -151,6 +151,11 @@
return false;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
}
@Test
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -159,6 +159,11 @@
return false;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
}
@Test
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -98,6 +98,11 @@
{
return false;
}
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -100,4 +100,9 @@
return false;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java 2009-07-29 13:36:54 UTC (rev 3350)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java 2009-07-29 14:45:28 UTC (rev 3351)
@@ -4,6 +4,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Type;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -154,6 +155,11 @@
return false;
}
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
};
getCurrentManager().addBean(wrappedBean);
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3350 - ri/trunk/impl/src/main/java/org/jboss/webbeans/event.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-07-29 09:36:54 -0400 (Wed, 29 Jul 2009)
New Revision: 3350
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
Log:
Minor change for a toString method on observer methods to only list the declaring class now that it is available on beans.
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-07-29 13:30:48 UTC (rev 3349)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-07-29 13:36:54 UTC (rev 3350)
@@ -238,7 +238,7 @@
{
StringBuilder builder = new StringBuilder();
builder.append("Observer Implementation: \n");
- builder.append(" Observer (Declaring) class: " + Names.typesToString(observerBean.getTypes()));
+ builder.append(" Observer (Declaring) class: " + observerBean.getBeanClass());
builder.append(" Observer method: " + observerMethod);
return builder.toString();
}
15 years, 4 months