geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [03/50] [abbrv] incubator-geode git commit: Revert "GEODE-1376: Cleaned up server port to be '0'."
Date Fri, 20 May 2016 17:10:28 GMT
Revert "GEODE-1376: Cleaned up server port to be '0'."

This reverts commit c33efb60630fe8bed7613c60f941810a7574f16b, which caused
a number of REST test failures in build 467 due to removal/rename of
test methods.

https://builds.apache.org/job/Geode-nightly/467/testReport/


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/d1a0748b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/d1a0748b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/d1a0748b

Branch: refs/heads/feature/GEODE-835
Commit: d1a0748baf43c5cb5b2af46411d65d77778d1012
Parents: a881e9c
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Fri May 13 10:29:28 2016 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Fri May 13 10:50:11 2016 -0700

----------------------------------------------------------------------
 ...stAPIOnRegionFunctionExecutionDUnitTest.java |  77 ++-
 .../web/controllers/RestAPITestBase.java        |  16 +-
 .../RestAPIsAndInterOpsDUnitTest.java           | 501 +++++++++++--------
 ...tAPIsOnGroupsFunctionExecutionDUnitTest.java |   6 +-
 ...APIsOnMembersFunctionExecutionDUnitTest.java |  19 +-
 .../controllers/RestAPIsWithSSLDUnitTest.java   | 495 +++++++++++-------
 .../internal/AutoConnectionSourceDUnitTest.java | 345 ++++++-------
 .../AutoConnectionSourceImplJUnitTest.java      |   5 +
 .../internal/LocatorLoadBalancingDUnitTest.java | 439 +++++++++-------
 .../cache/client/internal/LocatorTestBase.java  | 396 +++++++++------
 .../internal/cache/Bug47667DUnitTest.java       |  24 +-
 .../CacheServerManagementDUnitTest.java         | 260 ++++++----
 12 files changed, 1500 insertions(+), 1083 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
index dc3986b..fedd119 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
@@ -36,7 +36,6 @@ import java.util.*;
 
 /**
  * Dunit Test to validate OnRegion function execution with REST APIs
- *
  * @since 8.0
  */
 
@@ -59,22 +58,22 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
       if (context instanceof RegionFunctionContext) {
         RegionFunctionContext rfContext = (RegionFunctionContext) context;
         rfContext.getDataSet().getCache().getLogger()
-            .info("Executing function :  SampleFunction.execute(hasResult=true) with filter: " + rfContext.getFilter() + "  " + rfContext);
+                .info("Executing function :  SampleFunction.execute(hasResult=true) with filter: " + rfContext.getFilter() + "  " + rfContext);
         if (rfContext.getArguments() instanceof Boolean) {
           /* return rfContext.getArguments(); */
           if (hasResult()) {
             rfContext.getResultSender().lastResult(
-                (Serializable) rfContext.getArguments());
+                    (Serializable) rfContext.getArguments());
           } else {
             rfContext
-                .getDataSet()
-                .getCache()
-                .getLogger()
-                .info(
-                    "Executing function :  SampleFunction.execute(hasResult=false) " + rfContext);
+                    .getDataSet()
+                    .getCache()
+                    .getLogger()
+                    .info(
+                            "Executing function :  SampleFunction.execute(hasResult=false) " + rfContext);
             while (true && !rfContext.getDataSet().isDestroyed()) {
               rfContext.getDataSet().getCache().getLogger()
-                  .info("For Bug43513 ");
+                      .info("For Bug43513 ");
               try {
                 Thread.sleep(100);
               } catch (InterruptedException ie) {
@@ -91,7 +90,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
               Thread.sleep(2000);
             } catch (InterruptedException e) {
               rfContext.getDataSet().getCache().getLogger()
-                  .warning("Got Exception : Thread Interrupted" + e);
+                      .warning("Got Exception : Thread Interrupted" + e);
             }
           }
           if (PartitionRegionHelper.isPartitionedRegion(rfContext.getDataSet())) {
@@ -101,11 +100,11 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
              * rfContext).get(key);
              */
             rfContext.getResultSender().lastResult(
-                (Serializable) PartitionRegionHelper.getLocalDataForContext(
-                    rfContext).get(key));
+                    (Serializable) PartitionRegionHelper.getLocalDataForContext(
+                            rfContext).get(key));
           } else {
             rfContext.getResultSender().lastResult(
-                (Serializable) rfContext.getDataSet().get(key));
+                    (Serializable) rfContext.getDataSet().get(key));
           }
           /* return (Serializable)rfContext.getDataSet().get(key); */
         } else if (rfContext.getArguments() instanceof Set) {
@@ -113,7 +112,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
           ArrayList vals = new ArrayList();
           for (Object key : origKeys) {
             Object val = PartitionRegionHelper
-                .getLocalDataForContext(rfContext).get(key);
+                    .getLocalDataForContext(rfContext).get(key);
             if (val != null) {
               vals.add(val);
             }
@@ -137,10 +136,10 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
           DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
           LogWriter logger = ds.getLogWriter();
           logger.info("Executing in SampleFunction on Server : "
-              + ds.getDistributedMember() + "with Context : " + context);
+                  + ds.getDistributedMember() + "with Context : " + context);
           while (ds.isConnected()) {
             logger
-                .fine("Just executing function in infinite loop for Bug43513");
+                    .fine("Just executing function in infinite loop for Bug43513");
             try {
               Thread.sleep(250);
             } catch (InterruptedException e) {
@@ -183,7 +182,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
   private boolean createPeerWithPR() {
     RegionAttributes ra = PartitionedRegionTestHelper.createRegionAttrsForPR(0,
-        10);
+            10);
     AttributesFactory raf = new AttributesFactory(ra);
     PartitionAttributesImpl pa = new PartitionAttributesImpl();
     pa.setAll(ra.getPartitionAttributes());
@@ -232,10 +231,10 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
   }
 
   private void createCacheAndRegisterFunction() {
-    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0.getHost().getHostName(), null)));
-    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1.getHost().getHostName(), null)));
-    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2.getHost().getHostName(), null)));
-    restURLs.add(vm3.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm3.getHost().getHostName(), null)));
+    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0, null)));
+    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1, null)));
+    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2, null)));
+    restURLs.add(vm3.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm3, null)));
 
     vm0.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction()));
     vm1.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction()));
