[webbeans-commits] Webbeans SVN: r1556 - tck/trunk/impl/src/main/resources.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Feb 16 22:52:40 EST 2009


Author: shane.bryzak at jboss.com
Date: 2009-02-16 22:52:40 -0500 (Mon, 16 Feb 2009)
New Revision: 1556

Modified:
   tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
chapter 7 assertions

Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml	2009-02-17 01:35:31 UTC (rev 1555)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml	2009-02-17 03:52:40 UTC (rev 1556)
@@ -2037,10 +2037,526 @@
   
   </section>
   
-  <section id="8" title="Scopes and contexts">
+  <section id="7.1" title="Event types and binding types">
   
+    <assertion id="a">
+      <text>An event object is an instance of a concrete Java class with no type variables or wildcards</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>The event types of the event include all superclasses and interfaces of the class of the event object</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>An event binding type is a Java annotation defined as @Target({FIELD, PARAMETER}) or @Target({METHOD, FIELD, PARAMETER, TYPE}) and @Retention(RUNTIME)</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>All event binding types must specify the @javax.inject.BindingType meta-annotation</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>An event consumer will be notified of an event if the observed event type it specifies is one of the event types of the event, and if all the observed event bindings it specifies are event bindings of the event</text>
+    </assertion>
+  
   </section>
   
