You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@tomee.apache.org by bu...@apache.org on 2012/12/17 10:38:09 UTC

svn commit: r842767 - in /websites/staging/openejb/trunk: cgi-bin/ content/ content/examples-trunk/telephone-stateful/src/main/java/org/superbiz/telephone/ content/examples-trunk/telephone-stateful/src/test/java/org/superbiz/telephone/

Author: buildbot
Date: Mon Dec 17 09:38:09 2012
New Revision: 842767

Log:
Staging update by buildbot for openejb

Modified:
    websites/staging/openejb/trunk/cgi-bin/   (props changed)
    websites/staging/openejb/trunk/content/   (props changed)
    websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java
    websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java

Propchange: websites/staging/openejb/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Dec 17 09:38:09 2012
@@ -1 +1 @@
-1422791
+1422816

Propchange: websites/staging/openejb/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Dec 17 09:38:09 2012
@@ -1 +1 @@
-1422791
+1422816

Modified: websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java (original)
+++ websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java Mon Dec 17 09:38:09 2012
@@ -38,18 +38,20 @@ public class TelephoneBean implements Te
             "You don't say!",
     };
 
-    private List<String> conversation = new ArrayList<String>();
+    private final List<String> conversation = new ArrayList<String>();
 
-    public void speak(String words) {
+    @Override
+    public void speak(final String words) {
         conversation.add(words);
     }
 
+    @Override
     public String listen() {
         if (conversation.size() == 0) {
             return "Nothing has been said";
         }
 
-        String lastThingSaid = conversation.get(conversation.size() - 1);
+        final String lastThingSaid = conversation.get(conversation.size() - 1);
         return answers[Math.abs(lastThingSaid.hashCode()) % answers.length];
     }
 }

Modified: websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java (original)
+++ websites/staging/openejb/trunk/content/examples-trunk/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java Mon Dec 17 09:38:09 2012
@@ -23,14 +23,15 @@ import javax.naming.InitialContext;
 import java.util.Properties;
 
 /**
- * @version $Rev: 1227481 $ $Date: 2012-01-05 04:39:55 +0000 (Thu, 05 Jan 2012) $
+ * @version $Rev: 1422816 $ $Date: 2012-12-17 09:37:53 +0000 (Mon, 17 Dec 2012) $
  */
 public class TelephoneTest extends TestCase {
 
     //START SNIPPET: setup
 
+    @Override
     protected void setUp() throws Exception {
-        Properties properties = new Properties();
+        final Properties properties = new Properties();
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
         properties.setProperty("openejb.embedded.remotable", "true");
         // Uncomment these properties to change the defaults
@@ -52,23 +53,21 @@ public class TelephoneTest extends TestC
     //START SNIPPET: localcontext
     public void testTalkOverLocalNetwork() throws Exception {
 
-        Properties properties = new Properties();
+        final Properties properties = new Properties();
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
-        InitialContext localContext = new InitialContext(properties);
+        final InitialContext localContext = new InitialContext(properties);
 
-        Telephone telephone = (Telephone) localContext.lookup("TelephoneBeanRemote");
+        final Telephone telephone = (Telephone) localContext.lookup("TelephoneBeanRemote");
 
         telephone.speak("Did you know I am talking directly through the embedded container?");
 
         assertEquals("Interesting.", telephone.listen());
 
-
         telephone.speak("Yep, I'm using the bean's remote interface but since the ejb container is embedded " +
-                "in the same vm I'm just using the LocalInitialContextFactory.");
+                        "in the same vm I'm just using the LocalInitialContextFactory.");
 
         assertEquals("Really?", telephone.listen());
 
-
         telephone.speak("Right, you really only have to use the RemoteInitialContextFactory if you're in a different vm.");
 
         assertEquals("Oh, of course.", telephone.listen());
@@ -82,28 +81,25 @@ public class TelephoneTest extends TestC
      */
     //START SNIPPET: remotecontext
     public void testTalkOverRemoteNetwork() throws Exception {
-        Properties properties = new Properties();
+        final Properties properties = new Properties();
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
-        properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
-        InitialContext remoteContext = new InitialContext(properties);
+        properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:" + Integer.parseInt(System.getProperty("ejbd.port", "4201")));
+        final InitialContext remoteContext = new InitialContext(properties);
 
-        Telephone telephone = (Telephone) remoteContext.lookup("TelephoneBeanRemote");
+        final Telephone telephone = (Telephone) remoteContext.lookup("TelephoneBeanRemote");
 
         telephone.speak("Is this a local call?");
 
         assertEquals("No.", telephone.listen());
 
-
         telephone.speak("This would be a lot cooler if I was connecting from another VM then, huh?");
 
         assertEquals("I wondered about that.", telephone.listen());
 
-
         telephone.speak("I suppose I should hangup and call back over the LocalInitialContextFactory.");
 
         assertEquals("Good idea.", telephone.listen());
 
-
         telephone.speak("I'll remember this though in case I ever have to call you accross a network.");
 
         assertEquals("Definitely.", telephone.listen());