@@ -284,7 +283,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
     createPeersWithPR(vm0, vm1, vm2, vm3);
 
-    vm3.invoke("populatePRRegion", () -> populatePRRegion());
+    vm3.invoke("populatePRRegion",() -> populatePRRegion());
 
     CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", null, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());
@@ -306,16 +305,16 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
     createPeersWithPR(vm0, vm1, vm2, vm3);
 
-    vm3.invoke("populatePRRegion", () -> populatePRRegion());
+    vm3.invoke("populatePRRegion",() -> populatePRRegion());
 
     String jsonBody = "["
-        + "{\"@type\": \"double\",\"@value\": 210}"
-        + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
-        + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\","
-        + "\"quantity\":\"2\","
-        + "\"unitprice\":\"5\","
-        + "\"totalprice\":\"10.00\"}"
-        + "]";
+            + "{\"@type\": \"double\",\"@value\": 210}"
+            + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
+            + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\","
+            + "\"quantity\":\"2\","
+            + "\"unitprice\":\"5\","
+            + "\"totalprice\":\"10.00\"}"
+            + "]";
 
     CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, null, jsonBody, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());
@@ -325,15 +324,15 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
     assertCorrectInvocationCount(4, vm0, vm1, vm2, vm3);
 
     jsonBody = "["
-        + "{\"@type\": \"double\",\"@value\": 220}"
-        + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
-        + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\","
-        + "\"quantity\":\"3\","
-        + "\"unitprice\":\"9\","
-        + "\"totalprice\":\"12.00\"}"
-        + "]";
-
-    resetInvocationCounts(vm0, vm1, vm2, vm3);
+            + "{\"@type\": \"double\",\"@value\": 220}"
+            + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
+            + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\","
+            + "\"quantity\":\"3\","
+            + "\"unitprice\":\"9\","
+            + "\"totalprice\":\"12.00\"}"
+            + "]";
+
+    resetInvocationCounts(vm0,vm1,vm2,vm3);
 
     response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", jsonBody, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
index 9e8086c..fc71fd8 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
@@ -66,6 +66,7 @@ public class RestAPITestBase extends DistributedTestCase {
     if (agentUtil.findWarLocation("geode-web-api") == null) {
       fail("unable to locate geode-web-api WAR file");
     }
+    Wait.pause(1000); // TODO: replace this with Awaitility
     final Host host = Host.getHost(0);
     vm0 = host.getVM(0);
     vm1 = host.getVM(1);
@@ -101,10 +102,11 @@ public class RestAPITestBase extends DistributedTestCase {
     }
   }
 
