use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class PersistentReplicatedTestBase method createPersistentRegionWithoutCompaction.
protected SerializableRunnable createPersistentRegionWithoutCompaction(final VM vm0) {
SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
public void run() {
Cache cache = getCache();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
File dir = getDiskDirForVM(vm0);
dir.mkdirs();
dsf.setDiskDirs(new File[] { dir });
dsf.setMaxOplogSize(1);
dsf.setAutoCompact(false);
dsf.setAllowForceCompaction(true);
dsf.setCompactionThreshold(20);
DiskStore ds = dsf.create(REGION_NAME);
RegionFactory rf = new RegionFactory();
rf.setDiskStoreName(ds.getName());
rf.setDiskSynchronous(true);
rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
rf.setScope(Scope.DISTRIBUTED_ACK);
rf.create(REGION_NAME);
}
};
vm0.invoke(createRegion);
return createRegion;
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class RollingUpgrade2DUnitTest method createPersistentReplicateRegion.
public static void createPersistentReplicateRegion(GemFireCache cache, String regionName, File diskStore) throws Exception {
DiskStore store = cache.findDiskStore("store");
if (store == null) {
DiskStoreFactory factory = cache.createDiskStoreFactory();
factory.setMaxOplogSize(1L);
factory.setDiskDirs(new File[] { diskStore.getAbsoluteFile() });
factory.create("store");
}
RegionFactory rf = ((GemFireCacheImpl) cache).createRegionFactory();
rf.setDiskStoreName("store");
rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
rf.create(regionName);
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class PersistentReplicatedTestBase method createNonPersistentRegion.
protected void createNonPersistentRegion(VM vm) throws Exception {
SerializableRunnable createRegion = new SerializableRunnable("Create non persistent region") {
public void run() {
Cache cache = getCache();
RegionFactory rf = new RegionFactory();
rf.setDataPolicy(DataPolicy.REPLICATE);
rf.setScope(Scope.DISTRIBUTED_ACK);
rf.create(REGION_NAME);
}
};
vm.invoke(createRegion);
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class UnregisterInterestDUnitTest method createCacheAndStartServer.
public static Integer createCacheAndStartServer() throws Exception {
DistributedSystem ds = new UnregisterInterestDUnitTest().getSystem();
ds.disconnect();
Properties props = new Properties();
props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
CacheFactory cf = new CacheFactory(props);
cache = cf.create();
RegionFactory rf = ((GemFireCacheImpl) cache).createRegionFactory(RegionShortcut.REPLICATE);
rf.create(regionname);
CacheServer server = ((GemFireCacheImpl) cache).addCacheServer();
server.setPort(AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET));
server.start();
return server.getPort();
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class QueryDataDUnitTest method testNormalRegions.
@Test
public void testNormalRegions() throws Exception {
this.managerVM.invoke(this.testName.getMethodName(), () -> {
DistributedSystemMXBean distributedSystemMXBean = this.managementTestRule.getSystemManagementService().getDistributedSystemMXBean();
String normalRegionName1 = this.testName.getMethodName() + "_NORMAL_REGION_1";
String tempRegionName1 = this.testName.getMethodName() + "_TEMP_REGION_1";
// to Reverse order of regions while getting Random region in QueryDataFunction [?]
String normalRegionName2 = this.testName.getMethodName() + "_NORMAL_REGION_2";
String tempRegionName2 = this.testName.getMethodName() + "_TEMP_REGION_2";
Cache cache = this.managementTestRule.getCache();
RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.LOCAL_HEAP_LRU);
regionFactory.create(normalRegionName1);
regionFactory.create(normalRegionName2);
Region region = cache.getRegion("/" + normalRegionName1);
assertThat(region.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.NORMAL);
RegionFactory regionFactory1 = cache.createRegionFactory(RegionShortcut.REPLICATE);
regionFactory1.create(tempRegionName1);
regionFactory1.create(tempRegionName2);
String query1 = "SELECT * FROM /" + tempRegionName1 + " r1, /" + normalRegionName1 + " r2 WHERE r1.ID = r2.ID";
String query2 = "SELECT * FROM /" + normalRegionName2 + " r1, /" + tempRegionName2 + " r2 WHERE r1.ID = r2.ID";
String query3 = "SELECT * FROM /" + normalRegionName2;
distributedSystemMXBean.queryDataForCompressedResult(query1, null, 2);
distributedSystemMXBean.queryDataForCompressedResult(query2, null, 2);
distributedSystemMXBean.queryDataForCompressedResult(query3, null, 2);
// TODO: assert results of queryDataForCompressedResult?
});
}
Aggregations