[webbeans-commits] Webbeans SVN: r2932 - in tck/trunk: impl/src/main/java/org/jboss/jsr299/tck and 14 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Jun 30 02:02:13 EDT 2009
Author: nickarls
Date: 2009-06-30 02:02:12 -0400 (Tue, 30 Jun 2009)
New Revision: 2932
Modified:
tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
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/ejb/DependentContextEjbTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.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/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/ejb/EjbInjectionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/resource/InjectionOfResourceTest.java
Log:
Remove obsolete DependentStorageRequest
Remove removal method from BeanStore and dependencies to that
Change tests to use creation contexts
Fix some broken tests
Modified: tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -72,9 +72,4 @@
*/
public <T> T getEnterpriseBean(Class<? extends T> beanType, Class<T> localInterface);
- @Deprecated
- public <T> void destroyAndRemoveBeanInstance(Bean<T> bean, T instance);
-
- public <T> T createBeanInstance(Bean<T> bean);
-
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -19,6 +19,7 @@
import org.jboss.jsr299.tck.api.JSR299Configuration;
import org.jboss.jsr299.tck.impl.JSR299ConfigurationImpl;
import org.jboss.jsr299.tck.impl.OldSPIBridge;
+import org.jboss.testharness.api.DeploymentException;
public abstract class AbstractJSR299Test extends org.jboss.testharness.AbstractTest
{
@@ -170,43 +171,16 @@
return OldSPIBridge.getInstanceByName(getCurrentManager(), name);
}
- /**
- * Create a bean instance. This method abstracts the TCK
- * from having to manage the CreationalContext
- *
- * @param <T> the bean type
- * @param bean the bean
- * @return the created bean instance
- */
- public <T> T createBeanInstance(Bean<T> bean)
- {
- return getCurrentConfiguration().getBeans().createBeanInstance(bean);
- }
-
- /**
- * Destroy a bean instance. This method abstracts the TCK
- * from having to manage the CreationalContext
- *
- * @param <T> the bean type
- * @param bean the bean
- * @param instance the instance to destroy
- */
- @Deprecated
- public <T> void destroyAndRemoveBeanInstance(Bean<T> bean, T instance)
- {
- getCurrentConfiguration().getBeans().destroyAndRemoveBeanInstance(bean, instance);
- }
-
@Override
- protected org.jboss.testharness.api.DeploymentException handleDeploymentFailure(org.jboss.testharness.api.DeploymentException deploymentException)
+ protected DeploymentException handleDeploymentFailure(DeploymentException deploymentException)
{
if (getCurrentConfiguration().getManagers().isDefinitionError(deploymentException))
{
- return new org.jboss.testharness.api.DeploymentException(deploymentException, new DefinitionError(deploymentException.getCause()));
+ return new DeploymentException(deploymentException, new DefinitionError(deploymentException.getCause()));
}
else if (getCurrentConfiguration().getManagers().isDeploymentError(deploymentException))
{
- return new org.jboss.testharness.api.DeploymentException(deploymentException, new DeploymentError(deploymentException.getCause()));
+ return new DeploymentException(deploymentException, new DeploymentError(deploymentException.getCause()));
}
else
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -2,6 +2,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import org.hibernate.tck.annotations.SpecAssertion;
@@ -22,7 +23,8 @@
public void testDestroyedInstanceMustNotBeReturnedByGet()
{
Bean<MySessionBean> mySessionBean = getBeans(MySessionBean.class).iterator().next();
- MySessionBean beanInstance = createBeanInstance(mySessionBean);
+ CreationalContext<MySessionBean> sessionCreationalContext = getCurrentManager().createCreationalContext(mySessionBean);
+ MySessionBean beanInstance = mySessionBean.create(sessionCreationalContext);
assert beanInstance != null;
destroyContext(getCurrentManager().getContext(SessionScoped.class));
setContextActive(getCurrentManager().getContext(SessionScoped.class));
@@ -30,7 +32,9 @@
assert beanInstance == null;
Bean<MyApplicationBean> myApplicationBean = getBeans(MyApplicationBean.class).iterator().next();
- MyApplicationBean myApplicationBeanInstance = createBeanInstance(myApplicationBean);
+ CreationalContext<MyApplicationBean> applicationCreationalContext = getCurrentManager().createCreationalContext(myApplicationBean);
+
+ MyApplicationBean myApplicationBeanInstance = myApplicationBean.create(applicationCreationalContext);
assert myApplicationBeanInstance != null;
destroyContext(getCurrentManager().getContext(ApplicationScoped.class));
setContextActive(getCurrentManager().getContext(ApplicationScoped.class));
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -9,6 +9,7 @@
import org.hibernate.tck.annotations.SpecAssertions;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.impl.MockCreationalContext;
+import org.jboss.jsr299.tck.tests.context.dependent.ejb.FoxRunLocal;
import org.jboss.testharness.impl.packaging.Artifact;
import org.testng.annotations.Test;
@@ -33,11 +34,11 @@
public void testGetReturnsExistingInstance()
{
Bean<MySessionBean> mySessionBean = getBeans(MySessionBean.class).iterator().next();
- MySessionBean beanInstance = createBeanInstance(mySessionBean);
- beanInstance.setId(10);
- assert beanInstance != null;
- MySessionBean beanInstanceFromGet = getCurrentManager().getContext(SessionScoped.class).get(mySessionBean);
- assert beanInstanceFromGet.getId() == 10;
+ CreationalContext<MySessionBean> creationalContext = getCurrentManager().createCreationalContext(mySessionBean);
+ MySessionBean first = getCurrentManager().getContext(SessionScoped.class).get(mySessionBean, creationalContext);
+ first.setId(10);
+ MySessionBean second = getCurrentManager().getContext(SessionScoped.class).get(mySessionBean, creationalContext);
+ assert second.getId() == 10;
}
@Test(groups = { "contexts" })
@@ -83,7 +84,8 @@
getCurrentManager().addBean(bean);
Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
- MySessionBean instance = createBeanInstance(bean);
+ CreationalContext<MySessionBean> creationalContext = getCurrentManager().createCreationalContext(bean);
+ MySessionBean instance = sessionContext.get(bean, creationalContext);
instance.ping();
assert instance != null;
assert bean.isCreateCalled();
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-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -37,7 +37,8 @@
Set<Bean<FoxRun>> foxRunBeans = getBeans(FoxRun.class);
assert foxRunBeans.size() == 1;
Bean<FoxRun> foxRunBean = foxRunBeans.iterator().next();
- FoxRun foxRun = createBeanInstance(foxRunBean);
+ CreationalContext<FoxRun> creationalContext = getCurrentManager().createCreationalContext(foxRunBean);
+ FoxRun foxRun = foxRunBean.create(creationalContext);
assert !foxRun.fox.equals(foxRun.anotherFox);
}
@@ -65,8 +66,10 @@
public void testInstanceUsedForProducerMethodNotShared() throws Exception
{
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
- Tarantula tarantula = createBeanInstance(tarantulaBean);
- Tarantula tarantula2 = createBeanInstance(tarantulaBean);
+
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
+ Tarantula tarantula2 = tarantulaBean.create(creationalContext);
assert tarantula != null;
assert tarantula2 != null;
assert tarantula != tarantula2;
@@ -77,8 +80,9 @@
public void testInstanceUsedForProducerFieldNotShared() throws Exception
{
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class, TAME_LITERAL).iterator().next();
- Tarantula tarantula = createBeanInstance(tarantulaBean);
- Tarantula tarantula2 = createBeanInstance(tarantulaBean);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
+ Tarantula tarantula2 = tarantulaBean.create(creationalContext);
assert tarantula != null;
assert tarantula2 != null;
assert tarantula != tarantula2;
@@ -96,9 +100,10 @@
{
SpiderProducer spiderProducer = getInstanceByType(SpiderProducer.class);
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
- Tarantula tarantula = createBeanInstance(tarantulaBean);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
- destroyAndRemoveBeanInstance(tarantulaBean, tarantula);
+ tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.getInstanceUsedForDisposal() != null;
assert SpiderProducer.getInstanceUsedForDisposal() != spiderProducer;
}
@@ -185,7 +190,8 @@
public void testContextIsActiveWhenInvokingProducerMethod()
{
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
- Tarantula tarantula = createBeanInstance(tarantulaBean);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
assert SpiderProducer.isDependentContextActive();
}
@@ -207,10 +213,11 @@
public void testContextIsActiveWhenInvokingDisposalMethod()
{
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
- Tarantula tarantula = createBeanInstance(tarantulaBean);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
SpiderProducer.setDependentContextActive(false);
- destroyAndRemoveBeanInstance(tarantulaBean, tarantula);
+ tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDependentContextActive();
}
@@ -401,14 +408,14 @@
protected void execute() throws Exception
{
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
-
- Tarantula tarantula = createBeanInstance(tarantulaBean);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
// Reset test class state
SpiderProducer.setDestroyed(false);
- destroyAndRemoveBeanInstance(tarantulaBean, tarantula);
+ tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isDestroyed();
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -17,6 +17,7 @@
package org.jboss.jsr299.tck.tests.context.dependent.ejb;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import org.hibernate.tck.annotations.SpecAssertion;
@@ -41,7 +42,8 @@
public void testContextIsActiveDuringEJBDependencyInjection()
{
Bean<FoxRunLocal> foxRunBean = getBeans(FoxRunLocal.class).iterator().next();
- FoxRunLocal foxRun = createBeanInstance(foxRunBean);
+ CreationalContext<FoxRunLocal> creationalContext = getCurrentManager().createCreationalContext(foxRunBean);
+ FoxRunLocal foxRun = foxRunBean.create(creationalContext);
assert foxRun.getFox() != null;
}
@@ -66,10 +68,11 @@
{
assert getBeans(HouseLocal.class).size() == 1;
Bean<HouseLocal> bean = getBeans(HouseLocal.class).iterator().next();
- HouseLocal instance = createBeanInstance(bean);
+ CreationalContext<HouseLocal> creationalContext = getCurrentManager().createCreationalContext(bean);
+ HouseLocal instance = bean.create(creationalContext);
Room.destroyed = false;
Table.destroyed = false;
- destroyAndRemoveBeanInstance(bean, instance);
+ bean.destroy(instance, creationalContext);
assert Room.destroyed;
assert Table.destroyed;
}
@@ -89,10 +92,11 @@
{
assert getBeans(FarmLocal.class).size() == 1;
Bean<FarmLocal> farmBean = getBeans(FarmLocal.class).iterator().next();
- FarmLocal farm = createBeanInstance(farmBean);
+ CreationalContext<FarmLocal> creationalContext = getCurrentManager().createCreationalContext(farmBean);
+ FarmLocal farm = farmBean.create(creationalContext);
Horse.destroyed = false;
Stable.destroyed = false;
- destroyAndRemoveBeanInstance(farmBean, farm);
+ farmBean.destroy(farm, creationalContext);
assert Horse.destroyed;
assert Stable.destroyed;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -6,6 +6,7 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.hibernate.tck.annotations.SpecAssertion;
import org.hibernate.tck.annotations.SpecAssertions;
import org.jboss.jsr299.tck.AbstractJSR299Test;
@@ -83,7 +84,8 @@
@SpecAssertion(section = "2.3.5", id = "a")
public void testFieldInjectedFromProducerMethod() throws Exception
{
- Barn barn = createBeanInstance(getBeans(Barn.class).iterator().next());
+ Bean<Barn> barnBean = getBeans(Barn.class).iterator().next();
+ Barn barn = barnBean.create(getCurrentManager().createCreationalContext(barnBean));
assert barn.petSpider != null;
assert barn.petSpider instanceof DefangedTarantula;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -2,6 +2,7 @@
import java.lang.annotation.Annotation;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.spi.Bean;
@@ -40,8 +41,9 @@
protected void execute() throws Exception
{
Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
- Tarantula instance = createBeanInstance(tarantula);
- destroyAndRemoveBeanInstance(tarantula, instance);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
+ Tarantula instance = tarantula.create(creationalContext);
+ tarantula.destroy(instance, creationalContext);
}
}.run();
@@ -63,8 +65,9 @@
protected void execute() throws Exception
{
Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
Tarantula instance = getCurrentManager().getContext(tarantula.getScopeType()).get(tarantula);
- destroyAndRemoveBeanInstance(tarantula, instance);
+ tarantula.destroy(instance, creationalContext);
}
}.run();
@@ -90,8 +93,9 @@
protected void execute() throws Exception
{
Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
Tarantula instance = getCurrentManager().getContext(tarantula.getScopeType()).get(tarantula);
- destroyAndRemoveBeanInstance(tarantula, instance);
+ tarantula.destroy(instance, creationalContext);
}
}.run();
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-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -6,6 +6,7 @@
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.spi.Bean;
@@ -93,9 +94,10 @@
Bean<KleinStadt> stadtBean = getBeans(KleinStadt.class).iterator().next();
assert stadtBean != null : "Expected a bean for stateful session bean Kassel";
Context requestContext = getCurrentManager().getContext(RequestScoped.class);
- KleinStadt kassel = createBeanInstance(stadtBean);
+ CreationalContext<KleinStadt> creationalContext = getCurrentManager().createCreationalContext(stadtBean);
+ KleinStadt kassel = stadtBean.create(creationalContext);
kassel.ping();
- destroyAndRemoveBeanInstance(stadtBean, kassel);
+ stadtBean.destroy(kassel, creationalContext);
assert frankfurt.isKleinStadtDestroyed() : "Expected SFSB bean to be destroyed";
kassel = requestContext.get(stadtBean);
@@ -127,7 +129,8 @@
{
Bean<NeueStadt> stadtBean = getBeans(NeueStadt.class).iterator().next();
assert stadtBean != null : "Expected a bean for stateful session bean Kassel";
- NeueStadt stadtInstance = createBeanInstance(stadtBean);
+ CreationalContext<NeueStadt> creationalContext = getCurrentManager().createCreationalContext(stadtBean);
+ NeueStadt stadtInstance = stadtBean.create(creationalContext);
assert stadtInstance != null : "Expected instance to be created by container";
// Verify that the instance returned is a proxy by checking for all local interfaces
@@ -145,6 +148,19 @@
assert alteStadt.getAnotherPlaceOfInterest() != null;
}
+ @Test(groups = { "enterpriseBeans", "lifecycle", "ri-broken" })
+ @SpecAssertion(section = "6.11", id = "f")
+ public void testDependentObjectsDestroyed()
+ {
+ UniStadt marburg = getInstanceByType(UniStadt.class);
+ assert marburg != null : "Couldn't find the main SFSB";
+ Bean<UniStadt> uniStadtBean = getBeans(UniStadt.class).iterator().next();
+ CreationalContext<UniStadt> creationalContext = getCurrentManager().createCreationalContext(uniStadtBean);
+ uniStadtBean.destroy(marburg, creationalContext);
+ GrossStadt frankfurt = getInstanceByType(GrossStadt.class);
+ assert frankfurt.isSchlossDestroyed();
+ }
+
@Test
@SpecAssertion(section = "4.2", id = "bab")
public void testDirectSubClassInheritsPostConstructOnSuperclass() throws Exception
@@ -191,8 +207,9 @@
protected void execute() throws Exception
{
Bean<DirectOrderProcessorLocal> bean = getBeans(DirectOrderProcessorLocal.class).iterator().next();
+ CreationalContext<DirectOrderProcessorLocal> creationalContext = getCurrentManager().createCreationalContext(bean);
DirectOrderProcessorLocal instance = getInstanceByType(DirectOrderProcessorLocal.class);
- destroyAndRemoveBeanInstance(bean, instance);
+ bean.destroy(instance, creationalContext);
}
}.run();
assert OrderProcessor.preDestroyCalled;
@@ -210,8 +227,9 @@
protected void execute() throws Exception
{
Bean<IndirectOrderProcessor> bean = getBeans(IndirectOrderProcessor.class).iterator().next();
+ CreationalContext<IndirectOrderProcessor> creationalContext = getCurrentManager().createCreationalContext(bean);
IndirectOrderProcessor instance = getInstanceByType(IndirectOrderProcessor.class);
- destroyAndRemoveBeanInstance(bean, instance);
+ bean.destroy(instance, creationalContext);
}
}.run();
assert OrderProcessor.preDestroyCalled;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -1,5 +1,6 @@
package org.jboss.jsr299.tck.tests.implementation.enterprise.newBean;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.spi.Bean;
@@ -97,8 +98,9 @@
FoxLocal fox = getInstanceByType(FoxLocal.class);
FoxLocal newFox = getInstanceByType(FoxLocal.class,new NewLiteral());
Bean<Litter> litterBean = getBeans(Litter.class).iterator().next();
+ CreationalContext<Litter> creationalContext = getCurrentManager().createCreationalContext(litterBean);
Litter litter = getInstanceByType(Litter.class);
- destroyAndRemoveBeanInstance(litterBean, litter);
+ litterBean.destroy(litter, creationalContext);
assert fox.isLitterDisposed();
assert !newFox.isLitterDisposed();
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -3,6 +3,7 @@
import java.lang.annotation.Annotation;
import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.TypeLiteral;
@@ -70,7 +71,8 @@
assert getBeans(String.class).size() == 1;
String aString = getInstanceByType(String.class);
Bean<String> stringBean = getBeans(String.class).iterator().next();
- destroyAndRemoveBeanInstance(stringBean, aString);
+ CreationalContext<String> creationalContext = getCurrentManager().createCreationalContext(stringBean);
+ stringBean.destroy(aString, creationalContext);
assert BeanWithStaticProducerMethod.stringDestroyed;
}
@@ -255,7 +257,8 @@
public void testBindingTypesAppliedToProducerMethodParameters()
{
Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
- Tarantula instance = createBeanInstance(tarantula);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
+ Tarantula instance = tarantula.create(creationalContext);
assert instance.getDeathsCaused() == 1;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -1,5 +1,6 @@
package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.spi.Bean;
@@ -36,7 +37,8 @@
SpiderProducer.setTarantulaDestroyed(false);
Tarantula tarantula = getInstanceByType(Tarantula.class);
Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
- destroyAndRemoveBeanInstance(tarantulaBean, tarantula);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantulaBean);
+ tarantulaBean.destroy(tarantula, creationalContext);
assert SpiderProducer.isTarantulaDestroyed();
assert SpiderProducer.isDestroyArgumentsSet();
assert !SpiderProducerNotUsed.isTarantulaDestroyed();
@@ -77,7 +79,8 @@
protected void execute() throws Exception
{
Bean<SpiderEgg> eggBean = getBeans(SpiderEgg.class).iterator().next();
- assert createBeanInstance(eggBean) != null;
+ CreationalContext<SpiderEgg> creationalContext = getCurrentManager().createCreationalContext(eggBean);
+ assert eggBean.create(creationalContext) != null;
}
}.run();
@@ -97,7 +100,8 @@
{
Tarantula.setNumberCreated(0);
Bean<Tarantula> spiderBean = getBeans(Tarantula.class).iterator().next();
- Tarantula tarantula = createBeanInstance(spiderBean);
+ CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(spiderBean);
+ Tarantula tarantula = spiderBean.create(creationalContext);
assert tarantula.getValue().equals("Pete");
assert Tarantula.getNumberCreated() == 1;
}
@@ -111,7 +115,8 @@
public void testCreateReturnsNullIfProducerDoesAndDependent() throws Exception
{
Bean<Bread> breadBean = getBeans(Bread.class).iterator().next();
- assert createBeanInstance(breadBean) == null;
+ CreationalContext<Bread> creationalContext = getCurrentManager().createCreationalContext(breadBean);
+ assert breadBean.create(creationalContext) == null;
}
@Test(groups = { "producerMethod", "broken" }, expectedExceptions = IllegalProductException.class )
@@ -122,6 +127,7 @@
public void testCreateFailsIfProducerReturnsNullAndNotDependent() throws Exception
{
Bean<PotatoChip> chipBean = getBeans(PotatoChip.class).iterator().next();
- assert createBeanInstance(chipBean) == null;
+ CreationalContext<PotatoChip> creationalContext = getCurrentManager().createCreationalContext(chipBean);
+ assert chipBean.create(creationalContext) == null;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -11,6 +11,7 @@
import javax.enterprise.inject.CreationException;
import javax.enterprise.inject.spi.Bean;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.hibernate.tck.annotations.SpecAssertion;
import org.hibernate.tck.annotations.SpecAssertions;
import org.jboss.jsr299.tck.AbstractJSR299Test;
@@ -152,11 +153,12 @@
{
assert getBeans(Farm.class).size() == 1;
Bean<Farm> farmBean = getBeans(Farm.class).iterator().next();
+ CreationalContext<Farm> creationalContext = getCurrentManager().createCreationalContext(farmBean);
Farm farm = getInstanceByType(Farm.class);
assert farm.founded != null;
assert farm.initialStaff == 20;
assert farm.closed == null;
- destroyAndRemoveBeanInstance(farmBean, farm);
+ farmBean.destroy(farm, creationalContext);
assert farm.closed != null;
}
@@ -183,9 +185,10 @@
public void testContextualDestroyCatchesException()
{
Bean<Cod> codBean = getBeans(Cod.class).iterator().next();
+ CreationalContext<Cod> creationalContext = getCurrentManager().createCreationalContext(codBean);
Cod codInstance = getInstanceByType(Cod.class);
codInstance.ping();
- destroyAndRemoveBeanInstance(codBean, codInstance);
+ codBean.destroy(codInstance, creationalContext);
}
@Test(groups = "beanLifecycle")
@@ -248,8 +251,9 @@
protected void execute() throws Exception
{
Bean<CdOrderProcessor> bean = getBeans(CdOrderProcessor.class).iterator().next();
+ CreationalContext<CdOrderProcessor> creationalContext = getCurrentManager().createCreationalContext(bean);
CdOrderProcessor instance = getInstanceByType(CdOrderProcessor.class);
- destroyAndRemoveBeanInstance(bean, instance);
+ bean.destroy(instance, creationalContext);
}
}.run();
assert OrderProcessor.preDestroyCalled;
@@ -267,8 +271,9 @@
protected void execute() throws Exception
{
Bean<IndirectOrderProcessor> bean = getBeans(IndirectOrderProcessor.class).iterator().next();
+ CreationalContext<IndirectOrderProcessor> creationalContext = getCurrentManager().createCreationalContext(bean);
IndirectOrderProcessor instance = getInstanceByType(IndirectOrderProcessor.class);
- destroyAndRemoveBeanInstance(bean, instance);
+ bean.destroy(instance, creationalContext);
}
}.run();
assert OrderProcessor.preDestroyCalled;
@@ -303,8 +308,9 @@
protected void execute() throws Exception
{
Bean<NovelOrderProcessor> bean = getBeans(NovelOrderProcessor.class).iterator().next();
+ CreationalContext<NovelOrderProcessor> creationalContext = getCurrentManager().createCreationalContext(bean);
NovelOrderProcessor instance = getInstanceByType(NovelOrderProcessor.class);
- destroyAndRemoveBeanInstance(bean, instance);
+ bean.destroy(instance, creationalContext);
}
}.run();
assert !OrderProcessor.preDestroyCalled;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -7,6 +7,7 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.New;
import javax.enterprise.inject.deployment.Standard;
@@ -152,8 +153,9 @@
Fox fox = getInstanceByType(Fox.class);
Fox newFox = getInstanceByType(Fox.class,new NewLiteral());
Bean<Litter> litterBean = getBeans(Litter.class).iterator().next();
+ CreationalContext<Litter> creationalContext = getCurrentManager().createCreationalContext(litterBean);
Litter litter = getInstanceByType(Litter.class);
- destroyAndRemoveBeanInstance(litterBean, litter);
+ litterBean.destroy(litter, creationalContext);
assert fox.isLitterDisposed();
assert !newFox.isLitterDisposed();
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/ejb/EjbInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/ejb/EjbInjectionTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/ejb/EjbInjectionTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -17,6 +17,7 @@
package org.jboss.jsr299.tck.tests.implementation.simple.resource.ejb;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import org.hibernate.tck.annotations.SpecAssertion;
@@ -52,7 +53,8 @@
public void testInjectionOfEjbs()
{
Bean<SimpleBean> simpleBeanBean = getBeans(SimpleBean.class).iterator().next();
- SimpleBean simpleBean = createBeanInstance(simpleBeanBean);
+ CreationalContext<SimpleBean> creationalContext = getCurrentManager().createCreationalContext(simpleBeanBean);
+ SimpleBean simpleBean = simpleBeanBean.create(creationalContext);
assert !simpleBean.isMyEjbExists() : "Ejb was injected too early";
assert simpleBean.getMyEjb() != null : "Ejb was not injected into bean";
assert simpleBean.getMyEjb().hello().equals("hi!");
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -1,5 +1,6 @@
package org.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
@@ -40,7 +41,8 @@
public void testInjectionOfPersistenceContext()
{
Bean<SimpleBean> simpleBeanBean = getBeans(SimpleBean.class).iterator().next();
- SimpleBean simpleBean = createBeanInstance(simpleBeanBean);
+ CreationalContext<SimpleBean> creationalContext = getCurrentManager().createCreationalContext(simpleBeanBean);
+ SimpleBean simpleBean = simpleBeanBean.create(creationalContext);
EntityManager entityManager = simpleBean.getPersistenceContext();
assert !simpleBean.isPersistenceContextExistsDuringConstruction() : "Persistence context injected too early";
assert entityManager != null : "Persistence context was not injected into bean";
@@ -54,7 +56,8 @@
public void testInjectionOfPersistenceUnit()
{
Bean<SimpleBean> simpleBeanBean = getBeans(SimpleBean.class).iterator().next();
- SimpleBean simpleBean = createBeanInstance(simpleBeanBean);
+ CreationalContext<SimpleBean> creationalContext = getCurrentManager().createCreationalContext(simpleBeanBean);
+ SimpleBean simpleBean = simpleBeanBean.create(creationalContext);
EntityManagerFactory entityManagerFactory = simpleBean.getPersistenceUnit();
assert !simpleBean.isPersistenceUnitExistsDuringConstruction() : "Persistence unit injected too early";
assert entityManagerFactory != null : "Persistence unit was not injected into bean";
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/resource/InjectionOfResourceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/resource/InjectionOfResourceTest.java 2009-06-29 21:42:01 UTC (rev 2931)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/resource/InjectionOfResourceTest.java 2009-06-30 06:02:12 UTC (rev 2932)
@@ -1,5 +1,6 @@
package org.jboss.jsr299.tck.tests.implementation.simple.resource.resource;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
@@ -28,7 +29,8 @@
public void testInjectionOfResource()
{
Bean<SimpleBean> simpleBeanBean = getBeans(SimpleBean.class).iterator().next();
- SimpleBean simpleBean = createBeanInstance(simpleBeanBean);
+ CreationalContext<SimpleBean> creationalContext = getCurrentManager().createCreationalContext(simpleBeanBean);
+ SimpleBean simpleBean = simpleBeanBean.create(creationalContext);
BeanManager beanManager = simpleBean.getManager();
assert !simpleBean.isManagerInjected() : "Manager injected too early";
assert beanManager != null : "@Another Manager not found";
More information about the weld-commits
mailing list