Author: shane.bryzak(a)jboss.com
Date: 2009-01-27 04:12:17 -0500 (Tue, 27 Jan 2009)
New Revision: 1245
Modified:
tck/trunk/impl/tck-audit.xml
Log:
Completed chapter 3 assertions
Modified: tck/trunk/impl/tck-audit.xml
===================================================================
--- tck/trunk/impl/tck-audit.xml 2009-01-27 06:29:21 UTC (rev 1244)
+++ tck/trunk/impl/tck-audit.xml 2009-01-27 09:12:17 UTC (rev 1245)
@@ -1,6 +1,38 @@
<specification
xmlns="http://jboss.com/products/webbeans/tck/audit"
name="JSR-299: Java Contexts and Dependency Injection"
version="Revised Public Review Draft">
+
+ <section id="3" title="Bean implementation">
+ <assertion code="a">
+ <text>The container provides built-in support for simple beans (Java
classes)</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>The container provides built-in support for session beans</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>The container provides built-in support for producer methods and
fields</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>The container provides built-in support for Resources (Java EE
resources, persistence contexts, persistence units, remote EJBs and web
services)</text>
+ </assertion>
+
+ <assertion code="e">
+ <text>The container provides built-in support for JMS resources (topics and
queues)</text>
+ </assertion>
+ </section>
+
+ <section id="3.1" title="Restriction upon bean
instantiation">
+ <assertion code="a">
+ <text>The bean class is a concrete class and is not required to implement any
special interface or extend any special superclass</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>If the application calls a producer method directly, instead of letting
the container call it, the returned object is not a contextual instance and the
capabilities listed in Section 2.1, "Functionality provided by the container to the
bean" will not be available to the returned object.</text>
+ </assertion>
+ </section>
<section id="3.2" title="Simple beans">
<assertion code="a">
@@ -575,5 +607,420 @@
</assertion>
</section>
+ <section id="3.4.8" title="Declaring a disposal method using
annotations">
+
+ <assertion code="a">
+ <text>A disposal method may be declared using annotations by annotating a
parameter @javax.inject.Disposes. That parameter is the disposed parameter</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>If a method has more than one parameter annotated @Disposes, a
DefinitionException is thrown by the container</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>If a disposal method is annotated @Produces, or @Initializer or has a
parameter annotated @Observes, a DefinitionException is thrown by the container at
deployment time</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>If a non-static method of a session bean class has a parameter
annotated @Disposes, and the method is not a business method of the EJB, a
DefinitionException is thrown by the container at deployment time</text>
+ </assertion>
+ </section>
+
+ <section id="3.4.9" title="Declaring a disposal method using
XML">
+
+ <assertion code="a">
+ <text>For a bean defined in XML, a disposal method may be declared using the
method name, the <Disposes> element, and the parameter types of the
method</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>When a disposal method is declared in XML, the container ignores
binding annotations applied to the Java method parameter</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>If the bean class of a bean declared in XML does not have a method with
the name and parameter types declared in XML, a DefinitionException is thrown by the
container at deployment time</text>
+ </assertion>
+ </section>
+
+ <section id="3.4.10" title="Disposal method parameters">
+
+ <assertion code="a">
+ <text>In addition to the disposed parameter, a disposal method may declare
additional parameters, which may also specify bindings. The container calls
Manager.getInstanceToInject() to determine a value for each parameter of a disposal method
and calls the disposal method with those parameter values</text>
+ </assertion>
+ </section>
+
+ <section id="3.4.11" title="Disposal method resolution">
+
+ <assertion code="a">
+ <text>When searching for disposal methods for a producer method, the
container searches for disposal methods which are declared by an enabled bean, and for
which the disposed parameter must resolve to the producer method, according to the
typesafe resolution algorithm</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>If there are multiple disposal methods for a producer method, a
DefinitionException is thrown by the container at deployment time</text>
+ </assertion>
+ </section>
+
+ <section id="3.4.12" title="Default name for a producer
method">
+
+ <assertion code="a">
+ <text>The default name for a producer method is the method name, unless the
method follows the JavaBeans property getter naming convention, in which case the default
name is the JavaBeans property name</text>
+ </assertion>
+ </section>
+
+ <section id="3.5" title="Producer fields">
+
+ <assertion code="a">
+ <text>A producer field must be a field of a simple bean class or session bean
class</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>A producer field may be either static or nonstatic</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>If a producer field sometimes contains a null value when accessed, then
the producer field must have scope @Dependent</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>If a producer method contains a null value at runtime, and the producer
field declares any other scope, an IllegalProductException is thrown by the container.
This restriction allows the container to use a client proxy, as defined in Section 5.4,
"Client proxies"</text>
+ </assertion>
+
+ <assertion code="e">
+ <text>If the producer field return type is a parameterized type, it must
specify actual type parameters for each type parameter</text>
+ </assertion>
+
+ <assertion code="f">
+ <text>If a producer field return type contains a wildcard type parameter or
type variable, a DefinitionException is thrown by the container at deployment
time</text>
+ </assertion>
+
+ <assertion code="g">
+ <text>The application may access producer fields directly. However, if the
application accesses a producer field directly, the returned object is not bound to any
context; and its lifecycle is not managed by the container</text>
+ </assertion>
+
+ <assertion code="h">
+ <text>A bean may declare multiple producer fields</text>
+ </assertion>
+ </section>
+
+ <section id="3.5.1" title="Bean types of a producer field">
+
+ <assertion code="a">
+ <text>The bean types of a producer field depend upon the field type. If the
field type is an interface, the set of bean types contains the field type, all interfaces
it extends directly or indirectly and java.lang.Object</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>The bean types of a producer field depend upon the field type. If a
field type is primitive or is a Java array type, the set of bean types contains exactly
two types: the field type and java.lang.Object</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>The bean types of a producer field depend upon the field type. If the
field type is a class, the set of bean types contains the field type, every superclass and
all interfaces it implements directly or indirectly</text>
+ </assertion>
+ </section>
+
+ <section id="3.5.2" title="Declaring a producer field using
annotations">
+
+ <assertion code="a">
+ <text>A producer field may be declared by annotating a field with the
@javax.inject.Produces annotation</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>A producer field may also specify scope, name, deployment type,
stereotypes and/or bindings</text>
+ </assertion>
+ </section>
+
+ <section id="3.5.3" title="Declaring a producer field using
XML">
+
+ <assertion code="a">
+ <text>For a bean defined in XML, a producer field may be declared using the
field name, the <Produces> element, and the type</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>When a producer field is declared in XML, the container ignores binding
annotations applied to the Java field</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>If the bean class of a bean declared in XML does not have a field with
the name and type declared in XML, a DefinitionException is thrown by the container at
deployment time</text>
+ </assertion>
+
+ </section>
+
+ <section id="3.5.4" title="Default name for a producer
field">
+ <assertion code="a">
+ <text>The default name for a producer field is the field name</text>
+ </assertion>
+ </section>
+
+ <section id="3.6" title="Resources">
+ <assertion code="a">
+ <text>Resources may be declared in beans.xml, allowing direct injection of an
EE resource, entity manager, entity manager factory, EJB remote object or web service
reference</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>The lifecycle of an injected reference is identical to the semantics of
Java EE injection using @Resource, @PersistenceContext, @PersistenceUnit, @EJB or
@WebServiceRef</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>A resource always has scope @Dependent</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>A resource may not declare a bean name</text>
+ </assertion>
+
+ <assertion code="e">
+ <text>Resources are always declared using XML</text>
+ </assertion>
+ </section>
+
+ <section id="3.6.1" title="Declaring a resource using XML">
+
+ <assertion code="a">
+ <text>A resource may be declared in beans.xml using an element that
represents the Java type of the resource. For a Java EE resource, the EE resource type
must be specified�for example javax.sql.Datasource for a JDBC datasource. The bean type
of the resource is this specified type</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>A resource may be declared in beans.xml using an element that
represents the Java type of the resource. For a persistence context,
javax.persistence.EntityManager must be specified. The bean type of the resource is this
specified type</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>A resource may be declared in beans.xml using an element that
represents the Java type of the resource. For a persistence unit,
javax.persistence.EntityManagerFactory must be specified. The bean type of the resource
is this specified type</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>A resource may be declared in beans.xml using an element that
represents the Java type of the resource. For a remote EJB, an EJB remote interface type
must be specified. The bean type of the resource is this specified type</text>
+ </assertion>
+
+ <assertion code="e">
+ <text>A resource may be declared in beans.xml using an element that
represents the Java type of the resource. For a web service, a web service type must be
specified. The bean type of the resource is this specified type</text>
+ </assertion>
+
+ <assertion code="f">
+ <text>Each resource declaration must contain a child
<Resource>, <PersistenceContext>,
<PersistenceUnit>, <EJB> or
+<WebServiceRef> element. For a Java EE resource, a JNDI name or mapped
name must be specified using the <name> or <mappedName> child
elements
+of the <Resource> element</text>
+ </assertion>
+
+ <assertion code="g">
+ <text>Each resource declaration must contain a child
<Resource>, <PersistenceContext>,
<PersistenceUnit>, <EJB> or
+<WebServiceRef> element. For a persistence context, a persistence unit
name must be specified using the <unitName> child element of the
<PersistenceContext> element</text>
+ </assertion>
+
+ <assertion code="h">
+ <text>Each resource declaration must contain a child
<Resource>, <PersistenceContext>,
<PersistenceUnit>, <EJB> or
+<WebServiceRef> element. For a persistence unit, a persistence unit name
must be specified using the <unitName> child element of the
<PersistenceUnit> element</text>
+ </assertion>
+
+ <assertion code="i">
+ <text>Each resource declaration must contain a child
<Resource>, <PersistenceContext>,
<PersistenceUnit>, <EJB> or
+<WebServiceRef> element. For a remote EJB, a JNDI name, mapped name or EJB
link must be specified using the <name>, <mappedName> or
<ejbLink> child elements of the <EJB> element</text>
+ </assertion>
+
+ <assertion code="j">
+ <text>Each resource declaration must contain a child
<Resource>, <PersistenceContext>,
<PersistenceUnit>, <EJB> or
+<WebServiceRef> element. For a web service, a JNDI name or mapped name
must be specified using the <name> or <mappedName> child
elements of the <WebServiceRef> element. Optionally, a URL pointing to a
WSDL document may be specified using the <wsdlLocation> child
element</text>
+ </assertion>
+
+ <assertion name="k">
+ <text>The JNDI name specified by the <name> element must be a name in
the global java:global or application java:app naming context</text>
+ </assertion>
+
+ <assertion name="l">
+ <text>Optionally, one or more bindings may be specified for resources in XML.
If no binding is explicitly specified, the default binding @Current is
assumed.</text>
+ </assertion>
+
+ </section>
+
+ <section id="3.7" title="JMS resources">
+ <assertion code="a">
+ <text>JMS resources may be declared in beans.xml</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>JMS queue resources must allow the direct injection of the Queue,
QueueConnection, QueueSession, QueueReceiver and/or QueueSender</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>JMS topic resources must allow the direct injection of the Topic,
TopicConnection, TopicSession, TopicSubscriber and/or TopicPublisher</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>The lifecycles of the injected objects are managed by the container,
and therefore the application need not explicitly close() any injected JMS object. If the
application calls close() on an instance of a JMS resource, an
UnsupportedOperationException is thrown by the container.</text>
+ </assertion>
+
+ <assertion code="e">
+ <text>A JMS resource always has scope @Dependent</text>
+ </assertion>
+
+ <assertion code="f">
+ <text>A JMS resource may not declare a bean name</text>
+ </assertion>
+
+ <assertion code="g">
+ <text>JMS resources are always declared using XML</text>
+ </assertion>
+ </section>
+
+ <section id="3.7.1" title="Bean types of a JMS resource">
+
+ <assertion code="a">
+ <text>For JMS resources that represent a queue, the bean types are Queue,
QueueConnection, QueueSession and QueueSender</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>For JMS resources that represent a topic, the bean types are Topic,
TopicConnection, TopicSession and TopicPublisher</text>
+ </assertion>
+ </section>
+
+ <section id="3.7.2" title="Declaring a JMS resource using
XML">
+
+ <assertion code="a">
+ <text>A JMS resource may be declared using the <Topic> or
<Queue> elements in beans.xml</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>Each JMS resource declaration must contain a child <Resource>
element. A JNDI name or mapped name must be specified using the <name> or
<mappedName> child elements of the <Resource>
element</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>One or more bindings may be specified. If no binding is explicitly
specified, the default binding @Current is assumed</text>
+ </assertion>
+ </section>
+
+ <section id="3.8" title="Injected fields">
+
+ <assertion code="a">
+ <text>An injected field is a non-static, non-final field of a bean class, of
a servlet, or of any EJB session or message driven bean class.</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>Injected fields are initialized by the container immediately after
instantiation and before any methods of the instance are invoked. The container calls the
method Manager.getInstanceToInject() defined in Section 5.7.1, "Resolving
dependencies" to determine a value for each injected field</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>Any EJB session or message driven bean may declare injected fields and
have those fields injected by the container</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>If a field is a producer field or a decorator delegate attribute, it is
not an injected field</text>
+ </assertion>
+ </section>
+
+ <section id="3.8.1" title="Declaring an injected field using
annotations">
+
+ <assertion code="a">
+ <text>An injected field may be declared by annotating the field with any
binding type</text>
+ </assertion>
+ </section>
+
+ <section id="3.8.2" title="Declaring an injected field using
XML">
+ <assertion code="a">
+ <text>For bean defined in XML, an injected field may be declared using the
field name and a child element representing the type of the field</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>When an injected field is declared in XML, the container ignores
binding annotations applied to the Java field</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>If the type element does not declare any binding, the default binding
@Current is assumed</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>If the bean class of a bean declared in XML does not have a field with
the name and type declared in XML, a DefinitionException is thrown by the container at
deployment time</text>
+ </assertion>
+ </section>
+
+ <section id="3.9" title="Initializer methods">
+ <assertion code="a">
+ <text>An initializer method is a non-static method of a bean class, of a
servlet, or of any EJB session or message driven bean class.</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>Initializer methods are called by the container immediately after
injected fields have been initialized by the container and before any other methods of the
instance are invoked.</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>If the bean is a session bean, the initializer method is not required
to be a business method of the session bean</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>Method interceptors are never called when the container calls an
initializer method</text>
+ </assertion>
+
+ <assertion code="e">
+ <text>A bean class may declare multiple (or zero) initializer
methods</text>
+ </assertion>
+
+ <assertion code="f">
+ <text>The application may call initializer methods directly, but then no
parameters will be passed to the method by the container</text>
+ </assertion>
+
+ <assertion code="g">
+ <text>Any EJB session or message driven bean may declare initializer methods
and have the methods called by the container</text>
+ </assertion>
+ </section>
+
+ <section id="3.9.1" title="Declaring an initializer method using
annotations">
+ <assertion code="a">
+ <text>An initializer method may be declared by annotating the method
@javax.inject.Initializer</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>If an initializer method is annotated @Produces, has a parameter
annotated @Disposes, or has a parameter annotated @Observes, a DefinitionException is
thrown by the container at deployment time</text>
+ </assertion>
+
+ </section>
+
+ <section id="3.9.2" title="Declaring an initializer method using
XML">
+
+ <assertion code="a">
+ <text>For a bean defined in XML, an initializer method may be declared using
the method name, the <Initializer> element and the parameter types of the
method</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>When an initializer method is declared in XML, the container ignores
binding annotations applied to the Java method parameters</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>If the bean class of a bean declared in XML does not have a method with
the name and parameter types declared in XML, a DefinitionException is thrown by the
container at deployment time</text>
+ </assertion>
+ </section>
+
+ <section id="3.9.3" title="Initializer method parameters">
+ <assertion code="a">
+ <text>An initializer method may have any number of parameters. If the
initializer method has parameters, the container calls Manager.getInstanceToInject() to
determine a value for each parameter and calls the initializer method with those parameter
values</text>
+ </assertion>
+ </section>
+
+ <section id="3.10" title="Support for Common Annotations">
+ <assertion code="a">
+ <text>Dependency injection via @EJB, @Resource, @PersistenceUnit and
@PersistenceContext is provided by the container when annotations are applied to the bean
class of a simple bean</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>@PostConstruct and @PreDestroy callbacks are provided by the container
when annotations are applied to the bean class of a simple bean</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>Interception, as defined in javax.interceptor is provided by the
container when annotations are applied to the bean class of a simple bean</text>
+ </assertion>
+
+ <assertion code="d">
+ <text>@PersistenceContext(type=EXTENDED) is not supported for simple
beans</text>
+ </assertion>
+ </section>
+
+ <section id="3.11" title="The Bean object for a bean">
+ <assertion code="a">
+ <text>Concrete subclasses of Bean must implement the operations defined by
the Contextual interface defined in Section 6.1, "The Contextual
interface".</text>
+ </assertion>
+
+ <assertion code="b">
+ <text>An instance of Bean exists for every enabled bean in a
deployment</text>
+ </assertion>
+
+ <assertion code="c">
+ <text>An application or third party framework may add support for new kinds
of beans beyond those defined by the this specification (simple beans, session beans,
producer methods and fields, resources and JMS resources) by extending Bean and
registering beans with the container, using the mechanism defined in Section 11.3,
"Bean registration".</text>
+ </assertion>
+ </section>
</specification>