-  public String createCacheWithGroups(final String hostName, final String groups) {
+  public String createCacheWithGroups(VM vm, final String groups) {
     RestAPITestBase test = new RestAPITestBase(getTestMethodName());
 
-    final int servicePort = AvailablePortHelper.getRandomAvailableTCPPort();
+    final String hostName = vm.getHost().getHostName();
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     Properties props = new Properties();
 
@@ -114,12 +116,12 @@ public class RestAPITestBase extends DistributedTestCase {
 
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(servicePort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(serverPort));
 
     InternalDistributedSystem ds = test.getSystem(props);
     cache = CacheFactory.create(ds);
 
-    String restEndPoint = "http://" + hostName + ":" + servicePort + "/gemfire-api/v1";
+    String restEndPoint = "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
     return restEndPoint;
   }
 
@@ -130,7 +132,7 @@ public class RestAPITestBase extends DistributedTestCase {
 
   protected CloseableHttpResponse executeFunctionThroughRestCall(String function, String regionName, String filter, String jsonBody, String groups,
                                                                  String members) {
-    System.out.println("Entering executeFunctionThroughRestCall");
+    LogWriterUtils.getLogWriter().info("Entering executeFunctionThroughRestCall");
     try {
       CloseableHttpClient httpclient = HttpClients.createDefault();
       Random randomGenerator = new Random();
@@ -138,7 +140,7 @@ public class RestAPITestBase extends DistributedTestCase {
 
       HttpPost post = createHTTPPost(function, regionName, filter, restURLIndex, groups, members, jsonBody);
 
-      System.out.println("Request: POST " + post.toString());
+      LogWriterUtils.getLogWriter().info("Request: POST " + post.toString());
       return httpclient.execute(post);
     } catch (Exception e) {
       throw new RuntimeException("unexpected exception", e);
@@ -183,7 +185,7 @@ public class RestAPITestBase extends DistributedTestCase {
     try {
       String httpResponseString = processHttpResponse(response);
       response.close();
-      System.out.println("Response : " + httpResponseString);
+      LogWriterUtils.getLogWriter().info("Response : " + httpResponseString);
       //verify function execution result
       JSONArray resultArray = new JSONArray(httpResponseString);
       assertEquals(resultArray.length(), expectedServerResponses);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
index 0f4b2d3..5b0eb17 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
@@ -16,7 +16,38 @@
  */
 package com.gemstone.gemfire.rest.internal.web.controllers;
 
-import com.gemstone.gemfire.cache.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionFactory;
@@ -33,31 +64,17 @@ import com.gemstone.gemfire.management.ManagementTestBase;
 import com.gemstone.gemfire.pdx.PdxInstance;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.*;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.*;
 
 /**
  * Dunit Test containing inter - operations between REST Client and Gemfire cache client
- *
  * @since 8.0
  */
 
 public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
-
+  
   private static final long serialVersionUID = -254776154266339226L;
 
   private ManagementTestBase helper;
@@ -72,7 +89,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
   private static final String[] PARAM_QUERY_IDS_ARRAY = { "findAllPeople",
       "filterByGender", "filterByLastName" };
-
+  
   final static String QUERY_ARGS = "["
       + "{"
       + "\"@type\": \"string\","
@@ -81,29 +98,29 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       + "]";
 
   final static String PERSON_AS_JSON_CAS = "{"
-      + "\"@old\" :"
+      + "\"@old\" :" 
       + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 101," + " \"firstName\": \"Mithali\","
       + " \"middleName\": \"Dorai\"," + " \"lastName\": \"Raj\","
-      + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\""
+      + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\"" 
       + "},"
-      + "\"@new\" :"
+      + "\"@new\" :" 
       + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 1101," + " \"firstName\": \"Virat\","
       + " \"middleName\": \"Premkumar\"," + " \"lastName\": \"Kohli\","
-      + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\""
+      + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\"" 
       + "}"
       + "}";
-
+    
   final static String PERSON_AS_JSON_REPLACE = "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 501," + " \"firstName\": \"Barack\","
       + " \"middleName\": \"Hussein\"," + " \"lastName\": \"Obama\","
-      + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\""
+      + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\"" 
       + "}";
-
+  
   private static final String PERSON_LIST_AS_JSON = "[" + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 3," + " \"firstName\": \"Nishka3\","
@@ -161,38 +178,86 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
   protected final void postTearDownLocatorTestBase() throws Exception {
     disconnectAllFromDS();
   }
-
-  public void doPutsInClientCache() {
+  
+  public static String startBridgeServerWithRestServiceOnInVM(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
+    
+    final String hostName = vm.getHost().getHostName(); 
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    
+    //create Cache of given VM and start HTTP service with REST APIs service
+    new RestAPIsAndInterOpsDUnitTest("temp").startBridgeServer(hostName, serverPort, groups, locators, regions, probe);
+   
+    String restEndPoint =  "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
+    return restEndPoint;
+  }
+  
+  @SuppressWarnings("deprecation")
+  protected int startBridgeServer(String hostName, int restServicerPort, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
+            
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+    props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(restServicerPort));
+    
+    DistributedSystem ds = getSystem(props);
+    Cache cache = CacheFactory.create(ds);
+    ((GemFireCacheImpl)cache).setReadSerialized(true);
+    AttributesFactory factory = new AttributesFactory();
+    
+    factory.setEnableBridgeConflation(true);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+    RegionAttributes attrs = factory.create();
+    for(int i = 0; i < regions.length; i++) {
+      cache.createRegion(regions[i], attrs);
+    }
+    
+    CacheServer server = cache.addCacheServer();
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    server.setPort(serverPort);
+    server.setGroups(groups);
+    server.setLoadProbe(probe);
+    try {
+      server.start();
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+    remoteObjects.put(CACHE_KEY, cache);
+    return new Integer(serverPort);
+  }
+  
+  public static void doPutsInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
-
+   
     //put person object
     final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982, Calendar.DECEMBER, 4), Gender.FEMALE);
     final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975, Calendar.DECEMBER, 14), Gender.MALE);
     final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972, Calendar.AUGUST, 29), Gender.MALE);
     final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979, Calendar.MARCH, 17), Gender.MALE);
     final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983, Calendar.NOVEMBER, 25), Gender.FEMALE);
