@Test
  public void testAllMethodsWithTX() throws Exception {
    Object cbArg = new Object();
    AttributesFactory af = new AttributesFactory();
    af.setDataPolicy(DataPolicy.EMPTY);
    setCallbacks(af);
    clearCallbackState();
    CacheTransactionManager ctm = c.getCacheTransactionManager();
    ExpectedRegionEvent expre = new ExpectedRegionEvent();

    Region r = c.createRegion("r", af.create());
    expre.r = r;
    expre.cbArg = null;
    expre.op = Operation.REGION_CREATE;
    checkNoCW();
    checkNoTL();
    checkCL(expre);

    long creates = getStats().getCreates();
    long destroys = getStats().getDestroys();
    long invalidates = getStats().getInvalidates();
    ExpectedEntryEvent expee = new ExpectedEntryEvent();
    expee.r = r;
    expee.key = "key";

    ctm.begin();
    try {
      r.localInvalidate("key");
      fail("expected EntryNotFoundException");
    } catch (EntryNotFoundException ignored) {
    }
    try {
      r.localDestroy("key");
      fail("expected EntryNotFoundException");
    } catch (EntryNotFoundException ignored) {
    }
    ctm.rollback();

    ctm.begin();
    expee.txId = ctm.getTransactionId();
    r.put("key", "value", cbArg);
    expee.op = Operation.CREATE;
    expee.cbArg = cbArg;
    expee.newValue = "value";
    checkCW(expee);
    checkNoTL();
    checkNoCL();
    clearCallbackState();
    ctm.commit();
    checkCL(expee, false/* ClearCallbacks */);
    checkTL(expee);
    creates++;
    assertEquals(creates, getStats().getCreates());

    ctm.begin();
    expee.txId = ctm.getTransactionId();
    r.create("key", "value", cbArg);
    expee.op = Operation.CREATE;
    expee.cbArg = cbArg;
    expee.newValue = "value";
    checkCW(expee);
    checkNoTL();
    checkNoCL();
    clearCallbackState();
    ctm.commit();
    checkCL(expee, false/* ClearCallbacks */);
    checkTL(expee);
    creates++;
    assertEquals(creates, getStats().getCreates());

    ctm.begin();
    expee.txId = ctm.getTransactionId();
    r.invalidate("key", cbArg);
    expee.op = Operation.INVALIDATE;
    expee.cbArg = cbArg;
    expee.newValue = null;
    checkNoCW();
    checkNoTL();
    checkNoCL();
    clearCallbackState();
    ctm.commit();
    checkCL(expee, false/* ClearCallbacks */);
    invalidates++;
    assertEquals(invalidates, getStats().getInvalidates());
    checkTL(expee);

    ctm.begin();
    expee.txId = ctm.getTransactionId();
    r.destroy("key", cbArg);
    expee.op = Operation.DESTROY;
    expee.cbArg = cbArg;
    expee.newValue = null;
    checkCW(expee);
    checkNoTL();
    checkNoCL();
    clearCallbackState();
    ctm.commit();
    checkCL(expee, false/* ClearCallbacks */);
    destroys++;
    assertEquals(destroys, getStats().getDestroys());
    checkTL(expee);

    ctm.begin();
    expee.txId = ctm.getTransactionId();
    r.create("key", "value", cbArg);
    r.destroy("key", cbArg);
    clearCallbackState();
    ctm.commit();
    destroys++;
    assertEquals(destroys, getStats().getDestroys());
    expee.op = Operation.DESTROY;
    checkTL(expee);

    // the following confirms that bug 37903 is fixed
    ctm.begin();
    expee.txId = ctm.getTransactionId();
    r.invalidate("key");
    r.localInvalidate("key");
    r.localDestroy("key", cbArg);
    // note that the following would fail on a non-proxy with EntryNotFound
    // so it should also fail on a proxy
    try {
      // note if bug 37903 exists then the next line will throw an AssertionError
      r.destroy("key", cbArg);
      fail("expected EntryNotFoundException");
    } catch (EntryNotFoundException ignored) {
    }
    clearCallbackState();
    ctm.commit();
    destroys++;
    assertEquals(destroys, getStats().getDestroys());
    expee.op = Operation.LOCAL_DESTROY;
    checkTL(expee);
  }
Check region ops on a proxy region done from a tx.
geode-core/src/integrationTest/java/org/apache/geode/cache/ProxyJUnitTest.java