Author: pete.muir(a)jboss.org
Date: 2010-01-08 12:52:33 -0500 (Fri, 08 Jan 2010)
New Revision: 5406
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SensitiveFox.java
Log:
Remove need for static, explictly clean up producer
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
===================================================================
---
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2010-01-08
17:28:11 UTC (rev 5405)
+++
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2010-01-08
17:52:33 UTC (rev 5406)
@@ -113,6 +113,7 @@
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.getInstanceUsedForDisposal() != null;
assert SpiderProducer.getInstanceUsedForDisposal() != spiderProducer;
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "observerMethod" })
@@ -177,6 +178,7 @@
Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
assert SpiderProducer.isDependentContextActive();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "producerField"})
@@ -203,6 +205,7 @@
SpiderProducer.reset();
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDependentContextActive();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "observerMethod" })
@@ -217,7 +220,6 @@
@SpecAssertion(section = "6.4", id = "g") // Dependent context is
now always active
public void testContextIsActiveWhenEvaluatingElExpression()
{
- SensitiveFox.setManager(getCurrentManager());
String foxName =
getCurrentConfiguration().getEl().evaluateMethodExpression("#{sensitiveFox.getName}",
String.class, new Class[0], new Object[0]);
assert foxName != null;
assert SensitiveFox.isDependentContextActiveDuringEval();
@@ -227,7 +229,6 @@
@SpecAssertion(section = "6.4", id = "g") // Dependent context is
now always active
public void testContextIsActiveDuringBeanCreation()
{
- SensitiveFox.setManager(getCurrentManager());
SensitiveFox fox1 = getInstanceByType(SensitiveFox.class);
assert fox1 != null;
assert fox1.isDependentContextActiveDuringCreate();
@@ -327,6 +328,7 @@
spiderInstance.ping();
assert SpiderProducer.isDestroyed();
assert Tarantula.isDestroyed();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "producerField" })
@@ -360,6 +362,7 @@
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDestroyed();
assert Fox.isDestroyed();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "observerMethod" })
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SensitiveFox.java
===================================================================
---
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SensitiveFox.java 2010-01-08
17:28:11 UTC (rev 5405)
+++
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SensitiveFox.java 2010-01-08
17:52:33 UTC (rev 5406)
@@ -3,6 +3,7 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
import javax.inject.Named;
@Dependent
@@ -10,15 +11,17 @@
@Default
public class SensitiveFox
{
- private static BeanManager beanManager;
+ private final BeanManager beanManager;
private boolean dependentContextActiveDuringCreate = false;
private static boolean dependentContextActiveDuringEval = false;
- public SensitiveFox()
+ @Inject
+ public SensitiveFox(BeanManager beanManager)
{
dependentContextActiveDuringCreate =
beanManager.getContext(Dependent.class).isActive();
+ this.beanManager = beanManager;
}
public String getName()
@@ -40,9 +43,4 @@
return dependentContextActiveDuringEval;
}
- public static void setManager(BeanManager beanManager)
- {
- SensitiveFox.beanManager = beanManager;
- }
-
}
Show replies by date