-
+   
     region.put("1", person1);
     region.put("2", person2);
     region.put("3", person3);
     region.put("4", person4);
     region.put("5", person5);
-
+    
     final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi", DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE);
     final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945, Calendar.DECEMBER, 24), Gender.MALE);
     final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920, Calendar.AUGUST, 9), Gender.MALE);
     final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH, 27), Gender.FEMALE);
     final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973, Calendar.APRIL, 15), Gender.FEMALE);
-
+    
     final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923, Calendar.APRIL, 25), Gender.MALE);
     final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910, Calendar.JANUARY, 01), Gender.MALE);
     final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943, Calendar.AUGUST, 10), Gender.FEMALE);
     final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER, 27), Gender.MALE);
     final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER, 21), Gender.MALE);
     final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927, Calendar.FEBRUARY, 15), Gender.FEMALE);
-
+    
     Map<String, Object> userMap = new HashMap<String, Object>();
     userMap.put("6", person6);
     userMap.put("7", person7);
@@ -205,15 +270,15 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
     userMap.put("14", person14);
     userMap.put("15", person15);
     userMap.put("16", person16);
-
+    
     region.putAll(userMap);
-
+    
     if (cache != null)
       cache.getLogger().info("Gemfire Cache Client: Puts successfully done");
-
+    
   }
 
-  public void doQueryOpsUsingRestApis(String restEndpoint) {
+  public static void doQueryOpsUsingRestApis(String restEndpoint) {
     String currentQueryOp = null;
     try {
       // Query TestCase-1 :: Prepare parameterized Queries
@@ -226,7 +291,8 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse createNamedQueryResponse = httpclient.execute(post);
         assertEquals(createNamedQueryResponse.getStatusLine().getStatusCode(), 201);
         assertNotNull(createNamedQueryResponse.getEntity());
-        createNamedQueryResponse.close();
+        createNamedQueryResponse.close();        
+        
 
         post = new HttpPost(restEndpoint + findPeopleByGenderQuery);
         post.addHeader("Content-Type", "application/json");
@@ -235,6 +301,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         assertEquals(createNamedQueryResponse.getStatusLine().getStatusCode(), 201);
         assertNotNull(createNamedQueryResponse.getEntity());
         createNamedQueryResponse.close();
+        
 
         post = new HttpPost(restEndpoint + findPeopleByLastNameQuery);
         post.addHeader("Content-Type", "application/json");
@@ -244,7 +311,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         assertNotNull(createNamedQueryResponse.getEntity());
         createNamedQueryResponse.close();
       }
-
+      
       // Query TestCase-2 :: List all parameterized queries
       {
         currentQueryOp = "listAllQueries";
@@ -253,7 +320,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse listAllQueriesResponse = httpclient.execute(get);
         assertEquals(listAllQueriesResponse.getStatusLine().getStatusCode(), 200);
         assertNotNull(listAllQueriesResponse.getEntity());
-
+        
         HttpEntity entity = listAllQueriesResponse.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -264,19 +331,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
           sb.append(line);
         }
         listAllQueriesResponse.close();
-
+      
         // Check whether received response contains expected query IDs.
 
         JSONObject jsonObject = new JSONObject(sb.toString());
         JSONArray jsonArray = jsonObject.getJSONArray("queries");
         for (int i = 0; i < jsonArray.length(); i++) {
           assertTrue(
-              "PREPARE_PARAMETERIZED_QUERY: function IDs are not matched",
-              Arrays.asList(PARAM_QUERY_IDS_ARRAY).contains(
-                  jsonArray.getJSONObject(i).getString("id")));
+            "PREPARE_PARAMETERIZED_QUERY: function IDs are not matched",
+            Arrays.asList(PARAM_QUERY_IDS_ARRAY).contains(
+                jsonArray.getJSONObject(i).getString("id")));
         }
-      }
-
+      }  
+      
       // Query TestCase-3 :: Run the specified named query passing in scalar values for query parameters.
       {
         currentQueryOp = "filterByLastName";
@@ -284,35 +351,41 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         HttpPost post = new HttpPost(restEndpoint + "/queries/filterByLastName");
         post.addHeader("Content-Type", "application/json");
         post.addHeader("Accept", "application/json");
-        StringEntity entity = new StringEntity(QUERY_ARGS);
+        StringEntity entity = new StringEntity(QUERY_ARGS);       
         post.setEntity(entity);
         CloseableHttpResponse runNamedQueryResponse = httpclient.execute(post);
 
         assertEquals(200, runNamedQueryResponse.getStatusLine().getStatusCode());
         assertNotNull(runNamedQueryResponse.getEntity());
       }
-    } catch (Exception e) {
+    } catch ( Exception e ) {
       throw new RuntimeException("unexpected exception", e);
     }
   }