+  <section id="7.2" title="Firing an event via the Manager interface">
+  
+    <assertion id="a">
+      <text>The Manager interface provides the fireEvent() method for firing events</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>If the type of the event object passed to fireEvent() contains type variables or wildcards, an IllegalArgumentException is thrown</text>
+    </assertion>
+    
+  </section>
+  
+  <section id="7.3" title="Observing events via the Observer interface">
+    <assertion id="a">
+      <text>Observers of events implement the javax.event.Observer interface</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>An observer instance may be registered with the container by calling Manager.addObserver()</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>In an observer method, the first parameter is the observer object, the second parameter is the observed event type, and the remaining parameters are
+optional observed event bindings</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>The observer is notified when an event object that is assignable to the observed event type is raised with the observed event bindings</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>An observer instance may be deregistered by calling Manager.removeObserver()</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>If the observed event type passed to addObserver() or removeObserver() contains type variables or wildcards, an IllegalArgumentException is thrown</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>If two instances of the same binding type are passed to addObserver() or removeObserver(), a DuplicateBindingTypeException is thrown</text>
+    </assertion>
+    
+    <assertion id="h">
+      <text>If an instance of an annotation that is not a binding type is passed to addObserver() or removeObserver(), an IllegalArgumentException is thrown</text>
+    </assertion>
+  </section>
+  
+  <section id="7.4" title="Observer notification">
+  
+    <assertion id="a">
+      <text>When an event is fired by the application the container must determine the observers for that event by calling Manager.resolveObservers(), passing the event object and all event bindings</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>When an event is fired by the application the container must, for each observer, call the notify() method of the Observer interface, passing the event object</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If an observer throws an exception, the exception aborts processing of the event. No other observers of that event will be called. The fireEvent() method rethrows the exception</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>Any observer called before completion of a transaction may call setRollbackOnly() to force a transaction rollback</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>An observer may not directly initiate, commit or rollback JTA transactions</text>
+    </assertion>
+  
+  </section>
+  
+  <section id="7.5" title="Observer methods">
+    <assertion id="a">
+      <text>An observer method is an observer defined via annotations, instead of by explicitly implementing the Observer interface.  Unlike regular observers, observer methods are automatically discovered and registered by the container</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>An observer method must be a method of a simple bean class or session bean class</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>An observer method may be either static or non-static</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>If the bean is a session bean, the observer method must be a business method of the EJB or a static method of the bean class</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>There may be arbitrarily many observer methods with the same event parameter type and bindings</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>A bean may declare multiple observer methods</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.1" title="Event parameter of an observer method">
+    <assertion id="a">
+      <text>Each observer method must have exactly one event parameter, of the same type as the event type it observes.  When searching for observer methods for an event, the container considers the type and bindings of the event parameter</text>
+    </assertion>
+        
+    <assertion id="b">
+      <text>If the event parameter does not explicitly declare any binding, the observer method observes events with no binding</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If the type of the event parameter contains type variables or wildcards, a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.2" title="Declaring an observer method using annotations">
+    <assertion id="a">
+      <text>A observer method may be declared using annotations by annotating a parameter @javax.event.Observes.  That parameter is the event parameter.</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>If a method has more than one parameter annotated @Observes, a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If an observer method is annotated @Produces a DefinitionException
+is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>If an observer method is annotated @Initializer a DefinitionException
+is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>If an observer method has a parameter annotated @Disposes, a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>If a non-static method of a session bean class has a parameter annotated @Observes, and the method is not a business method of the EJB, a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>The event parameter may declare bindings</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.3" title="Declaring an observer method using XML">
+    <assertion id="a">
+      <text>For a beans defined in XML, an observer method may be declared using the method name, the &lt;Observes&gt; element, and the parameter types of the method</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>When an observer method is declared in XML, the container ignores binding annotations applied to the Java method parameters</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If the bean class of a bean declared in XML does not have a method with parameters that match those declared in XML, a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.4" title="Observer method parameters">
+    <assertion id="a">
+      <text>In addition to the event parameter, observer methods may declare additional parameters, which may declare bindings. The container calls the method Manager.getInstanceToInject() defined in Section 5.7.1, "Resolving dependencies" to determine a value for each parameter of an observer method and calls the observer method with those parameter values</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.5" title="Conditional observer methods">
+    <assertion id="a">
+      <text>Conditional observer methods are observer methods which are notified of an event only if an instance of the bean that defines the observer method already exists in the current context</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>A conditional observer methods may be declared by annotating the event parameter with the @javax.event.IfExists annotation</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>Conditional observer methods may be declared in XML by adding a child &lt;IfExists&gt; element to the &lt;Observes&gt; element</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.6" title="Transactional observer methods">
+    <assertion id="a">
+      <text>Transactional observer methods are observer methods which receive event notifications during the before or after completion phase of the transaction in which the event was fired. If no transaction is in progress when the event is fired, they are notified at the same time as other observers</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>A before completion observer method is called during the before completion phase of the transaction</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>An after completion observer method is called during the after completion phase of the transaction</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>An after success observer method is called during the after completion phase of the transaction, only when the transaction completes successfully</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>An after failure observer method is called during the after completion phase of the transaction, only when the transaction fails</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>A transactional observer method may be declared by annotating the event parameter of the observer method or in XML by a child element of the &lt;Observes&gt; element</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>The @javax.event.BeforeTransactionCompletion annotation or &lt;BeforeTransactionCompletion&gt; element specifies that the observer method is a before completion observer method</text>
+    </assertion>
+    
+    <assertion id="h">
+      <text>The @javax.event.AfterTransactionCompletion annotation or &lt;AfterTransactionCompletion&gt; element specifies that the observer method is an after completion observer method</text>
+    </assertion>
+    
+    <assertion id="i">
+      <text>The @javax.event.AfterTransactionSuccess annotation or &lt;AfterTransactionSuccess&gt; element specifies that the observer method is an after success observer method</text>
+    </assertion>
+    
+    <assertion id="j">
+      <text>The @javax.event.AfterTransactionFailure annotation or &lt;AfterTransactionFailure&gt; element specifies that the observer method is an after failure observer method</text>
+    </assertion>
+    
+    <assertion id="k">
+      <text>A transactional observer method may not specify more than one of the four types. If a transactional observer method specifies more than one of the four types, a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.7" title="Asynchronous observer methods">
+    <assertion id="a">
+      <text>An asynchronous observer method may be declared by annotating the event parameter of the observer method @javax.event.Asynchronously or in XML by a child &lt;Asynchronously&gt; element of the &lt;Observes&gt; element</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>An asynchronous observer method may also be a transactional observer method</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If an asynchronous observer method is also a transactional observer method, it may not be a before completion observer method or a conditional observer method. If an asynchronous observer method is specified as a before completion or conditional observer method, a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.8" title="Observer object for an observer method">
+    <assertion id="a">
+      <text>For every observer method of an enabled bean, the container is responsible for providing and registering an appropriate implementation of the Observer interface, that delegates event notifications to the observer method</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>The notify() method of the Observer implementation for an observer method either invokes the observer method immediately, or asynchronously, or registers the observer method for later invocation during the transaction completion phase, using a JTA Synchronization</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If the observer method is an asynchronous transactional observer method and there is currently a JTA transaction in progress, the observer object calls the observer method asynchronously during the after transaction completion phase</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>If the observer method is a transactional observer method and there is currently a JTA transaction in progress, the observer object calls the observer method during the appropriate transaction completion phase</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>If the observer method is an asynchronous observer method, the container calls the observer method asynchronously</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>If none of the conditions of assertions c, d, or e are true, the container calls the observer immediately</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>The container is not required to guarantee delivery of asynchronous events in the case of a server shutdown or failure</text>
+    </assertion>
+    
+    <assertion id="h">
+      <text>To invoke an observer method, the container must pass the event object to the event parameter and the object returned by Manager.getInstanceToInject() to each of the other parameters</text>
+    </assertion>
+    
+    <assertion id="i">
+      <text>If the observer method is static, the container must invoke the method</text>
+    </assertion>
+    
+    <assertion id="j">
+      <text>If the observer method is non-static, the container must obtain the Bean object for the most specialized bean that specializes the bean which declares the observer method</text>
+    </assertion>
+    
+    <assertion id="k">
+      <text>Placeholder</text>
+    </assertion>
+    
+    <assertion id="l">
+      <text>Placeholder</text>
+    </assertion>
+    
+    <assertion id="m">
+      <text>Placeholder</text>
+    </assertion>
+    
+    <assertion id="p">
+      <text>If the observer is a transactional or asynchronous observer method, any exception is caught and logged by the container</text>
+    </assertion>
+    
+    <assertion id="q">
+      <text>If the observer isn't a transactional or asynchronous observer method, the exception is rethrown by the notify() method of the observer object. If the exception is a checked exception, it is wrapped and rethrown as an (unchecked) ObserverException</text>
+    </assertion>
+    
+    <assertion id="r">
+      <text>The observer object is registered by calling Manager.addObserver(), passing the event parameter type as the observed event type, and the bindings of the event parameter as the observed event bindings</text>
+    </assertion>
+  </section>
+  
+  <section id="7.5.9" title="Observer invocation context">
+    <assertion id="a">
+      <text>If the observer method is an asynchronous observer method, it is called with no active transaction, no client security context and with a new request context that is destroyed when the observer method returns. The application context is also active</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>If the observer method is a @BeforeTransactionCompletion transactional observer method, it is called within the context of the transaction that is about to complete and with the same client security context and lifecycle contexts</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If the observer method is any other kind of transactional observer method, it is called in an unspecified transaction context, but with the same client security context and lifecycle contexts as the transaction that just completed</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>If an observer method is not an asynchronous observer method, and not a @BeforeTransactionCompletion transactional method, and not any other kind of transactional observer method, then the observer method is called in the same transaction context, client security context and lifecycle contexts as the invocation of Event.fire()</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>The transaction and security contexts for a business method of a session bean also depend upon the transaction attribute and @RunAs descriptor, if any</text>
+    </assertion>
+  </section>
+  
+  <section id="7.6" title="The Event interface">
+    <assertion id="a">
+      <text>An instance of the javax.event.Event interface may be injected via use of the @javax.event.Fires binding</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>Additional bindings may be specified at the injection point for javax.event.Event</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>The Event interface provides a method for firing events of a specific type</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>The Event interface provides a method for registering observers for
+events of the same type</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>The first parameter of the fire() method is the event object. The remaining parameters are event bindings</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>The first parameter of the observe() method is the observer object. The remaining parameters are the observed event bindings</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>If two instances of the same binding type are passed to fire() or observes(), a DuplicateBindingTypeException is thrown</text>
+    </assertion>
+    
+    <assertion id="h">
+      <text>If an instance of an annotation that is not a binding type is passed to fire() or observes(), an IllegalArgumentException is thrown</text>
+    </assertion>
+    
+    <assertion id="i">
+      <text>The @Fires annotation or &lt;Fires&gt; element may be applied to any injection point of type Event, where an actual type parameter is specified</text>
+    </assertion>
+    
+    <assertion id="j">
+      <text>If the type of the injection point is not of type Event a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="k">
+      <text>If the type of the injection point has no actual type parameter specified a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="l">
+      <text>If the type of the injection point parameter contains a type variable a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="m">
+      <text>If the type of the injection point parameter contains a wildcard a DefinitionException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="n">
+      <text>Whenever the @Fires annotation appears at an injection point, an implicit bean exists with exactly the bean type and bindings that appear at the injection point</text>
+    </assertion>
+    
+    <assertion id="o">
+      <text>Whenever the @Fires annotation appears at an injection point, an implicit bean exists with deployment type @Standard,</text>
+    </assertion>
+    
+    <assertion id="p">
+      <text>Whenever the @Fires annotation appears at an injection point, an implicit bean exists with @Dependent scope</text>
+    </assertion>
+    
+    <assertion id="q">
+      <text>Whenever the @Fires annotation appears at an injection point, an implicit bean exists with no bean name</text>
+    </assertion>
+    
+    <assertion id="r">
+      <text>Whenever the @Fires annotation appears at an injection point, an implicit bean exists with an implementation provided automatically by the container</text>
+    </assertion>
+    
+    <assertion id="s">
+      <text>The fire() method of the provided implementation of Event must call Manager.fireEvent(), passing the event object passed to Event.fire(), all bindings declared at the injection point (except @Fires), and all bindings passed to Event.fire()</text>
+    </assertion>
+    
+    <assertion id="t">
+      <text>The application may fire events by calling the fire() method</text>
+    </assertion>
+    
+    <assertion id="u">
+      <text>The observe() method of the provided implementation of Event must call Manager.addObserver(), passing the observer object passed to Event.observe(), all bindings declared at the injection point (except @Fires), and all bindings passed to Event.observer()</text>
+    </assertion>
+    
+    <assertion id="v">
+      <text>The application may register observers by calling the observe() method</text>
+    </assertion>
+  </section>
+  
+  <section id="7.7" title="Observer resolution">
+    <assertion id="a">
+      <text>The method Manager.resolveObservers() resolves observers for an event - the first parameter of resolveObservers() is the event object.  The remaining parameters are event bindings</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>If the type of the event object passed to resolveObservers() contains type variables, an IllegalArgumentException is thrown</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>If the type of the event object passed to resolveObservers() contains wildcards, an IllegalArgumentException is thrown</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>If two instances of the same binding type are passed to resolveObservers(), a DuplicateBindingTypeException is thrown</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>If an instance of an annotation that is not a binding type is passed to resolveObservers(), an IllegalArgumentException is thrown</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>When searching for observers for an event, the event object must be assignable to the observed event type, taking type parameters into consideration</text>
+    </assertion>
+    
+    <assertion id="g">
+      <text>When searching for observers for an event, for each observed event binding, (a) an instance of the binding type must have been passed to fireEvent() and (b) any member values of the binding type must match the member values of the instance passed to fireEvent()</text>
+    </assertion>
+  </section>
+  
+  <section id="7.7.1" title="Event binding types with members">
+    <assertion id="a">
+      <text>The binding type for an Event binding may have annotation members</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>The container uses equals() to compare event binding type member values</text>
+    </assertion>
+  </section>
+  
+  <section id="7.7.2" title="Multiple event bindings">
+    <assertion id="a">
+      <text>An event parameter may have multiple bindings</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>An observer method will only be notified if all the observed event bindings are specified when the event is fired</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>Other, less specific, observers will also be notified of events with multiple event bindings</text>
+    </assertion>
+  </section>
+  
+  <section id="7.8" title="JMS event mappings">
+    <assertion id="a">
+      <text>An event type may be mapped to a JMS resource that represents a topic</text>
+    </assertion>
+    
+    <assertion id="b">
+      <text>Multiple event types may be mapped to the same topic</text>
+    </assertion>
+    
+    <assertion id="c">
+      <text>All observers of mapped event types must be asynchronous observer methods. If an observer for a mapped event type is not an asynchronous observer method, a DeploymentException is thrown by the container at deployment time</text>
+    </assertion>
+    
+    <assertion id="d">
+      <text>When an event type is mapped to a topic, the container must send a message containing the serialized event and its event bindings to the topic whenever an event with that type is fired</text>
+    </assertion>
+    
+    <assertion id="e">
+      <text>When an event type is mapped to a topic, the container must listen for messages containing events of that type sent to the topic, and notify all observers of the event type whenever a message containing an event of that type is received</text>
+    </assertion>
+    
+    <assertion id="f">
+      <text>Events of a mapped event type are distributed to other processes which have the same event type mapped to the same topic</text>
+    </assertion>
+  </section>
+  
   <section id="8.1" title="The Context interface">
   
     <assertion id="a">




More information about the weld-commits mailing list