[webbeans-commits] Webbeans SVN: r1524 - in tck/trunk/impl/src/main: resources and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Feb 15 06:10:56 EST 2009


Author: shane.bryzak at jboss.com
Date: 2009-02-15 06:10:56 -0500 (Sun, 15 Feb 2009)
New Revision: 1524

Modified:
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/dependent/DependentContextTest.java
   tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
chapter 8 assertions

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/dependent/DependentContextTest.java	2009-02-15 09:40:57 UTC (rev 1523)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/integration/context/dependent/DependentContextTest.java	2009-02-15 11:10:56 UTC (rev 1524)
@@ -25,82 +25,52 @@
  */
 public class DependentContextTest
 {
-   /**
-    * when the container is injecting dependencies of an EJB or servlet or when
-    * a @PostConstruct or @PreDestroy callback is invoked by the EJB container.
-    */
    @Test(groups = { "contexts", "injection", "stub", "ejb3", "integration" })
-   @SpecAssertion(section = "8.3", id = "unknown")
+   @SpecAssertion(section = "8.3", id = "k")
    public void testContextIsActiveDuringEJBDependencyInjection()
    {
       assert false;
    }
 
-   /**
-    * when the container is injecting dependencies of an EJB or servlet or when
-    * a @PostConstruct or @PreDestroy callback is invoked by the EJB container.
-    */
-   @Test(groups = { "contexts", "injection", "stub", "servlet", "integration" })
-   @SpecAssertion(section = "8.3", id = "unknown")
-   public void testContextIsActiveDuringServletDependencyInjection()
-   {
-      assert false;
-   }
-
-   /**
-    * when the container is injecting dependencies of an EJB or servlet or when
-    * a @PostConstruct or @PreDestroy callback is invoked by the EJB container.
-    */
    @Test(groups = { "contexts", "postconstruct", "stub", "ejb3", "integration" })
-   @SpecAssertion(section = "8.3", id = "unknown")
+   @SpecAssertion(section = "8.3", id = "l")
    public void testContextIsActiveDuringEJBPostConstruct()
    {
       assert false;
    }
 
-   /**
-    * A bean, EJB or servlet may obtain an instance of a bean with scope @Dependent
-    * via dependency injection or by calling Manager.getInstance(),
-    * Manager.getInstanceByType() or Instance.get() when the @Dependent scope is
-    * active.
-    */
+
+   @Test(groups = { "contexts", "injection", "stub", "servlet", "integration" })
+   @SpecAssertion(section = "8.3", id = "m")
+   public void testContextIsActiveDuringServletDependencyInjection()
+   {
+      assert false;
+   }   
+   
    @Test(groups = { "stub", "contexts", "ejb3", "integration" })
-   @SpecAssertion(section = "8.3.1", id = "unknown")
+   @SpecAssertion(section = "8.3.1", id = "a")
    public void testEjbBeanMayCreateInstanceWheneverScopeActive()
    {
       assert false;
    }
 
-   /**
-    * A bean, EJB or servlet may obtain an instance of a bean with scope @Dependent
-    * via dependency injection or by calling Manager.getInstance(),
-    * Manager.getInstanceByType() or Instance.get() when the @Dependent scope is
-    * active.
-    */
+
    @Test(groups = { "stub", "contexts", "servlet", "integration" })
-   @SpecAssertion(section = "8.3.1", id = "unknown")
+   @SpecAssertion(section = "8.3.1", id = "a")
    public void testServletBeanMayCreateInstanceWheneverScopeIsActive()
    {
       assert false;
    }
 
-   /**
-    * destroy all dependent objects of an EJB bean or Servlet when the EJB bean
-    * or Servlet is destroyed,
-    */
    @Test(groups = { "stub", "contexts", "ejb3", "integration" })
-   @SpecAssertion(section = "8.3.2", id = "unknown")
+   @SpecAssertion(section = "8.3.2", id = "b")
    public void testDestroyingEjbDestroysDependents()
    {
       assert false;
    }
 
-   /**
-    * destroy all dependent objects of an EJB bean or Servlet when the EJB bean
-    * or Servlet is destroyed,
-    */
    @Test(groups = { "stub", "contexts", "servlet", "integration" })
-   @SpecAssertion(section = "8.3.2", id = "unknown")
+   @SpecAssertion(section = "8.3.2", id = "b")
    public void testDestroyingServletDestroysDependents()
    {
       assert false;

Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml	2009-02-15 09:40:57 UTC (rev 1523)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml	2009-02-15 11:10:56 UTC (rev 1524)
@@ -1650,7 +1650,178 @@
   
   </section>
   
+  <section id="8" title="Scopes and contexts">
   
+  </section>
   
+  <section id="8.1" title="The Context interface">
+  
+    <assertion id="a">
+      <text>The get() method of the Context object may return an existing instance of the given contextual type</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>The get() method of the Context object may return a null value if no CreationalContext is given</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>The get() method of the Context object may create a new instance of the given contextual type by calling Contextual.create() and return the new instance, if a CreationalContext is given</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>The get() method of a Context object may not return a null value unless no CreationalContext is given, or Contextual.create() returns a null value</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>The get() method of a Context object may not create a new instance of the given contextual type unless a CreationalContext is given</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>The Context implementation is responsible for destroying any contextual instance it creates by passing the instance to the destroy() method of the Contextual object representing the contextual type</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>A destroyed instance must not subsequently be returned by a Context object's get() method</text>
+    </assertion>
+    
+    <assertion id="h">
+      <text>When a scope is inactive, any invocation of the get() from the current thread upon the Context object for that scope results in a ContextNotActiveException</text>
+    </assertion>
+    
+    <assertion id="i">
+      <text>The isActive() method returns false when the scope of the context object is inactive, and true when it is active</text>
+    </assertion>    
+    
+  </section>
+  
+  <section id="8.2" title="Normal scopes and pseudo-scopes">
+    <assertion id="a">
+      <text>There may be no more than one mapped instance of a context object per contextual type per thread</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>A context may be associated with one or more threads</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>The get() operation of the Context object for an active normal scope returns the current instance of the given contextual type</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>When a context is destroyed, all mapped instances of contextual types with that scope are destroyed by passing them to the Contextual.destroy() method</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>Contexts with normal scopes must obey the following rule: Suppose beans A, B and Z all have normal scopes. Suppose A has an injection point x, and B has an injection point y. Suppose further that both x and y resolve to bean Z according to the typesafe resolution algorithm. If a is the current instance of A, and b is the current instance of B, then both a.x and b.y refer to the same instance of Z. This instance is the current instance of Z.</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>All pseudo-scopes must be explicitly declared @ScopeType(normal=false), to indicate to the container that no client proxy is required</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>All scopes defined by this specification, except for the @Dependent pseudo-scope, are normal scopes</text>
+    </assertion>
+  </section>
+  
+  <section id="8.3" title="Dependent pseudo-scope">
+  
+    <assertion id="a">
+      <text>When a bean is declared to have @Dependent scope, no injected instance of the bean is ever shared between multiple injection points</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>When a bean is declared to have @Dependent scope, any injected instance of the bean is bound to the lifecycle of the bean, servlet or EJB into which it is injected</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>When a bean is declared to have @Dependent scope, any instance of the bean that is used to evaluate a Unified EL expression exists to service that evaluation only</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>When a bean is declared to have @Dependent scope, any instance of the bean that receives a producer method, producer field, disposal method or observer method invocation exists to service that invocation only</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>Every invocation of the get() operation of the Context object for the @Dependent scope with a CreationalContext returns a new instance of the given bean</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>Every invocation of the get() operation of the Context object for the @Dependent scope with no CreationalContext returns a null value</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>The @Dependent scope is inactive except when an instance of a bean with scope @Dependent is created by the container to receive a producer method, producer
+field, disposal method or observer method invocation</text>
+      <note>Assertions g through k are all related and should be treated as "or" conditions</note>
+    </assertion>
+    
+    <assertion id="h">
+      <text>The @Dependent scope is inactive except while a Unified EL expression is evaluated</text>
+    </assertion>
+    
+    <assertion id="i">
+      <text>The @Dependent scope is inactive except while an observer method is invoked</text>
+    </assertion>
+    
+    <assertion id="j">
+      <text>The @Dependent scope is inactive except when the container is creating or destroying a contextual instance of a bean or injecting its dependencies</text>
+    </assertion>
+    
+    <assertion id="k">
+      <text>The @Dependent scope is inactive except when the container is injecting dependencies of an EJB</text>
+    </assertion>
+    
+    <assertion id="l">
+      <text>The @Dependent scope is inactive except when a @PostConstruct or @PreDestroy callback is invoked by the EJB container</text>
+    </assertion>
+    
+    <assertion id="m">
+      <text>The @Dependent scope is inactive except when the container is injecting dependencies of a servlet</text>
+    </assertion>
+    
+    <assertion id="n">
+      <text>The @Dependent scope is even active during invocation of interceptors and decorators of observer methods and interceptors and decorators of @PostConstruct and @PreDestroy callbacks</text>
+    </assertion>
+  
+  </section>
+  
+  <section id="8.3.1" title="Dependent objects">
+    <assertion id="a">
+      <text>A bean, EJB or servlet may obtain an instance of a bean with scope @Dependent via dependency injection or by calling Manager.getInstance(), Manager.getInstanceByType() or Instance.get() when the @Dependent scope is active</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>Instances of interceptors or decorators with scope @Dependent are also dependent objects of the bean they intercept or decorate</text>
+    </assertion>
+  </section>
+  
+  <section id="8.3.2" title="Dependent object destruction">
+  
+    <assertion id="a">
+      <text>The container must destroy all dependent objects of a contextual bean instance when the instance is destroyed</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>The container must destroy all dependent objects of an EJB or servlet when the EJB or servlet is destroyed</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>The container must destroy all @Dependent scoped contextual instances created during an EL expression evaluation when the evaluation completes</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>The container must destroy any @Dependent scoped contextual instance created to receive a producer method, producer field, disposal method or observer method invocation when the invocation completes</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>The container is permitted to destroy any @Dependent scoped contextual instance at any time if the instance is no Scopes and contexts longer referenced by the application (excluding weak, soft and phantom references)</text>
+    </assertion>
+  </section>
+  
+  <section id="8.4" title="Passivating scopes and serialization">
+  
+  </section>
+  
 
 </specification>




More information about the weld-commits mailing list