You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2007/01/19 16:10:21 UTC
svn commit: r497839 - in
/incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src:
main/java/org/apache/openejb/examples/counter/
test/java/org/apache/openejb/examples/counter/
Author: dblevins
Date: Fri Jan 19 07:10:20 2007
New Revision: 497839
URL: http://svn.apache.org/viewvc?view=rev&rev=497839
Log:
Patch from Filippo Diotalevi, OPENEJB-347: Example: Minimal Stateful Bean via @Stateful
Thanks again, Filippo!
Modified:
incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterImpl.java
incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterLocal.java
incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterRemote.java
incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/test/java/org/apache/openejb/examples/counter/CounterImplTest.java
Modified: incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterImpl.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterImpl.java?view=diff&rev=497839&r1=497838&r2=497839
==============================================================================
--- incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterImpl.java (original)
+++ incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterImpl.java Fri Jan 19 07:10:20 2007
@@ -32,6 +32,7 @@
* annotation while the CounterLocal interface is not annotated relying
* on the EJB3 default rules to make it a local interface.
*/
+//START SNIPPET: code
@Stateful
public class CounterImpl implements CounterLocal, CounterRemote {
@@ -46,3 +47,4 @@
}
}
+//END SNIPPET: code
Modified: incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterLocal.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterLocal.java?view=diff&rev=497839&r1=497838&r2=497839
==============================================================================
--- incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterLocal.java (original)
+++ incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterLocal.java Fri Jan 19 07:10:20 2007
@@ -22,6 +22,7 @@
* annotation, but it's optional. A business interface which is
* not annotated with @Local or @Remote is assumed to be Local
*/
+//START SNIPPET: code
public interface CounterLocal {
public int increment();
@@ -29,3 +30,4 @@
public int reset();
}
+//END SNIPPET: code
\ No newline at end of file
Modified: incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterRemote.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterRemote.java?view=diff&rev=497839&r1=497838&r2=497839
==============================================================================
--- incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterRemote.java (original)
+++ incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/main/java/org/apache/openejb/examples/counter/CounterRemote.java Fri Jan 19 07:10:20 2007
@@ -23,6 +23,7 @@
* A remote business interface must be annotated with the @Remote
* annotation
*/
+//START SNIPPET: code
@Remote
public interface CounterRemote {
@@ -31,3 +32,4 @@
public int reset();
}
+//END SNIPPET: code
Modified: incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/test/java/org/apache/openejb/examples/counter/CounterImplTest.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/test/java/org/apache/openejb/examples/counter/CounterImplTest.java?view=diff&rev=497839&r1=497838&r2=497839
==============================================================================
--- incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/test/java/org/apache/openejb/examples/counter/CounterImplTest.java (original)
+++ incubator/openejb/trunk/openejb3/examples/counter-stateful-pojo/src/test/java/org/apache/openejb/examples/counter/CounterImplTest.java Fri Jan 19 07:10:20 2007
@@ -24,7 +24,8 @@
import junit.framework.TestCase;
public class CounterImplTest extends TestCase {
-
+
+ //START SNIPPET: setup
private InitialContext initialContext;
protected void setUp() throws Exception {
@@ -34,12 +35,14 @@
initialContext = new InitialContext(properties);
}
+ //END SNIPPET: setup
/**
* Lookup the Counter bean via its remote home interface
*
* @throws Exception
*/
+ //START SNIPPET: remote
public void testCounterViaRemoteInterface() throws Exception {
Object object = initialContext.lookup("CounterImplBusinessRemote");
@@ -51,12 +54,14 @@
assertEquals(2, counter.increment());
assertEquals(0, counter.reset());
}
+ //END SNIPPET: remote
/**
* Lookup the Counter bean via its local home interface
*
* @throws Exception
*/
+ //START SNIPPET: local
public void testCounterViaLocalInterface() throws Exception {
Object object = initialContext.lookup("CounterImplBusinessLocal");
@@ -68,5 +73,6 @@
assertEquals(2, counter.increment());
assertEquals(0, counter.reset());
}
+ //END SNIPPET: local
}