use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testDiskConflictWithRedundancy.
@Test
public void testDiskConflictWithRedundancy() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
createPR(vm0, 1);
// create some buckets
createData(vm0, 0, 2, "a");
closePR(vm0);
createPR(vm1, 1);
// create an overlapping bucket
createData(vm1, 1, 2, "a");
IgnoredException[] expectVm0 = { IgnoredException.addIgnoredException("ConflictingPersistentDataException", vm0), IgnoredException.addIgnoredException("CacheClosedException", vm0) };
try {
createPR(vm0, 1);
fail("should have seen a conflicting data exception");
} catch (Exception ex) {
boolean expectedException = false;
if (ex.getCause() instanceof CacheClosedException) {
CacheClosedException cce = (CacheClosedException) ex.getCause();
if (cce.getCause() instanceof ConflictingPersistentDataException) {
expectedException = true;
}
}
if (!expectedException) {
throw ex;
}
} finally {
for (IgnoredException ie : expectVm0) {
ie.remove();
}
}
closePR(vm1);
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testBug42226.
/**
* Test for bug 4226. 1. Member A has the bucket 2. Member B starts creating the bucket. It tells
* member A that it hosts the bucket 3. Member A crashes 4. Member B destroys the bucket and
* throws a partition offline exception, because it wasn't able to complete initialization. 5.
* Member A recovers, and gets stuck waiting for member B.
*
* @throws Throwable
*/
// GEODE-1208: time sensitive, multiple non-thread-safe test hooks,
@Category(FlakyTest.class)
// async actions
@Test
public void testBug42226() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
// Add a hook which will disconnect from the distributed
// system when the initial image message shows up.
vm0.invoke(new SerializableRunnable() {
public void run() {
DistributionMessageObserver.setInstance(new DistributionMessageObserver() {
@Override
public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) {
if (message instanceof RequestImageMessage) {
RequestImageMessage rim = (RequestImageMessage) message;
// Don't disconnect until we see a bucket
if (rim.regionPath.contains("_B_")) {
DistributionMessageObserver.setInstance(null);
disconnectFromDS();
}
}
}
@Override
public void afterProcessMessage(DistributionManager dm, DistributionMessage message) {
}
});
}
});
LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPR(vm0, 1, 0, 1);
// Make sure we create a bucket
createData(vm0, 0, 1, "a");
// This should recover redundancy, which should cause vm0 to disconnect
IgnoredException ex = IgnoredException.addIgnoredException("PartitionOfflineException");
try {
LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPR(vm1, 1, 0, 1);
// Make sure get a partition offline exception
try {
createData(vm1, 0, 1, "a");
} catch (RMIException e) {
// We expect a PartitionOfflineException
if (!(e.getCause() instanceof PartitionOfflineException)) {
throw e;
}
}
} finally {
ex.remove();
}
// Make sure vm0 is really disconnected (avoids a race with the observer).
vm0.invoke(new SerializableRunnable() {
public void run() {
disconnectFromDS();
}
});
// This should recreate the bucket
AsyncInvocation async1 = createPRAsync(vm0, 1, 0, 1);
async1.getResult(MAX_WAIT);
checkData(vm1, 0, 1, "a");
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testRevokedMemberRedundancy1.
/**
* Test to make sure that we recreate a bucket if a member is revoked
*
* @throws Throwable
*/
@Test
public void testRevokedMemberRedundancy1() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
createPR(vm0, 1);
createPR(vm1, 1);
createData(vm0, 0, NUM_BUCKETS, "a");
Set<Integer> vm0Buckets = getBucketList(vm0);
Set<Integer> vm1Buckets = getBucketList(vm1);
assertEquals(vm0Buckets, vm1Buckets);
closeCache(vm1);
// This should work, because this bucket is still available.
checkData(vm0, 0, NUM_BUCKETS, "a");
createData(vm0, 0, NUM_BUCKETS, "b");
revokeKnownMissingMembers(vm2, 1);
// This should make a copy of all of the buckets,
// because we have revoked VM1.
createPR(vm2, 1);
Set<Integer> vm2Buckets = getBucketList(vm2);
assertEquals(vm1Buckets, vm2Buckets);
IgnoredException ex = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getName(), vm1);
try {
createPR(vm1, 1);
fail("Should have recieved a SplitDistributedSystemException");
} catch (RMIException e) {
// We revoked this member.
if (!(e.getCause() instanceof RevokedPersistentDataException)) {
throw e;
}
}
// Test that we can bounce vm0 and vm1, and still get a RevokedPersistentDataException
// when vm1 tries to recover
closeCache(vm0);
closeCache(vm2);
AsyncInvocation async0 = createPRAsync(vm0, 1);
AsyncInvocation async2 = createPRAsync(vm2, 1);
async0.getResult();
async2.getResult();
try {
createPR(vm1, 1);
fail("Should have recieved a RevokedPersistentDataException");
} catch (RMIException e) {
// We revoked this member.
if (!(e.getCause() instanceof RevokedPersistentDataException)) {
throw e;
}
}
ex.remove();
// The data shouldn't be affected.
checkData(vm2, 0, NUM_BUCKETS, "b");
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class UpdateVersionDUnitTest method closeCache.
private static void closeCache() {
if (cache != null && !cache.isClosed()) {
for (IgnoredException expectedException : expectedExceptions) {
cache.getLogger().info(expectedException.getRemoveMessage());
}
expectedExceptions.clear();
cache.getDistributedSystem().disconnect();
cache.close();
}
cache = null;
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class UpdateVersionDUnitTest method createCache.
/*
* Helper Methods
*/
private static void createCache(Integer locPort) {
UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + locPort + "]");
props.setProperty(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
props.setProperty(USE_CLUSTER_CONFIGURATION, "false");
InternalDistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
IgnoredException ex = new IgnoredException("could not get remote locator information for remote site");
cache.getLogger().info(ex.getAddMessage());
expectedExceptions.add(ex);
ex = new IgnoredException("Pool ln1 is not available");
cache.getLogger().info(ex.getAddMessage());
expectedExceptions.add(ex);
}
Aggregations