Author: pete.muir(a)jboss.org
Date: 2009-08-16 13:53:48 -0400 (Sun, 16 Aug 2009)
New Revision: 3533
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/Fox.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HorseStable.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Tarantula.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Map a few tests, split out assertions to a group
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-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -184,7 +184,7 @@
public void testContextIsActiveWhenInvokingProducerField()
{
// Reset test class
- Tarantula.setDependentContextActive(false);
+ Tarantula.reset();
getInstanceByType(Tarantula.class,TAME_LITERAL);
assert Tarantula.isDependentContextActive();
}
@@ -200,7 +200,7 @@
CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
- SpiderProducer.setDependentContextActive(false);
+ SpiderProducer.reset();
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDependentContextActive();
}
@@ -263,14 +263,31 @@
@Test(groups = { "contexts", "beanDestruction"})
@SpecAssertions({
+ @SpecAssertion(section = "6.1.1", id = "e")
+ })
+ public void testCallingCreationalContextReleaseDestroysDependents()
+ {
+ assert getBeans(Farm.class).size() == 1;
+ Bean<Farm> farmBean = getBeans(Farm.class).iterator().next();
+ CreationalContext<Farm> creationalContext =
getCurrentManager().createCreationalContext(farmBean);
+ Farm farm = farmBean.create(creationalContext);
+ farm.open();
+ Stable.destroyed = false;
+ Horse.destroyed = false;
+ creationalContext.release();
+ assert Stable.destroyed;
+ assert Horse.destroyed;
+ }
+
+ @Test(groups = { "contexts", "beanDestruction"})
+ @SpecAssertions({
@SpecAssertion(section = "6.4.2", id = "aaaa"),
@SpecAssertion(section = "6.4", id = "b")
})
public void testDestroyingManagedParentDestroysDependentsOfSameBean()
{
// Reset test class
- Fox.setDestroyed(false);
- Fox.setDestroyCount(0);
+ Fox.reset();
assert getCurrentManager().getBeans(FoxRun.class).size() == 1;
Bean<FoxRun> bean = getBeans(FoxRun.class).iterator().next();
@@ -287,7 +304,7 @@
public void testDependentsDestroyedWhenElEvaluationCompletes() throws Exception
{
// Reset test class
- Fox.setDestroyed(false);
+ Fox.reset();
FoxRun.setDestroyed(false);
getCurrentConfiguration().getEl().evaluateValueExpression("#{foxRun}",
FoxRun.class);
@@ -296,18 +313,24 @@
}
@Test(groups = { "contexts", "producerMethod" })
- @SpecAssertion(section = "6.4.2", id = "ddd")
+ @SpecAssertions({
+ @SpecAssertion(section = "6.4.2", id = "ddd"),
+ @SpecAssertion(section = "6.4.1", id="h")
+ })
+
public void testDependentsDestroyedWhenProducerMethodCompletes()
{
// Reset the test class
- SpiderProducer.setDestroyed(false);
+ SpiderProducer.reset();
+ Tarantula.reset();
Tarantula spiderInstance = getInstanceByType(Tarantula.class, PET_LITERAL);
spiderInstance.ping();
assert SpiderProducer.isDestroyed();
+ assert Tarantula.isDestroyed();
}
@Test(groups = { "contexts", "producerField" })
- @SpecAssertion(section = "6.4.2", id = "ddd")
+ @SpecAssertion(section = "6.4.2", id = "dde")
public void testDependentsDestroyedWhenProducerFieldCompletes()
{
// Reset the test class
@@ -319,7 +342,10 @@
}
@Test(groups = { "contexts", "disposalMethod" })
- @SpecAssertion(section = "6.4.2", id = "ddd")
+ @SpecAssertions({
+ @SpecAssertion(section = "6.4.2", id = "ddf"),
+ @SpecAssertion(section = "6.4.2", id ="ccc")
+ })
public void testDependentsDestroyedWhenDisposerMethodCompletes()
{
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class,
PET_LITERAL).iterator().next();
@@ -328,23 +354,28 @@
assert tarantula != null;
// Reset test class state
- SpiderProducer.setDestroyed(false);
+ SpiderProducer.reset();
+ Fox.reset();
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDestroyed();
+ assert Fox.isDestroyed();
}
@Test(groups = { "contexts", "observerMethod" })
- @SpecAssertion(section = "6.4.2", id = "ddd")
+ @SpecAssertions({
+ @SpecAssertion(section = "6.4.2", id = "ddg"),
+ @SpecAssertion(section = "6.4.2", id = "ccd")
+ })
public void testDependentsDestroyedWhenObserverMethodEvaluationCompletes()
{
// Reset test class state...
- HorseStable.setInstanceThatObservedEvent(null);
- HorseStable.setDestroyed(false);
-
+ HorseStable.reset();
+ Fox.reset();
getCurrentManager().fireEvent(new HorseInStableEvent());
assert HorseStable.getInstanceThatObservedEvent() != null;
assert HorseStable.isDestroyed();
+ assert Fox.isDestroyed();
}
@Test(groups = { "contexts" })
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Fox.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Fox.java 2009-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Fox.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -17,16 +17,12 @@
return destroyed;
}
- public static void setDestroyed(boolean destroyed)
+ public static void reset()
{
- Fox.destroyed = destroyed;
+ destroyed = false;
+ destroyCount = 0;
}
- public static void setDestroyCount(int destroyCount)
- {
- Fox.destroyCount = destroyCount;
- }
-
public static int getDestroyCount()
{
return destroyCount;
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HorseStable.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HorseStable.java 2009-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HorseStable.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -20,7 +20,7 @@
dependentContextActive = beanManager.getContext(Dependent.class).isActive();
}
- public void horseEntered(@Observes HorseInStableEvent horseEvent)
+ public void horseEntered(@Observes HorseInStableEvent horseEvent, Fox fox)
{
instanceThatObservedEvent = this;
}
@@ -36,9 +36,11 @@
return dependentContextActive;
}
- public static void setDependentContextActive(boolean dependentContextActive)
+ public static void reset()
{
- HorseStable.dependentContextActive = dependentContextActive;
+ HorseStable.dependentContextActive = false;
+ instanceThatObservedEvent = null;
+ destroyed = false;
}
public static HorseStable getInstanceThatObservedEvent()
@@ -46,18 +48,8 @@
return instanceThatObservedEvent;
}
- public static void setInstanceThatObservedEvent(HorseStable
instanceThatObservedEvent)
- {
- HorseStable.instanceThatObservedEvent = instanceThatObservedEvent;
- }
-
public static boolean isDestroyed()
{
return destroyed;
}
-
- public static void setDestroyed(boolean destroyed)
- {
- HorseStable.destroyed = destroyed;
- }
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java 2009-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -23,7 +23,7 @@
return spider;
}
- public void disposeTarantula(@Disposes @Pet Tarantula tarantula)
+ public void disposeTarantula(@Disposes @Pet Tarantula tarantula, Fox fox)
{
dependentContextActive = beanManager.getContext(Dependent.class).isActive();
instanceUsedForDisposal = this;
@@ -34,11 +34,6 @@
return dependentContextActive;
}
- public static void setDependentContextActive(boolean dependentContextActive)
- {
- SpiderProducer.dependentContextActive = dependentContextActive;
- }
-
public static SpiderProducer getInstanceUsedForDisposal()
{
return instanceUsedForDisposal;
@@ -48,10 +43,12 @@
{
return destroyed;
}
-
- public static void setDestroyed(boolean destroyed)
+
+ public static void reset()
{
- SpiderProducer.destroyed = destroyed;
+ destroyed = false;
+ dependentContextActive = false;
+ instanceUsedForDisposal = null;
}
@PreDestroy
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Tarantula.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Tarantula.java 2009-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Tarantula.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -1,10 +1,14 @@
package org.jboss.jsr299.tck.tests.context.dependent;
+import javax.annotation.PreDestroy;
+
import org.jboss.jsr299.tck.impl.JSR299ConfigurationImpl;
class Tarantula extends Spider implements DeadlySpider
{
+ private static boolean destroyed;
+
private static boolean dependentContextActive = false;
public Tarantula()
@@ -12,15 +16,27 @@
dependentContextActive =
JSR299ConfigurationImpl.get().getContexts().getDependentContext().isActive();
}
+ @PreDestroy
+ public void preDestroy()
+ {
+ destroyed = true;
+ }
+
public static boolean isDependentContextActive()
{
return dependentContextActive;
}
- public static void setDependentContextActive(boolean dependentContextActive)
+ public static boolean isDestroyed()
{
- Tarantula.dependentContextActive = dependentContextActive;
+ return destroyed;
}
+ public static void reset()
+ {
+ destroyed = false;
+ dependentContextActive = false;
+ }
+
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -44,7 +44,8 @@
@SpecAssertions( {
@SpecAssertion(section = "7.3.2", id = "aa"),
@SpecAssertion(section = "7.3.2", id = "bb"),
- @SpecAssertion(section = "7.3.3", id = "b")
+ @SpecAssertion(section = "7.3.3", id = "b"),
+ @SpecAssertion(section = "6.5.3", id = "b")
})
public void testCreateSFSB() throws Exception
{
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java 2009-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/ClientProxyTest.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -21,9 +21,10 @@
import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.inject.spi.Bean;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
import org.testng.annotations.Test;
@@ -62,7 +63,10 @@
// TODO expand this test
}
@Test
- @SpecAssertion(section="5.5.2", id="ab")
+ @SpecAssertions({
+ @SpecAssertion(section="5.5.2", id="ab"),
+ @SpecAssertion(section = "6.5.4", id="a")
+ })
public void testInactiveScope() throws Exception
{
assert getCurrentConfiguration().getContexts().getRequestContext().isActive();
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-08-16
17:17:58 UTC (rev 3532)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-08-16
17:53:48 UTC (rev 3533)
@@ -51,7 +51,10 @@
{
@Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.6.9", id = "aa")
+ @SpecAssertions({
+ @SpecAssertion(section = "6.5.3", id="d"),
+ @SpecAssertion(section = "5.6.9", id = "aa")
+ })
public void testGetBean()
{
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-08-16 17:17:58 UTC (rev 3532)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-08-16 17:53:48 UTC (rev 3533)
@@ -2700,14 +2700,38 @@
<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">
+ <group>
<text>The container must ensure that all |@Dependent| scoped contextual
instances injected into method parameters of a disposer method or observer method of any
other event are destroyed when the invocation completes.</text>
- </assertion>
+ <assertion id="ccc">
+ <text>Check disposer method</text>
+ </assertion>
+
+ <assertion id="ccd">
+ <text>Check observer method</text>
+ </assertion>
+ </group>
- <assertion id="ddd">
+ <group>
<text>The container must ensure that any |@Dependent| scoped contextual
instance created to receive a producer method, producer field, disposer method or observer
method invocation is destroyed when the invocation completes.</text>
- </assertion>
+
+ <assertion id="ddd">
+ <text>Check producer method</text>
+ </assertion>
+
+ <assertion id="dde">
+ <text>Check producer field</text>
+ </assertion>
+
+ <assertion id="ddf">
+ <text>Check disposer method</text>
+ </assertion>
+
+ <assertion id="ddg">
+ <text>Check observer method</text>
+ </assertion>
+ </group>
+
<assertion id="eee">
<text>The container must ensure that all |@Dependent| scoped contextual
instances created during an EL expression evaluation are destroyed when the evaluation
completes.</text>
</assertion>
@@ -2741,8 +2765,9 @@
<text>From time to time, the container attempts to obtain a contextual
instance of a bean that already exists, without creating a new contextual instance. The
container must determine if the scope of the bean is active and if it is, obtain the
active context object for the bean scope, then attempt to obtain an instance of the bean
by calling |Context.get()|, passing the |Bean| instance representing the bean without
passing any instance of |CreationalContext|.</text>
</assertion>
- <assertion id="c">
- <text>IF the scope is not active, or if |Context.get()| returns a null value,
there is no contextual instance that already exists.</text>
+ <assertion id="c" testable="false">
+ <text>If the scope is not active, or if |Context.get()| returns a null value,
there is no contextual instance that already exists.</text>
+ <note>Statement of intent</note>
</assertion>
<assertion id="e">
@@ -2777,9 +2802,11 @@
<text>Any reference to a bean with a normal scope is valid as long as the
application maintains a hard reference to it. However, it may only be invoked when the
context associated with the normal scope is active. If it is invoked when the context is
inactive, a |ContextNotActiveException| is thrown by the container.</text>
</assertion>
- <assertion id="b">
- <text>Any reference to a bean with a pseudo-scope (such as |@Dependent|) is
valid until the bean instance to which it refers is
-destroyed. It may be invoked even if the context associated with the pseudo-scope is not
active. If the application invokes a method of a reference to an instance that has already
been destroyed, the behavior is undefined.</text>
+ <assertion id="b" testable="false">
+ <text>
+ Any reference to a bean with a pseudo-scope (such as |@Dependent|) is valid
until the bean instance to which it refers is destroyed. It may be invoked even if the
context associated with the pseudo-scope is not active. If the application invokes a
method of a reference to an instance that has already been destroyed, the behavior is
undefined.
+ </text>
+ <note>Describes unspecified behavior</note>
</assertion>
</section>
@@ -2789,6 +2816,8 @@
</assertion>
</section>
+
+
<section id="6.6.1" title="Passivation capable beans">
<assertion id="a" testable="false">
<text>As defined by the EJB specification, all stateful session beans are
passivation capable. Stateless and singleton session beans are not passivation
capable.</text>
@@ -2852,9 +2881,7 @@
<text>The |getId()| ~method of the |PassivationCapable| implementation 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>
-
- <section id="6.6.2" title="Passivation capable
dependencies">
+ </section><section id="6.6.2" title="Passivation capable
dependencies">
<assertion id="a">
<text>The container must guarantee that all session beans are passivation
capable dependencies.</text>
</assertion>
@@ -2893,8 +2920,9 @@
</assertion>
</group>
- <assertion id="b">
+ <assertion id="b" testable="false">
<text>Passivating scopes must be explicitly declared
|(a)ScopeType(passivating=true)|.</text>
+ <note>A statement of intent</note>
</assertion>
</section>
@@ -3067,9 +3095,58 @@
</section>
<section id="6.7" title="Context management for built-in
scopes">
- <assertion id="a">
+ <group>
<text>The built-in context object is active during servlet, web service and
EJB invocations, or in the case of the conversation context object, for JSF
requests.</text>
- </assertion>
+
+ <assertion id="a">
+ <text>Test request, session and application for servlet service
method()</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>Test request, session and application for servlet
filter</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>Test request, session and application for servlet
listener</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>Test request, session and application for web service</text>
+ </assertion>
+
+ <assertion id="e">
+ <text>Test request, session and application for synchronous EJB
invocation</text>
+ </assertion>
+
+ <assertion id="f">
+ <text>Test request, session and application for asynchronous EJB
invocation</text>
+ </assertion>
+
+ <assertion id="g">
+ <text>Test request, session, application and conversation context for a JSF
action method</text>
+ </assertion>
+
+ <assertion id="h">
+ <text>Test request, session, application and conversation context for a JSF
validator</text>
+ </assertion>
+
+ <assertion id="i">
+ <text>Test request, session, application and conversation context for a JSF
converter</text>
+ </assertion>
+
+ <assertion id="j">
+ <text>Test request, session, application and conversation context for a JSF
action method</text>
+ </assertion>
+
+ <assertion id="k">
+ <text>Test request, session, application and conversation context for a JSF
value change listener</text>
+ </assertion>
+
+ <assertion id="l">
+ <text>Test request, session, application and conversation context for a JSF
render</text>
+ </assertion>
+ </group>
+
</section>
<section id="6.7.1" title="Request context lifecycle">