Skip to content

Commit f0258d0

Browse files
committed
Merge pull request #262 from arjantijms/master
Tests that stateful session bean is capable of calling a method on itself via a proxy.
2 parents 76e110d + 3d30dd7 commit f0258d0

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.javaee7.ejb.stateful;
2+
3+
import javax.annotation.Resource;
4+
import javax.ejb.SessionContext;
5+
import javax.ejb.Stateful;
6+
7+
/**
8+
*
9+
* @author Arjan Tijms
10+
*
11+
*/
12+
@Stateful
13+
public class ReentrantStatefulBean {
14+
15+
@Resource
16+
private SessionContext sessionConext;
17+
18+
public void initialMethod() {
19+
sessionConext.getBusinessObject(ReentrantStatefulBean.class).reentrantMehthod();
20+
}
21+
22+
public void reentrantMehthod() {
23+
24+
}
25+
26+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.javaee7.ejb.stateful;
2+
3+
import javax.inject.Inject;
4+
5+
import org.jboss.arquillian.container.test.api.Deployment;
6+
import org.jboss.arquillian.junit.Arquillian;
7+
import org.jboss.shrinkwrap.api.Archive;
8+
import org.jboss.shrinkwrap.api.ShrinkWrap;
9+
import org.jboss.shrinkwrap.api.spec.WebArchive;
10+
import org.junit.Test;
11+
import org.junit.runner.RunWith;
12+
13+
/**
14+
* This tests that a stateful bean is capable of calling a method via
15+
* a business proxy on itself.
16+
*
17+
* @author Arjan Tijms
18+
*
19+
*/
20+
@RunWith(Arquillian.class)
21+
public class ReentrantCallTest {
22+
23+
@Inject
24+
private ReentrantStatefulBean reentrantStatefulBean;
25+
26+
@Deployment
27+
public static Archive<?> deployment() {
28+
return ShrinkWrap.create(WebArchive.class)
29+
.addClass(ReentrantStatefulBean.class);
30+
}
31+
32+
33+
@Test
34+
public void doReentrantCall() {
35+
// initialMethod() will internally call another method on itself.
36+
// This should not throw an exception. See e.g. https://issues.apache.org/jira/browse/OPENEJB-1099
37+
reentrantStatefulBean.initialMethod();
38+
}
39+
40+
}

0 commit comments

Comments
 (0)