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 2008/04/19 20:50:30 UTC

svn commit: r649841 - /openejb/trunk/openejb3/examples/injection-of-ejbs/src/test/java/org/superbiz/injection/EjbDependencyTest.java

Author: dblevins
Date: Sat Apr 19 11:50:19 2008
New Revision: 649841

URL: http://svn.apache.org/viewvc?rev=649841&view=rev
Log:
Simplified test case

Modified:
    openejb/trunk/openejb3/examples/injection-of-ejbs/src/test/java/org/superbiz/injection/EjbDependencyTest.java

Modified: openejb/trunk/openejb3/examples/injection-of-ejbs/src/test/java/org/superbiz/injection/EjbDependencyTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/injection-of-ejbs/src/test/java/org/superbiz/injection/EjbDependencyTest.java?rev=649841&r1=649840&r2=649841&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/injection-of-ejbs/src/test/java/org/superbiz/injection/EjbDependencyTest.java (original)
+++ openejb/trunk/openejb3/examples/injection-of-ejbs/src/test/java/org/superbiz/injection/EjbDependencyTest.java Sat Apr 19 11:50:19 2008
@@ -27,13 +27,10 @@
  *  A test case for DataReaderImpl ejb, testing both the remote and local interface 
  *
  */
+//START SNIPPET: code
 public class EjbDependencyTest extends TestCase {
-	
-	private static final String REMOTE_STORE_RESULT = "REMOTE:42";
-	private static final String LOCAL_STORE_RESULT = "LOCAL:42";
-	
-	//START SNIPPET: setup
-	private InitialContext initialContext;
+
+    private InitialContext initialContext;
 
     protected void setUp() throws Exception {
         Properties properties = new Properties();
@@ -41,23 +38,14 @@
 
         initialContext = new InitialContext(properties);
     }
-    //END SNIPPET: setup
 
-    //START SNIPPET: test
-    public void testViaLocalInterface() throws Exception {
-    	Object object = initialContext.lookup("DataReaderImplLocal");
-    	
-    	assertNotNull(object);
-    	assertEquals(LOCAL_STORE_RESULT, ((DataReaderLocal)object).readDataFromLocalStore());
-    	assertEquals(REMOTE_STORE_RESULT, ((DataReaderLocal)object).readDataFromRemoteStore());
-    }
-    //END SNIPPET: test
-    
-    public void testViaRemoteInterface() throws Exception {
-    	Object object = initialContext.lookup("DataReaderImplRemote");
-    	
-    	assertNotNull(object);
-    	assertEquals(LOCAL_STORE_RESULT, ((DataReaderRemote)object).readDataFromLocalStore());
-    	assertEquals(REMOTE_STORE_RESULT, ((DataReaderRemote)object).readDataFromRemoteStore());
+    public void test() throws Exception {
+        DataReaderLocal dataReader = (DataReaderLocal) initialContext.lookup("DataReaderImplLocal");
+
+        assertNotNull(dataReader);
+
+        assertEquals("LOCAL:42", dataReader.readDataFromLocalStore());
+    	assertEquals("REMOTE:42", dataReader.readDataFromRemoteStore());
     }
-}
\ No newline at end of file
+}
+//END SNIPPET: code