@Override
      public void run() throws Exception {
        TXManagerImpl mgr = getGemfireCache().getTxManager();
        Region<OrderId, Order> orderRegion = getCache().getRegion(ORDER);
        LocalRegion lr = (LocalRegion) orderRegion;
        assertEquals(DataPolicy.NORMAL, orderRegion.getAttributes().getDataPolicy());
        CustId custId = new CustId(1);
        OrderId orderId = new OrderId(1, custId);
        Set setWithoutTX = orderRegion.keySet();
        Iterator iterWithoutTX = setWithoutTX.iterator();
        if (!iterWithoutTX.hasNext()) {
          org.apache.geode.test.dunit.LogWriterUtils.getLogWriter().info("No keys in region");
        } else {
          org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
              .info("Region size:" + orderRegion.size());
        }
        // without tx, the local region with NORMAL policy will get nothing from server
        assertFalse(iterWithoutTX.hasNext());
        assertEquals(0, orderRegion.size());
        assertNull(lr.entries.getEntry(orderId));

        org.apache.geode.test.dunit.LogWriterUtils.getLogWriter().info("Now check with TX");

        mgr.begin();

        Set setWithTX = orderRegion.keySet();
        Iterator iterWithTX = setWithTX.iterator();
        if (!iterWithTX.hasNext()) {
          org.apache.geode.test.dunit.LogWriterUtils.getLogWriter().info("No keys in region");
        } else {
          org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
              .info("Region size:" + orderRegion.size());
        }
        // with tx, the local region keySet() will get keys from server, but lr.entries is still
        // empty
        assertTrue(iterWithTX.hasNext());
        assertEquals(5, orderRegion.size());

        assertEquals(0, lr.entries.size());
        Set aSet = lr.entries.keySet();
        Iterator iter = aSet.iterator();
        assertFalse(iter.hasNext());
        assertNull(lr.entries.getEntry(orderId));
        assertNotNull(lr.getEntry(orderId));

        mgr.commit();
      }
Tests the basic client-server transaction functionality
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java