use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class FixedPartitioningDUnitTest method testSamePartitionName_Primary_OnTwoMembers.
/**
* Test validation : only one node should return primary for a particular partition name for a
* specific FPR at any given point of time. DuplicatePrimaryPartitionException is thrown during
* FPR creation if this condition is not met.
*/
@Test
public void testSamePartitionName_Primary_OnTwoMembers() {
IgnoredException ex = IgnoredException.addIgnoredException("DuplicatePrimaryPartitionException");
try {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
fpaList.add(fpa1);
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 9, new QuarterPartitionResolver(), null, false));
member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpaList.clear();
fpaList.add(fpa1);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 9, new QuarterPartitionResolver(), null, false));
member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpaList.clear();
fpaList.add(fpa1);
member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 9, new QuarterPartitionResolver(), null, false));
fail("DuplicatePrimaryPartitionException Expected");
} catch (Exception duplicate) {
if (!((duplicate.getCause() instanceof DuplicatePrimaryPartitionException) && (duplicate.getCause().getMessage().contains("can not be defined as primary on more than one node")))) {
Assert.fail("Expected DuplicatePrimaryPartitionException ", duplicate);
}
} finally {
ex.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class FixedPartitioningDUnitTest method testNumBuckets_totalNumBuckets.
/**
* Sum of num-buckets for different primary partitions should not be greater than totalNumBuckets.
*/
@Test
public void testNumBuckets_totalNumBuckets() {
IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", null, 1, 0, 5, new QuarterPartitionResolver(), null, false));
member2.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);
member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 5, new QuarterPartitionResolver(), null, false));
member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
fpaList.clear();
fpaList.add(fpa1);
fpaList.add(fpa2);
member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 5, new QuarterPartitionResolver(), null, false));
fail("IllegalStateException expected");
} catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException) && (ex.getCause().getMessage().contains("for different primary partitions should not be greater than total-num-buckets ")))) {
Assert.fail("Expected IllegalStateException ", ex);
}
} finally {
expected.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class ReplicatedRegion_ParallelWANPropagationDUnitTest method doPuts0.
public static void doPuts0(String regionName, int numPuts) {
IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class.getName());
try {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
assertNotNull(r);
for (long i = 0; i < numPuts; i++) {
LogWriterUtils.getLogWriter().info("Put : key : " + i);
r.put(i, "0_" + i);
}
} finally {
exp.remove();
exp1.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class WanAutoDiscoveryDUnitTest method testInvalidHostRemoteLocators.
@Test
public void testInvalidHostRemoteLocators() {
IgnoredException ie = IgnoredException.addIgnoredException("could not get remote locator information for remote site");
try {
Set<String> remoteLocators = new HashSet();
addUnknownHost(remoteLocators);
testRemoteLocators(remoteLocators, false, 0);
} finally {
ie.remove();
}
}
use of org.apache.geode.test.dunit.IgnoredException in project geode by apache.
the class WANTestBase method createSender.
public static void createSender(String dsName, int remoteDsId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter, boolean isManualStart) {
final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
try {
File persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
persistentDirectory.mkdir();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
File[] dirs1 = new File[] { persistentDirectory };
GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName, isParallel, maxMemory, batchSize, isConflation, isPersistent, filter, isManualStart, numDispatcherThreadsForTheRun, GatewaySender.DEFAULT_ORDER_POLICY);
gateway.create(dsName, remoteDsId);
} finally {
exln.remove();
}
}
Aggregations