MappingCommandUtils { public static boolean isPartition(RegionAttributesType attributesType) { boolean isPartitioned = false; if (attributesType.getDataPolicy() != null) { isPartitioned = attributesType.getDataPolicy().isPartition(); } else if (attributesType.getRefid() != null) { isPartitioned = RegionShortcut.valueOf(attributesType.getRefid()).isPartition(); } return isPartitioned; }  static CacheConfig getCacheConfig(ConfigurationPersistenceService configService,
      String group); static RegionConfig checkForRegion(String regionName, CacheConfig cacheConfig,
      String groupName); static ArrayList<RegionMapping> getMappingsFromRegionConfig(CacheConfig cacheConfig,
      RegionConfig regionConfig,
      String group); static boolean isMappingSynchronous(CacheConfig cacheConfig, RegionConfig regionConfig); static CacheConfig.AsyncEventQueue findAsyncEventQueue(CacheConfig cacheConfig,
      RegionConfig regionConfig); static boolean isAccessor(RegionAttributesType attributesType); static boolean isPartition(RegionAttributesType attributesType); static String createAsyncEventQueueName(String regionPath);  }
@Test public void testIsPartitionWithPartitionDataPolicyReturnsTrue() { when(regionAttributesType.getDataPolicy()).thenReturn(RegionAttributesDataPolicy.PARTITION); boolean result = MappingCommandUtils.isPartition(regionAttributesType); assertThat(result).isEqualTo(true); }
@Test public void testIsPartitionWithPersistentPartitionDataPolicyReturnsTrue() { when(regionAttributesType.getDataPolicy()) .thenReturn(RegionAttributesDataPolicy.PERSISTENT_PARTITION); boolean result = MappingCommandUtils.isPartition(regionAttributesType); assertThat(result).isEqualTo(true); }
@Test public void testIsPartitionWithPersistentPartitionRefidReturnsTrue() { when(regionAttributesType.getRefid()).thenReturn(RegionShortcut.PARTITION.name()); boolean result = MappingCommandUtils.isPartition(regionAttributesType); assertThat(result).isEqualTo(true); }
@Test public void testIsPartitionWithLocalRefidReturnsFalse() { when(regionAttributesType.getRefid()).thenReturn(RegionShortcut.LOCAL.name()); boolean result = MappingCommandUtils.isPartition(regionAttributesType); assertThat(result).isEqualTo(false); }
@Test public void testIsPartitionWithDataPolicyAndRefidIsNullReturnsFalse() { when(regionAttributesType.getDataPolicy()).thenReturn(null); when(regionAttributesType.getRefid()).thenReturn(null); boolean result = MappingCommandUtils.isPartition(regionAttributesType); assertThat(result).isEqualTo(false); }
@Test public void testIsPartitionWithReplicateDataPolicyReturnsFalse() { when(regionAttributesType.getDataPolicy()).thenReturn(RegionAttributesDataPolicy.REPLICATE); boolean result = MappingCommandUtils.isPartition(regionAttributesType); assertThat(result).isEqualTo(false); }