use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class RegionManagementDUnitTest method createLocalRegion_tmp.
private void createLocalRegion_tmp(final VM vm, final String localRegionName) {
vm.invoke("Create Local region", () -> {
SystemManagementService service = getSystemManagementService_tmp();
RegionFactory regionFactory = getCache_tmp().createRegionFactory(RegionShortcut.LOCAL);
regionFactory.create(localRegionName);
});
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class ManagementTestBase method createPartitionRegion.
/**
* Creates a partition Region
*/
protected void createPartitionRegion(final VM vm, final String partitionRegionName) {
vm.invoke("Create Partitioned region", () -> {
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
SystemManagementService service = (SystemManagementService) getManagementService();
RegionFactory rf = cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT);
LogWriterUtils.getLogWriter().info("Creating Par Region");
rf.create(partitionRegionName);
});
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class ManagementTestBase method createLocalRegion.
/**
* Creates a Local region
*/
protected void createLocalRegion(final VM vm, final String localRegionName) throws Exception {
vm.invoke("Create Local region", () -> {
GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
SystemManagementService service = (SystemManagementService) getManagementService();
RegionFactory rf = cache.createRegionFactory(RegionShortcut.LOCAL);
LogWriterUtils.getLogWriter().info("Creating Local Region");
rf.create(localRegionName);
});
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class RegionManagementDUnitTest method createPartitionRegion_tmp.
private void createPartitionRegion_tmp(final VM vm, final String partitionRegionName) {
vm.invoke("Create Partitioned region", () -> {
SystemManagementService service = getSystemManagementService_tmp();
RegionFactory regionFactory = getCache_tmp().createRegionFactory(RegionShortcut.PARTITION_REDUNDANT);
regionFactory.create(partitionRegionName);
});
}
use of org.apache.geode.cache.RegionFactory in project geode by apache.
the class DistributionManagerDUnitTest method testKickOutSickMember.
/**
* Tests that a sick member is kicked out
*/
@Test
public void testKickOutSickMember() throws Exception {
disconnectAllFromDS();
IgnoredException.addIgnoredException("10 seconds have elapsed while waiting");
Host host = Host.getHost(0);
// VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
// in order to set a small ack-wait-threshold, we have to remove the
// system property established by the dunit harness
String oldAckWait = (String) System.getProperties().remove(DistributionConfig.GEMFIRE_PREFIX + ACK_WAIT_THRESHOLD);
try {
final Properties props = getDistributedSystemProperties();
// loner
props.setProperty(MCAST_PORT, "0");
props.setProperty(ACK_WAIT_THRESHOLD, "5");
props.setProperty(ACK_SEVERE_ALERT_THRESHOLD, "5");
props.setProperty(NAME, "putter");
getSystem(props);
Region rgn = (new RegionFactory()).setScope(Scope.DISTRIBUTED_ACK).setDataPolicy(DataPolicy.REPLICATE).create("testRegion");
basicGetSystem().getLogWriter().info("<ExpectedException action=add>sec have elapsed while waiting for replies</ExpectedException>");
vm1.invoke(new SerializableRunnable("Connect to distributed system") {
public void run() {
props.setProperty(NAME, "sleeper");
getSystem(props);
LogWriter log = basicGetSystem().getLogWriter();
log.info("<ExpectedException action=add>service failure</ExpectedException>");
log.info("<ExpectedException action=add>org.apache.geode.ForcedDisconnectException</ExpectedException>");
RegionFactory rf = new RegionFactory();
Region r = rf.setScope(Scope.DISTRIBUTED_ACK).setDataPolicy(DataPolicy.REPLICATE).addCacheListener(getSleepingListener(true)).create("testRegion");
myCache = r.getCache();
}
});
// now we have two caches set up, each having an alert listener. Vm1
// also has a cache listener that will turn off its ability to respond
// to "are you dead" messages and then sleep
rgn.put("bomb", "pow!");
rgn.getCache().close();
basicGetSystem().getLogWriter().info("<ExpectedException action=remove>sec have elapsed while waiting for replies</ExpectedException>");
basicGetSystem().disconnect();
vm1.invoke(new SerializableRunnable("wait for forced disconnect") {
public void run() {
// wait a while for the DS to finish disconnecting
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return !basicGetSystem().isConnected();
}
public String description() {
return null;
}
};
// if this fails it means the sick member wasn't kicked out and something is wrong
Wait.waitForCriterion(ev, 60 * 1000, 200, true);
ev = new WaitCriterion() {
public boolean done() {
return myCache.isClosed();
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, 20 * 1000, 200, false);
if (!myCache.isClosed()) {
if (basicGetSystem().isConnected()) {
basicGetSystem().disconnect();
}
myCache = null;
throw new RuntimeException("Test Failed - vm1's cache is not closed");
}
if (basicGetSystem().isConnected()) {
basicGetSystem().disconnect();
throw new RuntimeException("Test Failed - vm1's system should have been disconnected");
}
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
return regionDestroyedInvoked;
}
public String description() {
return "vm1's listener should have received afterRegionDestroyed notification";
}
};
Wait.waitForCriterion(wc, 30 * 1000, 1000, true);
}
});
} finally {
if (oldAckWait != null) {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + ACK_WAIT_THRESHOLD, oldAckWait);
}
}
}
Aggregations