[webbeans-commits] Webbeans SVN: r2800 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle and 1 other directory.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Jun 9 13:55:58 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-06-09 13:55:58 -0400 (Tue, 09 Jun 2009)
New Revision: 2800
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.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/lifecycle/Heidelburg.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Kassel.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/KleinStadt.java
Log:
Fix various tests
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-06-09 17:19:44 UTC (rev 2799)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-06-09 17:55:58 UTC (rev 2800)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans.bean;
+import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
@@ -145,6 +146,7 @@
{
Set<Type> types = new LinkedHashSet<Type>(getTypes());
types.add(EnterpriseBeanInstance.class);
+ types.add(Serializable.class);
ProxyFactory proxyFactory = Proxies.getProxyFactory(types);
@SuppressWarnings("unchecked")
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-09 17:19:44 UTC (rev 2799)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-06-09 17:55:58 UTC (rev 2800)
@@ -39,19 +39,10 @@
public class EnterpriseBeanLifecycleTest extends AbstractJSR299Test
{
- /**
- * When the create() method of a Bean object that represents a stateful
- * session bean that is called, the container creates and returns a session
- * bean proxy, as defined in Section 3.3.9, "Session bean proxies".
- * @throws Exception
- *
- * TODO Check this test once WBRI-269 is fixed
- */
- @Test(groups = { "ri-broken", "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
+ @Test(groups = {"enterpriseBeans", "clientProxy", "lifecycle", "integration" })
@SpecAssertions( {
@SpecAssertion(section = "3.3.8", id = "a"),
@SpecAssertion(section = "3.3.9", id = "a"),
- @SpecAssertion(section = "3.3.9", id = "b"),
@SpecAssertion(section = "6", id = "a"),
@SpecAssertion(section = "6.5", id = "a") })
public void testCreateSFSB() throws Exception
@@ -59,30 +50,40 @@
GrossStadt frankfurt = getInstanceByType(GrossStadt.class);
Bean<KleinStadt> stadtBean = getBeans(KleinStadt.class).iterator().next();
assert stadtBean != null : "Expected a bean for stateful session bean Kassel";
- KleinStadt stadtInstance = createBeanInstance(stadtBean);
+ KleinStadt stadtInstance = getInstanceByType(KleinStadt.class, new AnnotationLiteral<Important>() {});
assert stadtInstance != null : "Expected instance to be created by container";
- //assert frankfurt.isKleinStadtCreated() : "PostConstruct should be invoked when bean instance is created";
+ assert frankfurt.isKleinStadtCreated() : "PostConstruct should be invoked when bean instance is created";
frankfurt.resetCreatedFlags();
// Create a second one to make sure create always does create a new session bean
- KleinStadt anotherStadtInstance = createBeanInstance(stadtBean);
+ KleinStadt anotherStadtInstance = getInstanceByType(KleinStadt.class, new AnnotationLiteral<Important>() {});
assert anotherStadtInstance != null : "Expected second instance of session bean";
- //assert frankfurt.isKleinStadtCreated();
+ assert frankfurt.isKleinStadtCreated();
assert anotherStadtInstance != stadtInstance : "create() should not return same bean as before";
// Verify that the instance returned is a proxy by checking for all local interfaces
Set<Class<?>> interfaces = new HashSet<Class<?>>(Arrays.asList(stadtInstance.getClass().getInterfaces()));
assert interfaces.contains(KleinStadt.class);
assert interfaces.contains(SchoeneStadt.class);
+
+ }
+
+ @Test(groups = { "ri-broken", "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
+ @SpecAssertions( {
+ @SpecAssertion(section = "3.3.9", id = "b")
+ })
+ public void testSerializeSFSB() throws Exception
+ {
+ KleinStadt stadtInstance = getInstanceByType(KleinStadt.class, new AnnotationLiteral<Important>() {});
byte[] bytes = serialize(stadtInstance);
- stadtInstance = (KleinStadt) deserialize(bytes);
+ Object object = deserialize(bytes);
+ stadtInstance = (KleinStadt) object;
assert getCurrentConfiguration().getBeans().isProxy(stadtInstance);
- //frankfurt.dispose();
}
- @Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration", "ri-broken" })
+ @Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
@SpecAssertions({
@SpecAssertion(section = "6.5", id = "b"),
@SpecAssertion(section = "6", id = "e")
@@ -94,6 +95,7 @@
assert stadtBean != null : "Expected a bean for stateful session bean Kassel";
Context requestContext = getCurrentManager().getContext(RequestScoped.class);
KleinStadt kassel = createBeanInstance(stadtBean);
+ kassel.ping();
destroyAndRemoveBeanInstance(stadtBean, kassel);
assert frankfurt.isKleinStadtDestroyed() : "Expected SFSB bean to be destroyed";
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Heidelburg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Heidelburg.java 2009-06-09 17:19:44 UTC (rev 2799)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Heidelburg.java 2009-06-09 17:55:58 UTC (rev 2800)
@@ -2,17 +2,17 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.ejb.EJB;
import javax.ejb.Remove;
import javax.ejb.Stateful;
+import javax.enterprise.inject.Current;
@Stateful
@Important
-public class Heidelburg implements KleinStadt
+public class Heidelburg implements KleinStadt, SchoeneStadt
{
private String name;
- @EJB
+ @Current
private GrossStadt grossStadt;
@PostConstruct
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Kassel.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Kassel.java 2009-06-09 17:19:44 UTC (rev 2799)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Kassel.java 2009-06-09 17:55:58 UTC (rev 2800)
@@ -2,10 +2,10 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.ejb.EJB;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Current;
@Stateful
@RequestScoped
@@ -13,7 +13,7 @@
{
private String name;
- @EJB
+ @Current
private GrossStadt grossStadt;
@PostConstruct
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/KleinStadt.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/KleinStadt.java 2009-06-09 17:19:44 UTC (rev 2799)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/KleinStadt.java 2009-06-09 17:55:58 UTC (rev 2800)
@@ -14,4 +14,6 @@
public String getName();
public void setName(String name);
+ public void ping();
+
}
More information about the weld-commits
mailing list