-
-  public void verifyUpdatesInClientCache() {
+  
+  public static void verifyUpdatesInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
-
+    
     {
-      Person expectedPerson = new Person(3L, "Nishka3", "Nilkanth3", "Patel3", DateTimeUtils.createDate(2009, Calendar.JULY, 31), Gender.FEMALE);
+      Person expectedPerson = new Person(3L, "Nishka3", "Nilkanth3", "Patel3", DateTimeUtils.createDate(2009, Calendar.JULY, 31), Gender.FEMALE );
       Object value = region.get("3");
       if (value instanceof PdxInstance) {
-        PdxInstance pi3 = (PdxInstance) value;
+        PdxInstance pi3  = (PdxInstance) value;
         Person actualPerson = (Person) pi3.getObject();
-        comparePersonObject(expectedPerson, actualPerson);
+        assertEquals(actualPerson.getId(), expectedPerson.getId());
+        assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
+        assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
+        assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
+        assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
+        assertEquals(actualPerson.getGender(), expectedPerson.getGender());
       } else if (value instanceof Person) {
         fail("VerifyUpdatesInClientCache, Get on key 3, Expected to get value of type PdxInstance ");
       }
     }
-
+     
+    
     //TODO: uncomment it once following issue encountered in put?op=CAS is fixed or document the issue
     // CAS functionality is not working in following test case
     // step-1: Java client, Region.put("K", A);
@@ -331,47 +404,43 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       }
     }
     */
-
+    
     //verify update on key "2"
     {
-      Person expectedPerson = new Person(501L, "Barack", "Hussein", "Obama", DateTimeUtils.createDate(1961, Calendar.APRIL, 8), Gender.MALE);
+      Person expectedPerson = new Person(501L, "Barack", "Hussein", "Obama", DateTimeUtils.createDate(1961, Calendar.APRIL, 8), Gender.MALE );
       Object value = region.get("2");
       if (value instanceof PdxInstance) {
-        PdxInstance pi3 = (PdxInstance) value;
+        PdxInstance pi3  = (PdxInstance) value;
         Person actualPerson = (Person) pi3.getObject();
-        comparePersonObject(expectedPerson, actualPerson);
-      } else {
+        assertEquals(actualPerson.getId(), expectedPerson.getId());
+        assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
+        assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
+        assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
+        assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
+        assertEquals(actualPerson.getGender(), expectedPerson.getGender());
+      }else {
         fail("VerifyUpdatesInClientCache, Get on key 2, Expected to get value of type PdxInstance ");
       }
     }
-
+    
     //verify Deleted key "13"
     {
       Object obj = region.get("13");
       assertEquals(obj, null);
-
+      
       obj = region.get("14");
       assertEquals(obj, null);
-
+      
       obj = region.get("15");
       assertEquals(obj, null);
-
+      
       obj = region.get("16");
       assertEquals(obj, null);
     }
-
+    
   }
