You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/01/28 13:17:41 UTC

svn commit: r904058 - /tuscany/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java

Author: antelder
Date: Thu Jan 28 12:17:41 2010
New Revision: 904058

URL: http://svn.apache.org/viewvc?rev=904058&view=rev
Log:
Change to use a less commonly used port, add a commentted out test on how long a client connection takes

Modified:
    tuscany/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java

Modified: tuscany/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java?rev=904058&r1=904057&r2=904058&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java Thu Jan 28 12:17:41 2010
@@ -19,10 +19,10 @@
 
 package itest;
 
-import static org.junit.Assert.fail;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.net.URI;
 
@@ -41,7 +41,7 @@
  */
 public class ClientTestCase{
 
-    private static URI domainURI = URI.create("tuscany:OneNodeTestCase?listen=127.0.0.1:14820");
+    private static URI domainURI = URI.create("tuscany:OneNodeTestCase?listen=127.0.0.1:14829");
     private static Node node;
     private static HazelcastInstance client;
 
@@ -54,23 +54,35 @@
     @Test
     public void testNode() throws Exception {
 
-        client = HazelcastClient.newHazelcastClient("OneNodeTestCase", "tuscany", "127.0.0.1:14820"); 
+        client = HazelcastClient.newHazelcastClient("OneNodeTestCase", "tuscany", "127.0.0.1:14829"); 
         IMap<Object, Object> map = client.getMap("OneNodeTestCase/Endpoints");        
 
         assertNotNull(map);
         assertEquals(2, map.size());
         Object ep1 = map.get("HelloworldService#service-binding(Helloworld/Helloworld)");
-        System.out.println((RuntimeEndpointImpl)ep1);
+//        System.out.println((RuntimeEndpointImpl)ep1);
         assertNotNull(ep1);
         assertTrue(ep1 instanceof RuntimeEndpointImpl);
         Object ep2 = map.get("HelloworldClient#service-binding(Helloworld/Helloworld)");
         assertNotNull(ep2);
     }
 
+    //@Test
+    public void testTime() throws Exception {
+        long start = System.currentTimeMillis();
+        long count = 100;
+        for (int i=0; i<count; i++) {
+            testNode();
+            client.shutdown();
+        }
+        long avg = (System.currentTimeMillis() - start) / count;
+        System.out.println("Average for " + count + " client connects " + avg);
+    }
+
     @Test
     public void testBadPassword() throws Exception {
         try {
-            client = HazelcastClient.newHazelcastClient("OneNodeTestCase", "IncorrectPassword", "127.0.0.1:14820"); 
+            client = HazelcastClient.newHazelcastClient("OneNodeTestCase", "IncorrectPassword", "127.0.0.1:14829"); 
             fail();
         } catch (Exception e) {
             //expected