Github user davinash commented on a diff in the pull request: https://github.com/apache/geode/pull/390#discussion_r103070526 --- Diff: geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java --- @@ -773,6 +755,73 @@ public void clientIsPreventedFromConnectingToLocatorAsServer() throws Exception } + private void proxyRegionClientServerOp(RegionShortcut shortcut) throws Exception { + // start server first + final String REGION_NAME = "proxyRegionClientServerOp"; + PORT1 = initServerCache(false); + // Create regions on servers. + server1.invoke(new SerializableCallable() { + @Override + public Object call() throws Exception { + Cache c = CacheFactory.getAnyInstance(); + assertNotNull(c); + Region<Object, Object> r = c.createRegionFactory(shortcut).create(REGION_NAME); + assertNotNull(r); + return null; + } + }); + + String host = NetworkUtils.getServerHostName(server1.getHost()); + + Properties props = new Properties(); + props.setProperty(MCAST_PORT, "0"); + props.setProperty(LOCATORS, ""); + ClientCacheFactory ccf = new ClientCacheFactory(props); + ccf.addPoolServer(host, PORT1); + + ClientCache clientCache = ccf.create(); + Region<Object, Object> clientRegion = + clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME); + assertNotNull(clientRegion); + + // let us populate this region from client. + for (int i = 0; i < 10; i++) { + clientRegion.put(i, i * 10); + } + // Verify using gets + for (int i = 0; i < 10; i++) { + assertEquals(i * 10, clientRegion.get(i)); + } + assertEquals(10, clientRegion.size()); + assertFalse(clientRegion.isEmpty()); + // delete all the entries from the server + server1.invoke(new SerializableCallable() { + @Override + public Object call() throws Exception { + Cache c = CacheFactory.getAnyInstance(); + assertNotNull(c); + Region<Object, Object> r = c.getRegion(REGION_NAME); + assertNotNull(r); + for (int i = 0; i < 10; i++) { + r.remove(i); + } + return null; + } + }); + assertEquals(0, clientRegion.size()); + assertTrue(clientRegion.isEmpty()); + + clientRegion.destroyRegion(); + clientCache.close(); + } + + @Test --- End diff -- Done.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---