private void createCache(boolean copyOnRead) throws CacheException {
    Properties p = new Properties();
    p.setProperty(MCAST_PORT, "0"); // loner
    cache = CacheFactory.create(DistributedSystem.connect(p));
    cache.setCopyOnRead(copyOnRead);

    AttributesFactory af = new AttributesFactory();
    af.setScope(Scope.LOCAL);
    af.setCacheListener(new CacheListenerAdapter() {
      @Override
      public void afterCreate(EntryEvent event) {
        oldValue = event.getOldValue();
        newValue = event.getNewValue();
      }

      @Override
      public void afterUpdate(EntryEvent event) {
        oldValue = event.getOldValue();
        newValue = event.getNewValue();
      }

      @Override
      public void afterInvalidate(EntryEvent event) {
        oldValue = event.getOldValue();
        newValue = event.getNewValue();
      }

      @Override
      public void afterDestroy(EntryEvent event) {
        oldValue = event.getOldValue();
        newValue = event.getNewValue();
      }

      @Override
      public void afterRegionInvalidate(RegionEvent event) {
        // ignore
      }

      @Override
      public void afterRegionDestroy(RegionEvent event) {
        // ignore
      }

      @Override
      public void close() {
        oldValue = null;
        newValue = null;
      }
    });
    region = cache.createRegion("CopyJUnitTest", af.create());
  }
Tests the functionality of the {@link CopyHelper#copy} method and the builtin copy-on-get Cache
functions.

@since GemFire 4.0
geode-core/src/integrationTest/java/org/apache/geode/CopyJUnitTest.java