Weld SVN: r4181 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-18 09:04:11 -0400 (Sun, 18 Oct 2009)
New Revision: 4181
Modified:
doc/trunk/reference/en-US/ri-spi.xml
Log:
Update requirements for performing EE component injection
Modified: doc/trunk/reference/en-US/ri-spi.xml
===================================================================
--- doc/trunk/reference/en-US/ri-spi.xml 2009-10-18 12:51:53 UTC (rev 4180)
+++ doc/trunk/reference/en-US/ri-spi.xml 2009-10-18 13:04:11 UTC (rev 4181)
@@ -760,11 +760,25 @@
class.
</para>
- <programlisting><![CDATA[
+ <para>
+ The CDI specification also requires that a
+ <literal>ProcessInjectionTarget</literal> event is fired for
+ every Java EE component class. Furthermore, if an observer
+ calls <literal>ProcessInjectionTarget.setInjectionTarget()</literal>
+ the container must use <emphasis>the specified</emphasis> injection
+ target to perform injection.
+ </para>
+
+ <para>
+ To help the integrator, Weld provides
+ <literal>WeldManager.fireProcessInjectionTarget()</literal>
+ which returns the <literal>InjectionTarget</literal> to use.
+ </para>
+
+ <programlisting><![CDATA[// Fire ProcessInjectionTarget, returning the InjectionTarget
+// to use
+InjectionTarget it = weldBeanManager.fireProcessInjectionTarget(clazz);
-// Create the injection target, once per class
-InjectionTarget it = beanManager.createInjectionTarget(clazz);
-
// Per instance required, create the creational context
CreationalContext<?> cc = beanManager.createCreationalContext(null);
15 years, 1 month
Weld SVN: r4180 - api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-18 08:51:53 -0400 (Sun, 18 Oct 2009)
New Revision: 4180
Modified:
api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java
Log:
fix contract
Modified: api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java
===================================================================
--- api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java 2009-10-18 12:47:27 UTC (rev 4179)
+++ api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java 2009-10-18 12:51:53 UTC (rev 4180)
@@ -108,8 +108,7 @@
* A helper method to allow integration code to easily fire the ProcessInjectionTarget
* for Java EE component classes supporting injection
*
- * The container must use the returned InjectionTarget to create, inject, dispose of
- * and call the lifecycle callbacks for the Java EE components
+ * The container must use the returned InjectionTarget to inject the Java EE component.
*
* @param <X>
* @param type
15 years, 1 month
Weld SVN: r4179 - api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi and 16 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-18 08:47:27 -0400 (Sun, 18 Oct 2009)
New Revision: 4179
Added:
api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
Removed:
api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java
Modified:
api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java
api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java
core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java
core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java
core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java
core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java
core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
Log:
introduce @Typed, add support for extracting the resolved generic type, add more explicit cleanup code
Deleted: api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -1,44 +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 javax.enterprise.inject;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Allows the bean types of a bean to be explicitly specified by the user,
- * instead of using the transitive closure of the type hierarchy
- *
- * @author Pete Muir
- */
-
-@Target( { FIELD, METHOD, TYPE })
-@Retention(RUNTIME)
-@Documented
-public @interface BeanTypes
-{
-
- Class<?>[] value() default {};
-
-}
Copied: api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java (from rev 3982, api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java)
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java (rev 0)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,44 @@
+/*
+ * 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 javax.enterprise.inject;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Allows the bean types of a bean to be explicitly specified by the user,
+ * instead of using the transitive closure of the type hierarchy
+ *
+ * @author Pete Muir
+ */
+
+@Target( { FIELD, METHOD, TYPE })
+@Retention(RUNTIME)
+@Documented
+public @interface Typed
+{
+
+ Class<?>[] value() default {};
+
+}
Property changes on: api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java
===================================================================
--- api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -19,6 +19,7 @@
import java.util.Collection;
import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
/**
* Represents a deployment of a CDI application.
@@ -134,10 +135,13 @@
* Load the {@link BeanDeploymentArchive} containing the given class.
*
* If the deployment archive containing the given class is not currently a
- * bean deployment archive, it should be added to the bean deployment archive
+ * bean deployment archive, it must be added to the bean deployment archive
* graph and returned. If the deployment archive is currently a bean
* deployment archive it should be returned.
*
+ * If beanClass is the bean class of an EJB session bean, an {@link EjbDescriptor}
+ * for the bean must be returned by {@link BeanDeploymentArchive#getEjbs()}.
+ *
* @param beanClass the bean class to load
* @return the {@link BeanDeploymentArchive} containing the bean class
*/
Modified: api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java
===================================================================
--- api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -21,6 +21,7 @@
import java.lang.annotation.Annotation;
import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionTarget;
@@ -66,6 +67,10 @@
* The injection target for the given EJB, or null if Weld was not
* given this descriptor in the deployment.
*
+ * This should only be used to create an inject contextual EJBs by
+ * the EJB container. {@link #fireProcessInjectionTarget()} must be used
+ * to obtain an {@link InjectionTarget} for non-contextual EJB injection.
+ *
* @param <T>
* @param descriptor
* @return
@@ -96,5 +101,20 @@
* @return
*/
public ServiceRegistry getServices();
+
+ /**
+ * Fire a ProcessInjectionTarget event for the given type.
+ *
+ * A helper method to allow integration code to easily fire the ProcessInjectionTarget
+ * for Java EE component classes supporting injection
+ *
+ * The container must use the returned InjectionTarget to create, inject, dispose of
+ * and call the lifecycle callbacks for the Java EE components
+ *
+ * @param <X>
+ * @param type
+ * @return
+ */
+ public <X> InjectionTarget<X> fireProcessInjectionTarget(AnnotatedType<X> type);
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -62,9 +62,10 @@
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.bean.proxy.ClientProxyProvider;
import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.events.AbstractProcessInjectionTarget;
import org.jboss.weld.context.CreationalContextImpl;
+import org.jboss.weld.context.SerializableContextual;
import org.jboss.weld.context.WeldCreationalContext;
-import org.jboss.weld.context.SerializableContextual;
import org.jboss.weld.ejb.EjbDescriptors;
import org.jboss.weld.ejb.spi.EjbDescriptor;
import org.jboss.weld.el.Namespace;
@@ -607,7 +608,7 @@
}
bindingAnnotations.add(new AnyLiteral());
Set<ObserverMethod<?, T>> observers = new HashSet<ObserverMethod<?, T>>();
- Set<ObserverMethod<?,?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new Reflections.HierarchyDiscovery(eventType).getFlattenedTypes(), bindingAnnotations, null));
+ Set<ObserverMethod<?,?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new Reflections.HierarchyDiscovery(eventType).getTypeClosureAsSet(), bindingAnnotations, null));
for (ObserverMethod<?,?> observer : eventObservers)
{
observers.add((ObserverMethod<?, T>) observer);
@@ -1399,6 +1400,27 @@
{
services.cleanup();
this.currentInjectionPoint.remove();
+ this.accessibleManagers.clear();
+ this.beanResolver.clear();
+ this.beans.clear();
+ this.childActivities.clear();
+ this.clientProxyProvider.clear();
+ this.contexts.clear();
+ this.currentActivities.clear();
+ this.decoratorResolver.clear();
+ this.decorators.clear();
+ this.enabledDecoratorClasses.clear();
+ this.enabledInterceptorClasses.clear();
+ this.enabledPolicyClasses.clear();
+ this.enabledPolicyStereotypes.clear();
+ this.enterpriseBeans.clear();
+ this.interceptorResolver.clear();
+ this.interceptors.clear();
+ this.nameBasedResolver.clear();
+ this.namespaces.clear();
+ this.observerResolver.clear();
+ this.observers.clear();
+ this.specializedBeans.clear();
}
public InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> getCdiInterceptorsRegistry()
@@ -1410,4 +1432,9 @@
{
return declaredInterceptorsRegistry;
}
+
+ public <X> InjectionTarget<X> fireProcessInjectionTarget(AnnotatedType<X> annotatedType)
+ {
+ return AbstractProcessInjectionTarget.fire(this, annotatedType, createInjectionTarget(annotatedType));
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -120,5 +120,6 @@
public void cleanup()
{
contextuals.clear();
+ passivationCapableContextuals.clear();
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -19,13 +19,14 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import javax.decorator.Decorates;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.Typed;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.stereotype.Stereotype;
import javax.inject.Named;
@@ -46,7 +47,6 @@
import org.jboss.weld.metadata.cache.MergedStereotypes;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.util.Reflections;
-import org.jboss.weld.util.collections.Arrays2;
/**
* An abstract bean representation common for all beans
@@ -174,15 +174,36 @@
*/
protected void initTypes()
{
- if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
+ if (getAnnotatedItem().isAnnotationPresent(Typed.class))
{
- types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
+ this.types = getTypedTypes(getAnnotatedItem().getTypeClosureAsMap(), getAnnotatedItem().getJavaClass(), getAnnotatedItem().getAnnotation(Typed.class));
}
else
{
- types = getAnnotatedItem().getTypeClosure();
+ this.types = getAnnotatedItem().getTypeClosure();
+ if (getType().isInterface())
+ {
+ this.types.add(Object.class);
+ }
}
}
+
+ protected static Set<Type> getTypedTypes(Map<Class<?>, Type> typeClosure, Class<?> rawType, Typed typed)
+ {
+ Set<Type> types = new HashSet<Type>();
+ for (Class<?> specifiedClass : typed.value())
+ {
+ if (!typeClosure.containsKey(specifiedClass))
+ {
+ throw new DefinitionException("@Typed class " + specifiedClass.getName() + " is not present in the type hierarchy " + rawType);
+ }
+ else
+ {
+ types.add(typeClosure.get(specifiedClass));
+ }
+ }
+ return types;
+ }
/**
* Initializes the binding types
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -30,7 +30,6 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.context.NormalScope;
import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
@@ -48,7 +47,6 @@
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Names;
import org.jboss.weld.util.Reflections;
-import org.jboss.weld.util.collections.Arrays2;
/**
* The implicit producer bean
@@ -90,24 +88,13 @@
@Override
protected void initTypes()
{
- if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
+ if (getType().isArray() || getType().isPrimitive())
{
- types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
- }
- else if (getType().isArray() || getType().isPrimitive())
- {
Set<Type> types = new HashSet<Type>();
types.add(getType());
types.add(Object.class);
super.types = types;
}
- else if (getType().isInterface())
- {
- Set<Type> types = new HashSet<Type>();
- types.add(Object.class);
- types.addAll(getAnnotatedItem().getTypeClosure());
- super.types = types;
- }
else
{
super.initTypes();
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -22,7 +22,10 @@
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
+import java.util.Map;
import java.util.Set;
import javassist.util.proxy.ProxyFactory;
@@ -32,8 +35,8 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
-import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.CreationException;
+import javax.enterprise.inject.Typed;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.InjectionTarget;
import javax.interceptor.Interceptor;
@@ -59,7 +62,6 @@
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Proxies;
-import org.jboss.weld.util.collections.Arrays2;
/**
* An enterprise bean representation
@@ -190,19 +192,19 @@
@Override
protected void initTypes()
{
- if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
+ Map<Class<?>, Type> types = new LinkedHashMap<Class<?>, Type>();
+ for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
{
- types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
+ types.put(businessInterfaceDescriptor.getInterface(), businessInterfaceDescriptor.getInterface());
}
+ if (getAnnotatedItem().isAnnotationPresent(Typed.class))
+ {
+ super.types = getTypedTypes(types, getAnnotatedItem().getJavaClass(), getAnnotatedItem().getAnnotation(Typed.class));
+ }
else
{
- Set<Type> types = new LinkedHashSet<Type>();
- types.add(Object.class);
- for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
- {
- types.add(businessInterfaceDescriptor.getInterface());
- }
- super.types = types;
+ types.put(Object.class, Object.class);
+ super.types = new HashSet<Type>(types.values());
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -138,5 +138,10 @@
{
return "Proxy pool with " + pool.size() + " proxies";
}
+
+ public void clear()
+ {
+ this.pool.clear();
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -42,7 +42,7 @@
import org.jboss.weld.bean.ee.EEResourceProducerField;
import org.jboss.weld.bean.ee.PersistenceContextProducerField;
import org.jboss.weld.bootstrap.events.ProcessBeanImpl;
-import org.jboss.weld.bootstrap.events.ProcessInjectionTargetImpl;
+import org.jboss.weld.bootstrap.events.ProcessBeanInjectionTarget;
import org.jboss.weld.bootstrap.events.ProcessManagedBeanImpl;
import org.jboss.weld.bootstrap.events.ProcessObserverMethodImpl;
import org.jboss.weld.bootstrap.events.ProcessProducerFieldImpl;
@@ -111,7 +111,7 @@
}
else if (bean instanceof AbstractClassBean<?>)
{
- ProcessInjectionTargetImpl.fire(manager, (AbstractClassBean<?>) bean);
+ ProcessBeanInjectionTarget.fire(manager, (AbstractClassBean<?>) bean);
}
if (bean instanceof ManagedBean<?>)
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -79,6 +79,7 @@
public BeanDeployer addClass(AnnotatedType<?> clazz)
{
ClassTransformer classTransformer = Container.instance().deploymentServices().get(ClassTransformer.class);
+ // TODO Discover any @New injection points, and store as newClasses
classes.add(classTransformer.loadClass(clazz));
return this;
}
@@ -112,6 +113,7 @@
createSimpleBean(clazz);
}
}
+ // TODO Iterate over newClasses and add a new bean for each
for (InternalEjbDescriptor<?> ejbDescriptor : getEnvironment().getEjbDescriptors())
{
createEnterpriseBean(ejbDescriptor);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -128,6 +128,8 @@
log.debug("Enabled interceptor types for " + beanManager + ": " + beanManager.getEnabledInterceptorClasses());
}
+ // TODO Move class stuff into startContainer phase
+ // TODO read EJB descriptors after reading classes
public void deployBeans(Environment environment)
{
for (ExtensionBean bean : extensionBeanDeployerEnvironment.getBeans())
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -268,6 +268,7 @@
// Add the Deployment BeanManager Bean to the Deployment BeanManager
deploymentManager.addBean(new ManagerBean(deploymentManager));
+ // TODO keep a list of new bdas, add them all in, and deploy beans for them, then merge into existing
BeforeBeanDiscoveryImpl.fire(deploymentManager, deployment, beanDeployments, extensionDeployerEnvironment);
}
return this;
@@ -277,6 +278,7 @@
{
synchronized (this)
{
+ // TODO keep a list of new bdas, add them all in, and deploy beans for them, then merge into existing
for (Entry<BeanDeploymentArchive, BeanDeployment> entry : beanDeployments.entrySet())
{
entry.getValue().deployBeans(environment);
@@ -302,6 +304,7 @@
public Bootstrap endInitialization()
{
+ // TODO rebuild the manager accessibility graph if the bdas have changed
synchronized (this)
{
// Register the managers so external requests can handle them
Added: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,51 @@
+package org.jboss.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+
+public abstract class AbstractProcessInjectionTarget<T> extends AbstractDefinitionContainerEvent
+{
+
+ public static <X> void fire(BeanManagerImpl beanManager, AbstractClassBean<X> bean)
+ {
+ new ProcessBeanInjectionTarget<X>(beanManager, bean) {}.fire();
+ }
+
+ public static <X> InjectionTarget<X> fire(BeanManagerImpl beanManager, AnnotatedType<X> annotatedType, InjectionTarget<X> injectionTarget)
+ {
+ ProcessSimpleInjectionTarget<X> processSimpleInjectionTarget = new ProcessSimpleInjectionTarget<X>(beanManager, annotatedType, injectionTarget) {};
+ processSimpleInjectionTarget.fire();
+ return processSimpleInjectionTarget.getInjectionTarget();
+ }
+
+ protected final AnnotatedType<T> annotatedType;
+
+ public AbstractProcessInjectionTarget(BeanManagerImpl beanManager, AnnotatedType<T> annotatedType)
+ {
+ super(beanManager, ProcessInjectionTarget.class, new Type[] {annotatedType.getBaseType() });
+ this.annotatedType = annotatedType;
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public List<Throwable> getDefinitionErrors()
+ {
+ return super.getErrors();
+ }
+
+ public AnnotatedType<T> getAnnotatedType()
+ {
+ return annotatedType;
+ }
+
+}
\ No newline at end of file
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java (from rev 4164, core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,31 @@
+package org.jboss.weld.bootstrap.events;
+
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+
+
+public class ProcessBeanInjectionTarget<T> extends AbstractProcessInjectionTarget<T> implements ProcessInjectionTarget<T>
+{
+
+ private final AbstractClassBean<T> classBean;
+
+ public ProcessBeanInjectionTarget(BeanManagerImpl beanManager, AbstractClassBean<T> bean)
+ {
+ super(beanManager, bean.getAnnotatedItem());
+ this.classBean = bean;
+ }
+
+ public InjectionTarget<T> getInjectionTarget()
+ {
+ return classBean.getInjectionTarget();
+ }
+
+ public void setInjectionTarget(InjectionTarget<T> injectionTarget)
+ {
+ classBean.setInjectionTarget(injectionTarget);
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -1,57 +0,0 @@
-package org.jboss.weld.bootstrap.events;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.bean.AbstractClassBean;
-
-
-public class ProcessInjectionTargetImpl<T> extends AbstractDefinitionContainerEvent implements ProcessInjectionTarget<T>
-{
-
- public static <X> void fire(BeanManagerImpl beanManager, AbstractClassBean<X> bean)
- {
- new ProcessInjectionTargetImpl<X>(beanManager, bean.getAnnotatedItem(), bean) {}.fire();
- }
-
- private final AnnotatedType<T> annotatedType;
- private AbstractClassBean<T> classBean;
-
- public ProcessInjectionTargetImpl(BeanManagerImpl beanManager, AnnotatedType<T> annotatedType, AbstractClassBean<T> bean)
- {
- super(beanManager, ProcessInjectionTarget.class, new Type[] { bean.getAnnotatedItem().getBaseType() });
- this.classBean = bean;
- this.annotatedType = annotatedType;
- }
-
- public void addDefinitionError(Throwable t)
- {
- getErrors().add(t);
- }
-
- public List<Throwable> getDefinitionErrors()
- {
- return super.getErrors();
- }
-
- public AnnotatedType<T> getAnnotatedType()
- {
- return annotatedType;
- }
-
- public InjectionTarget<T> getInjectionTarget()
- {
- return classBean.getInjectionTarget();
- }
-
- public void setInjectionTarget(InjectionTarget<T> injectionTarget)
- {
- classBean.setInjectionTarget(injectionTarget);
- }
-
-}
Added: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,30 @@
+package org.jboss.weld.bootstrap.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.jboss.weld.BeanManagerImpl;
+
+
+public class ProcessSimpleInjectionTarget<T> extends AbstractProcessInjectionTarget<T> implements ProcessInjectionTarget<T>
+{
+
+ private InjectionTarget<T> injectionTarget;
+
+ public ProcessSimpleInjectionTarget(BeanManagerImpl beanManager, AnnotatedType<T> annotatedType, InjectionTarget<T> injectionTarget)
+ {
+ super(beanManager, annotatedType);
+ }
+
+ public InjectionTarget<T> getInjectionTarget()
+ {
+ return injectionTarget;
+ }
+
+ public void setInjectionTarget(InjectionTarget<T> injectionTarget)
+ {
+ this.injectionTarget = injectionTarget;
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -75,7 +75,7 @@
}
if (getBeanStore() == null)
{
- throw new IllegalStateException("No bean store available for " + toString());
+ return null;
}
if (contextual == null)
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -63,6 +63,13 @@
}
@Override
+ public void destroy()
+ {
+ super.destroy();
+ this.beanStore.remove();
+ }
+
+ @Override
public void cleanup()
{
super.cleanup();
Modified: core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -150,6 +150,10 @@
return ejbs.values().iterator();
}
- public void cleanup() {}
+ public void cleanup()
+ {
+ this.ejbClasses.clear();
+ this.ejbs.clear();
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -123,5 +123,10 @@
{
return "Namespace(" + ( name==null ? "Root" : name ) + ')';
}
+
+ public void clear()
+ {
+
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -18,6 +18,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.Map;
import java.util.Set;
/**
@@ -45,6 +46,11 @@
{
return delegate().getMetaAnnotationsAsArray(metaAnnotationType);
}
+
+ public Map<Class<?>, Type> getTypeClosureAsMap()
+ {
+ return delegate().getTypeClosureAsMap();
+ }
@Deprecated
public Set<Annotation> getQualifiers()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -20,6 +20,7 @@
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import javax.enterprise.context.NormalScope;
@@ -52,6 +53,8 @@
* are no matches.
*/
public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType);
+
+ public Map<Class<?>, Type> getTypeClosureAsMap();
/**
* Gets all annotations which are declared on this annotated item with the
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -21,12 +21,14 @@
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import org.jboss.weld.introspector.AnnotationStore;
import org.jboss.weld.introspector.WeldAnnotated;
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.Reflections.HierarchyDiscovery;
import org.jboss.weld.util.collections.Arrays2;
/**
@@ -59,7 +61,8 @@
private final Class<T> rawType;
private final Type[] actualTypeArguments;
private final Type type;
- private final Set<Type> flattenedTypes;
+ private final Map<Class<?>, Type> typeClosureAsMap;
+ private final Set<Type> typeClosureAsSet;
private final Set<Type> interfaceOnlyFlattenedTypes;
private final boolean proxyable;
private final boolean _parameterizedType;
@@ -87,13 +90,15 @@
this.actualTypeArguments = new Type[0];
}
this._parameterizedType = Reflections.isParameterizedType(rawType);
- this.flattenedTypes = new Reflections.HierarchyDiscovery(type).getFlattenedTypes();
+ HierarchyDiscovery discovery = new Reflections.HierarchyDiscovery(type);
this.interfaceOnlyFlattenedTypes = new HashSet<Type>();
for (Type t : rawType.getGenericInterfaces())
{
- interfaceOnlyFlattenedTypes.addAll(new Reflections.HierarchyDiscovery(t).getFlattenedTypes());
+ interfaceOnlyFlattenedTypes.addAll(new Reflections.HierarchyDiscovery(t).getTypeClosureAsSet());
}
- this.proxyable = Proxies.isTypesProxyable(flattenedTypes);
+ this.typeClosureAsSet = discovery.getTypeClosureAsSet();
+ this.typeClosureAsMap = discovery.getTypeClosureAsMap();
+ this.proxyable = Proxies.isTypesProxyable(typeClosureAsSet);
}
public AbstractWeldAnnotated(AnnotationStore annotatedItemHelper)
@@ -103,7 +108,8 @@
this.type = null;
this.actualTypeArguments = new Type[0];
this._parameterizedType = false;
- this.flattenedTypes = null;
+ this.typeClosureAsMap = null;
+ this.typeClosureAsSet = null;
this.interfaceOnlyFlattenedTypes = null;
this.proxyable = false;
}
@@ -263,7 +269,12 @@
public Set<Type> getTypeClosure()
{
- return Collections.unmodifiableSet(flattenedTypes);
+ return typeClosureAsSet;
}
+
+ public Map<Class<?>, Type> getTypeClosureAsMap()
+ {
+ return typeClosureAsMap;
+ }
}
\ No newline at end of file
Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -65,6 +65,9 @@
this.extraAnnotations.get(annotationType).addAll(annotations);
}
- public void cleanup() {}
+ public void cleanup()
+ {
+ this.extraAnnotations.clear();
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -132,9 +132,10 @@
public void cleanup()
{
- bindingTypes.clear();
- scopes.clear();
- stereotypes.clear();
+ this.bindingTypes.clear();
+ this.scopes.clear();
+ this.stereotypes.clear();
+ this.interceptorBindings.clear();
}
public <T extends Annotation> InterceptorBindingModel getInterceptorBindingModel(final Class<T> interceptorBinding)
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -35,7 +35,6 @@
private final ConcurrentCache<Class<?>, WeldClass<?>> classes;
private final ConcurrentCache<AnnotatedType<?>, WeldClass<?>> annotatedTypes;
private final ConcurrentCache<Class<?>, WeldAnnotation<?>> annotations;
- private final ClassTransformer transformer = this;
private final TypeStore typeStore;
/**
@@ -51,6 +50,7 @@
public <T> WeldClass<T> loadClass(final Class<T> clazz)
{
+ final ClassTransformer transformer = this;
return classes.putIfAbsent(clazz, new Callable<WeldClass<T>>()
{
@@ -64,6 +64,7 @@
public <T> WeldClass<T> loadClass(final AnnotatedType<T> clazz)
{
+ final ClassTransformer transformer = this;
return annotatedTypes.putIfAbsent(clazz, new Callable<WeldClass<T>>()
{
@@ -77,8 +78,10 @@
public <T extends Annotation> WeldAnnotation<T> loadAnnotation(final Class<T> clazz)
{
+ final ClassTransformer transformer = this;
return annotations.putIfAbsent(clazz, new Callable<WeldAnnotation<T>>()
{
+
public WeldAnnotation<T> call() throws Exception
{
return WeldAnnotationImpl.of(clazz, transformer);
@@ -94,9 +97,9 @@
public void cleanup()
{
- annotatedTypes.clear();
- annotations.clear();
- classes.clear();
+ this.annotatedTypes.clear();
+ this.annotations.clear();
+ this.classes.clear();
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -33,7 +33,9 @@
import java.lang.reflect.WildcardType;
import java.security.AccessControlException;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import javax.inject.Qualifier;
@@ -63,31 +65,51 @@
private final Type type;
- private Set<Type> types;
+ private Map<Class<?>, Type> typeMap;
+ private Set<Type> typeSet;
public HierarchyDiscovery(Type type)
{
this.type = type;
}
- protected void add(Type type)
+ protected void add(Class<?> clazz, Type type)
{
- types.add(type);
+ typeSet.add(type);
+ if (clazz != null)
+ {
+ typeMap.put(clazz, type);
+ }
}
- public Set<Type> getFlattenedTypes()
+ public Set<Type> getTypeClosureAsSet()
{
- if (types == null)
+ if (typeSet == null)
{
- this.types = new HashSet<Type>();
- discoverTypes(type);
+ init();
}
- return types;
+ return typeSet;
}
+
+ public Map<Class<?>, Type> getTypeClosureAsMap()
+ {
+ if (typeMap == null)
+ {
+ init();
+ }
+ return typeMap;
+ }
+
+ private void init()
+ {
+ this.typeSet = new HashSet<Type>();
+ this.typeMap = new HashMap<Class<?>, Type>();
+ discoverTypes(type);
+ }
public Type getResolvedType()
{
- if (type instanceof Class)
+ if (type instanceof Class<?>)
{
Class<?> clazz = (Class<?>) type;
return resolveType(clazz);
@@ -99,23 +121,25 @@
{
if (type != null)
{
- if (type instanceof Class)
+ if (type instanceof Class<?>)
{
Class<?> clazz = (Class<?>) type;
- add(resolveType(clazz));
+ add(clazz, resolveType(clazz));
discoverFromClass(clazz);
}
else
{
+ Class<?> clazz = null;
if (type instanceof ParameterizedType)
{
Type rawType = ((ParameterizedType) type).getRawType();
- if (rawType instanceof Class)
+ if (rawType instanceof Class<?>)
{
discoverFromClass((Class<?>) rawType);
+ clazz = (Class<?>) rawType;
}
}
- add(type);
+ add(clazz, type);
}
}
}
@@ -464,12 +488,6 @@
return false;
}
- public static Set<Type> createTypeClosure(Class<?> rawType, Type[] actualTypeArguments)
- {
- Type type = new ParameterizedTypeImpl(rawType, actualTypeArguments, rawType.getDeclaringClass());
- return new HierarchyDiscovery(type).getFlattenedTypes();
- }
-
/**
* Invokes a method and wraps exceptions
*
Modified: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java 2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java 2009-10-18 12:47:27 UTC (rev 4179)
@@ -10,8 +10,8 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
import javax.inject.Named;
@@ -59,7 +59,7 @@
*
* @return
*/
- @Produces @BeanTypes(DriversSeat.class)
+ @Produces @Typed(DriversSeat.class)
public DriversSeat produceDriversSeat()
{
return driversSeat.newInstance().produce().inject().get();
@@ -89,7 +89,7 @@
/**
* Producer method for bean with default qualifiers and type SpareTire only
*/
- @Produces @BeanTypes(SpareTire.class)
+ @Produces @Typed(SpareTire.class)
public SpareTire produceSpareTire()
{
return spareTire.newInstance().produce().inject().get();
15 years, 1 month
Weld SVN: r4178 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-18 08:44:56 -0400 (Sun, 18 Oct 2009)
New Revision: 4178
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContext2Test.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContextTest.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
Log:
Don't expect to be able to reuse a destroyed context in the same test
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java 2009-10-18 12:44:56 UTC (rev 4178)
@@ -0,0 +1,48 @@
+package org.jboss.jsr299.tck.tests.context;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+
+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.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ * @author David Allen
+ */
+@Artifact
+@SpecVersion(spec="cdi", version="PFD2")
+public class ContextDestroysBeansTest extends AbstractJSR299Test
+{
+
+ @Test(groups = { "contexts", "rewrite" })
+ @SpecAssertions( {
+ @SpecAssertion(section = "6.2", id = "p"),
+ @SpecAssertion(section = "6.3", id = "d")
+ })
+ public void testContextDestroysBeansWhenDestroyed()
+ {
+ MyContextual bean = new MyContextual(getCurrentManager());
+ bean.setShouldReturnNullInstances(false);
+ // TODO Remove use of this deprecated API
+ getCurrentManager().addBean(bean);
+
+ Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
+ CreationalContext<MySessionBean> creationalContext = getCurrentManager().createCreationalContext(bean);
+ MySessionBean instance = sessionContext.get(bean, creationalContext);
+ instance.ping();
+ assert instance != null;
+ assert bean.isCreateCalled();
+
+ destroyContext(sessionContext);
+ assert bean.isDestroyCalled();
+ }
+
+}
\ No newline at end of file
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContext2Test.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContext2Test.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContext2Test.java 2009-10-18 12:44:56 UTC (rev 4178)
@@ -0,0 +1,55 @@
+package org.jboss.jsr299.tck.tests.context;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ * @author David Allen
+ */
+@Artifact
+@SpecVersion(spec="cdi", version="PFD2")
+public class DestroyForSameCreationalContext2Test extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertion(section = "6.2", id = "r")
+ public void testDestroyForSameCreationalContextOnly()
+ {
+ // Check that the mock cc is called (via cc.release()) when we request a context destroyed
+ // Note that this is an indirect effect
+ Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
+ Context requestContext = getCurrentManager().getContext(RequestScoped.class);
+ Context appContext = getCurrentManager().getContext(ApplicationScoped.class);
+
+ // We also test this directly using a custom contextual, and ensuring that the same contextual is passed to both methods
+ DummyContextual contextual = new DummyContextual();
+
+ sessionContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
+ destroyContext(sessionContext);
+ assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
+
+ // Do it for other contexts
+ contextual = new DummyContextual();
+ appContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
+ destroyContext(appContext);
+ assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
+
+ contextual = new DummyContextual();
+ requestContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
+ destroyContext(requestContext);
+ assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
+
+ }
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContext2Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContextTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContextTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContextTest.java 2009-10-18 12:44:56 UTC (rev 4178)
@@ -0,0 +1,46 @@
+package org.jboss.jsr299.tck.tests.context;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.impl.MockCreationalContext;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ * @author David Allen
+ */
+@Artifact
+@SpecVersion(spec="cdi", version="PFD2")
+public class DestroyForSameCreationalContextTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertion(section = "6.2", id = "r")
+ public void testDestroyForSameCreationalContextOnly()
+ {
+ // Check that the mock cc is called (via cc.release()) when we request a context destroyed
+ // Note that this is an indirect effect
+ Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
+
+ Bean<AnotherSessionBean> sessionBean = getBeans(AnotherSessionBean.class).iterator().next();
+
+ MockCreationalContext.reset();
+ CreationalContext<AnotherSessionBean> creationalContext = new MockCreationalContext<AnotherSessionBean>();
+ AnotherSessionBean instance = sessionContext.get(sessionBean, creationalContext);
+ instance.ping();
+
+ destroyContext(sessionContext);
+ assert MockCreationalContext.isReleaseCalled();
+
+ }
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyForSameCreationalContextTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-10-18 12:43:37 UTC (rev 4177)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-10-18 12:44:56 UTC (rev 4178)
@@ -1,9 +1,6 @@
package org.jboss.jsr299.tck.tests.context;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
-import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
@@ -78,70 +75,7 @@
assert getCurrentManager().getContext(SessionScoped.class).get(bean, creationalContext) == null;
assert bean.isCreateCalled();
}
-
- @Test(groups = { "contexts", "rewrite" })
- @SpecAssertions( {
- @SpecAssertion(section = "6.2", id = "p"),
- @SpecAssertion(section = "6.3", id = "d")
- })
- public void testContextDestroysBeansWhenDestroyed()
- {
- MyContextual bean = new MyContextual(getCurrentManager());
- bean.setShouldReturnNullInstances(false);
- // TODO Remove use of this deprecated API
- getCurrentManager().addBean(bean);
-
- Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
- CreationalContext<MySessionBean> creationalContext = getCurrentManager().createCreationalContext(bean);
- MySessionBean instance = sessionContext.get(bean, creationalContext);
- instance.ping();
- assert instance != null;
- assert bean.isCreateCalled();
-
- destroyContext(sessionContext);
- assert bean.isDestroyCalled();
- }
- @Test
- @SpecAssertion(section = "6.2", id = "r")
- public void testDestroyForSameCreationalContextOnly()
- {
- // Check that the mock cc is called (via cc.release()) when we request a context destroyed
- // Note that this is an indirect effect
- Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
- Context requestContext = getCurrentManager().getContext(RequestScoped.class);
- Context appContext = getCurrentManager().getContext(ApplicationScoped.class);
-
- Bean<AnotherSessionBean> sessionBean = getBeans(AnotherSessionBean.class).iterator().next();
-
- MockCreationalContext.reset();
- CreationalContext<AnotherSessionBean> creationalContext = new MockCreationalContext<AnotherSessionBean>();
- AnotherSessionBean instance = sessionContext.get(sessionBean, creationalContext);
- instance.ping();
-
- destroyContext(sessionContext);
- assert MockCreationalContext.isReleaseCalled();
-
- // We also test this directly using a custom contextual, and ensuring that the same contextual is passed to both methods
- DummyContextual contextual = new DummyContextual();
-
- sessionContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
- destroyContext(sessionContext);
- assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
-
- // Do it for other contexts
- contextual = new DummyContextual();
- appContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
- destroyContext(appContext);
- assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
-
- contextual = new DummyContextual();
- requestContext.get(contextual, getCurrentManager().createCreationalContext(contextual));
- destroyContext(requestContext);
- assert contextual.getCreationalContextPassedToCreate() == contextual.getCreationalContextPassedToDestroy();
-
- }
-
@Test(groups = { "contexts" })
@SpecAssertions( {
@SpecAssertion(section = "6.3", id = "e")
15 years, 1 month
Weld SVN: r4177 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution and 1 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-18 08:43:37 -0400 (Sun, 18 Oct 2009)
New Revision: 4177
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/African.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Australian.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Cat.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/DomesticCat.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Emu.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/European.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/FlightlessBird.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Lion.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Tame.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Wild.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
Add tests and assertions for @Typed
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java 2009-10-18 05:49:43 UTC (rev 4176)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -101,7 +101,7 @@
}
@Test
- @SpecAssertion(section = "2.2.2", id = "a")
+ @SpecAssertion(section = "2.2.3", id = "a")
@SuppressWarnings("unused")
public void testBeanClientCanCastBeanInstanceToAnyBeanType()
{
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/African.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/African.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/African.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class African
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/African.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Australian.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Australian.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Australian.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class Australian
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Australian.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java 2009-10-18 05:49:43 UTC (rev 4176)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -1,8 +1,8 @@
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
-import javax.enterprise.inject.BeanTypes;
+import javax.enterprise.inject.Typed;
-(a)BeanTypes(Canary.class)
+(a)Typed(Canary.class)
public class Canary implements Bird
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java 2009-10-18 05:49:43 UTC (rev 4176)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -1,10 +1,10 @@
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
import javax.ejb.Stateless;
-import javax.enterprise.inject.BeanTypes;
+import javax.enterprise.inject.Typed;
@Stateless
-(a)BeanTypes(CapercaillieLocal.class)
+(a)Typed(CapercaillieLocal.class)
public class Capercaillie implements CapercaillieLocal
{
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Cat.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Cat.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Cat.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class Cat<T>
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Cat.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/DomesticCat.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/DomesticCat.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/DomesticCat.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+
+public class DomesticCat extends Cat<European>
+{
+
+ public DomesticCat(String name)
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/DomesticCat.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Emu.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Emu.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Emu.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.enterprise.inject.Typed;
+
+(a)Typed(FlightlessBird.class)
+public class Emu extends FlightlessBird<Australian>
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Emu.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java 2009-10-18 05:49:43 UTC (rev 4176)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -30,10 +30,10 @@
@SpecVersion(spec="cdi", version="PFD2")
@Packaging(PackagingType.EAR)
public class EnterpriseResolutionByTypeTest extends AbstractJSR299Test
-{
+{
@Test
- @SpecAssertion(section = "TBD", id = "TBD")
+ @SpecAssertion(section = "2.2.2", id = "b")
public void testBeanTypesOnSessionBean()
{
assert getBeans(CapercaillieLocal.class).size() == 1;
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/European.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/European.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/European.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class European
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/European.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/FlightlessBird.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/FlightlessBird.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/FlightlessBird.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class FlightlessBird<T>
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/FlightlessBird.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Lion.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Lion.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Lion.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class Lion extends Cat<African>
+{
+
+ public Lion(String name)
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Lion.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java 2009-10-18 05:49:43 UTC (rev 4176)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -1,18 +1,27 @@
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
-import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
public class PetShop
{
- @Produces @BeanTypes(Dove.class)
+ @Produces @Typed(Dove.class)
private Dove dove = new Dove("charlie");
- @Produces @BeanTypes(Parrot.class)
+ @Produces @Typed(Parrot.class)
public Parrot getParrot()
{
return new Parrot("polly");
}
+
+ @Produces @Typed(Cat.class) @Tame
+ private DomesticCat felix = new DomesticCat("felix");
+
+ @Produces @Typed(Cat.class) @Wild
+ public Lion getAslan()
+ {
+ return new Lion("timmy");
+ }
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-10-18 05:49:43 UTC (rev 4176)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -16,6 +16,7 @@
*/
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashSet;
@@ -40,6 +41,13 @@
public class ResolutionByTypeTest extends AbstractJSR299Test
{
+ private static final TypeLiteral<FlightlessBird<Australian>> AUSTRALIAN_FLIGHTLESS_BIRD = new TypeLiteral<FlightlessBird<Australian>>() {};
+ private static final TypeLiteral<FlightlessBird<European>> EUROPEAN_FLIGHTLESS_BIRD = new TypeLiteral<FlightlessBird<European>>() {};
+ private static final TypeLiteral<Cat<European>> EUROPEAN_CAT = new TypeLiteral<Cat<European>>() {};
+ private static final TypeLiteral<Cat<African>> AFRICAN_CAT = new TypeLiteral<Cat<African>>() {};
+ private static final Annotation TAME = new AnnotationLiteral<Tame>() {};
+ private static final Annotation WILD = new AnnotationLiteral<Wild>() {};
+
@Test(groups = "resolution")
@SpecAssertion(section = "5.3", id = "lb")
public void testDefaultBindingTypeAssumed() throws Exception
@@ -211,11 +219,10 @@
}
@Test
- @SpecAssertion(section = "TBD", id = "TBD")
+ @SpecAssertion(section = "2.2.2", id = "a")
public void testBeanTypesOnManagedBean()
{
assert getBeans(Canary.class).size() == 1;
- Set<Bean<Bird>> beans = getBeans(Bird.class);
Bean<Canary> bean = getUniqueBean(Canary.class);
assert getBeans(Bird.class).isEmpty();
assert bean.getTypes().size() == 1;
@@ -223,7 +230,19 @@
}
@Test
- @SpecAssertion(section = "TBD", id = "TBD")
+ @SpecAssertion(section = "2.2.2", id = "e")
+ public void testGenericBeanTypesOnManagedBean()
+ {
+ assert getBeans(AUSTRALIAN_FLIGHTLESS_BIRD).size() == 1;
+ assert getBeans(Emu.class).isEmpty();
+ assert getBeans(EUROPEAN_FLIGHTLESS_BIRD).isEmpty();
+ Bean<FlightlessBird<Australian>> bean = getUniqueBean(AUSTRALIAN_FLIGHTLESS_BIRD);
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(AUSTRALIAN_FLIGHTLESS_BIRD.getType());
+ }
+
+ @Test
+ @SpecAssertion(section = "2.2.2", id = "c")
public void testBeanTypesOnProducerMethod()
{
assert getBeans(Parrot.class).size() == 1;
@@ -234,9 +253,31 @@
}
@Test
- @SpecAssertion(section = "TBD", id = "TBD")
- public void testBeanTypesOnProducerField()
+ @SpecAssertion(section = "2.2.2", id = "h")
+ public void testGenericBeanTypesOnProducerField()
{
+ assert getBeans(EUROPEAN_CAT, TAME).size() == 1;
+ assert getBeans(DomesticCat.class, TAME).isEmpty();
+ Bean<Cat<European>> bean = getUniqueBean(EUROPEAN_CAT, TAME);
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(EUROPEAN_CAT.getType());
+ }
+
+ @Test
+ @SpecAssertion(section = "2.2.2", id = "g")
+ public void testGenericBeanTypesOnProducerMethod()
+ {
+ assert getBeans(AFRICAN_CAT, WILD).size() == 1;
+ assert getBeans(Lion.class, WILD).isEmpty();
+ Bean<Cat<African>> bean = getUniqueBean(AFRICAN_CAT, WILD);
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(AFRICAN_CAT.getType());
+ }
+
+ @Test
+ @SpecAssertion(section = "2.2.2", id = "d")
+ public void testGeeBeanTypesOnProducerField()
+ {
assert getBeans(Dove.class).size() == 1;
assert getBeans(Bird.class).isEmpty();
Bean<Dove> bean = getUniqueBean(Dove.class);
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Tame.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Tame.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Tame.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,34 @@
+/*
+ * 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.lookup.typesafe.resolution;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Qualifier
+@interface Tame {
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Tame.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Wild.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Wild.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Wild.java 2009-10-18 12:43:37 UTC (rev 4177)
@@ -0,0 +1,34 @@
+/*
+ * 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.lookup.typesafe.resolution;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Qualifier
+@interface Wild {
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Wild.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-18 05:49:43 UTC (rev 4176)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-10-18 12:43:37 UTC (rev 4177)
@@ -97,8 +97,51 @@
<text>A parameterized type that contains a wildcard type parameter is not a legal bean type.</text>
</assertion>
</section>
+
+ <section id="2.2.2" title="Restricting the bean types of a bean">
+ <group>
+ <text>The bean types of a bean may be restricted by annotating the bean class or producer method or field with the annotation @javax.enterprise.inject.BeanTypes. When a @BeanTypes annotation is explicitly specified, only the types whose classes are explicitly listed using the value member are bean types of the bean.</text>
+ <assertion id="a">
+ <text>Check managed bean</text>
+ </assertion>
+ <assertion id="b">
+ <text>Check session bean</text>
+ </assertion>
+ <assertion id="c">
+ <text>Check producer method</text>
+ </assertion>
+ <assertion id="d">
+ <text>Check producer field</text>
+ </assertion>
+ <assertion id="e">
+ <text>Check generic managed bean</text>
+ </assertion>
+ <assertion id="g">
+ <text>Check generic producer method</text>
+ </assertion>
+ <assertion id="h">
+ <text>Check generic producer field</text>
+ </assertion>
+ </group>
+
+ <group>
+ <text>If a bean class or producer method or field specifies a @BeanTypes annotation, and the value member specifies a class which does not correspond to a type in the unrestricted set of bean types of a bean, the container automatically detects the problem and treats it as a definition error, as defined in Section 12.4, "Problems detected automatically by the container".</text>
+ <assertion id="j">
+ <text>Check managed bean</text>
+ </assertion>
+ <assertion id="k">
+ <text>Check session bean</text>
+ </assertion>
+ <assertion id="l">
+ <text>Check producer method</text>
+ </assertion>
+ <assertion id="m">
+ <text>Check producer field</text>
+ </assertion>
+ </group>
+ </section>
- <section id="2.2.2" title="Typecasting between bean types">
+ <section id="2.2.3" title="Typecasting between bean types">
<assertion id="a">
<text>A client of a bean may typecast its contextual reference to a bean to any bean type of the bean which is a Java interface. However, the client may not in general typecast its contextual reference to an arbitrary concrete bean type of the bean.</text>
</assertion>
15 years, 1 month
Weld SVN: r4176 - core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-10-18 01:49:43 -0400 (Sun, 18 Oct 2009)
New Revision: 4176
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java
Log:
Improved test - verify that the value set on the interceptor is actually serialized and deserialized
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java 2009-10-17 21:42:10 UTC (rev 4175)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java 2009-10-18 05:49:43 UTC (rev 4176)
@@ -33,11 +33,22 @@
public static boolean prePassivateInvoked;
public static boolean postActivateInvoked;
+ public static String initialMessage;
+
+ public PassivationActivationInterceptor()
+ {
+ this.message = initialMessage;
+ }
+
+ public static PassivationActivationInterceptor instance;
+ public String message = null;
+
@PrePassivate
public void prePassivate(InvocationContext invocationContext) throws Exception
{
prePassivateInvoked = true;
invocationContext.proceed();
+ instance = this;
}
@@ -46,6 +57,7 @@
{
postActivateInvoked = true;
invocationContext.proceed();
+ instance = this;
}
}
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java 2009-10-17 21:42:10 UTC (rev 4175)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java 2009-10-18 05:49:43 UTC (rev 4176)
@@ -44,21 +44,33 @@
{
Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
+
+ PassivationActivationInterceptor.initialMessage = "Goal!";
+
Ball ball = (Ball) bean.create(creationalContext);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
new ObjectOutputStream(byteArrayOutputStream).writeObject(ball);
+ PassivationActivationInterceptor oldInterceptor = PassivationActivationInterceptor.instance;
+
+ PassivationActivationInterceptor.initialMessage = "Miss!";
+
assert PassivationActivationInterceptor.prePassivateInvoked;
assert !PassivationActivationInterceptor.postActivateInvoked;
+ assert PassivationActivationInterceptor.instance != null;
PassivationActivationInterceptor.prePassivateInvoked = false;
PassivationActivationInterceptor.postActivateInvoked = false;
-
+ PassivationActivationInterceptor.instance = null;
+
ball = (Ball)new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())).readObject();
assert !PassivationActivationInterceptor.prePassivateInvoked;
assert PassivationActivationInterceptor.postActivateInvoked;
-
+ assert PassivationActivationInterceptor.instance != null;
+ assert PassivationActivationInterceptor.instance != oldInterceptor;
+ assert PassivationActivationInterceptor.instance.message != null;
+ assert PassivationActivationInterceptor.instance.message.equals(oldInterceptor.message);
}
}
15 years, 1 month
Weld SVN: r4175 - core/trunk/impl/src/main/java/org/jboss/weld/bootstrap.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-17 17:42:10 -0400 (Sat, 17 Oct 2009)
New Revision: 4175
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
Log:
Error if loadBeanDeploymentArchive returns null
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2009-10-17 21:24:15 UTC (rev 4174)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2009-10-17 21:42:10 UTC (rev 4175)
@@ -132,8 +132,13 @@
{
for (ExtensionBean bean : extensionBeanDeployerEnvironment.getBeans())
{
- if (deployment.loadBeanDeploymentArchive(bean.getBeanClass()).equals(beanDeploymentArchive))
+ BeanDeploymentArchive classBeanDeploymentArchive = deployment.loadBeanDeploymentArchive(bean.getBeanClass());
+ if (classBeanDeploymentArchive == null)
{
+ throw new IllegalStateException("deployment.loadBeanDeploymentArchive() returned null for " + bean.getBeanClass());
+ }
+ if (classBeanDeploymentArchive.equals(beanDeploymentArchive))
+ {
beanDeployer.getManager().addBean(bean);
}
}
15 years, 1 month
Weld SVN: r4174 - cdi-tck/trunk.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-17 17:24:15 -0400 (Sat, 17 Oct 2009)
New Revision: 4174
Modified:
cdi-tck/trunk/pom.xml
Log:
use released javax.inject
Modified: cdi-tck/trunk/pom.xml
===================================================================
--- cdi-tck/trunk/pom.xml 2009-10-17 21:23:50 UTC (rev 4173)
+++ cdi-tck/trunk/pom.xml 2009-10-17 21:24:15 UTC (rev 4174)
@@ -79,7 +79,7 @@
<testng.version>5.10</testng.version>
<jsr250.api.version>1.0</jsr250.api.version>
<cdi.api.version>1.0-CR1</cdi.api.version>
- <atinject.api.version>1.0-PFD-1</atinject.api.version>
+ <atinject.api.version>1</atinject.api.version>
<ejb.api.version>3.1.0-Alpha1</ejb.api.version>
<jsr250.api.version>1.0</jsr250.api.version>
<jpa.api.version>1.0</jpa.api.version>
15 years, 1 month
Weld SVN: r4173 - in api/trunk: parent and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-17 17:23:50 -0400 (Sat, 17 Oct 2009)
New Revision: 4173
Modified:
api/trunk/bom/pom.xml
api/trunk/parent/pom.xml
Log:
new version of testng, use released @Inject
Modified: api/trunk/bom/pom.xml
===================================================================
--- api/trunk/bom/pom.xml 2009-10-17 18:38:58 UTC (rev 4172)
+++ api/trunk/bom/pom.xml 2009-10-17 21:23:50 UTC (rev 4173)
@@ -72,7 +72,7 @@
</repositories>
<properties>
- <atinject.api.version>1.0-PFD-1</atinject.api.version>
+ <atinject.api.version>1</atinject.api.version>
<ejb.api.version>3.1.0-Alpha1</ejb.api.version>
<jsr250.api.version>1.0</jsr250.api.version>
<jpa.api.version>1.0</jpa.api.version>
Modified: api/trunk/parent/pom.xml
===================================================================
--- api/trunk/parent/pom.xml 2009-10-17 18:38:58 UTC (rev 4172)
+++ api/trunk/parent/pom.xml 2009-10-17 21:23:50 UTC (rev 4173)
@@ -76,7 +76,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>5.9</version>
+ <version>5.10</version>
<classifier>jdk15</classifier>
</dependency>
15 years, 1 month
Weld SVN: r4172 - in cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: implementation/enterprise/lifecycle and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-17 14:38:58 -0400 (Sat, 17 Oct 2009)
New Revision: 4172
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
Log:
Simplyfy and fix bad tests
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java 2009-10-17 18:38:09 UTC (rev 4171)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java 2009-10-17 18:38:58 UTC (rev 4172)
@@ -22,6 +22,8 @@
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.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.testng.annotations.Test;
@@ -32,27 +34,10 @@
@Artifact
@BeansXml("beans.xml")
@SpecVersion(spec="cdi", version="PFD2")
+(a)Packaging(PackagingType.EAR)
@IntegrationTest
public class EJBDecoratorInvocationTest extends AbstractJSR299Test
{
-
- @Test(groups="ri-broken")
- @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.reset();
- getInstanceByType(PigSty.class).clean();
- assert TimestampLogger.getMessage().equals(PigSty.MESSAGE);
- assert MockLogger.getMessage().equals(TimestampLogger.PREFIX + PigSty.MESSAGE);
- }
@Test(groups="ri-broken")
@SpecAssertions({
@@ -61,36 +46,11 @@
public void testEJBDecoratorInvocation() {
// testDecoratorInvocation tests decorators of normal beans called from an EJB
// it doesn't test actual decoration of the EJB
- PigStyDecorator.decoratorCalled = false;
+ PigStyDecorator.reset();
+ PigStyImpl.reset();
getInstanceByType(PigSty.class).clean();
- assert PigStyDecorator.decoratorCalled;
+ assert PigStyDecorator.isDecoratorCalled();
+ assert PigStyImpl.isBeanCalled();
}
-
- @Test(groups="ri-broken")
- @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();
- }
}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java 2009-10-17 18:38:58 UTC (rev 4172)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.decorators.invocation;
+
+import java.io.Serializable;
+
+public class Pig implements Serializable
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java 2009-10-17 18:38:09 UTC (rev 4171)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java 2009-10-17 18:38:58 UTC (rev 4172)
@@ -16,17 +16,18 @@
*/
package org.jboss.jsr299.tck.tests.decorators.invocation;
+import javax.ejb.Local;
+
/**
* @author pmuir
*
*/
+@Local
public interface PigSty
{
public static final String MESSAGE = "smelly work!";
public void clean();
-
- public void washDown();
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java 2009-10-17 18:38:09 UTC (rev 4171)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java 2009-10-17 18:38:58 UTC (rev 4172)
@@ -1,22 +1,32 @@
package org.jboss.jsr299.tck.tests.decorators.invocation;
+import java.io.Serializable;
+
import javax.decorator.Decorates;
import javax.decorator.Decorator;
@Decorator
-public class PigStyDecorator implements PigSty {
- public static boolean decoratorCalled = false;
-
- @Decorates PigSty pigSty;
-
- public void clean() {
- decoratorCalled = true;
- pigSty.clean();
- }
+public class PigStyDecorator implements PigSty, Serializable
+{
+ private static boolean decoratorCalled = false;
+
+ public static boolean isDecoratorCalled()
+ {
+ return decoratorCalled;
+ }
+
+ public static void reset()
+ {
+ decoratorCalled = false;
+ }
- public void washDown() {
- decoratorCalled = true;
- pigSty.washDown();
- }
+ @Decorates
+ transient PigSty pigSty;
+ public void clean()
+ {
+ decoratorCalled = true;
+ pigSty.clean();
+ }
+
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java 2009-10-17 18:38:09 UTC (rev 4171)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java 2009-10-17 18:38:58 UTC (rev 4172)
@@ -16,27 +16,36 @@
*/
package org.jboss.jsr299.tck.tests.decorators.invocation;
+import javax.ejb.Stateful;
import javax.inject.Inject;
/**
* @author pmuir
*
*/
+@Stateful
public class PigStyImpl implements PigSty
{
- @Inject Logger logger;
+ @Inject
+ private Pig pig;
+ private static boolean BEAN_CALLED;
+
public void clean()
{
- logger.log(PigSty.MESSAGE);
+ BEAN_CALLED = true;
+ assert pig instanceof Pig;
}
- @Inject Foo foo;
+ public static boolean isBeanCalled()
+ {
+ return BEAN_CALLED;
+ }
- public void washDown()
+ public static void reset()
{
- foo.log(MESSAGE);
+ BEAN_CALLED = false;
}
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-10-17 18:38:09 UTC (rev 4171)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-10-17 18:38:58 UTC (rev 4172)
@@ -103,7 +103,6 @@
Context requestContext = getCurrentManager().getContext(RequestScoped.class);
CreationalContext<KleinStadt> creationalContext = getCurrentManager().createCreationalContext(stadtBean);
KleinStadt kassel = stadtBean.create(creationalContext);
- assert requestContext.get(stadtBean) != null : "bean exists in request context";
kassel.ping();
stadtBean.destroy(kassel, creationalContext);
@@ -120,7 +119,6 @@
})
public void testRemovedEjbIgnored()
{
- assert false;
KleinStadt stadtInstance = getInstanceByType(KleinStadt.class, new AnnotationLiteral<Important>() {});
assert stadtInstance != null : "Expected instance to be created by container";
stadtInstance.setName("Kassel-Wilhelmshoehe");
15 years, 1 month