[webbeans-commits] Webbeans SVN: r3298 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/context/dependent/ejb and 3 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Jul 27 23:00:00 EDT 2009


Author: shane.bryzak at jboss.com
Date: 2009-07-27 23:00:00 -0400 (Mon, 27 Jul 2009)
New Revision: 3298

Added:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola2.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor2.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Bream.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.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/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
   tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Passivating context tests


Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java	2009-07-28 00:01:53 UTC (rev 3297)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -133,13 +133,20 @@
       Context context = getCurrentManager().getContext(Dependent.class);
       assert context.get(foxBean, null) == null;
    }
+      
+   @Test(groups = { "contexts" })
+   @SpecAssertion(section = "6.2", id = "ab")
+   public void testContextScopeType()
+   {
+      assert getCurrentManager().getContext(Dependent.class).getScopeType().equals(Dependent.class);
+   }   
 
    @Test(groups = { "contexts" })
    @SpecAssertions({
       @SpecAssertion(section = "6.2", id = "ha"),
       @SpecAssertion(section = "6.4", id = "g")
    })
-   public void testContextIsInactive()
+   public void testContextIsActive()
    {
       assert getCurrentManager().getContext(Dependent.class).isActive();
    }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java	2009-07-28 00:01:53 UTC (rev 3297)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -37,7 +37,7 @@
 {
 
    @Test(groups = { "contexts", "ejb3", "integration"})
-   @SpecAssertion(section = "6.4.2", id = "aaaa")
+   @SpecAssertion(section = "6.4.2", id = "aaab")
    public void testDestroyingEjbDestroysDependents() throws Exception
    {
       assert getBeans(HouseLocal.class).size() == 1;
@@ -53,7 +53,7 @@
    }
    
    @Test(groups = { "contexts", "ejb3", "integration"})
-   @SpecAssertion(section = "6.4.2", id = "aaaa")
+   @SpecAssertion(section = "6.4.2", id = "aaab")
    public void testDestroyingEjbDestroysDependentSimples() throws Exception
    {
       assert getBeans(FarmLocal.class).size() == 1;

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.context.passivating;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.interceptor.Interceptors;
+
+ at SuppressWarnings("serial")
+ at SessionScoped
+ at Interceptors(KokkolaInterceptor.class)
+public class Kokkola implements Serializable
+{
+
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola2.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola2.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Kokkola2.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.context.passivating;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.interceptor.Interceptors;
+
+ at SuppressWarnings("serial")
+ at SessionScoped
+ at Interceptors(KokkolaInterceptor2.class)
+public class Kokkola2 implements Serializable
+{
+
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.context.passivating;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class KokkolaInterceptor implements Serializable
+{
+   @AroundInvoke
+   public Object intercept(InvocationContext context)
+   {
+      // do nothing
+      return null;
+   }
+}

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor2.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor2.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/KokkolaInterceptor2.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.context.passivating;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class KokkolaInterceptor2
+{
+   @AroundInvoke
+   public Object intercept(InvocationContext context)
+   {
+      // do nothing
+      return null;
+   }
+}

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-28 00:01:53 UTC (rev 3297)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/PassivatingContextTest.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -6,6 +6,8 @@
 
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.IllegalProductException;
 import javax.enterprise.inject.spi.Bean;
 
@@ -13,6 +15,7 @@
 import org.jboss.test.audit.annotations.SpecAssertions;
 import org.jboss.test.audit.annotations.SpecVersion;
 import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.impl.MockCreationalContext;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.Packaging;
 import org.jboss.testharness.impl.packaging.PackagingType;
@@ -33,12 +36,28 @@
    
    @Test(groups = { "contexts", "passivation", "review" })
    @SpecAssertion(section = "6.6.1", id = "ba")
-   public void testSimpleWebBeanWithSerializableImplementationClassOK()
+   public void testManagedBeanWithSerializableImplementationClassOK()
    {
       Set<Bean<Jyvaskyla>> beans = getBeans(Jyvaskyla.class);
       assert !beans.isEmpty();
    }
    
+   @Test(groups = { "contexts", "passivation"})
+   @SpecAssertion(section = "6.6.1", id = "bb")
+   public void testManagedBeanWithSerializableInterceptorClassOK()
+   {
+      Set<Bean<Kokkola>> beans = getBeans(Kokkola.class);
+      assert !beans.isEmpty();
+   }
+   
+   @Test(groups = { "contexts", "passivation", "ri-broken"})
+   @SpecAssertion(section = "6.6.1", id = "bb")
+   public void testManagedBeanWithNonSerializableInterceptorClassNotOK()
+   {
+      Set<Bean<Kokkola2>> beans = getBeans(Kokkola2.class);
+      assert beans.isEmpty();
+   }   
+   
    @Test @SpecAssertion(section="6.6.2", id = "c")
    public void testInjectionOfDependentPrimitiveProductIntoNormalBean()
    {

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Bream.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Bream.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Bream.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.implementation.simple.lifecycle;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+ at SessionScoped
+class Bream implements Serializable
+{
+
+}

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java	2009-07-28 00:01:53 UTC (rev 3297)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java	2009-07-28 03:00:00 UTC (rev 3298)
@@ -14,6 +14,8 @@
 
 import org.jboss.jsr299.tck.AbstractJSR299Test;
 import org.jboss.jsr299.tck.impl.MockCreationalContext;
+import org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle.Important;
+import org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle.KleinStadt;
 import org.jboss.test.audit.annotations.SpecAssertion;
 import org.jboss.test.audit.annotations.SpecAssertions;
 import org.jboss.test.audit.annotations.SpecVersion;
@@ -48,6 +50,34 @@
    }
    
    @Test
+   @SpecAssertions( {
+      @SpecAssertion(section = "6.6.2", id = "b")
+   })
+   public void testSerializeRequestScoped() throws Exception
+   {
+      Cod codInstance = getInstanceByType(Cod.class);
+
+      byte[] bytes = serialize(codInstance);
+      Object object = deserialize(bytes);
+      codInstance = (Cod) object;
+      assert getCurrentConfiguration().getBeans().isProxy(codInstance);      
+   }   
+   
+   @Test
+   @SpecAssertions( {
+      @SpecAssertion(section = "6.6.2", id = "b")
+   })
+   public void testSerializeSessionScoped() throws Exception
+   {
+      Bream instance = getInstanceByType(Bream.class);
+
+      byte[] bytes = serialize(instance);
+      Object object = deserialize(bytes);
+      instance = (Bream) object;
+      assert getCurrentConfiguration().getBeans().isProxy(instance);      
+   }      
+   
+   @Test
    @SpecAssertion(section = "3.1.4.2", id = "b")
    public void testBindingTypeAnnotatedConstructor()
    {

Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml	2009-07-28 00:01:53 UTC (rev 3297)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml	2009-07-28 03:00:00 UTC (rev 3298)
@@ -2587,15 +2587,15 @@
   <section id="6.4.2" title="Dependent object destruction">
   
     <assertion id="aaaa">
-      <text>The container must ensure that all dependent objects of a non-contextual instance of a bean or other Java EE component class are destroyed when the instance is destroyed by the container.</text>
+      <text>The container must ensure that all dependent objects of a non-contextual instance of a bean ~or other Java EE component~ class are destroyed when the instance is destroyed by the container.</text>
     </assertion>
   
     <assertion id="aaab">
-      <text>The container must ensure that all dependent objects of a non-contextual instance of a bean or other Java EE component class are destroyed when the instance is destroyed by the container.</text>
+      <text>The container must ensure that all dependent objects of a non-contextual instance of a ~bean~ or other Java EE component class are destroyed when the instance is destroyed by the container.</text>
     </assertion>
     
     <assertion id="bbb">
-      <text>The container must ensure that all |@Dependent| scoped contextual instances injected into method parameters of an observer method of any container lifecycle event, as defined in Section 11.5, "Container lifecycle events", is destroyed after all observers of the |BeforeShutdown| event complete.</text>
+      <text>The container must ensure that all |@Dependent| scoped contextual instances injected into method parameters of an observer method of any container lifecycle event, as defined in Section 11.5, "Container lifecycle events", are destroyed after all observers of the |BeforeShutdown| event complete.</text>
     </assertion>
     
     <assertion id="ccc">
@@ -2729,12 +2729,13 @@
       <text>An implementation of |Contextual| that is not a bean is passivation capable if it implements both |PassivationCapable| and |Serializable|.</text>
     </assertion>
     
-    <assertion id="g">
-      <text>The |getId()| method must return a value that uniquely identifies the instance of |Bean| or |Contextual|.</text>
+    <assertion id="g" testable="false">
+      <text>The |PassivationCapable.getId()| method must return a value that uniquely identifies the instance of |Bean| or |Contextual|.</text>
+      <note>This is a requirement of the implementation</note>
     </assertion>
     
     <assertion id="h" testable="false">
-      <text>The |getId()| ~method must return a value that uniquely identifies the instance of |Bean| or |Contextual|.  It~ is recommended that the string contain the package name of the class that implements |Bean| or |Contextual|.</text>
+      <text>The |PassivationCapable.getId()| ~method must return a value that uniquely identifies the instance of |Bean| or |Contextual|.  It~ is recommended that the string contain the package name of the class that implements |Bean| or |Contextual|.</text>
       <note>Recommendation only</note>
     </assertion>
   </section>




More information about the weld-commits mailing list