public void run2() throws CacheException { final Cache cache; try { CacheXml30Test.lonerDistributedSystem = false; cache = getCache(); } finally { CacheXml30Test.lonerDistributedSystem = true; } Region region = cache.getRegion(regionName); assertNotNull(region); RegionAttributes attrs = region.getAttributes(); assertNotNull(attrs.getPartitionAttributes()); PartitionAttributes pa = attrs.getPartitionAttributes(); // assertNull(pa.getCacheWriter()); assertEquals(pa.getRedundantCopies(), 1); assertEquals(pa.getGlobalProperties().getProperty( PartitionAttributesFactory.GLOBAL_MAX_MEMORY_PROPERTY), "96"); assertEquals(pa.getLocalProperties().getProperty( PartitionAttributesFactory.LOCAL_MAX_MEMORY_PROPERTY), "32"); } };
public Object load(LoaderHelper helper) throws CacheLoaderException { /* checking the attributes set in xml file */ PartitionedRegion pr = (PartitionedRegion) helper.getRegion(); if (pr.getAttributes().getPartitionAttributes().getRedundantCopies() != 1) Assert .fail("Redundancy of the partition region is not 1"); Assert.assertEquals(pr.getAttributes() .getPartitionAttributes().getGlobalProperties().getProperty( PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_PROPERTY), "11"); Assert.assertEquals(pr.getAttributes() .getPartitionAttributes().getLocalMaxMemory(), 200); /* * Returning the same key. This is to check CaccheLoader is invoked or * not */ return helper.getKey(); }
aStr.append(" globalProperties: " + parAttr.getGlobalProperties() + "\n"); aStr.append(" partitonResolver: " + parAttr.getPartitionResolver()+ "\n"); aStr.append(" colocatedWith: " + parAttr.getColocatedWith() + "\n");
generate(p, LOCAL_PROPERTIES); p = pa.getGlobalProperties(); generate(p, GLOBAL_PROPERTIES);
generate(p, LOCAL_PROPERTIES); p = pa.getGlobalProperties(); generate(p, GLOBAL_PROPERTIES);
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setOffHeap(((PartitionAttributesImpl) pa).getOffHeap()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setEnableOffHeapMemory(((PartitionAttributesImpl) pa).getEnableOffHeapMemory()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }