Author: pete.muir(a)jboss.org
Date: 2010-01-22 11:35:15 -0500 (Fri, 22 Jan 2010)
New Revision: 5585
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/SensitiveFox.java
Log:
port r5406 to trunk
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-01-22
16:34:32 UTC (rev 5584)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2010-01-22
16:35:15 UTC (rev 5585)
@@ -129,6 +129,7 @@
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.getInstanceUsedForDisposal() != null;
assert SpiderProducer.getInstanceUsedForDisposal() != spiderProducer;
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "observerMethod" })
@@ -193,6 +194,7 @@
Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
assert SpiderProducer.isDependentContextActive();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "producerField"})
@@ -219,6 +221,7 @@
SpiderProducer.reset();
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDependentContextActive();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "observerMethod" })
@@ -233,7 +236,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();
@@ -243,7 +245,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();
@@ -343,6 +344,7 @@
spiderInstance.ping();
assert SpiderProducer.isDestroyed();
assert Tarantula.isDestroyed();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "producerField" })
@@ -376,6 +378,7 @@
tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDestroyed();
assert Fox.isDestroyed();
+ SpiderProducer.reset();
}
@Test(groups = { "contexts", "observerMethod" })
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SensitiveFox.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SensitiveFox.java 2010-01-22
16:34:32 UTC (rev 5584)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SensitiveFox.java 2010-01-22
16:35:15 UTC (rev 5585)
@@ -19,6 +19,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
@@ -26,15 +27,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()
@@ -56,9 +59,4 @@
return dependentContextActiveDuringEval;
}
- public static void setManager(BeanManager beanManager)
- {
- SensitiveFox.beanManager = beanManager;
- }
-
}
Show replies by date