@Test
  public void testAfterCallbacks() {
    region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, getDiskRegionProperties(),
        Scope.LOCAL);

    // testing create callbacks
    region.getAttributesMutator().addCacheListener(new CacheListenerAdapter() {
      @Override
      public void afterCreate(EntryEvent event) {
        intoCreateAfterCbk = true;
      }
    });
    region.getAttributesMutator().setCacheWriter(new CacheWriterAdapter() {
      @Override
      public void beforeCreate(EntryEvent event) {
        region.clear();
      }
    });
    region.create("key1", "createValue");
    assertTrue("Create callback not called", intoCreateAfterCbk);

    // testing update callbacks
    region.getAttributesMutator().addCacheListener(new CacheListenerAdapter() {
      @Override
      public void afterUpdate(EntryEvent event) {
        intoUpdateAfterCbk = true;
      }
    });
    region.getAttributesMutator().setCacheWriter(new CacheWriterAdapter() {
      @Override
      public void beforeUpdate(EntryEvent event) {
        region.clear();
      }
    });
    region.create("key2", "createValue");
    region.put("key2", "updateValue");
    assertTrue("Update callback not called", intoUpdateAfterCbk);

    // testing destroy callbacks
    region.getAttributesMutator().addCacheListener(new CacheListenerAdapter() {
      @Override
      public void afterDestroy(EntryEvent event) {
        intoDestroyAfterCbk = true;
      }
    });
    region.getAttributesMutator().setCacheWriter(new CacheWriterAdapter() {
      @Override
      public void beforeDestroy(EntryEvent event) {
        region.clear();
      }
    });
    region.create("key3", "createValue");
    region.destroy("key3");
    assertTrue("Destroy callback not called", intoDestroyAfterCbk);
  }
Tests if callbacks are getting invoked correctly for 'create', 'update' and 'destroy' of disk
region entries with concurrent 'clear'
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegCbkChkJUnitTest.java