[webbeans-commits] Webbeans SVN: r1685 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean and 3 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Feb 24 12:49:48 EST 2009
Author: pete.muir at jboss.org
Date: 2009-02-24 12:49:48 -0500 (Tue, 24 Feb 2009)
New Revision: 1685
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/TurkuLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Big.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/EspooLocal_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/London_Broken.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/PassivatingContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/Turku.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/CityProducer2.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Espoo_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Generator.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Jamsa_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Kuopio_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Loviisa_Broken.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/PassivatingContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation2.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Fixes to passivation tests
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -24,7 +24,6 @@
import javax.inject.AmbiguousDependencyException;
import javax.inject.DefinitionException;
-import javax.inject.IllegalProductException;
import javax.inject.InconsistentSpecializationException;
import javax.inject.New;
import javax.inject.NullableDependencyException;
@@ -34,11 +33,9 @@
import javax.inject.manager.Bean;
import javax.inject.manager.InjectionPoint;
-import org.jboss.webbeans.bean.AbstractProducerBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
import org.jboss.webbeans.bean.NewSimpleBean;
import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.metadata.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ListComparator;
@@ -101,21 +98,6 @@
{
throw new NullableDependencyException("The injection point " + injectionPoint + " has nullable dependencies");
}
- if (MetaDataCache.instance().getScopeModel(bean.getScopeType()).isPassivating())
- {
- if (resolvedBean instanceof AbstractProducerBean)
- {
- AbstractProducerBean producerBean = (AbstractProducerBean) resolvedBean;
- if ((injectionPoint instanceof AnnotatedField) && ((AnnotatedField<?>) injectionPoint).isTransient())
- {
- injectionPoint.getBean();
- }
- else if (producerBean.isDependent() && !Reflections.isSerializable(producerBean.getType()))
- {
- throw new IllegalProductException("Cannot inject @Depedent non-serializable type into " + injectionPoint);
- }
- }
- }
}
else
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -212,16 +212,16 @@
Method method = (Method) injectionPoint.getMember();
if (method.isAnnotationPresent(Initializer.class))
{
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope");
+ 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 (method.isAnnotationPresent(Produces.class))
{
- throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope");
+ 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());
}
}
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");
+ 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());
}
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/PassivatingContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/PassivatingContextTest.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/PassivatingContextTest.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -6,6 +6,8 @@
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
import org.testng.annotations.Test;
/**
@@ -14,13 +16,15 @@
*
* Spec version: PRD2
*/
+ at Artifact
+ at IntegrationTest
public class PassivatingContextTest extends AbstractDeclarativeTest
{
@Test(groups = { "contexts", "passivation", "enterpriseBean", "integration" })
@SpecAssertion(section = "8.4", id = "a")
public void testEJBWebBeanCanDeclarePassivatingScope()
{
- deployBeans(Turku.class);
+ assert getCurrentManager().resolveByType(Turku.class).size() == 1;
}
@Test(groups = { "stub", "contexts", "passivation", "jms" })
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/Turku.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/Turku.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/Turku.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -6,7 +6,7 @@
@Stateful
@SessionScoped
-class Turku
+class Turku implements TurkuLocal
{
@Remove
public void bye() {
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/TurkuLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/TurkuLocal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/TurkuLocal.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.integration.context.passivating;
+
+public interface TurkuLocal
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/passivating/TurkuLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Big.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Big.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Big.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.unit.context.passivating;
+
+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.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Big
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Big.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/CityProducer2.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/CityProducer2.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/CityProducer2.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -3,10 +3,10 @@
import javax.context.Dependent;
import javax.inject.Produces;
+ at AnotherDeploymentType
class CityProducer2
{
- @Produces
- @Dependent
+ @Produces @Dependent @Big
public Violation create()
{
return new Violation();
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/EspooLocal_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/EspooLocal_Broken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/EspooLocal_Broken.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.unit.context.passivating;
+
+import javax.ejb.Local;
+
+ at Local
+public interface EspooLocal_Broken
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/EspooLocal_Broken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Espoo_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Espoo_Broken.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Espoo_Broken.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -7,7 +7,7 @@
@Stateful
@SessionScoped
-class Espoo_Broken
+class Espoo_Broken implements EspooLocal_Broken
{
@Current
Violation reference;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Generator.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Generator.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Generator.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -7,6 +7,7 @@
import javax.inject.Produces;
@ApplicationScoped
+ at AnotherDeploymentType
class Generator implements Serializable
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Jamsa_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Jamsa_Broken.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Jamsa_Broken.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -7,6 +7,7 @@
import javax.inject.Produces;
@SessionScoped
+ at AnotherDeploymentType
class Jamsa_Broken extends City implements Serializable
{
private static final long serialVersionUID = 8228981889946806181L;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Kuopio_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Kuopio_Broken.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Kuopio_Broken.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -3,7 +3,6 @@
import java.io.Serializable;
import javax.context.SessionScoped;
-import javax.inject.Current;
import javax.inject.Initializer;
@SessionScoped
@@ -16,7 +15,7 @@
}
@Initializer
- public void init(@Current Violation reference) {
+ public void init(@Big Violation reference) {
}
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/London_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/London_Broken.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/London_Broken.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -0,0 +1,25 @@
+package org.jboss.jsr299.tck.unit.context.passivating;
+
+import java.io.Serializable;
+
+import javax.context.SessionScoped;
+import javax.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();
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/London_Broken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Loviisa_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Loviisa_Broken.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Loviisa_Broken.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -3,7 +3,6 @@
import java.io.Serializable;
import javax.context.SessionScoped;
-import javax.inject.Current;
import javax.inject.Initializer;
@SessionScoped
@@ -15,7 +14,7 @@
}
@Initializer
- public Loviisa_Broken(@Current Violation reference) {
+ public Loviisa_Broken(@Big Violation reference) {
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/PassivatingContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/PassivatingContextTest.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/PassivatingContextTest.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -1,10 +1,12 @@
package org.jboss.jsr299.tck.unit.context.passivating;
import java.io.IOException;
+import java.lang.annotation.Annotation;
import java.util.Set;
import javax.context.Context;
import javax.context.SessionScoped;
+import javax.inject.AnnotationLiteral;
import javax.inject.IllegalProductException;
import javax.inject.UnserializableDependencyException;
import javax.inject.manager.Bean;
@@ -27,6 +29,9 @@
@BeansXml("beans.xml")
public class PassivatingContextTest extends AbstractDeclarativeTest
{
+
+ private static final Annotation BIG_LITERAL = new AnnotationLiteral<Big>() {};
+
@Test(groups = { "contexts", "passivation" })
@SpecAssertion(section = "8.4", id = "b")
public void testSimpleWebBeanWithSerializableImplementationClassOK()
@@ -86,11 +91,12 @@
assert testSerialize(vaasaBeans.iterator().next());
}
- @Test(groups = { "contexts", "passivation" }, expectedExceptions = UnserializableDependencyException.class)
+ @Test(groups = { "contexts", "passivation" , "ri-broken"}, expectedExceptions = UnserializableDependencyException.class)
@SpecAssertion(section = "8.4", id = "k")
public void testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoStatefulSessionBeanFails()
{
- getCurrentManager().getInstanceByType(Espoo_Broken.class);
+ // WBRI-150
+ getCurrentManager().getInstanceByType(EspooLocal_Broken.class);
}
@Test(groups = { "contexts", "passivation" })
@@ -134,7 +140,7 @@
@SpecAssertion(section = "8.4", id = "t")
public void testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoProducerMethodParameterWithPassivatingScopeFails()
{
- getCurrentManager().getInstanceByType(Jamsa_Broken.class).ping();
+ getCurrentManager().getInstanceByType(Violation2.class).ping();
}
@Test(groups = { "contexts", "passivation" }, expectedExceptions = IllegalProductException.class)
@@ -169,7 +175,6 @@
@SpecAssertion(section = "8.4", id = "t")
public void testDependentScopedProducerFieldReturnsNonSerializableObjectForInjectionIntoProducerMethodParameterWithPassivatingScopeFails()
{
- // TODO Not quite sure what this test is doing
- getCurrentManager().getInstanceByType(Jamsa_Broken.class).ping();
+ getCurrentManager().getInstanceByType(Violation2.class, BIG_LITERAL).ping();
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -5,5 +5,10 @@
@Dependent
class Violation
{
+
+ public void ping()
+ {
+
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation2.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation2.java 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/unit/context/passivating/Violation2.java 2009-02-24 17:49:48 UTC (rev 1685)
@@ -5,5 +5,10 @@
@Dependent
class Violation2
{
+
+ public void ping()
+ {
+
+ }
}
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-02-24 17:29:06 UTC (rev 1684)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-02-24 17:49:48 UTC (rev 1685)
@@ -4303,10 +4303,14 @@
<text>Simple beans are not required to be serializable. If a simple bean declares a passivating scope, and the bean class is not serializable, a DefinitionException is thrown by the container at deployment time</text>
</assertion>
- <assertion id="c">
- <text>If a producer method or field declares a passivating scope and returns a non-serializable object at runtime, an IllegalProductException is thrown by the container</text>
+ <assertion id="cc">
+ <text>If a ~producer method or ~field declares a passivating scope and returns a non-serializable object at runtime, an IllegalProductException is thrown by the container</text>
</assertion>
+ <assertion id="cd">
+ <text>If a producer method~ or field~ declares a passivating scope and returns a non-serializable object at runtime, an IllegalProductException is thrown by the container</text>
+ </assertion>
+
<assertion id="ca">
<text>Check a producer method which declares a passivating scope and returns a serializable product works</text>
<note>Sanity test</note>
More information about the weld-commits
mailing list