RegionConfigRealizer implements ConfigurationRealizer<Region, RuntimeRegionInfo> { @Override public RealizationResult create(Region regionConfig, InternalCache cache) { RegionConfig xmlConfig = converter.fromConfigObject(regionConfig); return create(xmlConfig, regionConfig.getName(), cache); }  @Override RealizationResult create(Region regionConfig, InternalCache cache); RealizationResult create(RegionConfig regionConfig, String regionPath,
      InternalCache cache); @Override RuntimeRegionInfo get(Region config, InternalCache cache); @Override boolean exists(Region config, InternalCache cache); @Override RealizationResult update(Region config, InternalCache cache); @Override RealizationResult delete(Region config, InternalCache cache);  }
@Test public void createsPartitionedInCache() { config.setType(RegionType.PARTITION); validator.validate(CacheElementOperation.CREATE, config); realizer.create(config, cache); verify(regionFactory).create("test"); verify(regionFactory).setDataPolicy(DataPolicy.PARTITION); }
@Test public void createsReplicateInCache() { config.setType(RegionType.REPLICATE); validator.validate(CacheElementOperation.CREATE, config); realizer.create(config, cache); verify(regionFactory).create("test"); verify(regionFactory).setDataPolicy(DataPolicy.REPLICATE); }
@Test public void createPartitionRegion() throws Exception { config.setType(RegionType.PARTITION); config.setRedundantCopies(2); realizer.create(config, cache); verify(regionFactory).setDataPolicy(DataPolicy.PARTITION); ArgumentCaptor<PartitionAttributes> argumentCaptor = ArgumentCaptor.forClass(PartitionAttributes.class); verify(regionFactory).setPartitionAttributes(argumentCaptor.capture()); assertThat(argumentCaptor.getValue().getRedundantCopies()).isEqualTo(2); }
@Test public void getRegionFactoryWhenValueNotSet() throws Exception { config.setType(RegionType.REPLICATE); config.setDiskStoreName(null); config.setKeyConstraint(null); config.setValueConstraint(null); realizer.create(config, cache); verify(regionFactory, never()).setKeyConstraint(any()); verify(regionFactory, never()).setValueConstraint(any()); verify(regionFactory, never()).setDiskStoreName(any()); verify(regionFactory).setDataPolicy(DataPolicy.REPLICATE); }