use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class PartitionedRegionBucketCreationDistributionDUnitTest method testEnforceUniqueHostForLonerDistributedSystem.
/**
* Added for defect #47181. Use below combination to reproduce the issue: mcast-port = 0 Locators
* should be empty enforce-unique-host = true redundancy-zone = "zone"
*/
@Test
public void testEnforceUniqueHostForLonerDistributedSystem() {
Cache myCache = createLonerCacheWithEnforceUniqueHost();
try {
AttributesFactory attr = new AttributesFactory();
PartitionAttributesFactory paf = new PartitionAttributesFactory();
PartitionAttributes prAttr = paf.create();
attr.setPartitionAttributes(prAttr);
RegionAttributes regionAttribs = attr.create();
Region region = myCache.createRegion("PR1", regionAttribs);
for (int i = 0; i < 113; i++) {
region.put("Key_" + i, new Integer(i));
}
// verify region size
assertEquals(113, region.size());
} finally {
myCache.close();
myCache.getDistributedSystem().disconnect();
}
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class PartitionedRegionCreationDUnitTest method getCacheSerializableRunnableForPRInitialize.
/**
* This function tests root, allpartition region and their scope and mirrortype attribute.
*/
public CacheSerializableRunnable getCacheSerializableRunnableForPRInitialize() {
SerializableRunnable initializePrRegion;
initializePrRegion = new CacheSerializableRunnable("initialize") {
@Override
public void run2() throws CacheException {
Cache cache = getCache();
Region root = cache.getRegion(PartitionedRegionHelper.PR_ROOT_REGION_NAME);
if (root == null)
fail("PartionedRegionInitializationDUnitTest() - the " + PartitionedRegionHelper.PR_ROOT_REGION_NAME + " do not exists");
RegionAttributes regionAttribs = root.getAttributes();
Scope scope = regionAttribs.getScope();
if (!scope.isDistributedAck())
fail("PartionedRegionInitializationDUnitTest() - the " + PartitionedRegionHelper.PR_ROOT_REGION_NAME + " scope is not distributedAck");
assertEquals("PartionedRegionInitializationTest() - the " + PartitionedRegionHelper.PR_ROOT_REGION_NAME + " does not have the proper data policy" + DataPolicy.REPLICATE, DataPolicy.REPLICATE, regionAttribs.getDataPolicy());
// Region allPartitionedRegions = root
// .getSubregion(PartitionedRegionHelper.PARTITIONED_REGION_CONFIG_NAME);
// if (allPartitionedRegions == null)
// fail("PartionedRegionInitializationTest() - the "
// + PartitionedRegionHelper.PARTITIONED_REGION_CONFIG_NAME
// + " do not exists");
// regionAttribs = allPartitionedRegions.getAttributes();
// scope = regionAttribs.getScope();
// if (!scope.isDistributedAck())
// fail("PartionedRegionInitializationTest() - the "
// + PartitionedRegionHelper.PARTITIONED_REGION_CONFIG_NAME
// + " scope is not global");
// DataPolicy datapolicy = regionAttribs.getDataPolicy();
// if (! DataPolicy.REPLICATE.equals(datapolicy))
// fail("PartionedRegionInitializationTest() - the "
// + PartitionedRegionHelper.PARTITIONED_REGION_CONFIG_NAME
// + " data policy is not " + DataPolicy.REPLICATE);
}
};
return (CacheSerializableRunnable) initializePrRegion;
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class RemoveDAckDUnitTest method createCacheVM1.
// end of create cache for VM0
public static void createCacheVM1() {
try {
ds = (new RemoveDAckDUnitTest()).getSystem(props);
AttributesFactory factory = new AttributesFactory();
cache = CacheFactory.create(ds);
factory.setScope(Scope.DISTRIBUTED_ACK);
RegionAttributes attr = factory.create();
region = cache.createRegion("map", attr);
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class RemoveDAckDUnitTest method createCacheVM0.
public static void createCacheVM0() {
try {
ds = (new RemoveDAckDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
RegionAttributes attr = factory.create();
region = cache.createRegion("map", attr);
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class RemoveAllDAckDUnitTest method createCacheForVM1.
public static void createCacheForVM1() throws Exception {
CacheWriter aWriter = new BeforeDestroyCallback();
ds = (new RemoveAllDAckDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setCacheWriter(aWriter);
RegionAttributes attr = factory.create();
region = cache.createRegion("map", attr);
}
Aggregations