use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class MyFunctionException method testDistributedRegionFunctionExecutionOnDataPolicyEmpty_ClientServer_NoLastResult.
// GEODE-632: random ports, eats exceptions
@Category(FlakyTest.class)
@Test
public void testDistributedRegionFunctionExecutionOnDataPolicyEmpty_ClientServer_NoLastResult() {
VM empty1 = replicate3;
VM empty2 = normal;
empty2.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
replicate2.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
empty1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
createCacheInClientVm();
Integer port1 = (Integer) empty1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createServer(DataPolicy.EMPTY));
Integer port2 = (Integer) empty2.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createServer(DataPolicy.EMPTY));
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createPeer(DataPolicy.REPLICATE));
replicate2.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createPeer(DataPolicy.REPLICATE));
createClientAndPopulateClientRegion(DataPolicy.EMPTY, port1, port2);
// add ExpectedException's to servers since client can connect to any
// one of those
final IgnoredException expectedEx = IgnoredException.addIgnoredException("did not send last result", empty1);
final IgnoredException expectedEx2 = IgnoredException.addIgnoredException("did not send last result", empty2);
try {
executeFunction_NoLastResult();
} finally {
expectedEx.remove();
expectedEx2.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class MyFunctionException method testDistributedRegionFunctionExecutionOnDataPolicyReplicate_ClientServer_FunctionInvocationTargetException_WithoutHA.
@Test
public void testDistributedRegionFunctionExecutionOnDataPolicyReplicate_ClientServer_FunctionInvocationTargetException_WithoutHA() {
VM empty = replicate3;
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
replicate2.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
empty.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createCacheInVm());
createCacheInClientVm();
registerFunction(new Boolean(false), new Integer(0));
Integer port1 = (Integer) replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createServer(DataPolicy.REPLICATE));
Integer port2 = (Integer) replicate2.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createServer(DataPolicy.REPLICATE));
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createPeer(DataPolicy.NORMAL));
empty.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.createPeer(DataPolicy.EMPTY));
replicate1.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.registerFunction(new Boolean(false), new Integer(0)));
replicate2.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.registerFunction(new Boolean(false), new Integer(0)));
normal.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.registerFunction(new Boolean(false), new Integer(0)));
empty.invoke(() -> DistributedRegionFunctionExecutionDUnitTest.registerFunction(new Boolean(false), new Integer(0)));
createClientAndPopulateClientRegion(DataPolicy.EMPTY, port1, port2);
// add expected exception to avoid suspect strings
final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
executeFunctionFunctionInvocationTargetException_ClientServer_WithoutHA();
ex.remove();
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class PRColocationDUnitTest method testColocatedPRWithLocalDestroy.
@Test
public void testColocatedPRWithLocalDestroy() throws Throwable {
createCacheInAllVms();
redundancy = new Integer(0);
localMaxmemory = new Integer(50);
totalNumBuckets = new Integer(11);
// Create Customer PartitionedRegion in All VMs
regionName = CustomerPartitionedRegionName;
colocatedWith = null;
isPartitionResolver = new Boolean(false);
attributeObjects = new Object[] { regionName, redundancy, localMaxmemory, totalNumBuckets, colocatedWith, isPartitionResolver };
createPartitionedRegion(attributeObjects);
// Create Order PartitionedRegion in All VMs
regionName = OrderPartitionedRegionName;
colocatedWith = CustomerPartitionedRegionName;
isPartitionResolver = new Boolean(false);
attributeObjects = new Object[] { regionName, redundancy, localMaxmemory, totalNumBuckets, colocatedWith, isPartitionResolver };
createPartitionedRegion(attributeObjects);
// Put the customer 1-10 in CustomerPartitionedRegion
accessor.invoke(() -> PRColocationDUnitTest.putCustomerPartitionedRegion(CustomerPartitionedRegionName));
// Put the order 1-10 for each Customer in OrderPartitionedRegion
accessor.invoke(() -> PRColocationDUnitTest.putOrderPartitionedRegion(OrderPartitionedRegionName));
// add expected exception string
final String expectedExMessage = "Any Region in colocation chain cannot be destroyed locally.";
final IgnoredException ex = IgnoredException.addIgnoredException(expectedExMessage, dataStore1);
dataStore1.invoke(new CacheSerializableRunnable("PR with Local destroy") {
@Override
public void run2() {
Region partitionedregion = basicGetCache().getRegion(Region.SEPARATOR + OrderPartitionedRegionName);
try {
partitionedregion.localDestroyRegion();
fail("It should have thrown an Exception saying: " + expectedExMessage);
} catch (Exception Expected) {
LogWriterUtils.getLogWriter().info("Expected Messageee : " + Expected.getMessage());
assertTrue(Expected.getMessage().contains(expectedExMessage));
}
}
});
dataStore1.invoke(new CacheSerializableRunnable("PR with Local Destroy") {
@Override
public void run2() {
Region partitionedregion = basicGetCache().getRegion(Region.SEPARATOR + CustomerPartitionedRegionName);
try {
partitionedregion.localDestroyRegion();
fail("It should have thrown an Exception saying: " + expectedExMessage);
} catch (Exception Expected) {
LogWriterUtils.getLogWriter().info("Expected Messageee : " + Expected.getMessage());
assertTrue(Expected.getMessage().contains(expectedExMessage));
}
}
});
ex.remove();
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class WANTestBase method validateParallelSenderQueueAllBucketsDrained.
public static void validateParallelSenderQueueAllBucketsDrained(final String senderId) {
IgnoredException exp = IgnoredException.addIgnoredException(RegionDestroyedException.class.getName());
IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
RegionQueue regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
Set<BucketRegion> buckets = ((PartitionedRegion) regionQueue.getRegion()).getDataStore().getAllLocalPrimaryBucketRegions();
for (final BucketRegion bucket : buckets) {
Awaitility.await().atMost(180, TimeUnit.SECONDS).until(() -> {
assertEquals("Expected bucket entries for bucket: " + bucket.getId() + " is: 0 but actual entries: " + bucket.keySet().size() + " This bucket isPrimary: " + bucket.getBucketAdvisor().isPrimary() + " KEYSET: " + bucket.keySet(), 0, bucket.keySet().size());
});
}
// for loop ends
} finally {
exp.remove();
exp1.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class WANTestBase method validateRegionSize.
public static void validateRegionSize(String regionName, final int regionSize, long waitTimeInMilliSec) {
IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class.getName());
try {
final Region r = cache.getRegion(Region.SEPARATOR + regionName);
assertNotNull(r);
if (regionSize != r.keySet().size()) {
Awaitility.await().atMost(waitTimeInMilliSec, TimeUnit.MILLISECONDS).pollInterval(500, TimeUnit.MILLISECONDS).until(() -> assertEquals("Expected region entries: " + regionSize + " but actual entries: " + r.keySet().size() + " present region keyset " + r.keySet(), regionSize, r.keySet().size()));
}
} finally {
exp.remove();
exp1.remove();
}
}
Aggregations