[webbeans-commits] Webbeans SVN: r3075 - ri/trunk/impl/src/main/java/org/jboss/webbeans and 22 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Jul 17 08:14:01 EDT 2009
Author: dallen6
Date: 2009-07-17 08:13:59 -0400 (Fri, 17 Jul 2009)
New Revision: 3075
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/javax.enterprise.inject.spi.Extension
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Jamsa_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kuopio_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/London_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Loviisa_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Mikkeli_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Nokia_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Uusikaupunki_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Violation2.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/ForwardingBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken6/NonSerializableTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken7/NonSerializableTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken8/NonSerializableTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java
Log:
Changes to the Bean interface, implementation, and tests for the latest specification.
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Bean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -49,6 +49,7 @@
/**
* The deployment type of a bean
+ * @deprecated
*
* @return the deployment type
*/
@@ -62,13 +63,21 @@
public String getName();
/**
- * The serializability of a bean
+ * The bean class of the managed bean or session bean or of the bean that
+ * declares the producer method or field
*
- * @return true if the bean is serializable
+ * @return the class of the managed bean
*/
- public boolean isSerializable();
+ public Class<?> getBeanClass();
/**
+ * Test to see if the bean is a policy
+ *
+ * @return true if the bean is a policy
+ */
+ public boolean isPolicy();
+
+ /**
* The nullability of a bean
*
* @return true if the bean is nullable
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Iterator;
@@ -34,7 +35,7 @@
*
* @param <T>
*/
-public class InstanceImpl<T> extends FacadeImpl<T> implements Instance<T>
+public class InstanceImpl<T> extends FacadeImpl<T> implements Instance<T>, Serializable
{
private static final long serialVersionUID = -376721889693284887L;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -17,6 +17,7 @@
package org.jboss.webbeans;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
@@ -27,7 +28,6 @@
import java.util.List;
import java.util.Set;
-import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.enterprise.inject.AmbiguousResolutionException;
import javax.enterprise.inject.Instance;
@@ -46,6 +46,7 @@
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.injection.FieldInjectionPoint;
import org.jboss.webbeans.introspector.WBAnnotated;
import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.resolution.ResolvableWBClass;
@@ -104,14 +105,14 @@
}
specializedBeans.add(abstractBean.getSpecializedBean());
}
- if (Beans.isPassivatingBean(bean, beanManager) && bean instanceof AbstractClassBean)
+ if (Beans.isPassivationCapableBean(bean) && bean instanceof AbstractClassBean<?>)
{
AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean;
if (classBean.hasDecorators())
{
for (Decorator<?> decorator : classBean.getDecorators())
{
- if (!decorator.isSerializable())
+ if (!Reflections.isSerializable(decorator.getBeanClass()))
{
throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scope but has non-serializable decorator: " + decorator);
}
@@ -166,7 +167,7 @@
{
throw new NullableDependencyException("The injection point " + ij + " has nullable dependencies");
}
- if (Beans.isPassivatingBean(ij.getBean(), beanManager) && !resolvedBean.isSerializable() && resolvedBean.getScopeType().equals(Dependent.class))
+ if (Beans.isPassivatingScope(ij.getBean(), beanManager) && (!ij.isTransient()) && !Beans.isPassivationCapableBean(resolvedBean))
{
throw new UnserializableDependencyException("The bean " + ij.getBean() + " declares a passivating scope but has non-serializable dependency: " + resolvedBean);
}
@@ -177,7 +178,7 @@
List<RIBean<?>> specializedBeans = new ArrayList<RIBean<?>>();
for (Bean<?> bean : manager.getBeans())
{
- if (bean instanceof RIBean)
+ if (bean instanceof RIBean<?>)
{
validateRIBean((RIBean<?>) bean, manager, specializedBeans);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -292,7 +292,7 @@
Bean<?> resolvedBean = manager.getBeans(injectionPoint.getJavaClass(), bindings).iterator().next();
if (passivating)
{
- if (Dependent.class.equals(resolvedBean.getScopeType()) && !resolvedBean.isSerializable() && (((injectionPoint instanceof WBField) && !((WBField<?>) injectionPoint).isTransient()) || (injectionPoint instanceof WBParameter)))
+ if (Dependent.class.equals(resolvedBean.getScopeType()) && !Reflections.isSerializable(resolvedBean.getBeanClass()) && (((injectionPoint instanceof WBField) && !((WBField<?>) injectionPoint).isTransient()) || (injectionPoint instanceof WBParameter)))
{
return false;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -205,41 +205,44 @@
{
throw new IllegalProductException("Cannot return null from a non-dependent producer method");
}
- boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(getScopeType()).isPassivating();
- if (passivating && !Reflections.isSerializable(instance.getClass()))
+ else if (instance != null)
{
- throw new IllegalProductException("Producers cannot declare passivating scope and return a non-serializable class");
- }
- InjectionPoint injectionPoint = manager.getInjectionPoint();
- if (injectionPoint == null)
- {
- return;
- }
- if (isDependent() && Beans.isPassivatingBean(injectionPoint.getBean(), manager))
- {
- if (injectionPoint.getMember() instanceof Field)
+ boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(getScopeType()).isPassivating();
+ if (passivating && !Reflections.isSerializable(instance.getClass()))
{
- if (!Reflections.isTransient(injectionPoint.getMember()) && instance != null && !Reflections.isSerializable(instance.getClass()))
- {
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
- }
+ throw new IllegalProductException("Producers cannot declare passivating scope and return a non-serializable class");
}
- else if (injectionPoint.getMember() instanceof Method)
+ InjectionPoint injectionPoint = manager.getInjectionPoint();
+ if (injectionPoint == null)
{
- Method method = (Method) injectionPoint.getMember();
- if (method.isAnnotationPresent(Initializer.class))
+ return;
+ }
+ if (!Reflections.isSerializable(instance.getClass()) && Beans.isPassivationCapableBean(injectionPoint.getBean()))
+ {
+ if (injectionPoint.getMember() instanceof Field)
{
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ if (!Reflections.isTransient(injectionPoint.getMember()) && instance != null && !Reflections.isSerializable(instance.getClass()))
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
+ }
}
- if (method.isAnnotationPresent(Produces.class))
+ else if (injectionPoint.getMember() instanceof Method)
{
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ Method method = (Method) injectionPoint.getMember();
+ if (method.isAnnotationPresent(Initializer.class))
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ }
+ if (method.isAnnotationPresent(Produces.class))
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ }
}
+ else if (injectionPoint.getMember() instanceof Constructor)
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ }
}
- else if (injectionPoint.getMember() instanceof Constructor)
- {
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
- }
}
}
@@ -351,6 +354,11 @@
protected abstract T produceInstance(CreationalContext<T> creationalContext);
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
/**
* Gets a string representation
*
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -345,4 +345,9 @@
return id;
}
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -386,6 +386,11 @@
{
return manager.getServices().get(EjbServices.class).resolveEjb(getEjbDescriptor().delegate());
}
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -45,6 +45,13 @@
}
/**
+ * Abstract getter for the delegate
+ *
+ * @return The delegate
+ */
+ protected abstract Bean<T> delegate();
+
+ /**
* Destroys an instance through the delegate
*
* @param instance The instance to destroy
@@ -55,6 +62,22 @@
}
/**
+ * Compares an object with the delegate
+ *
+ * @return True if equals, false otherwise
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return delegate().getBeanClass();
+ }
+
+ /**
* Gets the binding types of the delegate
*
* @return The binding types
@@ -74,6 +97,11 @@
return delegate().getDeploymentType();
}
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return delegate().getInjectionPoints();
+ }
+
/**
* Gets the name of the delegate
*
@@ -105,31 +133,6 @@
}
/**
- * Indicates if the delegate is nullable
- *
- * @return True if nullable, false otherwise
- */
- public boolean isNullable()
- {
- return delegate().isNullable();
- }
-
- /**
- * Indicates if the delegate is serializable
- *
- * @return True if serializable, false otherwise
- */
- public boolean isSerializable()
- {
- return delegate().isSerializable();
- }
-
- public Set<InjectionPoint> getInjectionPoints()
- {
- return delegate().getInjectionPoints();
- }
-
- /**
* Gets the hash code of the delegate
*
* @return The hash code
@@ -141,22 +144,19 @@
}
/**
- * Compares an object with the delegate
+ * Indicates if the delegate is nullable
*
- * @return True if equals, false otherwise
+ * @return True if nullable, false otherwise
*/
- @Override
- public boolean equals(Object obj)
+ public boolean isNullable()
{
- return delegate().equals(obj);
+ return delegate().isNullable();
}
- /**
- * Abstract getter for the delegate
- *
- * @return The delegate
- */
- protected abstract Bean<T> delegate();
+ public boolean isPolicy()
+ {
+ return delegate().isPolicy();
+ }
/**
* Returns a string representation
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -60,6 +60,11 @@
public abstract Class<T> getType();
+ public Class<?> getBeanClass()
+ {
+ return getType();
+ }
+
public abstract void initialize(BeanDeployerEnvironment environment);
public abstract boolean isSpecializing();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -533,4 +533,10 @@
return specializedBean;
}
+ public boolean isPolicy()
+ {
+ //TODO Implement the isPolicy() on SimpleBean
+ return false;
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -66,12 +66,6 @@
// TODO Auto-generated method stub
}
- @Override
- public boolean isSerializable()
- {
- return true;
- }
-
protected abstract T newInstance(Type type, Set<Annotation> annotations);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -96,17 +96,18 @@
return false;
}
- public boolean isSerializable()
+ @Override
+ public boolean isSpecializing()
{
return false;
}
- @Override
- public boolean isSpecializing()
+ public boolean isPolicy()
{
+ //TODO Implement the isPolicy() method based on the annotations of this bean
return false;
}
-
+
@Override
public boolean isProxyable()
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -56,6 +56,12 @@
return TYPE;
}
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return EventImpl.class;
+ }
+
public Set<Type> getTypes()
{
return DEFAULT_TYPES;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -57,6 +57,12 @@
return TYPE;
}
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return InstanceImpl.class;
+ }
+
public Set<Type> getTypes()
{
return DEFAULT_TYPES;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -63,12 +63,6 @@
}
@Override
- public boolean isSerializable()
- {
- return true;
- }
-
- @Override
public String toString()
{
return "Built-in javax.inject.manager.Manager bean";
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -16,12 +16,15 @@
*/
package org.jboss.webbeans.bootstrap;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.ObserverMethod;
import org.jboss.webbeans.BeanManagerImpl;
@@ -52,8 +55,9 @@
private static final LogProvider log = Logging.getLogProvider(AbstractBeanDeployer.class);
- private final BeanManagerImpl manager;
+ private final BeanManagerImpl manager;
private final BeanDeployerEnvironment environment;
+ private final List<Throwable> definitionErrors = new ArrayList<Throwable>();
public AbstractBeanDeployer(BeanManagerImpl manager, BeanDeployerEnvironment environment)
{
@@ -163,8 +167,15 @@
{
ObserverMethodImpl<?, ?> observer = ObserverFactory.create(method, declaringBean, manager);
environment.getObservers().add(observer);
+ //TODO Not sure how to create the templated event without any type information here
+ //fireProcessObserverMethod(observer, method);
}
+ private <X, T> void fireProcessObserverMethod(final ObserverMethodImpl<X, T> observerMethod, final AnnotatedMethod<X> method)
+ {
+ manager.fireEvent(new ProcessObserverMethodImpl<X, T>(method, observerMethod, definitionErrors));
+ }
+
protected <T> void createSimpleBean(WBClass<T> annotatedClass)
{
SimpleBean<T> bean = SimpleBean.of(annotatedClass, manager);
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.bootstrap;
+
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+
+/**
+ * Implementation of the event used to notify observers for each observer
+ * method that is added.
+ *
+ * @author David Allen
+ *
+ */
+public class ProcessObserverMethodImpl<X, T> implements ProcessObserverMethod<X, T>
+{
+ private final AnnotatedMethod<X> beanMethod;
+ private final ObserverMethod<X, T> observerMethod;
+ private final List<Throwable> definitionErrors;
+
+ public ProcessObserverMethodImpl(AnnotatedMethod<X> beanMethod, ObserverMethod<X, T> observerMethod, List<Throwable> definitionErrors)
+ {
+ this.beanMethod = beanMethod;
+ this.observerMethod = observerMethod;
+ this.definitionErrors = definitionErrors;
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ this.definitionErrors.add(t);
+ }
+
+ public AnnotatedMethod<X> getAnnotatedMethod()
+ {
+ return beanMethod;
+ }
+
+ public ObserverMethod<X, T> getObserverMethod()
+ {
+ return observerMethod;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -16,6 +16,8 @@
*/
package org.jboss.webbeans.conversation;
+import java.io.Serializable;
+
import javax.enterprise.context.Conversation;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Initializer;
@@ -34,9 +36,14 @@
@RequestScoped
@Named("javax.context.conversation")
@Standard
-public class ConversationImpl implements Conversation
+public class ConversationImpl implements Conversation, Serializable
{
+ /**
+ * Eclipse generated UID.
+ */
+ private static final long serialVersionUID = 5262382965141841363L;
+
private static LogProvider log = Logging.getLogProvider(ConversationImpl.class);
// The conversation ID
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -44,20 +44,20 @@
* Helper class for bean inspection
*
* @author Pete Muir
+ * @author David Allen
*
*/
public class Beans
{
-
/**
- * Indicates if a bean is passivating
+ * Indicates if a bean's scope type is passivating
*
* @param bean The bean to inspect
- * @return True if passivating, false otherwise
+ * @return True if the scope is passivating, false otherwise
*/
- public static boolean isPassivatingBean(Bean<?> bean, BeanManagerImpl manager)
+ public static boolean isPassivatingScope(Bean<?> bean, BeanManagerImpl manager)
{
- if (bean instanceof EnterpriseBean)
+ if (bean instanceof EnterpriseBean<?>)
{
return ((EnterpriseBean<?>) bean).getEjbDescriptor().isStateful();
}
@@ -68,6 +68,25 @@
}
/**
+ * Tests if a bean is capable of having its state temporarily stored to
+ * secondary storage
+ *
+ * @param bean The bean to inspect
+ * @return True if the bean is passivation capable
+ */
+ public static boolean isPassivationCapableBean(Bean<?> bean)
+ {
+ if (bean instanceof EnterpriseBean<?>)
+ {
+ return ((EnterpriseBean<?>) bean).getEjbDescriptor().isStateful();
+ }
+ else
+ {
+ return Reflections.isSerializable(bean.getBeanClass());
+ }
+ }
+
+ /**
* Indicates if a bean is proxyable
*
* @param bean The bean to test
@@ -75,7 +94,7 @@
*/
public static boolean isBeanProxyable(Bean<?> bean)
{
- if (bean instanceof RIBean)
+ if (bean instanceof RIBean<?>)
{
return ((RIBean<?>) bean).isProxyable();
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/ActivitiesTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -87,11 +87,6 @@
return false;
}
- public boolean isSerializable()
- {
- return false;
- }
-
public Object create(CreationalContext<Object> creationalContext)
{
return null;
@@ -102,6 +97,16 @@
}
+ public Class<?> getBeanClass()
+ {
+ return Object.class;
+ }
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
};
InjectionPoint injectionPoint = new InjectionPoint()
{
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/child/SameBeanTypeInChildActivityTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -80,11 +80,6 @@
return false;
}
- public boolean isSerializable()
- {
- return false;
- }
-
public MyBean create(CreationalContext<MyBean> creationalContext)
{
return null;
@@ -95,6 +90,16 @@
}
+ public Class<?> getBeanClass()
+ {
+ return MyBean.class;
+ }
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
};
return bean;
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/ELCurrentActivityTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -141,6 +141,16 @@
}
+ public Class<?> getBeanClass()
+ {
+ return Cow.class;
+ }
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
}
@Test
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/InstanceCurrentActivityTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -138,11 +138,6 @@
return true;
}
- public boolean isSerializable()
- {
- return false;
- }
-
public Cow create(CreationalContext<Cow> creationalContext)
{
return new Cow();
@@ -154,6 +149,16 @@
}
+ public Class<?> getBeanClass()
+ {
+ return Cow.class;
+ }
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
}
@Test
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/NullProducerTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -9,7 +9,7 @@
{
@Test(description="WBRI-276")
- public void testProduerMethodReturnsNull()
+ public void testProducerMethodReturnsNull()
{
getCurrentManager().getInstanceByType(Government.class).destabilize();
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/manager/ManagerTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -79,11 +79,6 @@
return true;
}
- public boolean isSerializable()
- {
- return false;
- }
-
public Dummy create(CreationalContext<Dummy> creationalContext)
{
return null;
@@ -93,6 +88,16 @@
{
}
+
+ public Class<?> getBeanClass()
+ {
+ return Dummy.class;
+ }
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/ForwardingBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/ForwardingBean.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/ForwardingBean.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -52,11 +52,6 @@
return delegate().isNullable();
}
- public boolean isSerializable()
- {
- return delegate().isSerializable();
- }
-
public T create(CreationalContext<T> creationalContext)
{
return delegate().create(creationalContext);
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MyContextual.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -61,11 +61,6 @@
return false;
}
- public boolean isSerializable()
- {
- return true;
- }
-
public MySessionBean create(CreationalContext<MySessionBean> creationalContext)
{
createCalled = true;
@@ -95,4 +90,14 @@
this.shouldReturnNullInstances = shouldReturnNullInstances;
}
+ public Class<?> getBeanClass()
+ {
+ return MySessionBean.class;
+ }
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Jamsa_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Jamsa_Broken.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Jamsa_Broken.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,25 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Current;
-import javax.enterprise.inject.Produces;
-
- at SessionScoped
- at AnotherDeploymentType
-class Jamsa_Broken extends City implements Serializable
-{
- private static final long serialVersionUID = 8228981889946806181L;
-
- public Jamsa_Broken()
- {
- }
-
- @Produces
- @SessionScoped
- public Violation2 create(@Current Violation violation)
- {
- return new Violation2();
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kuopio_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kuopio_Broken.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kuopio_Broken.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,21 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Initializer;
-
- at SessionScoped
-class Kuopio_Broken extends City implements Serializable
-{
- private static final long serialVersionUID = 2446135216757213774L;
-
- public Kuopio_Broken() {
-
- }
-
- @Initializer
- public void init(@Big Violation reference) {
-
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/London_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/London_Broken.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/London_Broken.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,25 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Produces;
-
- at SessionScoped
- at AnotherDeploymentType
-class London_Broken extends City implements Serializable
-{
- private static final long serialVersionUID = 8228981889946806181L;
-
- public London_Broken()
- {
- }
-
- @Produces
- @SessionScoped
- @Big
- public Violation2 create(@Big Violation violation)
- {
- return new Violation2();
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Loviisa_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Loviisa_Broken.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Loviisa_Broken.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,20 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Initializer;
-
- at SessionScoped
-class Loviisa_Broken extends City implements Serializable
-{
- private static final long serialVersionUID = -2866858442948392508L;
-
- public Loviisa_Broken() {
- }
-
- @Initializer
- public Loviisa_Broken(@Big Violation reference) {
-
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Mikkeli_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Mikkeli_Broken.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Mikkeli_Broken.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,23 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Current;
-import javax.enterprise.inject.Initializer;
-
- at SessionScoped
-class Mikkeli_Broken extends City implements Serializable
-{
- private static final long serialVersionUID = -3853118456066667893L;
-
- public Mikkeli_Broken()
- {
- }
-
- @Initializer
- public Mikkeli_Broken(@Current Violation reference)
- {
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Nokia_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Nokia_Broken.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Nokia_Broken.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,16 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Current;
-
- at SessionScoped
-class Nokia_Broken extends City implements Serializable
-{
- private static final long serialVersionUID = -9104722758108835718L;
-
- @SuppressWarnings("unused")
- @Current
- private Violation reference;
-}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,6 +1,7 @@
package org.jboss.jsr299.tck.tests.context.passivating;
import java.io.IOException;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.util.Set;
@@ -17,6 +18,7 @@
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.testharness.impl.util.Reflections;
import org.testng.annotations.Test;
/**
@@ -24,18 +26,17 @@
* @author Nicklas Karlsson
* @author David Allen
*
- * Spec version: 20090625
+ * Spec version: 20090519
*/
@Artifact
@BeansXml("beans.xml")
@Packaging(PackagingType.EAR)
public class PassivatingContextTest extends AbstractJSR299Test
{
- private static final Annotation BIG_LITERAL = new AnnotationLiteral<Big>() {};
@Test(groups = { "contexts", "passivation", "review" })
@SpecAssertion(section = "6.6.1", id = "b")
- public void testManagedWebBeanWithSerializableImplementationClassOK()
+ public void testSimpleWebBeanWithSerializableImplementationClassOK()
{
Set<Bean<Jyvaskyla>> beans = getBeans(Jyvaskyla.class);
assert !beans.isEmpty();
@@ -55,10 +56,10 @@
@Test(groups = { "contexts", "passivation" })
@SpecAssertions({
- @SpecAssertion(section = "6.6.4", id = "unknown"),
- @SpecAssertion(section = "6.6.4", id = "unknown")
+ @SpecAssertion(section = "unknown", id = "unknown"),
+ @SpecAssertion(section = "unknown", id = "unknown")
})
- public void testManagedWebBeanDeclaringPassivatingScopeIsSerializedWhenContextIsPassivated() throws IOException, ClassNotFoundException
+ public void testSimpleWebBeanDeclaringPassivatingScopeIsSerializedWhenContextIsPassivated() throws IOException, ClassNotFoundException
{
Kajaani instance = getInstanceByType(Kajaani.class);
instance.setTheNumber(100);
@@ -84,7 +85,7 @@
* @throws IOException
*/
@Test(groups = { "contexts", "passivation", "ri-broken" })
- @SpecAssertion(section = "6.6.2", id = "unknown")
+ @SpecAssertion(section = "unknown", id = "unknown")
public void testDependentEJBsAreSerializable() throws IOException, ClassNotFoundException
{
Set<Bean<Vaasa>> vaasaBeans = getBeans(Vaasa.class);
@@ -93,20 +94,13 @@
}
@Test(groups = { "contexts", "passivation" })
- @SpecAssertion(section = "6.6.2", id = "unknown")
- public void testManagedDependentWebBeanWithNonSerializableImplementationInjectedIntoTransientFieldOK()
+ @SpecAssertion(section = "6.6.4", id = "aab")
+ public void testSimpleWebBeanWithNonSerializableImplementationInjectedIntoTransientFieldOK()
{
Set<Bean<Joensuu>> beans = getBeans(Joensuu.class);
assert !beans.isEmpty();
}
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "6.6.2", id = "unknown")
- public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoNonTransientFieldOfWebBeanWithPassivatingScopeFails()
- {
- getInstanceByType(Nokia_Broken.class).ping();
- }
-
@Test(groups = { "contexts", "passivation" })
@SpecAssertion(section = "unknown", id = "unknown")
public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoTransientFieldOfWebBeanWithPassivatingScopeOK()
@@ -115,34 +109,6 @@
assert !beans.isEmpty();
}
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoConstructorParameterOfWebBeanWithPassivatingScopeFails()
- {
- getInstanceByType(Loviisa_Broken.class).ping();
- }
-
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoInitializerParameterOfWebBeanWithPassivatingScopeFails()
- {
- getInstanceByType(Kuopio_Broken.class).ping();
- }
-
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoProducerMethodParameterWithPassivatingScopeFails()
- {
- getInstanceByType(Violation2.class).ping();
- }
-
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoNonTransientFieldOfWebBeanWithPassivatingScopeFails()
- {
- getInstanceByType(Uusikaupunki_Broken.class).ping();
- }
-
@Test(groups = { "contexts", "passivation" })
@SpecAssertion(section = "unknown", id = "unknown")
public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoTransientFieldOfWebBeanWithPassivatingScopeOK()
@@ -150,27 +116,6 @@
getInstanceByType(Salo_Broken.class).ping();
}
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoConstructorParameterOfWebBeanWithPassivatingScopeFails()
- {
- getInstanceByType(Loviisa_Broken.class).ping();
- }
-
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoInitializerParameterOfWebBeanWithPassivatingScopeFails()
- {
- getInstanceByType(Mikkeli_Broken.class).ping();
- }
-
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoProducerMethodParameterWithPassivatingScopeFails()
- {
- getInstanceByType(Violation2.class,BIG_LITERAL).ping();
- }
-
@Test(groups = { "contexts", "passivation", "enterpriseBean", "integration" })
//@SpecAssertion(section = "8.4", id = "a")
@SpecAssertion(section = "unknown", id = "unknown")
@@ -180,17 +125,23 @@
}
@Test(expectedExceptions = IllegalProductException.class)
- @SpecAssertion(section = "unknown", id = "unknown")
+ @SpecAssertion(section = "6.6.4", id = "d")
public void testNonSerializableProducerFieldDeclaredPassivatingThrowsIllegalProductException()
{
getInstanceByType(HelsinkiNonSerializable.class).ping();
}
@Test(groups = { "contexts", "passivation" })
- @SpecAssertion(section = "unknown", id = "unknown")
- public void testIsSerializableOnBean()
+ @SpecAssertion(section = "6.6.1", id = "b")
+ public void testPassivationCapableBean()
{
- assert !getBeans(Sysma.class).iterator().next().isSerializable();
- assert getBeans(Hyvinkaa.class).iterator().next().isSerializable();
+ assert !isSerializable(getBeans(Sysma.class).iterator().next().getBeanClass());
+ assert isSerializable(getBeans(Hyvinkaa.class).iterator().next().getBeanClass());
}
+
+ public static boolean isSerializable(Class<?> clazz)
+ {
+ return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);
+ }
+
}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Uusikaupunki_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Uusikaupunki_Broken.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Uusikaupunki_Broken.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,17 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Current;
-
- at SessionScoped
-class Uusikaupunki_Broken extends City implements Serializable
-{
- private static final long serialVersionUID = 5097928748462594346L;
-
- @SuppressWarnings("unused")
- @Current
- private Violation reference;
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Violation2.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Violation2.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Violation2.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,14 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.passivating;
-
-import javax.enterprise.context.Dependent;
-
- at Dependent
-class Violation2
-{
-
- public void ping()
- {
-
- }
-
-}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken6/NonSerializableTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken6/NonSerializableTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken6/NonSerializableTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -7,12 +7,16 @@
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.testng.annotations.Test;
+/**
+ *
+ * Spec version: 20090625
+ */
@Artifact
@ExpectedDeploymentException(DeploymentError.class)
public class NonSerializableTest extends AbstractJSR299Test
{
@Test(groups = { "contexts", "passivation" })
- @SpecAssertion(section = "8.4", id = "l")
+ @SpecAssertion(section = "6.6.4", id = "aab")
public void testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoNonTransientFieldOfWebBeanWithPassivatingScopeFails()
{
assert false;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken7/NonSerializableTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken7/NonSerializableTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken7/NonSerializableTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -7,12 +7,16 @@
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.testng.annotations.Test;
+/**
+ *
+ * Spec version: 20090625
+ */
@Artifact
@ExpectedDeploymentException(DeploymentError.class)
public class NonSerializableTest extends AbstractJSR299Test
{
@Test(groups = { "contexts", "passivation" })
- @SpecAssertion(section = "8.4", id = "m")
+ @SpecAssertion(section = "6.6.4", id = "aab")
public void testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoConstructorParameterOfWebBeanWithPassivatingScopeFails()
{
assert false;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken8/NonSerializableTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken8/NonSerializableTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/broken8/NonSerializableTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -7,12 +7,16 @@
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.testng.annotations.Test;
+/**
+ *
+ * Spec version: 20090625
+ */
@Artifact
@ExpectedDeploymentException(DeploymentError.class)
public class NonSerializableTest extends AbstractJSR299Test
{
@Test(groups = { "contexts", "passivation" })
- @SpecAssertion(section = "8.4", id = "n")
+ @SpecAssertion(section = "6.6.4", id = "aab")
public void testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoInitializerParameterOfWebBeanWithPassivatingScopeFails()
{
assert false;
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/InitializedBinding.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,29 +0,0 @@
-package org.jboss.jsr299.tck.tests.deployment.lifecycle;
-
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.ObserverMethod;
-
-class InitializedBinding implements AfterBeanDiscovery
-{
- public void addDefinitionError(Throwable t)
- {
- throw new RuntimeException(t);
- }
-
- public void addBean(Bean<?> bean)
- {
- throw new UnsupportedOperationException();
- }
-
- public void addContext(Context context)
- {
- throw new UnsupportedOperationException();
- }
-
- public void addObserverMethod(ObserverMethod<?, ?> observerMethod)
- {
- throw new UnsupportedOperationException();
- }
-}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -5,6 +5,9 @@
import org.jboss.jsr299.tck.DefinitionError;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
import org.testng.annotations.Test;
/**
@@ -17,18 +20,22 @@
* @author Dan Allen
*/
@Artifact
+ at Resources({
+ @Resource(source="javax.enterprise.inject.spi.Extension", destination="WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension")
+})
+//TODO I don't see why a test that uses the SPI extension mechanism must be an integration test (DRA)
+//@IntegrationTest
@ExpectedDeploymentException(DefinitionError.class)
public class AddDefinitionErrorTest extends AbstractJSR299Test
{
- @Test(groups="broken")
+ @Test
+ //TODO This test is not working in container due to exceptions being unwound on the server
@SpecAssertion(section = "11.5.2", id = "c")
public void testObserverDefinitionErrorTreatedAsDefinitionError()
{
assert false;
}
- // TODO make this an integration test using Extension
-
// FIXME need to communicate state of container at the time of failure
// @Override
// @AfterClass(alwaysRun = true, groups = "scaffold")
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/implicit/ImplicitEventTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -1,5 +1,7 @@
package org.jboss.jsr299.tck.tests.event.implicit;
+import java.io.Serializable;
+
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.enterprise.inject.TypeLiteral;
@@ -54,7 +56,8 @@
assert event.getName() == null;
assert event.getBindings().size() == 1;
assert event.getBindings().iterator().next().equals(new AnyLiteral());
- assert event.isSerializable();
+ Registration registration = this.getInstanceByType(Registration.class);
+ assert isSerializable(registration.getCourseFullEvent().getClass());
}
@Test
@@ -64,4 +67,10 @@
assert getInstanceByType(Registration.class).getCourseFullEvent() != null;
}
+
+ public static boolean isSerializable(Class<?> clazz)
+ {
+ return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);
+ }
+
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java 2009-07-17 06:44:48 UTC (rev 3074)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java 2009-07-17 12:13:59 UTC (rev 3075)
@@ -144,6 +144,16 @@
return this == obj;
}
+ public Class<?> getBeanClass()
+ {
+ return Mustard.class;
+ }
+
+ public boolean isPolicy()
+ {
+ return false;
+ }
+
};
getCurrentManager().addBean(wrappedBean);
Copied: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/javax.enterprise.inject.spi.Extension (from rev 3041, tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/javax.enterprise.inject.spi.Extension)
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/javax.enterprise.inject.spi.Extension (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/javax.enterprise.inject.spi.Extension 2009-07-17 12:13:59 UTC (rev 3075)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.addDefinitionError.BeanDiscoveryObserver
More information about the weld-commits
mailing list