Author: jharting
Date: 2010-04-21 06:29:31 -0400 (Wed, 21 Apr 2010)
New Revision: 6134
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java
Log:
CDITCK-142
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2010-04-21
10:24:39 UTC (rev 6133)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2010-04-21
10:29:31 UTC (rev 6134)
@@ -334,16 +334,23 @@
@SpecAssertion(section = "6.4.2", id = "ddd"),
@SpecAssertion(section = "6.4.1", id="h")
})
-
public void testDependentsDestroyedWhenProducerMethodCompletes()
{
- // Reset the test class
+ // Reset the test classes
SpiderProducer.reset();
Tarantula.reset();
- Tarantula spiderInstance = getInstanceByType(Tarantula.class, PET_LITERAL);
- spiderInstance.ping();
+ DomesticationKit.reset();
+
+ Bean<Tarantula> tarantulaBean = getUniqueBean(Tarantula.class, PET_LITERAL);
+ CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = (Tarantula) getCurrentManager().getReference(tarantulaBean,
Tarantula.class, creationalContext);
+ tarantula.ping();
+ // contextual instance created to receive a producer method invocation
+ // is destroyed when the invocation completes
assert SpiderProducer.isDestroyed();
- assert Tarantula.isDestroyed();
+ // DomesticationKit instance is a dependent object of the Tarantula instance
+ tarantulaBean.destroy(tarantula, creationalContext);
+ assert DomesticationKit.isDestroyed();
SpiderProducer.reset();
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java 2010-04-21
10:24:39 UTC (rev 6133)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java 2010-04-21
10:29:31 UTC (rev 6134)
@@ -33,7 +33,7 @@
private static SpiderProducer instanceUsedForDisposal = null;
- @Produces @Pet public Tarantula produceTarantula(Tarantula spider)
+ @Produces @Pet public Tarantula produceTarantula(Tarantula spider, DomesticationKit
domesticationKit)
{
dependentContextActive = beanManager.getContext(Dependent.class).isActive();
return spider;
Show replies by date