-
-  private void comparePersonObject(Person expectedPerson, Person actualPerson) {
-    assertEquals(actualPerson.getId(), expectedPerson.getId());
-    assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
-    assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
-    assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
-    assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
-    assertEquals(actualPerson.getGender(), expectedPerson.getGender());
-  }
-
-  public void doUpdatesUsingRestApis(String restEndpoint) {
+  
+  public static void doUpdatesUsingRestApis(String restEndpoint) {
     //UPdate keys using REST calls
     {
 
@@ -388,7 +457,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-
+    
     //Delete Single keys
     {
       try {
@@ -401,7 +470,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-
+    
     //Delete set of keys
     {
       try {
@@ -414,7 +483,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-
+    
     //REST put?op=CAS for key 1
     /*
     try {   
@@ -430,15 +499,15 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
     }catch (HttpServerErrorException se) {
       fail("Caught HttpServerErrorException while doing put with op=cas");
     }
-    */
-
+    */ 
+    
     //REST put?op=REPLACE for key 2
     {
       /*HttpEntity<Object> entity = new HttpEntity<Object>(PERSON_AS_JSON_REPLACE, headers);
       ResponseEntity<String> result = RestTestUtils.getRestTemplate().exchange(
         restEndpoint + "/People/2?op=replace",
       HttpMethod.PUT, entity, String.class);*/
-
+      
       try {
         CloseableHttpClient httpclient = HttpClients.createDefault();
         HttpPut put = new HttpPut(restEndpoint
@@ -453,14 +522,14 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       }
     }
   }
-
-  public void fetchRestServerEndpoints(String restEndpoint) {
+  
+  public static void fetchRestServerEndpoints(String restEndpoint) {
     HttpGet get = new HttpGet(restEndpoint + "/servers");
     get.addHeader("Content-Type", "application/json");
     get.addHeader("Accept", "application/json");
     CloseableHttpClient httpclient = HttpClients.createDefault();
     CloseableHttpResponse response;
-
+    
     try {
       response = httpclient.execute(get);
       HttpEntity entity = response.getEntity();
@@ -472,18 +541,18 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       while ((line = reader.readLine()) != null) {
         str.append(line);
       }
-
+      
       //validate the satus code
       assertEquals(response.getStatusLine().getStatusCode(), 200);
-
-      if (response.getStatusLine().getStatusCode() == 200) {
+      
+      if(response.getStatusLine().getStatusCode() == 200) {
         JSONArray jsonArray = new JSONArray(str.toString());
-
+        
         //verify total number of REST service endpoints in DS
         assertEquals(jsonArray.length(), 2);
       }
-
-    } catch (ClientProtocolException e) {
+      
+    } catch (ClientProtocolException e) { 
       e.printStackTrace();
       fail(" Rest Request should not have thrown ClientProtocolException!");
     } catch (IOException e) {
@@ -493,26 +562,26 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       e.printStackTrace();
       fail(" Rest Request should not have thrown  JSONException!");
     }
-
+    
   }
-
-  public void doGetsUsingRestApis(String restEndpoint) {
-
+  
+  public static void doGetsUsingRestApis(String restEndpoint) {
+    
     //HttpHeaders headers = setAcceptAndContentTypeHeaders(); 
     String currentOperation = null;
     JSONObject jObject;
     JSONArray jArray;
-    try {
+    try {    
       //1. Get on key="1" and validate result.
       {
         currentOperation = "GET on key 1";
-
+        
         HttpGet get = new HttpGet(restEndpoint + "/People/1");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
         CloseableHttpClient httpclient = HttpClients.createDefault();
         CloseableHttpResponse response = httpclient.execute(get);
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -522,26 +591,27 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         jObject = new JSONObject(str.toString());
-
+      
         assertEquals(jObject.get("id"), 101);
         assertEquals(jObject.get("firstName"), "Mithali");
         assertEquals(jObject.get("middleName"), "Dorai");
         assertEquals(jObject.get("lastName"), "Raj");
         assertEquals(jObject.get("gender"), Gender.FEMALE.name());
       }
-
+      
       //2. Get on key="16" and validate result.
       {
         currentOperation = "GET on key 16";
 
+        
         HttpGet get = new HttpGet(restEndpoint + "/People/16");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
         CloseableHttpClient httpclient = HttpClients.createDefault();
         CloseableHttpResponse response = httpclient.execute(get);
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -551,16 +621,17 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         jObject = new JSONObject(str.toString());
-
+        
+      
         assertEquals(jObject.get("id"), 104);
         assertEquals(jObject.get("firstName"), "Shila");
         assertEquals(jObject.get("middleName"), "kumari");
         assertEquals(jObject.get("lastName"), "Dixit");
         assertEquals(jObject.get("gender"), Gender.FEMALE.name());
       }
-
+      
       //3. Get all (getAll) entries in Region
       {
 
@@ -571,7 +642,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse result = httpclient.execute(get);
         assertEquals(result.getStatusLine().getStatusCode(), 200);
         assertNotNull(result.getEntity());
-
+      
         HttpEntity entity = result.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -582,16 +653,16 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
           sb.append(line);
         }
         result.close();
-
+        
         try {
           jObject = new JSONObject(sb.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 16);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
       }
-
+      
       //4. GetAll?limit=10 (10 entries) and verify results
       {
         HttpGet get = new HttpGet(restEndpoint + "/People?limit=10");
@@ -601,7 +672,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -611,19 +682,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         try {
           jObject = new JSONObject(str.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 10);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
       }
-
+      
       //5. Get keys - List all keys in region
-      {
-
+      {  
+        
         HttpGet get = new HttpGet(restEndpoint + "/People/keys");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
@@ -631,7 +702,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -641,19 +712,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         try {
           jObject = new JSONObject(str.toString());
-          jArray = jObject.getJSONArray("keys");
+          jArray = jObject.getJSONArray("keys"); 
           assertEquals(jArray.length(), 16);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
-      }
-
+      } 
+      
       //6. Get data for specific keys
-      {
-
+      {  
+       
         HttpGet get = new HttpGet(restEndpoint + "/People/1,3,5,7,9,11");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
@@ -661,7 +732,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -671,44 +742,53 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         try {
           jObject = new JSONObject(str.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 6);
-
+          
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
-      }
-    } catch (Exception e) {
-      throw new RuntimeException("unexpected exception", e);
+      } 
+    }catch ( Exception e ) {
+      throw new RuntimeException("unexpected exception", e); 
     }
   }
 
-  public void createRegionInClientCache() {
+  public static void createRegionInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     ClientRegionFactory<String, Object> crf = cache
         .createClientRegionFactory(ClientRegionShortcut.PROXY);
-    crf.create(PEOPLE_REGION_NAME);
+    Region<String, Object> region = crf.create(PEOPLE_REGION_NAME);
+
+  }
+
+  public static void createRegionInManager() {
+    Cache cache = GemFireCacheImpl.getInstance();
+    assertNotNull(cache);
+
+    RegionFactory<String, Object> rf = cache
+        .createRegionFactory(RegionShortcut.REPLICATE);
+    Region<String, Object> region = rf.create(PEOPLE_REGION_NAME);
   }
 
-  public void createRegion() {
+  public static void createRegionInPeerServer() {
     Cache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
 
-    RegionFactory<String, Object> regionFactory = cache
+    RegionFactory<String, Object> rf = cache
         .createRegionFactory(RegionShortcut.REPLICATE);
-    regionFactory.create(PEOPLE_REGION_NAME);
+    Region<String, Object> region = rf.create(PEOPLE_REGION_NAME);
   }
 
   /**
-   * InterOps Test between REST-client, Peer Cache Client and Client Cache
-   *
+   * InterOps Test between REST-client, Peer Cache Client and Client Cache 
    * @throws Exception
    */
-
+ 
   public void testInterOpsWithReplicatedRegion() throws Exception {
 
     final Host host = Host.getHost(0);
@@ -719,46 +799,47 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
     // start locator
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-
-    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
-
+    
+    startLocatorInVM(locator, locatorPort, "");
+    
     // find locators
     String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort
         + "]";
 
     // start manager (peer cache)
-    manager.invoke("Start manager", () -> startManager(null, locators,
-        new String[] { REGION_NAME }, CacheServer.DEFAULT_LOAD_PROBE));
-
+    int managerPort = startManagerInVM(manager,/* groups */null, locators,
+        new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE);
+    
     //start startCacheServer With RestService enabled
-    String restEndpoint = (String) server.invoke(RestAPIsAndInterOpsDUnitTest.class,
-        "startBridgeServerWithRestServiceOnInVM", new Object[] { server, null, locators, new String[] { REGION_NAME }, CacheServer.DEFAULT_LOAD_PROBE });
-
+    String restEndpoint = (String)server.invoke(RestAPIsAndInterOpsDUnitTest.class,
+        "startBridgeServerWithRestServiceOnInVM", new Object[] { server ,  null, locators, new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE });
+    
     // create a client cache
-    client.invoke("Create Client", () -> createClientCache(NetworkUtils.getServerHostName(locator.getHost()), locatorPort));
-
+    createClientCacheInVM(client, NetworkUtils.getServerHostName(locator.getHost()),
+        locatorPort);
+    
     // create region in Manager, peer cache and Client cache nodes
-    manager.invoke("create region", () -> createRegion());
-    server.invoke("create region", () -> createRegion());
-    client.invoke("create region", () -> createRegionInClientCache());
-
+    manager.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInManager());
+    server.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInPeerServer());
+    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInClientCache());
+    
     // do some person puts from clientcache
-    client.invoke("doPutsInClientCache", () -> doPutsInClientCache());
+    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.doPutsInClientCache());
 
     //TEST: fetch all available REST endpoints
-    fetchRestServerEndpoints(restEndpoint);
-
+    RestAPIsAndInterOpsDUnitTest.fetchRestServerEndpoints(restEndpoint);
+   
     // Controller VM - config REST Client and make HTTP calls
-    doGetsUsingRestApis(restEndpoint);
-
+    RestAPIsAndInterOpsDUnitTest.doGetsUsingRestApis(restEndpoint);
+    
     //update Data using REST APIs
-    doUpdatesUsingRestApis(restEndpoint);
-
-    client.invoke("verifyUpdatesInClientCache", () -> verifyUpdatesInClientCache());
+    RestAPIsAndInterOpsDUnitTest.doUpdatesUsingRestApis(restEndpoint);
+    
+    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.verifyUpdatesInClientCache());
 
     //Querying
-    doQueryOpsUsingRestApis(restEndpoint);
-
+    RestAPIsAndInterOpsDUnitTest.doQueryOpsUsingRestApis(restEndpoint);
+    
     // stop the client and make sure the bridge server notifies
     // stopBridgeMemberVM(client);
     helper.closeCache(locator);
@@ -768,44 +849,66 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
   }
 
-  private void createClientCache(final String host, final int port) throws Exception {
-    // Connect using the GemFire locator and create a Caching_Proxy cache
-    ClientCache cache = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port).create();
-    cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-  }
-
-  private int startManager(final String[] groups,
-      final String locators, final String[] regions, final ServerLoadProbe probe) throws IOException {
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-
-    props.setProperty("jmx-manager", "true");
-    props.setProperty("jmx-manager-start", "true");
-    props.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
-
-    final int httpPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    //Set REST service related configuration
-    props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, "localhost");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
-
-    DistributedSystem ds = getSystem(props);
-    Cache cache = CacheFactory.create(ds);
-    AttributesFactory factory = new AttributesFactory();
+  private void createClientCacheInVM(VM vm, final String host, final int port) throws Exception {
+    SerializableRunnable connect = new SerializableRunnable(
+        "Start Cache client") {
+      public void run() {
+        // Connect using the GemFire locator and create a Caching_Proxy cache
+        ClientCache c = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port)
+            .create();
+       
+        Region r = c.createClientRegionFactory(
+            ClientRegionShortcut.PROXY).create(REGION_NAME);
+      }
+    };
 
-    factory.setEnableBridgeConflation(true);
-    factory.setDataPolicy(DataPolicy.REPLICATE);
-    RegionAttributes attrs = factory.create();
-    for (int i = 0; i < regions.length; i++) {
-      cache.createRegion(regions[i], attrs);
+    if (vm == null) {
+      connect.run();
+    } else {
+      vm.invoke(connect);
     }
-    CacheServer server = cache.addCacheServer();
-    server.setPort(0);
-    server.setGroups(groups);
-    server.setLoadProbe(probe);
-    server.start();
+  }
 
-    return new Integer(server.getPort());
+  private int startManagerInVM(VM vm, final String[] groups,
+      final String locators, final String[] regions, final ServerLoadProbe probe) {
+    SerializableCallable connect = new SerializableCallable("Start Manager ") {
+      public Object call() throws IOException {
+        Properties props = new Properties();
+        props
+            .setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+        props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+
+        props.setProperty("jmx-manager", "true");
+        props.setProperty("jmx-manager-start", "true");
+        props.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
+        
+        final int httpPort = AvailablePortHelper.getRandomAvailableTCPPort();
+        //Set REST service related configuration
+        props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
+        props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, "localhost");
+        props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+
+        DistributedSystem ds = getSystem(props);
+        Cache cache = CacheFactory.create(ds);
+        AttributesFactory factory = new AttributesFactory();
+        
+        factory.setEnableBridgeConflation(true);
+        factory.setDataPolicy(DataPolicy.REPLICATE);
+        RegionAttributes attrs = factory.create();
+        for (int i = 0; i < regions.length; i++) {
+          cache.createRegion(regions[i], attrs);
+        }
+        CacheServer server = cache.addCacheServer();
+        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+        server.setPort(serverPort);
+        server.setGroups(groups);
+        server.setLoadProbe(probe);
+        server.start();
+        
+        return new Integer(serverPort);
+      }
+    };
+    Integer port = (Integer) vm.invoke(connect);
+    return port.intValue();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
index a567700..61e0925 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
@@ -39,9 +39,9 @@ public class RestAPIsOnGroupsFunctionExecutionDUnitTest extends RestAPITestBase
   }
 
   private void setupCacheWithGroupsAndFunction() {
-    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0.getHost().getHostName(), "g0,gm")));
-    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1.getHost().getHostName(), "g1")));
-    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2.getHost().getHostName(), "g0,g1")));
+    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0, "g0,gm")));
+    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1, "g1")));
+    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2, "g0,g1")));
 
     vm0.invoke("registerFunction(new OnGroupsFunction())", () -> FunctionService.registerFunction(new OnGroupsFunction()));
     vm1.invoke("registerFunction(new OnGroupsFunction())", () -> FunctionService.registerFunction(new OnGroupsFunction()));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
