use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class FixedPartitioningDUnitTest method test_DataStoreWithoutPartition_DataStoreWithPartition.
/**
* 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_DataStoreWithoutPartition_DataStoreWithPartition() {
IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", null, 1, 40, 12, new QuarterPartitionResolver(), null, false));
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));
} 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 MyGatewayEventSubstitutionFilter method createPartitionedRegion.
public static void createPartitionedRegion(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets) {
IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class.getName());
try {
AttributesFactory fact = new AttributesFactory();
if (senderIds != null) {
StringTokenizer tokenizer = new StringTokenizer(senderIds, ",");
while (tokenizer.hasMoreTokens()) {
String senderId = tokenizer.nextToken();
// GatewaySender sender = cache.getGatewaySender(senderId);
// assertNotNull(sender);
fact.addGatewaySenderId(senderId);
}
}
PartitionAttributesFactory pfact = new PartitionAttributesFactory();
pfact.setTotalNumBuckets(totalNumBuckets);
pfact.setRedundantCopies(redundantCopies);
pfact.setRecoveryDelay(0);
fact.setPartitionAttributes(pfact.create());
Region r = cache.createRegionFactory(fact.create()).create(regionName);
assertNotNull(r);
} finally {
exp.remove();
exp1.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class MyGatewayEventSubstitutionFilter method createPRWithRedundantCopyWithAsyncEventQueue.
/**
* Create PartitionedRegion with 1 redundant copy
*/
public static void createPRWithRedundantCopyWithAsyncEventQueue(String regionName, String asyncEventQueueId, Boolean offHeap) throws InterruptedException {
IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
CountDownLatch recoveryDone = new CountDownLatch(2);
ResourceObserver observer = new InternalResourceManager.ResourceObserverAdapter() {
@Override
public void recoveryFinished(Region region) {
recoveryDone.countDown();
}
};
InternalResourceManager.setResourceObserver(observer);
try {
AttributesFactory fact = new AttributesFactory();
PartitionAttributesFactory pfact = new PartitionAttributesFactory();
pfact.setTotalNumBuckets(16);
pfact.setRedundantCopies(1);
fact.setPartitionAttributes(pfact.create());
fact.setOffHeap(offHeap);
Region r = cache.createRegionFactory(fact.create()).addAsyncEventQueueId(asyncEventQueueId).create(regionName);
assertNotNull(r);
recoveryDone.await();
} finally {
exp.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class MyGatewayEventSubstitutionFilter method createAsyncEventQueueWithCustomListener.
public static void createAsyncEventQueueWithCustomListener(String asyncChannelId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, int nDispatchers) {
IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
try {
createDiskStore(asyncChannelId, diskStoreName);
AsyncEventListener asyncEventListener = new CustomAsyncEventListener();
AsyncEventQueueFactory factory = getInitialAsyncEventQueueFactory(isParallel, maxMemory, batchSize, isPersistent, diskStoreName);
factory.setDispatcherThreads(nDispatchers);
AsyncEventQueue asyncChannel = factory.create(asyncChannelId, asyncEventListener);
} finally {
exp.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class MyGatewayEventSubstitutionFilter method doPuts.
public static void doPuts(String regionName, int numPuts) {
IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class.getName());
IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class.getName());
try {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
assertNotNull(r);
for (long i = 0; i < numPuts; i++) {
r.put(i, i);
}
} finally {
exp1.remove();
exp2.remove();
}
// for (long i = 0; i < numPuts; i++) {
// r.destroy(i);
// }
}
Aggregations