geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [2/5] incubator-geode git commit: adding unit tests for REST API
Date Thu, 25 Feb 2016 23:49:59 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
new file mode 100644
index 0000000..29aab32
--- /dev/null
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
@@ -0,0 +1,653 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.rest.internal.web.controllers;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.security.KeyStore;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+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;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.client.internal.LocatorTestBase;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.management.ManagementTestBase;
+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 com.gemstone.gemfire.util.test.TestUtil;
+
+/**
+ * 
+ * @author rishim
+ * @since 8.0
+ */
+public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
+
+  private static final long serialVersionUID = -254776154266339226L;
+
+  private ManagementTestBase helper;
+
+  public static final String PEOPLE_REGION_NAME = "People";
+  
+  private File jks;
+
+  public RestAPIsWithSSLDUnitTest(String name) {
+    super(name);
+    this.helper = new ManagementTestBase(name);
+    this.jks  = findTrustedJKS();
+
+  }
+
+  public void setUp() throws Exception {
+    disconnectAllFromDS();
+    super.setUp();
+  }
+
+  @Override
+  protected final void postTearDownLocatorTestBase() throws Exception {
+    closeInfra();
+    disconnectAllFromDS();
+  }
+
+  private static File findTrustedJKS() {
+    return new File(TestUtil.getResourcePath(RestAPIsWithSSLDUnitTest.class, "/ssl/trusted.keystore"));
+  }
+
+  public String startBridgeServerWithRestServiceOnInVM(final VM vm, final String locators, final String[] regions,
+      final Properties sslProperties, final boolean clusterLevel) {
+
+    SerializableCallable startBridge = new SerializableCallable("Start Bridge ") {
+      public Object call() throws IOException {
+        final String hostName = vm.getHost().getHostName();
+        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+        startBridgeServer(hostName, serverPort, locators, regions, sslProperties, clusterLevel);
+        String restEndPoint = "https://" + hostName + ":" + serverPort + "/gemfire-api/v1";
+        return restEndPoint;
+
+      }
+    };
+    String endpoint = (String) vm.invoke(startBridge);
+    return endpoint;
+
+  }
+
+  @SuppressWarnings("deprecation")
+  protected int startBridgeServer(String hostName, int restServicerPort, final String locators, final String[] regions,
+      final Properties sslProperties, boolean clusterLevel) {
+
+    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));
+
+    System.setProperty("javax.net.debug", "ssl");
+    configureSSL(props, sslProperties, clusterLevel);
+
+    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);
+    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);
+    userMap.put("8", person8);
+    userMap.put("9", person9);
+    userMap.put("10", person10);
+    userMap.put("11", person11);
+    userMap.put("12", person12);
+    userMap.put("13", person13);
+    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");
+
+  }
+
+  private String startInfraWithSSL(final Properties sslProperties, boolean clusterLevel) throws Exception {
+
+    final Host host = Host.getHost(0);
+    VM locator = host.getVM(0);
+    VM manager = host.getVM(1);
+    VM server = host.getVM(2);
+    VM client = host.getVM(3);
+
+    // start locator
+    int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+
+    startLocatorInVM(locator, locatorPort, "");
+
+    // find locators
+    String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
+
+    // start manager (peer cache)
+    int managerPort = startManagerInVM(manager, locators, new String[] { REGION_NAME }, sslProperties);
+
+    // start startBridgeServer With RestService enabled
+    String restEndpoint = startBridgeServerWithRestServiceOnInVM(server, locators, new String[] { REGION_NAME },
+        sslProperties, clusterLevel);
+
+    // create a client cache
+    createClientCacheInVM(client, NetworkUtils.getServerHostName(locator.getHost()), locatorPort);
+
+    // create region in Manager, peer cache and Client cache nodes
+    manager.invoke(() -> RestAPIsWithSSLDUnitTest.createRegionInManager());
+    server.invoke(() -> RestAPIsWithSSLDUnitTest.createRegionInPeerServer());
+    client.invoke(() -> RestAPIsWithSSLDUnitTest.createRegionInClientCache());
+
+    // do some person puts from clientcache
+    client.invoke(() -> RestAPIsWithSSLDUnitTest.doPutsInClientCache());
+
+    return restEndpoint;
+
+  }
+
+  private void closeInfra() throws Exception {
+
+    final Host host = Host.getHost(0);
+    VM locator = host.getVM(0);
+    VM manager = host.getVM(1);
+    VM server = host.getVM(2);
+    VM client = host.getVM(3);
+
+    // stop the client and make sure the bridge server notifies
+    // stopBridgeMemberVM(client);
+    helper.closeCache(locator);
+    helper.closeCache(manager);
+    helper.closeCache(server);
+    helper.closeCache(client);
+  }
+
+  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);
+      }
+    };
+
+    if (vm == null) {
+      connect.run();
+    } else {
+      vm.invoke(connect);
+    }
+  }
+
+  private void configureSSL(Properties props, Properties sslProperties, boolean clusterLevel) {
+
+    if(clusterLevel){
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_ENABLED_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_TYPE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_PROTOCOLS_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_REQUIRE_AUTHENTICATION_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_TRUSTSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_TRUSTSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME));
+      }
+
+    }else{
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME));
+      }
+
+    }
+    
+   
+  }
+
+  private int startManagerInVM(VM vm, final String locators, final String[] regions, final Properties sslProperties) {
+
+    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_HTTP_PORT_NAME, "0");
+
+        configureSSL(props, sslProperties, false);
+
+        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.start();
+
+        return new Integer(serverPort);
+      }
+    };
+    Integer port = (Integer) vm.invoke(connect);
+    return port.intValue();
+  }
+
+  public static void createRegionInClientCache() {
+    ClientCache cache = GemFireCacheImpl.getInstance();
+    assertNotNull(cache);
+    ClientRegionFactory<String, Object> crf = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
+    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 static void createRegionInPeerServer() {
+    Cache cache = GemFireCacheImpl.getInstance();
+    assertNotNull(cache);
+    RegionFactory<String, Object> rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
+    Region<String, Object> region = rf.create(PEOPLE_REGION_NAME);
+  }
+  
+  private static CloseableHttpClient getSSLBasedHTTPClient(String algo) throws Exception {
+    
+    File jks = findTrustedJKS();
+
+    KeyStore clientKeys = KeyStore.getInstance("JKS");
+    clientKeys.load(new FileInputStream(jks.getCanonicalPath()), "password".toCharArray());
+
+    KeyManagerFactory clientKeyManagerFactory = KeyManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+    clientKeyManagerFactory.init(clientKeys, "password".toCharArray());
+    // load server public key
+    KeyStore serverPub = KeyStore.getInstance("JKS");
+    serverPub.load(new FileInputStream(jks.getCanonicalPath()), "password".toCharArray());
+    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+    trustManagerFactory.init(serverPub);
+
+    SSLContext context = SSLContext.getInstance(algo);
+
+    context.init(clientKeyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(),
+        new java.security.SecureRandom());
+
+    // Host checking is disabled here , as tests might run on multiple hosts and
+    // host entries can not be assumed
+    SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(context,
+        SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+
+    CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
+
+    return httpclient;
+  }
+
+  private static void validateConnection(String restEndpoint, String algo) {
+
+    try {
+      // 1. Get on key="1" and validate result.
+      {
+        HttpGet get = new HttpGet(restEndpoint + "/People/1");
+        get.addHeader("Content-Type", "application/json");
+        get.addHeader("Accept", "application/json");
+
+       
+        CloseableHttpClient httpclient = getSSLBasedHTTPClient(algo);
+        CloseableHttpResponse response = httpclient.execute(get);
+
+        HttpEntity entity = response.getEntity();
+        InputStream content = entity.getContent();
+        BufferedReader reader = new BufferedReader(new InputStreamReader(content));
+        String line;
+        StringBuffer str = new StringBuffer();
+        while ((line = reader.readLine()) != null) {
+          str.append(line);
+        }
+
+        JSONObject 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());
+      }
+
+    } catch (Exception e) {
+      throw new RuntimeException("unexpected exception", e);
+    }
+  }
+  
+  // Actual Tests starts here.
+
+  public void testSimpleSSL() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
+    String restEndpoint = startInfraWithSSL(props,false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "SSL");
+  }
+  
+  public void testSSLWithoutKeyStoreType() throws Exception {
+
+   
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+  
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "SSL");
+
+
+  }
+  
+  public void testSSLWithSSLProtocol() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "SSL");
+
+  }
+  
+  public void testSSLWithTLSProtocol() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLS");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "TLS");
+
+  }
+  
+  public void testSSLWithTLSv11Protocol() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.1");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "TLSv1.1");
+
+  }
+  
+  public void testSSLWithTLSv12Protocol() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "TLSv1.2");
+
+  }
+  
+  public void testWithMultipleProtocol() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL,TLSv1.2");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "TLSv1.2");
+
+  }
+  
+  public void testSSLWithCipherSuite() throws Exception {
+
+    System.setProperty("javax.net.debug", "ssl");
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    
+    SSLContext ssl = SSLContext.getInstance("TLSv1.2");
+    
+    ssl.init(null, null, new java.security.SecureRandom());
+    String[] cipherSuites = ssl.getSocketFactory().getSupportedCipherSuites();
+    
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME,cipherSuites[0]);
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "TLSv1.2");
+
+  }
+  
+  public void testSSLWithMultipleCipherSuite() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    
+    SSLContext ssl = SSLContext.getInstance("TLSv1.2");
+    
+    ssl.init(null, null, new java.security.SecureRandom());
+    String[] cipherSuites = ssl.getSocketFactory().getSupportedCipherSuites();
+    
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME,cipherSuites[0]+","+cipherSuites[1]);
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "TLSv1.2");
+
+  }
+  
+  
+  public void testMutualAuthentication() throws Exception {
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,"true");
+
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME,jks.getCanonicalPath());
+
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,"password");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    RestAPIsWithSSLDUnitTest.validateConnection(restEndpoint, "SSL");
+
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestTestUtils.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestTestUtils.java
new file mode 100644
index 0000000..0406831
--- /dev/null
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestTestUtils.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.rest.internal.web.controllers;
+
+import java.net.URI;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import org.springframework.http.converter.ByteArrayHttpMessageConverter;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.ResourceHttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
+
+
+/**
+ * The RestTestUtils class contains core functionality for Spring REST Template
+ * <p/>
+ * 
+ * @author Nilkanth Patel
+ * @see org.springframework.context.ApplicationContext
+ * @see org.springframework.data.gemfire.GemfireTemplate
+ * @since 8.0
+ */
+public class RestTestUtils  {
+
+  public static final String BASE_URL = "http://localhost:8080";
+  public static final String GEMFIRE_REST_API_CONTEXT = "/gemfire-api";
+  public static final String GEMFIRE_REST_API_VERSION = "/v1";
+
+  public static final URI GEMFIRE_REST_API_WEB_SERVICE_URL = URI
+      .create(BASE_URL + GEMFIRE_REST_API_CONTEXT + GEMFIRE_REST_API_VERSION);
+
+  private static RestTemplate restTemplate;
+
+  public static RestTemplate getRestTemplate() {
+    if (restTemplate == null) {
+      restTemplate = new RestTemplate();
+
+      final List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
+
+      messageConverters.add(new ByteArrayHttpMessageConverter());
+      messageConverters.add(new ResourceHttpMessageConverter());
+      messageConverters.add(new StringHttpMessageConverter());
+      messageConverters.add(createMappingJackson2HttpMessageConverter());
+      
+      restTemplate.setMessageConverters(messageConverters);
+    }
+    return restTemplate;
+  }
+
+  public static HttpMessageConverter<Object> createMappingJackson2HttpMessageConverter() {
+    final Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean();
+
+    objectMapperFactoryBean.setFailOnEmptyBeans(true);
+    objectMapperFactoryBean.setIndentOutput(true);
+    objectMapperFactoryBean.setDateFormat(new SimpleDateFormat("MM/dd/yyyy"));
+    objectMapperFactoryBean
+        .setFeaturesToDisable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+    objectMapperFactoryBean
+        .setFeaturesToEnable(
+            com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_COMMENTS,
+            com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_SINGLE_QUOTES,
+            com.fasterxml.jackson.databind.DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
+    objectMapperFactoryBean.afterPropertiesSet();
+
+    final MappingJackson2HttpMessageConverter httpMessageConverter = new MappingJackson2HttpMessageConverter();
+    httpMessageConverter.setObjectMapper(objectMapperFactoryBean.getObject());
+    return httpMessageConverter;
+  }
+  
+  /*
+  protected static HttpMessageConverter<Object> createMarshallingHttpMessageConverter() {
+    final Jaxb2Marshaller jaxbMarshaller = new Jaxb2Marshaller();
+
+    jaxbMarshaller.setContextPaths("com.gemstone.gemfire.web.rest.domain",
+        "com.gemstone.gemfire.web.controllers.support");
+    jaxbMarshaller.setMarshallerProperties(Collections.singletonMap(
+        "jaxb.formatted.output", Boolean.TRUE));
+
+    return new MarshallingHttpMessageConverter(jaxbMarshaller);
+  }
+  */
+  
+  public static URI toUri(final String... pathSegments) {
+    return toUri(GEMFIRE_REST_API_WEB_SERVICE_URL, pathSegments);
+  }
+
+  public static URI toUri(final URI baseUrl, final String... pathSegments) {
+    return UriComponentsBuilder.fromUri(baseUrl).pathSegment(pathSegments)
+        .build().toUri();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/main/java/com/gemstone/gemfire/management/internal/AgentUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/AgentUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/AgentUtil.java
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/AddFreeItemToOrders.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/AddFreeItemToOrders.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/AddFreeItemToOrders.java
deleted file mode 100644
index c8a2ce3..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/AddFreeItemToOrders.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Vector;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.query.FunctionDomainException;
-import com.gemstone.gemfire.cache.query.NameResolutionException;
-import com.gemstone.gemfire.cache.query.Query;
-import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
-import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.cache.query.TypeMismatchException;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.pdx.PdxInstance;
-
-/**
- * Gemfire function to add free items in the existing order
- * if the total price for that order is greater then the argument
- * @author Nilkanth Patel
- */
-
-public class AddFreeItemToOrders implements Function  {
-  
-  public void execute(FunctionContext context) {
-
-    Cache c = null;
-    Region r = null;
-    List<Object> vals = new ArrayList<Object>();
-    List<Object> keys = new ArrayList<Object>();
-    List<Object> argsList = new ArrayList<Object>();
-    Object[] argsArray = null;
-    
-    if (context.getArguments() instanceof Boolean) {
-    
-    } else if (context.getArguments() instanceof String) {
-      String arg = (String) context.getArguments();
-    }else if(context.getArguments() instanceof Vector ) {
-      
-    }else if (context.getArguments() instanceof Object[]) {
-      argsArray = (Object[]) context.getArguments();
-      argsList = Arrays.asList(argsArray);
-    }else {
-      System.out.println("AddFreeItemToOrders : Invalid Arguments");
-    }
-    
-    try {
-      c = CacheFactory.getAnyInstance();
-      ((GemFireCacheImpl)c).getCacheConfig().setPdxReadSerialized(true);
-      r = c.getRegion("orders");
-    } catch (CacheClosedException ex) {
-      vals.add("NoCacheFoundResult");
-      context.getResultSender().lastResult(vals);
-    }
-
-    String oql = "SELECT DISTINCT entry.key FROM /orders.entries entry WHERE entry.value.totalPrice > $1";
-    Object queryArgs[] = new Object[1];
-    queryArgs[0] = argsList.get(0);
-    
-    final Query query = c.getQueryService().newQuery(oql);
-
-    SelectResults result = null;
-    try {
-      result = (SelectResults) query.execute(queryArgs);
-      int resultSize = result.size();
-      
-      if (result instanceof Collection<?>)  
-        for (Object item : result) {
-          keys.add(item);
-        }
-    } catch (FunctionDomainException e) {
-     if(c != null)
-      c.getLogger().info("Caught FunctionDomainException while executing function AddFreeItemToOrders: " + e.getMessage());
-      
-    } catch (TypeMismatchException e) {
-      if(c != null)
-        c.getLogger().info("Caught TypeMismatchException while executing function AddFreeItemToOrders: " + e.getMessage()); 
-    } catch (NameResolutionException e) {
-      if(c != null)
-        c.getLogger().info("Caught NameResolutionException while executing function AddFreeItemToOrders: "  + e.getMessage());
-    } catch (QueryInvocationTargetException e) {
-      if(c != null)
-        c.getLogger().info("Caught QueryInvocationTargetException while executing function AddFreeItemToOrders" + e.getMessage());
-    }
-    
-    //class has to be in classpath.
-    try {
-      Item it = (Item)(argsList.get(1));
-      for(Object key : keys)
-      {
-        Object obj = r.get(key);
-        if(obj instanceof PdxInstance) {
-          PdxInstance pi = (PdxInstance)obj;
-          Order receivedOrder = (Order)pi.getObject();
-          receivedOrder.addItem(it);
-              
-          r.put(key, receivedOrder);
-        }
-      }
-      
-      context.getResultSender().lastResult("success");
-      
-    }catch (ClassCastException e) {
-      
-      context.getResultSender().lastResult("failure");
-    }catch (Exception e) {
-      context.getResultSender().lastResult("failure");
-    }
-    
-  }
-
-  public String getId() {
-    return "AddFreeItemToOrders";
-  }
-
-  @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    return false;
-  }
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Customer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Customer.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Customer.java
deleted file mode 100644
index 93ac63d..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Customer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.io.Serializable;
-import com.gemstone.gemfire.internal.lang.ObjectUtils;
-
-/**
- * The Customer class models a customer entity.
- * <p/>
- * @author Nilkanth Patel
- * @since 8.0
- */
-
-public class Customer implements Serializable {
-
-  private Long customerId;
-  private String firstName;
-  private String lastName;
-
-  public Customer() {
-  }
-
-  public Customer(final Long custId) {
-    this.customerId = custId;
-  }
-
-  public Customer(final Long custId, final String fname, final String lname) {
-    this.customerId = custId;
-    this.firstName = fname;
-    this.lastName = lname;
-  }
-
-  public Long getCustomerId() {
-    return customerId;
-  }
-
-  public void setCustomerId(Long customerId) {
-    this.customerId = customerId;
-  }
-
-  public String getFirstName() {
-    return firstName;
-  }
-
-  public void setFirstName(String firstName) {
-    this.firstName = firstName;
-  }
-
-  public String getLastName() {
-    return lastName;
-  }
-
-  public void setLastName(String lastName) {
-    this.lastName = lastName;
-  }
-
-  @Override
-  public boolean equals(final Object obj) {
-    if (obj == this) {
-      return true;
-    }
-
-    if (!(obj instanceof Customer)) {
-      return false;
-    }
-
-    final Customer that = (Customer) obj;
-
-    return (ObjectUtils.equals(this.getCustomerId(), that.getCustomerId())
-        && ObjectUtils.equals(this.getLastName(), that.getLastName()) && ObjectUtils
-          .equals(this.getFirstName(), that.getFirstName()));
-  }
-
-  @Override
-  public int hashCode() {
-    int hashValue = 17;
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getCustomerId());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getLastName());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getFirstName());
-    return hashValue;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder buffer = new StringBuilder("{ type = ");
-    buffer.append(getClass().getName());
-    buffer.append(", customerId = ").append(getCustomerId());
-    buffer.append(", firstName = ").append(getFirstName());
-    buffer.append(", lastName = ").append(getLastName());
-    buffer.append(" }");
-    return buffer.toString();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/DateTimeUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/DateTimeUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/DateTimeUtils.java
deleted file mode 100644
index 3a92df3..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/DateTimeUtils.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-public class DateTimeUtils {
-  public static Calendar createCalendar(final int year, final int month, final int day) {
-    final Calendar dateTime = Calendar.getInstance();
-    dateTime.clear();
-    dateTime.set(Calendar.YEAR, year);
-    dateTime.set(Calendar.MONTH, month);
-    dateTime.set(Calendar.DAY_OF_MONTH, day);
-    return dateTime;
-  }
-
-  public static Date createDate(final int year, final int month, final int day) {
-    return createCalendar(year, month, day).getTime();
-  }
-
-  public static String format(final Date dateTime, final String formatPattern) {
-    return (dateTime != null ? new SimpleDateFormat(formatPattern).format(dateTime) : null);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Gender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Gender.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Gender.java
deleted file mode 100644
index 9b00108..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Gender.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-/**
- * The Gender enum is a enumeration of genders (sexes).
- * <p/>
- * @author Nilkanth Patel, John Blum
- * @since 8.0
- */
-
-@SuppressWarnings("unused")
-public enum Gender {
-  FEMALE,
-  MALE
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetAllEntries.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetAllEntries.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetAllEntries.java
deleted file mode 100644
index cb85687..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetAllEntries.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-
-/**
- * The GetAllEntries is function that will return a map as a result of its execution.
- * <p/>
- * @author Nilkanth Patel
- * @since 8.0
- */
-
-public class GetAllEntries implements Function {
-
-  @Override
-  public void execute(FunctionContext context) {
-    Map<String, String> myMap = new HashMap();
-    myMap.put("k11", "v1");
-    myMap.put("k12", "v2");
-    myMap.put("k13", "v3");
-    myMap.put("k14", "v4");
-    myMap.put("k15", "v5");
-     
-    //return map as a function result
-    context.getResultSender().lastResult(myMap);
-  }
-
-  @Override
-  public String getId() {
-    return "GetAllEntries";
-  }
-
-  @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    return false;
-  }
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetDeliveredOrders.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetDeliveredOrders.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetDeliveredOrders.java
deleted file mode 100644
index 3a150a3..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetDeliveredOrders.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.query.FunctionDomainException;
-import com.gemstone.gemfire.cache.query.NameResolutionException;
-import com.gemstone.gemfire.cache.query.Query;
-import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
-import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.cache.query.TypeMismatchException;
-
-
-/**
-* The GetDeliveredOrders class is a gemfire function that gives details about delivered orders.
-* <p/>
-* @author Nilkanth Patel
-* @since 8.0
-*/
-
-public class GetDeliveredOrders  implements Function {
-  public void execute(FunctionContext context) {
-    
-    Cache c = null;
-    ArrayList<Object> vals = new ArrayList<Object>();
-    try {
-      c = CacheFactory.getAnyInstance();
-    } catch (CacheClosedException ex) {
-      vals.add("NoCacheFoundResult");
-      context.getResultSender().lastResult(vals);
-    }
-    
-    String oql = "SELECT o.purchaseOrderNo, o.deliveryDate  FROM /orders o WHERE o.deliveryDate != NULL";
-    final Query query = c.getQueryService().newQuery(oql);
-   
-    SelectResults result = null;
-    try {
-      result = (SelectResults) query.execute();
-      int resultSize = result.size();
-      
-      if(result instanceof Collection<?>)
-        for(Object item : result){
-          vals.add(item);
-        }
-    } catch (FunctionDomainException e) {
-      if(c != null)
-        c.getLogger().info("Caught FunctionDomainException while executing function GetDeliveredOrders: " + e.getMessage());
-        
-    } catch (TypeMismatchException e) {
-      if(c != null)
-        c.getLogger().info("Caught TypeMismatchException while executing function GetDeliveredOrders: " + e.getMessage());
-      
-    } catch (NameResolutionException e) {
-      if(c != null)
-        c.getLogger().info("Caught NameResolutionException while executing function GetDeliveredOrders: " + e.getMessage());
-      
-    } catch (QueryInvocationTargetException e) {
-      if(c != null)
-        c.getLogger().info("Caught QueryInvocationTargetException while executing function GetDeliveredOrders: " + e.getMessage());
-      
-    }
-    
-    context.getResultSender().lastResult(vals);
-  }
-
-  public String getId() {
-    return "GetDeliveredOrders";
-  }
-
-  @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    return false;
-  }
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetRegions.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetRegions.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetRegions.java
deleted file mode 100644
index d9e039b..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetRegions.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.util.ArrayList;
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-
-/**
-* The GetRegions class is an gemfire function that gives data about available regions.
-* <p/>
-* @author Nilkanth Patel
-* @since 8.0
-*/
-
-public class GetRegions implements Function  {
-
-  public void execute(FunctionContext context) {
-    
-    ArrayList<String> vals = new ArrayList<String>();
-    
-    Cache c = null;
-    try {
-      c = CacheFactory.getAnyInstance();
-    } catch (CacheClosedException ex) {
-      vals.add("NoCacheResult");
-      context.getResultSender().lastResult(vals);
-    }
-
-    final Set<Region<?, ?>> regionSet = c.rootRegions();
-    for (Region<?, ?> r : regionSet) {
-      vals.add(r.getName());
-    }
-    
-    context.getResultSender().lastResult(vals);
-  }
-
-  public String getId() {
-    return "GetRegions";
-  }
-
-  @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    return false;
-  }
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }
-};

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetValueForKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetValueForKey.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetValueForKey.java
deleted file mode 100644
index 25e87b6..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/GetValueForKey.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-
-public class GetValueForKey implements Function {
-  
-  @Override
-  public void execute(FunctionContext context) {  
-    Object args = context.getArguments();
-    
-    Cache cache = null;
-    
-    try{
-      cache = CacheFactory.getAnyInstance();
-      
-      if(args.toString().equalsIgnoreCase("1") ){
-        Region<String, Object> r = cache.getRegion("Products");
-        Object result = r.get("1");
-        context.getResultSender().lastResult(result);
-      
-      }else if(args.toString().equalsIgnoreCase("2")){
-        Region<String, Object> r = cache.getRegion("People");
-        Object result = r.get("2");
-        context.getResultSender().lastResult(result);      
-      }else{
-        //Default case
-        int i=10;
-        context.getResultSender().lastResult(i);
-      }
-    }catch(CacheClosedException e){
-      context.getResultSender().lastResult("Error: CacheClosedException");
-    }
-    
-  }
-
-  @Override
-  public String getId() {    
-    return "GetValueForKey";
-  }
-
-  @Override
-  public boolean hasResult() {
-    return true;
-  }
-
-  @Override
-  public boolean optimizeForWrite() {
-    return false;
-  }
-
-  @Override
-  public boolean isHA() {
-    return false;
-  }      
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Item.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Item.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Item.java
deleted file mode 100644
index 450ffda..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Item.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.io.Serializable;
-
-import com.gemstone.gemfire.internal.lang.ObjectUtils;
-import com.gemstone.gemfire.pdx.PdxReader;
-import com.gemstone.gemfire.pdx.PdxSerializable;
-import com.gemstone.gemfire.pdx.PdxWriter;
-
-/**
- * The Item class models item entity in the real world.
- * <p/>
- * @author Nilkanth Patel
- * @since 8.0
- */
-
-
-public class Item implements PdxSerializable {
-
-  private Long itemNo;
-  private String description;
-  private int quantity;
-  private float unitPrice;
-  private float totalPrice;
-
-  public Long getItemNo() {
-    return itemNo;
-  }
-
-  public void setItemNo(Long itemNo) {
-    this.itemNo = itemNo;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  public int getQuantity() {
-    return quantity;
-  }
-
-  public void setQuantity(int quantity) {
-    this.quantity = quantity;
-  }
-
-  public float getUnitPrice() {
-    return unitPrice;
-  }
-
-  public void setUnitPrice(final float unitprice) {
-    this.unitPrice = unitprice;
-  }
-
-  public float getTotalPrice() {
-    return totalPrice;
-  }
-
-  public void setTotalPrice(final float totalprice) {
-    this.totalPrice = totalprice;
-  }
-
-  public Item() {
-
-  }
-
-  public Item(final Long itemNumber) {
-    this.itemNo = itemNumber;
-  }
-
-  public Item(final Long itemNumber, final String desc, final int qty, final float uprice, final float tprice) {
-    this.itemNo = itemNumber;
-    this.description = desc;
-    this.quantity = qty;
-    this.unitPrice = uprice;
-    this.totalPrice = tprice;
-  }
-  
-  @Override
-  public boolean equals(final Object obj) {
-    if (obj == this) {
-      return true;
-    }
-
-    if (!(obj instanceof Item)) {
-      return false;
-    }
-
-    final Item that = (Item) obj;
-
-    return (ObjectUtils.equals(this.getItemNo(), that.getItemNo())
-        && ObjectUtils.equals(this.getDescription(), that.getDescription())
-        && ObjectUtils.equals(this.getQuantity(), that.getQuantity())
-        && ObjectUtils.equals(this.getQuantity(), that.getUnitPrice())
-        && ObjectUtils.equals(this.getQuantity(), that.getTotalPrice()));
-  }
-
-  @Override
-  public int hashCode() {
-    int hashValue = 17;
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getItemNo());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getDescription());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getQuantity());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getUnitPrice());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getTotalPrice());
-    return hashValue;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder buffer = new StringBuilder("{ type = ");
-    buffer.append(getClass().getName());
-    buffer.append(", itemNo = ").append(getItemNo());
-    buffer.append(", description = ").append(getDescription());
-    buffer.append(", quantity = ").append(getQuantity());
-    buffer.append(", unitPrice = ").append(getUnitPrice());
-    buffer.append(", totalPrice = ").append(getTotalPrice());
-    buffer.append(" }");
-    return buffer.toString();
-  }
-
-  @Override
-  public void toData(PdxWriter writer) {
-    writer.writeLong("itemNo", itemNo);
-    writer.writeString("description", description);
-    writer.writeInt("quantity", quantity);
-    writer.writeFloat("unitPrice", unitPrice);
-    writer.writeFloat("totalPrice", totalPrice);
-  }
-
-  @Override
-  public void fromData(PdxReader reader) {
-    itemNo = reader.readLong("itemNo");
-    description = reader.readString("description");
-    quantity = reader.readInt("quantity");
-    unitPrice = reader.readFloat("unitPrice");
-    totalPrice = reader.readFloat("totalPrice");
-    
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Order.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Order.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Order.java
deleted file mode 100644
index 34aefb2..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Order.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import com.gemstone.gemfire.pdx.PdxReader;
-import com.gemstone.gemfire.pdx.PdxSerializable;
-import com.gemstone.gemfire.pdx.PdxWriter;
-
-/**
-* The Order class is an abstraction modeling a order.
-* <p/>
-* @author Nilkanth Patel
-* @since 8.0
-*/
-
-public class Order implements PdxSerializable {
-  
-  private Long purchaseOrderNo;
-  private Long customerId;
-  private String description;
-  private Date orderDate;
-  private Date deliveryDate;
-  private String contact;
-  private String email;
-  private String phone;
-  private List<Item> items; 
-  private double totalPrice; 
-
-  public Order() {
-    items = new ArrayList<Item>();
-  }
-
-  public Order(final Long orderNo) {
-    this.purchaseOrderNo = orderNo;
-  }
-
-  public Order(final Long orderNo, final Long custId, final String desc,
-    final Date odate, final Date ddate, final String contact, final String email,
-    final String phone, final List<Item> items, final double tprice) {
-    this.purchaseOrderNo = orderNo;
-    this.customerId = custId;
-    this.description = desc;
-    this.orderDate = odate;
-    this.deliveryDate = ddate;
-    this.contact = contact;
-    this.email = email;
-    this.phone = phone;
-    this.items = items;
-    this.totalPrice = tprice;
-  }
-
-  public void addItem(final Item item) {
-    if (item != null)
-      this.items.add(item);
-  }
-
-  public Long getPurchaseOrderNo() {
-    return purchaseOrderNo;
-  }
-
-  public void setPurchaseOrderNo(Long purchaseOrderNo) {
-    this.purchaseOrderNo = purchaseOrderNo;
-  }
-
-  public Long getCustomerId() {
-    return customerId;
-  }
-
-  public void setCustomerId(Long customerId) {
-    this.customerId = customerId;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  public Date getDeliveryDate() {
-    return deliveryDate;
-  }
-
-  public void setDeliveryDate(Date date) {
-    this.deliveryDate = date;
-  }
-
-  public String getContact() {
-    return contact;
-  }
-
-  public void setContact(String contact) {
-    this.contact = contact;
-  }
-
-  public String getEmail() {
-    return email;
-  }
-
-  public void setEmail(String email) {
-    this.email = email;
-  }
-
-  public String getPhone() {
-    return phone;
-  }
-
-  public void setPhone(String phone) {
-    this.phone = phone;
-  }
-
-  public List<Item> getItems() {
-    return items;
-  }
-  
-  public void setItems(List<Item> items) {
-    if(this.items == null)
-      this.items = new ArrayList<Item>();
-    
-    for (Item it : items)
-      this.items.add(it);
-  }
-
-  public Date getOrderDate() {
-    return orderDate;
-  }
-
-  public void setOrderDate(Date orderDate) {
-    this.orderDate = orderDate;
-  }
-
-  public double getTotalPrice() {
-    return totalPrice;
-  }
-
-  public void setTotalPrice(double totalPrice) {
-    this.totalPrice = totalPrice;
-  }
-
-  @Override
-  public void toData(PdxWriter writer) {
-    writer.writeLong("purchaseOrderNo", purchaseOrderNo);
-    writer.writeLong("customerId", customerId);
-    writer.writeString("description", description);
-    writer.writeDate("orderDate", orderDate);
-    writer.writeDate("deliveryDate", deliveryDate);
-    writer.writeString("contact", contact);
-    writer.writeString("email", email);
-    writer.writeString("phone", phone);
-    writer.writeObject("items", items);
-    writer.writeDouble("totalPrice", totalPrice);
-  }
-
-  @Override
-  public void fromData(PdxReader reader) {
-    purchaseOrderNo = reader.readLong("purchaseOrderNo");
-    customerId = reader.readLong("customerId");
-    description = reader.readString("description");
-    orderDate = reader.readDate("orderDate");
-    deliveryDate = reader.readDate("deliveryDate");
-    contact = reader.readString("contact");
-    email = reader.readString("email");
-    phone = reader.readString("phone");
-    items = (List<Item>)reader.readObject("items");
-    totalPrice = reader.readDouble("totalPrice");
-    
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Person.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Person.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Person.java
deleted file mode 100644
index b5b5459..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/Person.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.util.Date;
-import com.gemstone.gemfire.internal.lang.ObjectUtils;
-import com.gemstone.gemfire.pdx.PdxReader;
-import com.gemstone.gemfire.pdx.PdxSerializable;
-import com.gemstone.gemfire.pdx.PdxWriter;
-
-import java.io.Serializable;
-
-/**
-* The Person class is an abstraction modeling a person.
-* <p/>
-* @author Nilkanth Patel, John Blum
-* @since 8.0
-*/
-@SuppressWarnings("unused")
-public class Person implements PdxSerializable {
-
-  private static final long serialVersionUID = 42108163264l;
-  
-  protected static final String DOB_FORMAT_PATTERN = "MM/dd/yyyy";
-  
-  private  Long id;
-  
-  private Date birthDate;
-  
-  private Gender gender;
-  
-  private String firstName;
-  private String middleName;
-  private String lastName;
-  
-  public Person() {
-  }
-  
-  public Person(final Long id) {
-    this.id = id;
-  }
-  
-  public Person(final String firstName, final String lastName) {
-    this.firstName = firstName;
-    this.lastName = lastName;
-  }
-  
-  public Person(Long id, String fn, String mn, String ln, Date bDate, Gender g) {
-    this.id = id;
-    this.firstName = fn;
-    this.middleName = mn;
-    this.lastName = ln;
-    this.birthDate = bDate;
-    this.gender = g;
-  }
-  
-  public Long getId() {
-    return id;
-  }
-  
-  public void setId(final Long id) {
-    this.id = id;
-  }
-  
-  public String getFirstName() {
-    return firstName;
-  }
-  
-  public void setFirstName(final String firstName) {
-    this.firstName = firstName;
-  }
-  
-  public String getLastName() {
-    return lastName;
-  }
-  
-  public void setLastName(final String lastName) {
-    this.lastName = lastName;
-  }
-  
-  public String getMiddleName() {
-    return middleName;
-  }
-  
-  public void setMiddleName(final String middleName) {
-    this.middleName = middleName;
-  }
-  
-  public Date getBirthDate() {
-    return birthDate;
-  }
-  
-  public void setBirthDate(final Date birthDate) {
-    this.birthDate = birthDate;
-  }
-  
-  public Gender getGender() {
-    return gender;
-  }
-  
-  public void setGender(final Gender gender) {
-    this.gender = gender;
-  }
-  
-  @Override
-  public boolean equals(final Object obj) {
-    if (obj == this) {
-      return true;
-    }
-  
-    if (!(obj instanceof Person)) {
-      return false;
-    }
-  
-    final Person that = (Person) obj;
-  
-    return (ObjectUtils.equals(this.getId(), that.getId())
-      || (ObjectUtils.equals(this.getBirthDate(), that.getBirthDate())
-      && ObjectUtils.equals(this.getLastName(), that.getLastName())
-      && ObjectUtils.equals(this.getFirstName(), that.getFirstName())));
-  }
-  
-  @Override
-  public int hashCode() {
-    int hashValue = 17;
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getId());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getBirthDate());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getLastName());
-    hashValue = 37 * hashValue + ObjectUtils.hashCode(getFirstName());
-    return hashValue;
-  }
-  
-  @Override
-  public String toString() {
-    final StringBuilder buffer = new StringBuilder("{ type = ");
-    buffer.append(getClass().getName());
-    buffer.append(", id = ").append(getId());
-    buffer.append(", firstName = ").append(getFirstName());
-    buffer.append(", middleName = ").append(getMiddleName());
-    buffer.append(", lastName = ").append(getLastName());
-    buffer.append(", birthDate = ").append(DateTimeUtils.format(getBirthDate(), DOB_FORMAT_PATTERN));
-    buffer.append(", gender = ").append(getGender());
-    buffer.append(" }");
-    return buffer.toString();
-  }
-  
-  @Override
-  public void toData(PdxWriter writer) {
-    writer.writeString("@type", getClass().getName());
-    writer.writeLong("id", id);
-    writer.writeString("firstName", firstName);
-    writer.writeString("middleName", middleName);
-    writer.writeString("lastName", lastName);
-    writer.writeObject("gender", gender);
-    writer.writeDate("birthDate", birthDate);
-    
-  }
-  
-  @Override
-  public void fromData(PdxReader reader) {
-    String type = reader.readString("@type");
-    id = reader.readLong("id");
-    firstName = reader.readString("firstName");
-    middleName = reader.readString("middleName");
-    lastName = reader.readString("lastName");
-    gender = (Gender)reader.readObject("gender");
-    birthDate = reader.readDate("birthDate");
-    
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/PutKeyFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/PutKeyFunction.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/PutKeyFunction.java
deleted file mode 100644
index e75d9fc..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/PutKeyFunction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.util.Properties;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.execute.Function;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
-
-
-/**
- * Function that puts the value from the argument at the key passed in through
- * the filter.
- */
-
-public class PutKeyFunction implements Function {
-
-  private static final String ID = "PutKeyFunction";
-
-  public void execute(FunctionContext context) {
-    RegionFunctionContext regionContext = (RegionFunctionContext)context;
-    Region dataSet = regionContext.getDataSet();
-    Object key = regionContext.getFilter().iterator().next();
-    Object value = regionContext.getArguments();
-    dataSet.put(key, value);
-    context.getResultSender().lastResult(Boolean.TRUE);
-  }
-
-  public String getId() {
-    return ID;
-  }
-
-  public boolean hasResult() {
-    return true;
-  }
-
-  public void init(Properties p) {
-  }
-
-  public boolean optimizeForWrite() {
-    return true;
-  }
-  public boolean isHA() {
-    return true;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9b55879e/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
deleted file mode 100644
index 50965f6..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.rest.internal.web.controllers;
-
-import java.util.Properties;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-
-public class RestAPITestBase extends DistributedTestCase {
-  private static final long serialVersionUID = 1L;
-  public static Cache cache = null;
-  VM vm0 = null;
-  VM vm1 = null;
-  VM vm2 = null;
-  VM vm3 = null;
-  
-  public RestAPITestBase(String name) {
-    super(name);
-  }
-  
-  
-  @Override
-  public void setUp() throws Exception {
-    super.setUp();
-    disconnectAllFromDS();
-    Wait.pause(5000);
-    final Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    vm2 = host.getVM(2);
-    vm3 = host.getVM(3);
-  }  
-  
-  /**
-   * close the clients and teh servers
-   */
-  @Override
-  protected final void preTearDown() throws Exception {
-    vm0.invoke(() -> closeCache());
-    vm1.invoke(() -> closeCache());
-    vm2.invoke(() -> closeCache());
-    vm3.invoke(() -> closeCache());
-  }
-
-  /**
-   * close the cache
-   * 
-   */
-  public static void closeCache() {
-    if (cache != null && !cache.isClosed()) {
-      cache.close();
-      cache.getDistributedSystem().disconnect();
-    }
-  }
-  
-  protected static String createCache(VM currentVM) {
-    
-    RestAPITestBase test = new RestAPITestBase(getTestMethodName());
-    
-    final String hostName = currentVM.getHost().getHostName();
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    
-    Properties props = new Properties();
-    
-    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(serverPort));
-    
-
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-    return "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
-    
-  }
-  
-  public static String createCacheWithGroups (VM vm, final String groups, final String regionName ) {
-    RestAPITestBase test = new RestAPITestBase(getTestMethodName());
-    
-    final String hostName = vm.getHost().getHostName(); 
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    
-    Properties props = new Properties();
-    
-    if(groups != null) {
-      props.put("groups", groups);
-    }
-    
-    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(serverPort));
-    
-    InternalDistributedSystem ds = test.getSystem(props);
-    cache = CacheFactory.create(ds);
-    
-    String restEndPoint =  "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
-    return restEndPoint; 
-  }
-  
-}


Mime
View raw message