use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml66DUnitTest method testDiskDirs.
/**
* Tests disk directories
*/
@Test
public void testDiskDirs() throws Exception {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
File[] dirs = new File[] { new File(this.getUniqueName() + "-dir1"), new File(this.getUniqueName() + "-dir2") };
for (int i = 0; i < dirs.length; i++) {
dirs[i].mkdirs();
dirs[i].deleteOnExit();
}
int[] diskSizes = { DiskWriteAttributesImpl.DEFAULT_DISK_DIR_SIZE, DiskWriteAttributesImpl.DEFAULT_DISK_DIR_SIZE };
attrs.setDiskDirsAndSize(dirs, diskSizes);
cache.createRegion("root", attrs);
testXml(cache);
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml66DUnitTest method testEntriesInRootRegion.
/**
* Tests creating a cache with entries defined in the root region
*/
@Test
public void testEntriesInRootRegion() throws Exception {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("root", new RegionAttributesCreation(cache));
root.put("KEY1", "VALUE1");
root.put("KEY2", "VALUE2");
root.put("KEY3", "VALUE3");
testXml(cache);
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml66DUnitTest method testBridgeLoadProbe.
@Test
public void testBridgeLoadProbe() throws Exception {
CacheCreation cache = new CacheCreation();
CacheServer server = cache.addCacheServer();
server.setPort(AvailablePortHelper.getRandomAvailableTCPPort());
server.setLoadProbe(new MyLoadProbe());
testXml(cache);
Cache c = getCache();
server = c.getCacheServers().get(0);
assertEquals(MyLoadProbe.class, server.getLoadProbe().getClass());
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml66DUnitTest method testLOCAL_PERSISTENT.
@Test
public void testLOCAL_PERSISTENT() throws Exception {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("plocal", "LOCAL_PERSISTENT");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
Region r = c.getRegion("plocal");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.PERSISTENT_REPLICATE, ra.getDataPolicy());
assertEquals(Scope.LOCAL, ra.getScope());
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class DiskStoreFactoryImpl method create.
public DiskStore create(String name) {
this.attrs.name = name;
// As a simple fix for 41290, only allow one DiskStore to be created
// at a time per cache by syncing on the cache.
DiskStore result;
synchronized (this.cache) {
result = findExisting(name);
if (result == null) {
if (this.cache instanceof GemFireCacheImpl) {
TypeRegistry registry = this.cache.getPdxRegistry();
DiskStoreImpl dsi = new DiskStoreImpl(this.cache, this.attrs);
result = dsi;
// Added for M&M
this.cache.getInternalDistributedSystem().handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi);
dsi.doInitialRecovery();
this.cache.addDiskStore(dsi);
if (registry != null) {
registry.creatingDiskStore(dsi);
}
} else if (this.cache instanceof CacheCreation) {
CacheCreation creation = (CacheCreation) this.cache;
result = new DiskStoreAttributesCreation(this.attrs);
creation.addDiskStore(result);
}
}
}
// that isn't backed up.
if (this.cache instanceof GemFireCacheImpl) {
BackupManager backup = this.cache.getBackupManager();
if (backup != null) {
backup.waitForBackup();
}
}
return result;
}
Aggregations