Author: pete.muir(a)jboss.org
Date: 2010-01-25 16:49:03 -0500 (Mon, 25 Jan 2010)
New Revision: 5627
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
Log:
test for WELD-80
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java 2010-01-25
21:23:35 UTC (rev 5626)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java 2010-01-25
21:49:03 UTC (rev 5627)
@@ -86,4 +86,13 @@
assert
getReference(ResultClient.class).lookupPete().getUsername().equals("pete");
}
+ @Test(description = "WELD-80", groups = "broken")
+ public void testPassivationOfEjbs()
+ {
+ HelloAction action = getReference(HelloAction.class);
+ action.executeRequest();
+ assert action.getHello().equals("hello");
+ assert action.getGoodBye().equals("goodbye");
+ }
+
}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java 2010-01-25
21:49:03 UTC (rev 5627)
@@ -0,0 +1,40 @@
+package org.jboss.weld.tests.enterprise;
+
+import javax.inject.Inject;
+
+public class HelloAction
+{
+
+ public static long sleepDuration = 1000 * 2;
+
+ @Inject
+ private IHelloBean helloBean;
+
+ private String hello;
+ private String goodBye;
+
+ public void executeRequest()
+ {
+ hello = helloBean.sayHello();
+ try
+ {
+ Thread.sleep(sleepDuration);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("Caught Interruption.");
+ }
+ goodBye = helloBean.sayGoodbye();
+ }
+
+ public String getHello()
+ {
+ return hello;
+ }
+
+ public String getGoodBye()
+ {
+ return goodBye;
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java 2010-01-25
21:49:03 UTC (rev 5627)
@@ -0,0 +1,33 @@
+package org.jboss.weld.tests.enterprise;
+
+import javax.annotation.Resource;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+
+@Stateful
+@SessionScoped
+@CacheConfig(idleTimeoutSeconds=1)
+public class HelloBean implements IHelloBean
+{
+ @Resource(mappedName = "java:app/BeanManager")
+ private BeanManager beanManager;
+
+ public String sayHello()
+ {
+ return "hello";
+ }
+
+ public String sayGoodbye()
+ {
+ return beanManager.getELResolver() != null ? "goodbye" :
"error";
+ }
+
+ @Remove
+ public void remove()
+ {
+ }
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java 2010-01-25
21:49:03 UTC (rev 5627)
@@ -0,0 +1,15 @@
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface IHelloBean
+{
+
+ public abstract String sayHello();
+
+ public abstract String sayGoodbye();
+
+ public abstract void remove();
+
+}
\ No newline at end of file
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Show replies by date