[webbeans-commits] Webbeans SVN: r1263 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean and 10 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Wed Jan 28 10:49:28 EST 2009
Author: pete.muir at jboss.org
Date: 2009-01-28 10:49:28 -0500 (Wed, 28 Jan 2009)
New Revision: 1263
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/RIBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BootstrapTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java
Log:
use getInstanceForInjection to find injection point, better hierachy for standard beans, enable a couple of TCK tests
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -35,11 +35,11 @@
import javax.inject.manager.Bean;
import javax.inject.manager.InjectionPoint;
-import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.AbstractProducerBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
import org.jboss.webbeans.bean.NewSimpleBean;
import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ListComparator;
import org.jboss.webbeans.util.Proxies;
@@ -117,9 +117,9 @@
throw new UnsupportedOperationException("Not yet implemented");
}
}
- if (bean instanceof AbstractBean && !(bean instanceof NewSimpleBean) && !(bean instanceof NewEnterpriseBean))
+ if (bean instanceof RIBean && !(bean instanceof NewSimpleBean) && !(bean instanceof NewEnterpriseBean))
{
- AbstractBean<?, ?> abstractBean = (AbstractBean<?, ?>) bean;
+ RIBean<?> abstractBean = (RIBean<?>) bean;
if (abstractBean.isSpecializing())
{
if (!hasHigherPrecedence(bean.getDeploymentType(), abstractBean.getSpecializedBean().getDeploymentType()))
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -53,9 +53,9 @@
import javax.inject.manager.Interceptor;
import javax.inject.manager.Manager;
-import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
+import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.proxy.ProxyPool;
import org.jboss.webbeans.context.ContextMap;
import org.jboss.webbeans.context.CreationalContextImpl;
@@ -63,7 +63,6 @@
import org.jboss.webbeans.ejb.spi.EjbResolver;
import org.jboss.webbeans.event.EventManager;
import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.injection.InjectionPointProvider;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -83,7 +82,6 @@
* @author Pete Muir
*
*/
- at Standard
public class ManagerImpl implements Manager, Serializable
{
@@ -98,8 +96,9 @@
private transient List<Class<? extends Annotation>> enabledDeploymentTypes;
// The Web Beans event manager
private transient final EventManager eventManager;
+
// An injection point metadata beans factory
- private transient final InjectionPointProvider injectionPointProvider;
+ private transient final ThreadLocal<InjectionPoint> currentInjectionPoint;
// The bean resolver
private transient final Resolver resolver;
@@ -130,8 +129,6 @@
private transient final NamingContext namingContext;
private final transient Map<Bean<?>, Bean<?>> specializedBeans;
-
- private final transient ThreadLocal<Map<Bean<?>, ?>> incompleteInstances;
/**
* Create a new manager
@@ -153,18 +150,8 @@
this.contextMap = new ContextMap();
this.eventManager = new EventManager();
this.ejbDescriptorCache = new EjbDescriptorCache();
- this.injectionPointProvider = new InjectionPointProvider();
+ this.currentInjectionPoint = new ThreadLocal<InjectionPoint>();
this.specializedBeans = new HashMap<Bean<?>, Bean<?>>();
- this.incompleteInstances = new ThreadLocal<Map<Bean<?>,?>>()
- {
-
- @Override
- protected Map<Bean<?>, ?> initialValue()
- {
- return new HashMap<Bean<?>, Object>();
- }
-
- };
List<Class<? extends Annotation>> defaultEnabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
defaultEnabledDeploymentTypes.add(0, Standard.class);
defaultEnabledDeploymentTypes.add(1, Production.class);
@@ -350,12 +337,12 @@
* @return A reference to the manager
*/
// TODO Build maps in the deployer :-)
- public void setBeans(Set<AbstractBean<?, ?>> beans)
+ public void setBeans(Set<RIBean<?>> beans)
{
synchronized (beans)
{
this.beans = new CopyOnWriteArrayList<Bean<?>>(beans);
- for (AbstractBean<?, ?> bean : beans)
+ for (RIBean<?> bean : beans)
{
if (bean instanceof NewEnterpriseBean)
{
@@ -602,35 +589,47 @@
public <T> T getInstanceToInject(InjectionPoint injectionPoint)
{
- return getInstanceToInject(AnnotatedClassImpl.of((Class<T>) injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0])), null);
+ return this.<T>getInstanceToInject(injectionPoint, null);
}
public <T> T getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
{
- return getInstanceToInject(AnnotatedClassImpl.of((Class<T>) injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0])), creationalContext);
- }
-
- private <T> T getInstanceToInject(AnnotatedItem<T, ?> element, CreationalContext<?> creationalContext)
- {
- Bean<T> bean = getBeanByType(element, element.getBindingTypesAsArray());
- if (creationalContext instanceof CreationalContextImpl)
+ boolean registerInjectionPoint = !injectionPoint.getType().equals(InjectionPoint.class);
+ try
{
- CreationalContextImpl<?> ctx = (CreationalContextImpl<?>) creationalContext;
- if (ctx.containsIncompleteInstance(bean))
+ if (registerInjectionPoint)
{
- return ctx.getIncompleteInstance(bean);
+ currentInjectionPoint.set(injectionPoint);
}
+ AnnotatedItem<T, ?> element = AnnotatedClassImpl.of((Class<T>) injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0]));
+ Bean<T> bean = getBeanByType(element, element.getBindingTypesAsArray());
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+ CreationalContextImpl<?> ctx = (CreationalContextImpl<?>) creationalContext;
+ if (ctx.containsIncompleteInstance(bean))
+ {
+ return ctx.getIncompleteInstance(bean);
+ }
+ else
+ {
+ return getInstance(bean, ctx.getCreationalContext(bean));
+ }
+ }
else
{
- return getInstance(bean, ctx.getCreationalContext(bean));
+ return getInstance(bean);
}
}
- else
+ finally
{
- return getInstance(bean);
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.remove();
+ }
}
}
+
/**
* Gets an instance by name, returning null if none is found and throwing an
* exception if too many beans match
@@ -871,9 +870,9 @@
*
* @return the factory
*/
- public InjectionPointProvider getInjectionPointProvider()
+ public InjectionPoint getInjectionPoint()
{
- return injectionPointProvider;
+ return currentInjectionPoint.get();
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -54,7 +54,7 @@
* @param <T> the type of bean
* @param <E> the Class<?> of the bean type
*/
-public abstract class AbstractBean<T, E> extends Bean<T>
+public abstract class AbstractBean<T, E> extends RIBean<T>
{
@SuppressWarnings("unchecked")
@@ -417,7 +417,7 @@
*
* @return The set of merged stereotypes
*/
- public MergedStereotypes<T, E> getMergedStereotypes()
+ protected MergedStereotypes<T, E> getMergedStereotypes()
{
return mergedStereotypes;
}
@@ -542,6 +542,7 @@
}
@Override
+ // TODO Fix this!!!
public boolean equals(Object other)
{
if (other instanceof AbstractBean)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -35,7 +35,6 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.injection.FieldInjectionPoint;
-import org.jboss.webbeans.injection.InjectionPointProvider;
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedClass;
@@ -98,18 +97,9 @@
*/
protected void injectBoundFields(T instance, CreationalContext<T> creationalContext)
{
- InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
for (FieldInjectionPoint<?> injectableField : injectableFields)
{
- injectionPointProvider.pushInjectionPoint(injectableField);
- try
- {
- injectableField.inject(instance, manager, creationalContext);
- }
- finally
- {
- injectionPointProvider.popInjectionPoint();
- }
+ injectableField.inject(instance, manager, creationalContext);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -194,7 +194,7 @@
{
throw new IllegalProductException("Producers cannot declare passivating scope and return a non-serializable class");
}
- InjectionPoint injectionPoint = manager.getInjectionPointProvider().getCurrentInjectionPoint();
+ InjectionPoint injectionPoint = manager.getInjectionPoint();
if (injectionPoint == null)
{
return;
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -1,66 +0,0 @@
-/*
- * 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.webbeans.bean;
-
-import javax.context.CreationalContext;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-
-/**
- * Bean for InjectionPoint metadata
- *
- * @author David Allen
- *
- */
-public class InjectionPointBean<T, S> extends AbstractFacadeBean<T, S, Object>
-{
-
- /**
- * Creates an InjectionPoint Web Bean for the injection of the containing bean owning
- * the field, constructor or method for the annotated item
- *
- * @param <T> must be InjectionPoint
- * @param <S>
- * @param field The annotated member field/parameter for the injection
- * @param manager The RI manager implementation
- * @return a new bean for this injection point
- */
- public static <T, S> InjectionPointBean<T, S> of(AnnotatedItem<T, S> field, ManagerImpl manager)
- {
- return new InjectionPointBean<T, S>(field, manager);
- }
-
- protected InjectionPointBean(AnnotatedItem<T, S> field, ManagerImpl manager)
- {
- super(field, manager);
- }
-
- public T create(CreationalContext<T> creationalContext)
- {
- // TODO Why do we need to cast here?
- return getType().cast(manager.getInjectionPointProvider().getPreviousInjectionPoint());
- }
-
- public void destroy(T instance)
- {
- // The instance is always in the Dependent context and can be garbage
- // collected
- }
-
-}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/RIBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/RIBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -0,0 +1,45 @@
+package org.jboss.webbeans.bean;
+
+import java.util.Set;
+
+import javax.context.Dependent;
+import javax.inject.manager.Bean;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
+
+public abstract class RIBean<T> extends Bean<T>
+{
+
+ private final ManagerImpl manager;
+
+ protected RIBean(ManagerImpl manager)
+ {
+ super(manager);
+ this.manager = manager;
+ }
+
+ @Override
+ protected ManagerImpl getManager()
+ {
+ return manager;
+ }
+
+ public abstract Class<T> getType();
+
+ public abstract boolean isSpecializing();
+
+ public boolean isDependent()
+ {
+ return getScopeType().equals(Dependent.class);
+ }
+
+ public abstract boolean isProxyable();
+
+ public abstract boolean isPrimitive();
+
+ public abstract Set<AnnotatedInjectionPoint<?, ?>> getInjectionPoints();
+
+ public abstract RIBean<?> getSpecializedBean();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/RIBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -37,7 +37,6 @@
import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
import org.jboss.webbeans.injection.ConstructorInjectionPoint;
import org.jboss.webbeans.injection.FieldInjectionPoint;
-import org.jboss.webbeans.injection.InjectionPointProvider;
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedClass;
@@ -125,7 +124,6 @@
try
{
DependentContext.INSTANCE.setActive(true);
- InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
T instance = null;
try
{
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -0,0 +1,94 @@
+package org.jboss.webbeans.bean.standard;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.context.Dependent;
+import javax.inject.Standard;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
+import org.jboss.webbeans.literal.CurrentLiteral;
+
+public abstract class AbstractStandardBean<T> extends RIBean<T>
+{
+
+ protected AbstractStandardBean(ManagerImpl manager)
+ {
+ super(manager);
+ }
+
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentLiteral() };
+ private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+
+ @Override
+ public Set<Annotation> getBindings()
+ {
+ return DEFAULT_BINDING;
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Standard.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public RIBean<?> getSpecializedBean()
+ {
+ return null;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<AnnotatedInjectionPoint<?, ?>> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isPrimitive()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return false;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java (from rev 1259, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/InjectionPointBean.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -0,0 +1,90 @@
+/*
+ * 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.webbeans.bean.standard;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.context.CreationalContext;
+import javax.inject.manager.InjectionPoint;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.literal.CurrentLiteral;
+
+/**
+ * Bean for InjectionPoint metadata
+ *
+ * @author David Allen
+ *
+ */
+public class InjectionPointBean extends AbstractStandardBean<InjectionPoint>
+{
+
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = { new CurrentLiteral() };
+ private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+ private static final Set<Type> TYPES = new HashSet<Type>(Arrays.asList(InjectionPoint.class));
+
+ /**
+ * Creates an InjectionPoint Web Bean for the injection of the containing bean owning
+ * the field, constructor or method for the annotated item
+ *
+ * @param <T> must be InjectionPoint
+ * @param <S>
+ * @param field The annotated member field/parameter for the injection
+ * @param manager The RI manager implementation
+ * @return a new bean for this injection point
+ */
+ public static InjectionPointBean of(ManagerImpl manager)
+ {
+ return new InjectionPointBean(AnnotatedClassImpl.of(InjectionPoint.class), manager);
+ }
+
+ protected InjectionPointBean(AnnotatedClass<InjectionPoint> clazz, ManagerImpl manager)
+ {
+ super(manager);
+ }
+
+ public InjectionPoint create(CreationalContext<InjectionPoint> creationalContext)
+ {
+ return getManager().getInjectionPoint();
+ }
+
+ public void destroy(InjectionPoint instance)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Class<InjectionPoint> getType()
+ {
+ return InjectionPoint.class;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.jboss.webbeans.bean.standard;
+
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.context.CreationalContext;
+import javax.inject.manager.Manager;
+
+import org.jboss.webbeans.ManagerImpl;
+
+public class ManagerBean extends AbstractStandardBean<ManagerImpl>
+{
+
+ private static final Set<Type> TYPES = new HashSet<Type>(Arrays.asList(ManagerImpl.class, Manager.class));
+
+ public static final ManagerBean of(ManagerImpl manager)
+ {
+ return new ManagerBean(manager);
+ }
+
+ protected ManagerBean(ManagerImpl manager)
+ {
+ super(manager);
+ }
+
+ public ManagerImpl create(CreationalContext<ManagerImpl> creationalContext)
+ {
+ return getManager();
+ }
+
+ @Override
+ public Class<ManagerImpl> getType()
+ {
+ return ManagerImpl.class;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+ public void destroy(ManagerImpl instance)
+ {
+ // No-op
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -18,7 +18,6 @@
import javax.inject.Realizes;
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.EventBean;
@@ -27,6 +26,7 @@
import org.jboss.webbeans.bean.NewSimpleBean;
import org.jboss.webbeans.bean.ProducerFieldBean;
import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
import org.jboss.webbeans.event.ObserverImpl;
@@ -50,19 +50,19 @@
private static final Set<Annotation> EMPTY_BINDINGS = Collections.emptySet();
- private final Set<AbstractBean<?, ?>> beans;
+ private final Set<RIBean<?>> beans;
private final Set<AnnotatedClass<?>> deferredClasses;
private final ManagerImpl manager;
public BeanDeployer(ManagerImpl manager)
{
this.manager = manager;
- this.beans = new HashSet<AbstractBean<?,?>>();
+ this.beans = new HashSet<RIBean<?>>();
this.deferredClasses = new HashSet<AnnotatedClass<?>>();
}
- public void addBean(AbstractBean<?, ?> bean)
+ public void addBean(RIBean<?> bean)
{
this.beans.add(bean);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -17,19 +17,16 @@
package org.jboss.webbeans.bootstrap;
-import java.util.Collections;
-import javax.context.CreationalContext;
import org.jboss.webbeans.BeanValidator;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.bean.standard.InjectionPointBean;
+import org.jboss.webbeans.bean.standard.ManagerBean;
import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.ejb.spi.EjbResolver;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.literal.DeployedLiteral;
import org.jboss.webbeans.literal.InitializedLiteral;
import org.jboss.webbeans.log.LogProvider;
@@ -47,38 +44,6 @@
public abstract class WebBeansBootstrap
{
- private static class ManagerBean extends SimpleBean<ManagerImpl>
- {
-
- public static final SimpleBean<ManagerImpl> of(ManagerImpl manager)
- {
- return new ManagerBean(AnnotatedClassImpl.of(ManagerImpl.class), manager);
- }
-
- protected ManagerBean(AnnotatedClass<ManagerImpl> type, ManagerImpl manager)
- {
- super(type, manager);
- }
-
- @Override
- protected void initConstructor()
- {
- // No - op, no constructor needed
- }
-
- @Override
- protected void initInjectionPoints()
- {
- injectionPoints = Collections.emptySet();
- }
-
- public ManagerImpl create(CreationalContext<ManagerImpl> creationalContext)
- {
- return manager;
- }
-
- }
-
// The log provider
private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
@@ -130,6 +95,7 @@
BeanDeployer beanDeployer = new BeanDeployer(manager);
beanDeployer.addClasses(classes);
beanDeployer.addBean(ManagerBean.of(manager));
+ beanDeployer.addBean(InjectionPointBean.of(manager));
beanDeployer.addClass(Transaction.class);
beanDeployer.deploy();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -43,6 +43,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -196,7 +197,7 @@
Object dependentsCollector = new Object();
try
{
- if (Dependent.class.equals(observerBean.getScopeType()) && observerBean instanceof AbstractBean)
+ if (Dependent.class.equals(observerBean.getScopeType()) && observerBean instanceof RIBean)
{
DependentContext.INSTANCE.setCurrentInjectionInstance(dependentsCollector);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -8,7 +8,6 @@
import java.util.Set;
import javax.context.CreationalContext;
-import javax.inject.Produces;
import javax.inject.manager.Bean;
import org.jboss.webbeans.ManagerImpl;
@@ -120,8 +119,6 @@
protected Object[] getParameterValues(List<ParameterInjectionPoint<?>> parameters, Object specialVal, Class<? extends Annotation> specialParam, ManagerImpl manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
- boolean producerMethod = this.isAnnotationPresent(Produces.class);
- InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
for (int i = 0; i < parameterValues.length; i++)
{
@@ -132,21 +129,7 @@
}
else
{
- if (!producerMethod)
- {
- injectionPointProvider.pushInjectionPoint(param);
- }
- try
- {
- parameterValues[i] = param.getValueToInject(manager, creationalContext);
- }
- finally
- {
- if (!producerMethod)
- {
- injectionPointProvider.popInjectionPoint();
- }
- }
+ parameterValues[i] = param.getValueToInject(manager, creationalContext);
}
}
return parameterValues;
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -1,83 +0,0 @@
-/*
- * 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.webbeans.injection;
-
-import java.util.Stack;
-
-import javax.inject.manager.InjectionPoint;
-
-/**
- * Provides injection point metadata
- *
- * @author David Allen
- * @author Nicklas Karlsson
- */
-public class InjectionPointProvider
-{
- // The stack of injection points
- private final Stack<InjectionPoint> injectionPoints = new Stack<InjectionPoint>();
-
- /**
- * Pushes an injection point to the stack
- *
- * @param injectionPoint The injection point to push
- */
- public void pushInjectionPoint(AnnotatedInjectionPoint<?, ?> injectionPoint)
- {
- injectionPoints.push(injectionPoint);
- }
-
- /**
- * Pops an injection point
- */
- public void popInjectionPoint()
- {
- if (injectionPoints.isEmpty())
- {
- return;
- }
- injectionPoints.pop();
- }
-
- /**
- * Gets the current injection point
- *
- * @return The current injection point or null if there is none on the stack
- */
- public InjectionPoint getCurrentInjectionPoint()
- {
- return injectionPoints.isEmpty() ? null : injectionPoints.peek();
- }
-
- /**
- * Gets the previous injection point
- *
- * @return The previous injection point or null if there is none on the stack
- */
- public InjectionPoint getPreviousInjectionPoint()
- {
- return injectionPoints.size() < 2 ? null : injectionPoints.elementAt(injectionPoints.size() - 2);
- }
-
- @Override
- public String toString()
- {
- return "InjectionPoint stack = " + injectionPoints.toString();
- }
-
-}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -8,7 +8,6 @@
import java.util.Set;
import javax.context.CreationalContext;
-import javax.inject.Produces;
import javax.inject.manager.Bean;
import org.jboss.webbeans.ManagerImpl;
@@ -125,8 +124,6 @@
protected Object[] getParameterValues(List<ParameterInjectionPoint<?>> parameters, Class<? extends Annotation> specialParam, Object specialVal, ManagerImpl manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
- boolean producerMethod = this.isAnnotationPresent(Produces.class);
- InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
for (int i = 0; i < parameterValues.length; i++)
{
@@ -137,21 +134,7 @@
}
else
{
- if (!producerMethod)
- {
- injectionPointProvider.pushInjectionPoint(param);
- }
- try
- {
- parameterValues[i] = param.getValueToInject(manager, creationalContext);
- }
- finally
- {
- if (!producerMethod)
- {
- injectionPointProvider.popInjectionPoint();
- }
- }
+ parameterValues[i] = param.getValueToInject(manager, creationalContext);
}
}
return parameterValues;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -165,7 +165,7 @@
{
return toString;
}
- toString = "Annotated field " + Names.fieldToString(field);
+ toString = Names.fieldToString(field) + " on " + getDeclaringClass();
return toString;
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -31,13 +31,11 @@
import javax.inject.TypeLiteral;
import javax.inject.manager.Bean;
import javax.inject.manager.Decorator;
-import javax.inject.manager.InjectionPoint;
import javax.inject.manager.InterceptionType;
import javax.inject.manager.Interceptor;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.MetaDataCache;
-import org.jboss.webbeans.bean.InjectionPointBean;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
import org.jboss.webbeans.model.BindingTypeModel;
@@ -200,15 +198,7 @@
}
};
-
- if (InjectionPoint.class.isAssignableFrom(element.getType()))
- {
- beans.add(InjectionPointBean.of(key, manager));
- }
- else
- {
- beans = registerInjectionPoint(element);
- }
+ beans = registerInjectionPoint(element);
return Collections.unmodifiableSet(beans);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Beans.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -22,8 +22,8 @@
import javax.inject.manager.Bean;
import org.jboss.webbeans.MetaDataCache;
-import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.RIBean;
/**
* Helper class for bean inspection
@@ -60,9 +60,9 @@
*/
public static boolean isBeanProxyable(Bean<?> bean)
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- return ((AbstractBean<?, ?>) bean).isProxyable();
+ return ((RIBean<?>) bean).isProxyable();
}
else
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BootstrapTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BootstrapTest.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BootstrapTest.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -6,9 +6,9 @@
import javax.inject.manager.Bean;
-import org.jboss.webbeans.bean.AbstractBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.test.mock.MockBootstrap;
import org.jboss.webbeans.test.unit.AbstractTest;
@@ -24,9 +24,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(Tuna.class);
@@ -40,9 +40,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(Hound.class);
@@ -56,9 +56,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(Tuna.class);
@@ -80,9 +80,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(TarantulaProducer.class);
@@ -100,9 +100,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(Hound.class);
@@ -124,9 +124,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(Hound.class);
@@ -155,9 +155,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : manager.getBeans())
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(TarantulaProducer.class);
@@ -175,9 +175,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : manager.getBeans())
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(Hound.class);
@@ -215,9 +215,9 @@
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : manager.getBeans())
{
- if (bean instanceof AbstractBean)
+ if (bean instanceof RIBean)
{
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ classes.put(((RIBean<?>) bean).getType(), bean);
}
}
assert classes.containsKey(Hound.class);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -16,7 +16,7 @@
assert Food.success;
}
- @Test
+ @Test(timeOut=1000)
public void testCircularInjectionOnOneNormalAndOneDependentBean() throws Exception
{
deployBeans(Car.class, Petrol.class);
@@ -35,7 +35,7 @@
}
- @Test
+ @Test(timeOut=1000)
public void testCircularInjectionOnOneDependentAndOneNormalBean() throws Exception
{
deployBeans(Car.class, Petrol.class);
@@ -89,7 +89,7 @@
}.run();
}
- @Test
+ @Test(timeOut=1000)
public void testNormalProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean() throws Exception
{
deployBeans(NormalSelfConsumingNormalProducer.class);
@@ -105,7 +105,7 @@
}.run();
}
- @Test
+ @Test(timeOut=1000)
public void testNormalProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean() throws Exception
{
deployBeans(DependentSelfConsumingNormalProducer.class);
@@ -121,7 +121,7 @@
}.run();
}
- @Test
+ @Test(timeOut=1000)
public void testDependentProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean() throws Exception
{
deployBeans(NormalSelfConsumingDependentProducer.class);
@@ -137,7 +137,7 @@
}.run();
}
- @Test
+ @Test(timeOut=1000)
public void testNormalSelfConsumingProducer() throws Exception
{
deployBeans(NormalLoopingProducer.class);
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java 2009-01-28 14:14:12 UTC (rev 1262)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java 2009-01-28 15:49:28 UTC (rev 1263)
@@ -32,7 +32,6 @@
import org.jboss.webbeans.tck.AbstractTest;
import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
import org.jboss.webbeans.tck.impl.literals.CurrentBinding;
import org.testng.annotations.Test;
@@ -232,46 +231,42 @@
}
}
- @Test(groups = { "injectionPoint", "broken" })
+ @Test(groups = { "injectionPoint" })
@SpecAssertion(section = "5.6")
- public void testStandardDeployment()
+ public void testStandardDeployment() throws Exception
{
- deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+ deployBeans();
- // Get an instance of the bean which has another bean injected into it
- try
+ new RunInDependentContext()
{
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Standard.class);
- }
- finally
- {
- deactivateDependentContext();
- }
+
+ @Override
+ protected void execute() throws Exception
+ {
+ assert manager.resolveByType(InjectionPoint.class).size() == 1;
+ assert manager.resolveByType(InjectionPoint.class).iterator().next().getDeploymentType().equals(Standard.class);
+ }
+
+ }.run();
}
- @Test(groups = { "injectionPoint", "broken" })
+ @Test(groups = { "injectionPoint" })
@SpecAssertion(section = "5.6")
- public void testDependentScope()
+ public void testDependentScope() throws Exception
{
- deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+ deployBeans();
- // Get an instance of the bean which has another bean injected into it
- try
+ new RunInDependentContext()
{
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Dependent.class);
- }
- finally
- {
- deactivateDependentContext();
- }
+
+ @Override
+ protected void execute() throws Exception
+ {
+ assert manager.resolveByType(InjectionPoint.class).size() == 1;
+ assert manager.resolveByType(InjectionPoint.class).iterator().next().getScopeType().equals(Dependent.class);
+ }
+
+ }.run();
}
@Test(groups = { "injectionPoint" })
More information about the weld-commits
mailing list