use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testMissingMemberRedundancy0.
/**
* Test that we wait for missing data to come back if the redundancy was 0.
*/
@Test
public void testMissingMemberRedundancy0() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
createPR(vm0, 0);
createPR(vm1, 0);
createData(vm0, 0, NUM_BUCKETS, "a");
Set<Integer> vm0Buckets = getBucketList(vm0);
Set<Integer> vm1Buckets = getBucketList(vm1);
final int aVM0Bucket = vm0Buckets.iterator().next();
final int aVM1Bucket = vm1Buckets.iterator().next();
closeCache(vm1);
IgnoredException ex = IgnoredException.addIgnoredException("PartitionOfflineException");
try {
checkReadWriteOperationsWithOfflineMember(vm0, aVM0Bucket, aVM1Bucket);
// Make sure that a newly created member is informed about the offline member
createPR(vm2, 0);
checkReadWriteOperationsWithOfflineMember(vm2, aVM0Bucket, aVM1Bucket);
} finally {
ex.remove();
}
// This should work, because these are new buckets
createData(vm0, NUM_BUCKETS, 113, "a");
createPR(vm1, 0);
// The data should be back online now.
checkData(vm0, 0, 113, "a");
closeCache(vm0);
closeCache(vm1);
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testRevokeAfterStartup.
@Test
public void testRevokeAfterStartup() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
int numBuckets = 50;
createPR(vm0, 1);
createPR(vm1, 1);
createData(vm0, 0, numBuckets, "a");
Set<Integer> vm0Buckets = getBucketList(vm0);
Set<Integer> vm1Buckets = getBucketList(vm1);
assertEquals(vm0Buckets, vm1Buckets);
closeCache(vm0);
createData(vm1, 0, numBuckets, "b");
closeCache(vm1);
AsyncInvocation a1 = createPRAsync(vm0, 1);
// [dsmith] Make sure that vm0 is waiting for vm1 to recover
// If VM(0) recovers early, that is a problem, because vm1
// has newer data
Thread.sleep(500);
assertTrue(a1.isAlive());
revokeKnownMissingMembers(vm2, 1);
a1.getResult(MAX_WAIT);
assertEquals(vm0Buckets, getBucketList(vm0));
checkData(vm0, 0, numBuckets, "a");
createData(vm0, numBuckets, 113, "b");
checkData(vm0, numBuckets, 113, "b");
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;
}
}
ex.remove();
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testChangedToalBucketNumberSinglePR.
/**
* Test total-buckets-num getting bigger, which cause exception. but changed to smaller should be
* ok.
*/
@Test
public void testChangedToalBucketNumberSinglePR() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
createPR(vm0, 0, 0, 5);
createData(vm0, 0, 5, "a");
closeCache(vm0);
IgnoredException expect = IgnoredException.addIgnoredException("IllegalStateException", vm0);
expect = IgnoredException.addIgnoredException("DiskAccessException", vm0);
try {
createPR(vm0, 0, 0, 2);
fail("Expect to get java.lang.IllegalStateException, but it did not");
} catch (RMIException exp) {
assertTrue(exp.getCause() instanceof IllegalStateException);
IllegalStateException ise = (IllegalStateException) exp.getCause();
Object[] prms = new Object[] { "/" + PR_REGION_NAME, 2, 5 };
assertTrue(ise.getMessage().contains(LocalizedStrings.PartitionedRegion_FOR_REGION_0_TotalBucketNum_1_SHOULD_NOT_BE_CHANGED_Previous_Configured_2.toString(prms)));
}
closeCache(vm0);
try {
createPR(vm0, 0, 0, 10);
fail("Expect to get java.lang.IllegalStateException, but it did not");
} catch (RMIException exp) {
assertTrue(exp.getCause() instanceof IllegalStateException);
IllegalStateException ise = (IllegalStateException) exp.getCause();
Object[] prms = new Object[] { "/" + PR_REGION_NAME, 10, 5 };
assertTrue(ise.getMessage().contains(LocalizedStrings.PartitionedRegion_FOR_REGION_0_TotalBucketNum_1_SHOULD_NOT_BE_CHANGED_Previous_Configured_2.toString(prms)));
}
expect.remove();
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PartitionedRegionMetaDataCleanupDUnitTest method testCrash.
@Test
public void testCrash() throws InterruptedException {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
createPR(vm0, "region1", 5);
createPR(vm1, "region2", 10);
// This should fail
IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException", vm1);
try {
createPR(vm1, "region1", 10);
fail("Should have received an exception");
} catch (RMIException e) {
// ok
} finally {
ex.remove();
}
ex = IgnoredException.addIgnoredException("DistributedSystemDisconnectedException", vm0);
try {
fakeCrash(vm0);
} finally {
ex.remove();
}
waitForCreate(vm0, "region1", 15);
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PartitionedRegionMetaDataCleanupDUnitTest method testCleanupOnCloseCache.
@Test
public void testCleanupOnCloseCache() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
createPR(vm0, "region1", 5);
createPR(vm1, "region2", 10);
// This should fail
IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException", vm1);
try {
createPR(vm1, "region1", 10);
fail("Should have received an exception");
} catch (RMIException e) {
// ok
} finally {
ex.remove();
}
closeCache(vm0);
waitForCreate(vm0, "region1", 15);
}
Aggregations