Search in sources :

Example 21 with IgnoredException

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();
    }
}
Also used : FixedPartitionAttributes(org.apache.geode.cache.FixedPartitionAttributes) ArrayList(java.util.ArrayList) IgnoredException(org.apache.geode.test.dunit.IgnoredException) EntryNotFoundException(org.apache.geode.cache.EntryNotFoundException) PartitionNotAvailableException(org.apache.geode.cache.partition.PartitionNotAvailableException) DuplicatePrimaryPartitionException(org.apache.geode.cache.DuplicatePrimaryPartitionException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 22 with IgnoredException

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();
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) AttributesFactory(org.apache.geode.cache.AttributesFactory) PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) PartitionOfflineException(org.apache.geode.cache.persistence.PartitionOfflineException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region)

Example 23 with IgnoredException

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();
    }
}
Also used : PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) AttributesFactory(org.apache.geode.cache.AttributesFactory) PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) IgnoredException(org.apache.geode.test.dunit.IgnoredException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) CountDownLatch(java.util.concurrent.CountDownLatch) ResourceObserver(org.apache.geode.internal.cache.control.InternalResourceManager.ResourceObserver)

Example 24 with IgnoredException

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();
    }
}
Also used : ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) AsyncEventQueueFactory(org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory) AsyncEventQueue(org.apache.geode.cache.asyncqueue.AsyncEventQueue) IgnoredException(org.apache.geode.test.dunit.IgnoredException) AsyncEventListener(org.apache.geode.cache.asyncqueue.AsyncEventListener)

Example 25 with IgnoredException

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);
// }
}
Also used : IgnoredException(org.apache.geode.test.dunit.IgnoredException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region)

Aggregations

IgnoredException (org.apache.geode.test.dunit.IgnoredException)142 Test (org.junit.Test)89 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)71 Region (org.apache.geode.cache.Region)46 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)46 VM (org.apache.geode.test.dunit.VM)43 Host (org.apache.geode.test.dunit.Host)38 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)34 AttributesFactory (org.apache.geode.cache.AttributesFactory)30 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)28 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)23 IOException (java.io.IOException)21 CacheClosedException (org.apache.geode.cache.CacheClosedException)21 LocalRegion (org.apache.geode.internal.cache.LocalRegion)20 PartitionOfflineException (org.apache.geode.cache.persistence.PartitionOfflineException)16 RMIException (org.apache.geode.test.dunit.RMIException)15 GatewaySender (org.apache.geode.cache.wan.GatewaySender)14 BucketRegion (org.apache.geode.internal.cache.BucketRegion)14 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)14 CacheXmlException (org.apache.geode.cache.CacheXmlException)12