CacheConfig { public List<RegionConfig> getRegions() { if (regions == null) { regions = new ArrayList<RegionConfig>(); } return this.regions; } CacheConfig();  CacheConfig(String version); CacheTransactionManagerType getCacheTransactionManager(); void setCacheTransactionManager(CacheTransactionManagerType value); DynamicRegionFactoryType getDynamicRegionFactory(); void setDynamicRegionFactory(DynamicRegionFactoryType value); List<GatewayHub> getGatewayHubs(); List<GatewaySender> getGatewaySenders(); GatewayReceiverConfig getGatewayReceiver(); void setGatewayReceiver(GatewayReceiverConfig value); DeclarableType getGatewayConflictResolver(); void setGatewayConflictResolver(DeclarableType value); List<AsyncEventQueue> getAsyncEventQueues(); List<CacheServer> getCacheServers(); List<PoolType> getPools(); List<DiskStoreType> getDiskStores(); PdxType getPdx(); void setPdx(PdxType value); List<RegionAttributesType> getRegionAttributes(); List<JndiBindingsType.JndiBinding> getJndiBindings(); List<RegionConfig> getRegions(); FunctionServiceType getFunctionService(); void setFunctionService(FunctionServiceType value); ResourceManagerType getResourceManager(); void setResourceManager(ResourceManagerType value); SerializationRegistrationType getSerializationRegistration(); void setSerializationRegistration(SerializationRegistrationType value); List<String> getBackups(); DeclarableType getInitializer(); void setInitializer(DeclarableType value); List<CacheElement> getCustomCacheElements(); Boolean isCopyOnRead(); void setCopyOnRead(Boolean value); Boolean isIsServer(); void setIsServer(Boolean value); String getLockTimeout(); void setLockTimeout(String value); String getLockLease(); void setLockLease(String value); String getMessageSyncInterval(); void setMessageSyncInterval(String value); String getSearchTimeout(); void setSearchTimeout(String value); String getVersion(); void setVersion(String value); RegionConfig findRegionConfiguration(String regionPath); List<T> findCustomCacheElements(Class<T> classT); T findCustomCacheElement(String elementId, Class<T> classT); List<T> findCustomRegionElements(String regionPath,
      Class<T> classT); T findCustomRegionElement(String regionPath, String elementId,
      Class<T> classT); @Deprecated
  static final String SEPARATOR; }
@Test public void indexType() { String xml = cacheXml + regionXml + "<index name=\"indexName\" expression=\"expression\" key-index=\"true\"/>" + "</region></cache>"; cacheConfig = service.unMarshall(xml); RegionConfig.Index index = cacheConfig.getRegions().get(0).getIndexes().get(0); assertThat(index.isKeyIndex()).isTrue(); assertThat(index.getName()).isEqualTo("indexName"); assertThat(index.getExpression()).isEqualTo("expression"); assertThat(index.getType()).isEqualTo("key"); }
@Test public void regionEntry() { String xml = cacheXml + regionXml + "<entry>" + "<key><string>key1</string></key>" + "<value><declarable>" + declarableWithStringXml + "</declarable></value>" + "</entry>" + "<entry>" + "<key><string>key2</string></key>" + "<value><declarable>" + declarableWithParamXml + "</declarable></value>" + "</entry>" + "</region></cache>"; cacheConfig = service.unMarshall(xml); RegionConfig.Entry entry = cacheConfig.getRegions().get(0).getEntries().get(0); assertThat(entry.getKey().toString()).isEqualTo("key1"); assertThat(entry.getValue().getDeclarable()).isEqualTo(declarableWithString); entry = cacheConfig.getRegions().get(0).getEntries().get(1); assertThat(entry.getKey().toString()).isEqualTo("key2"); assertThat(entry.getValue().getDeclarable()).isEqualTo(declarableWithParam); }
@Test public void regionConfig() { cacheConfig = new CacheConfig("1.0"); RegionConfig regionConfig = new RegionConfig(); regionConfig.setName("test"); regionConfig.setType(RegionType.REPLICATE); RegionAttributesType attributes = new RegionAttributesType(); attributes.setCacheLoader(new DeclarableType("abc.Foo")); regionConfig.setRegionAttributes(attributes); cacheConfig.getRegions().add(regionConfig); String xml = service.marshall(cacheConfig); CacheConfig newCache = service.unMarshall(xml); assertThat(cacheConfig).isEqualToComparingFieldByFieldRecursively(newCache); }