use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class Bug43684DUnitTest method createServerCache.
@SuppressWarnings("rawtypes")
public static Integer createServerCache(Boolean isReplicated, Boolean isPrimaryEmpty) throws Exception {
disconnectFromDS();
Properties props = new Properties();
props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
props.setProperty(STATISTIC_ARCHIVE_FILE, "server_" + OSProcess.getId() + ".gfs");
props.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
CacheFactory cf = new CacheFactory(props);
cache = (GemFireCacheImpl) cf.create();
RegionFactory rf;
if (isReplicated) {
RegionShortcut rs = isPrimaryEmpty ? RegionShortcut.REPLICATE_PROXY : RegionShortcut.REPLICATE;
rf = cache.createRegionFactory(rs);
} else {
RegionShortcut rs = isPrimaryEmpty ? RegionShortcut.PARTITION_PROXY : RegionShortcut.PARTITION;
rf = cache.createRegionFactory(rs);
rf.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(numBuckets).create());
}
rf.create(REGION_NAME);
CacheServerImpl server = (CacheServerImpl) 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 InterestRegrListenerDUnitTest method setUpServerVM.
public void setUpServerVM() throws Exception {
Properties gemFireProps = new Properties();
createCache(gemFireProps);
RegionFactory factory = cache.createRegionFactory(RegionShortcut.REPLICATE);
Region r = factory.create("serverRegion");
r.put("serverkey", "servervalue");
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class MyGatewayEventSubstitutionFilter method createReplicatedRegionWithSenderAndAsyncEventQueue.
public static void createReplicatedRegionWithSenderAndAsyncEventQueue(String regionName, String senderIds, String asyncChannelId, Boolean offHeap) {
IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
try {
AttributesFactory fact = new AttributesFactory();
if (senderIds != null) {
StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
while (tokenizer.hasMoreTokens()) {
String senderId = tokenizer.nextToken();
fact.addGatewaySenderId(senderId);
}
}
fact.setDataPolicy(DataPolicy.REPLICATE);
fact.setOffHeap(offHeap);
fact.setScope(Scope.DISTRIBUTED_ACK);
RegionFactory regionFactory = cache.createRegionFactory(fact.create());
regionFactory.addAsyncEventQueueId(asyncChannelId);
Region r = regionFactory.create(regionName);
assertNotNull(r);
} finally {
exp.remove();
}
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class MyGatewayEventSubstitutionFilter method createReplicatedRegionWithAsyncEventQueue.
public static void createReplicatedRegionWithAsyncEventQueue(String regionName, String asyncQueueIds, Boolean offHeap) {
IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
try {
AttributesFactory fact = new AttributesFactory();
addAsyncEventQueueIds(fact, asyncQueueIds);
fact.setDataPolicy(DataPolicy.REPLICATE);
fact.setOffHeap(offHeap);
RegionFactory regionFactory = cache.createRegionFactory(fact.create());
Region r = regionFactory.create(regionName);
assertNotNull(r);
} finally {
exp1.remove();
}
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class CacheManagementDUnitTest method createNotificationRegion.
private void createNotificationRegion(final String memberId) {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
Map<ObjectName, NotificationHubListener> notificationHubListenerMap = service.getNotificationHub().getListenerObjectMap();
await().until(() -> assertThat(notificationHubListenerMap.size()).isEqualTo(1));
RegionFactory regionFactory = this.managementTestRule.getCache().createRegionFactory(RegionShortcut.REPLICATE);
for (int i = 1; i <= 15; i++) {
regionFactory.create(NOTIFICATION_REGION_NAME + i);
}
Region region = this.managementTestRule.getCache().getRegion(ManagementConstants.NOTIFICATION_REGION + "_" + memberId);
assertThat(region).isEmpty();
}
Aggregations