index fd6b312..ca01830 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
@@ -44,7 +44,7 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     @Override
     public void execute(FunctionContext context) {
 
-      System.out.println("SWAP:1:executing OnMembersFunction:" + invocationCount);
+      LogWriterUtils.getLogWriter().fine("SWAP:1:executing OnMembersFunction:" + invocationCount);
       invocationCount++;
 
       context.getResultSender().lastResult(Boolean.TRUE);
@@ -71,14 +71,15 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     }
   }
 
-  private String createCacheAndRegisterFunction(String hostName, String memberName) {
-    final int servicePort = AvailablePortHelper.getRandomAvailableTCPPort();
+  private String createCacheAndRegisterFunction(VM vm, String memberName) {
+    final String hostName = vm.getHost().getHostName();
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.NAME_NAME, memberName);
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(servicePort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(serverPort));
 
     Cache c = null;
     try {
@@ -90,7 +91,7 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     c = CacheFactory.create(new RestAPIsOnMembersFunctionExecutionDUnitTest("temp").getSystem(props));
     FunctionService.registerFunction(new OnMembersFunction());
 
-    String restEndPoint = "http://" + hostName + ":" + servicePort + "/gemfire-api/v1";
+    String restEndPoint = "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
     return restEndPoint;
 
   }
@@ -114,10 +115,10 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
   }
 
   private void createCacheForVMs() {
-    restURLs.add(vm0.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm0.getHost().getHostName(), "m1")));
-    restURLs.add(vm1.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm1.getHost().getHostName(), "m2")));
-    restURLs.add(vm2.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm2.getHost().getHostName(), "m3")));
-    restURLs.add(vm3.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm3.getHost().getHostName(), "m4")));
+    restURLs.add(vm0.invoke(() -> createCacheAndRegisterFunction(vm0, "m1")));
+    restURLs.add(vm1.invoke(() -> createCacheAndRegisterFunction(vm1, "m2")));
+    restURLs.add(vm2.invoke(() -> createCacheAndRegisterFunction(vm2, "m3")));
+    restURLs.add(vm3.invoke(() -> createCacheAndRegisterFunction(vm3, "m4")));
   }
 
   public void testFunctionExecutionEOnSelectedMembers() {


Mime
View raw message