use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class HASlowReceiverDUnitTest method testSlowClient.
// Test slow client
@Test
public void testSlowClient() throws Exception {
setBridgeObeserverForAfterQueueDestroyMessage();
Host host = Host.getHost(0);
clientVM.invoke(() -> HASlowReceiverDUnitTest.createClientCache(NetworkUtils.getServerHostName(host), new Integer(PORT0), new Integer(PORT1), new Integer(PORT2), new Integer(2)));
clientVM.invoke(() -> HASlowReceiverDUnitTest.registerInterest());
// add expected socket exception string
final IgnoredException ex1 = IgnoredException.addIgnoredException(SocketException.class.getName());
final IgnoredException ex2 = IgnoredException.addIgnoredException(InterruptedException.class.getName());
putEntries();
// wait for put to block and allow server to remove
Thread.sleep(20000);
// client queue
clientVM.invoke(() -> HASlowReceiverDUnitTest.checkRedundancyLevel(new Integer(2)));
// check for slow client queue is removed or not.
assertTrue("isUnresponsiveClientRemoved is false, but should be true " + "after 20 seconds", isUnresponsiveClientRemoved);
ex1.remove();
ex2.remove();
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testRevokedMemberRedundancy0.
/**
* Test to make sure that we recreate a bucket if a member is revoked
*/
@Test
public void testRevokedMemberRedundancy0() {
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);
int aVM0Bucket = vm0Buckets.iterator().next();
int aVM1Bucket = vm1Buckets.iterator().next();
closeCache(vm1);
// This should work, because this bucket is still available.
checkData(vm0, aVM0Bucket, aVM0Bucket + 1, "a");
IgnoredException expect = IgnoredException.addIgnoredException("PartitionOfflineException", vm0);
try {
checkData(vm0, aVM1Bucket, aVM1Bucket + 1, "a");
fail("Should not have been able to read from missing buckets!");
} catch (RMIException e) {
if (!(e.getCause() instanceof PartitionOfflineException)) {
throw e;
}
}
try {
createData(vm0, aVM1Bucket, aVM1Bucket + 1, "b");
fail("Should not have been able to write to missing buckets!");
} catch (RMIException e) {
// We expect to see a partition offline exception here.
if (!(e.getCause() instanceof PartitionOfflineException)) {
throw e;
}
}
expect.remove();
// This should work, because these are new buckets
createData(vm0, NUM_BUCKETS, 113, "a");
revokeKnownMissingMembers(vm2, 1);
createPR(vm2, 0);
// We should be able to use that missing bucket now
checkData(vm2, aVM1Bucket, aVM1Bucket + 1, null);
createData(vm2, aVM1Bucket, aVM1Bucket + 1, "a");
checkData(vm2, aVM1Bucket, aVM1Bucket + 1, "a");
IgnoredException ex = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getName(), vm1);
try {
createPR(vm1, 0);
fail("Should have recieved a RevokedPersistentDataException");
} 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 FixedPartitioningDUnitTest method test_DataStoreWithPartition_DataStoreWithoutPartition.
/**
* This test validates that if one datastore has the fixed partition attributes defined then other
* datastore should also have the fixed partition attributes defined
*/
@Test
public void test_DataStoreWithPartition_DataStoreWithoutPartition() {
IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(fpa1);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false));
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", null, 1, 40, 12, new QuarterPartitionResolver(), null, false));
} catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException))) {
Assert.fail("Expected IllegalStateException ", ex);
}
} finally {
expected.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class FixedPartitioningDUnitTest method testNumberOfPartitions.
/**
* Number of primary partitions (which should be one for a partition) and secondary partitions of
* a FPR for a partition should never exceed number of redundant copies + 1. IllegalStateException
* is thrown during FPR creation if this condition is not met.
*/
@Test
public void testNumberOfPartitions() {
IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", null, 1, 0, 9, new QuarterPartitionResolver(), null, false));
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition("Q11", true, 3);
FixedPartitionAttributes fpa2 = FixedPartitionAttributes.createFixedPartition("Q12", false, 3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(fpa1);
fpaList.add(fpa2);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 9, new QuarterPartitionResolver(), null, false));
member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition("Q12", true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition("Q13", false, 3);
FixedPartitionAttributes fpa3 = FixedPartitionAttributes.createFixedPartition("Q11", false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
fpaList.add(fpa3);
member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 9, new QuarterPartitionResolver(), null, false));
member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition("Q13", true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition("Q11", false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 9, new QuarterPartitionResolver(), null, false));
fail("IllegalStateException expected");
} catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException) && (ex.getCause().getMessage().contains("should never exceed number of redundant copies")))) {
Assert.fail("Expected IllegalStateException ", ex);
}
} finally {
expected.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class FixedPartitioningDUnitTest method testSamePartitionName_DifferentNumBuckets.
/**
* Test validation : if same partition is having different num-buckets across the nodes then
* illegalStateException will be thrown
*/
@Test
public void testSamePartitionName_DifferentNumBuckets() {
IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
FixedPartitionAttributes fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(fpa1);
fpaList.add(fpa2);
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 9, new QuarterPartitionResolver(), null, false));
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 8);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 9, new QuarterPartitionResolver(), null, false));
fail("IllegalStateException Expected");
} catch (Exception illegal) {
if (!((illegal.getCause() instanceof IllegalStateException) && (illegal.getCause().getMessage().contains("num-buckets are not same")))) {
Assert.fail("Expected IllegalStateException ", illegal);
}
} finally {
ex.remove();
}
}
Aggregations