Search in sources :

Example 96 with CacheException

use of org.apache.geode.cache.CacheException in project geode by apache.

the class ClientRegisterInterestDUnitTest method testBug35381.

/**
   * Tests for Bug 35381 Calling register interest if establishCallbackConnection is not set causes
   * bridge server NPE.
   */
@Test
public void testBug35381() throws Exception {
    final Host host = Host.getHost(0);
    final String name = this.getUniqueName();
    // 1 server in this test
    final int[] ports = new int[1];
    final int whichVM = 0;
    final VM vm = Host.getHost(0).getVM(whichVM);
    vm.invoke(new CacheSerializableRunnable("Create bridge server") {

        public void run2() throws CacheException {
            LogWriterUtils.getLogWriter().info("[testBug35381] Create BridgeServer");
            getSystem();
            AttributesFactory factory = new AttributesFactory();
            factory.setScope(Scope.LOCAL);
            Region region = createRegion(name, factory.create());
            assertNotNull(region);
            assertNotNull(getRootRegion().getSubregion(name));
            region.put("KEY-1", "VAL-1");
            try {
                bridgeServerPort = startBridgeServer(0);
            } catch (IOException e) {
                LogWriterUtils.getLogWriter().error("startBridgeServer threw IOException", e);
                fail("startBridgeServer threw IOException ", e);
            }
            assertTrue(bridgeServerPort != 0);
            LogWriterUtils.getLogWriter().info("[testBug35381] port=" + bridgeServerPort);
            LogWriterUtils.getLogWriter().info("[testBug35381] serverMemberId=" + getMemberId());
        }
    });
    ports[whichVM] = vm.invoke(() -> ClientRegisterInterestDUnitTest.getBridgeServerPort());
    assertTrue(ports[whichVM] != 0);
    LogWriterUtils.getLogWriter().info("[testBug35381] create bridge client");
    Properties config = new Properties();
    config.setProperty(MCAST_PORT, "0");
    config.setProperty(LOCATORS, "");
    getSystem(config);
    getCache();
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.LOCAL);
    LogWriterUtils.getLogWriter().info("[testBug35381] creating connection pool");
    // SOURCE OF BUG 35381
    boolean establishCallbackConnection = false;
    ClientServerTestCase.configureConnectionPool(factory, NetworkUtils.getServerHostName(host), ports, establishCallbackConnection, -1, -1, null);
    Region region = createRegion(name, factory.create());
    assertNotNull(getRootRegion().getSubregion(name));
    try {
        region.registerInterest("KEY-1");
        fail("registerInterest failed to throw SubscriptionNotEnabledException with establishCallbackConnection set to false");
    } catch (SubscriptionNotEnabledException expected) {
    }
}
Also used : CacheException(org.apache.geode.cache.CacheException) Host(org.apache.geode.test.dunit.Host) IOException(java.io.IOException) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) AttributesFactory(org.apache.geode.cache.AttributesFactory) VM(org.apache.geode.test.dunit.VM) Region(org.apache.geode.cache.Region) SubscriptionNotEnabledException(org.apache.geode.cache.client.SubscriptionNotEnabledException) ClientSubscriptionTest(org.apache.geode.test.junit.categories.ClientSubscriptionTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 97 with CacheException

use of org.apache.geode.cache.CacheException in project geode by apache.

the class MultiVMRegionTestCase method testDistributedRegionInvalidate.

/**
   * Tests that {@linkplain Region#invalidateRegion invalidating} a region is propagated to all VMs
   * that define that entry.
   */
@Test
public void testDistributedRegionInvalidate() throws Exception {
    assumeTrue(supportsSubregions());
    final String name = this.getUniqueName();
    final String subname = "sub";
    final boolean useSubs = getRegionAttributes().getPartitionAttributes() == null;
    SerializableRunnable create = new CacheSerializableRunnable("Create Region") {

        @Override
        public void run2() throws CacheException {
            Region region;
            region = createRegion(name);
            if (useSubs) {
                region.createSubregion(subname, region.getAttributes());
            }
        }
    };
    Invoke.invokeInEveryVM(create);
    final Object key = "KEY";
    final Object value = "VALUE";
    final Object key2 = "KEY2";
    final Object value2 = "VALUE2";
    SerializableRunnable put = new CacheSerializableRunnable("Put key/value") {

        @Override
        public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
            region.put(key, value);
            region.put(key2, value2);
            flushIfNecessary(region);
            if (useSubs) {
                Region subregion = region.getSubregion(subname);
                subregion.put(key, value);
                subregion.put(key2, value2);
                flushIfNecessary(subregion);
            }
        }
    };
    Invoke.invokeInEveryVM(put);
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    vm0.invoke(new CacheSerializableRunnable("Invalidate Region") {

        @Override
        public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
            region.invalidateRegion();
        }
    });
    CacheSerializableRunnable verify = new CacheSerializableRunnable("Verify region invalidation") {

        @Override
        public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
            {
                Region.Entry entry = region.getEntry(key);
                assertNotNull(entry);
                Object v = entry.getValue();
                assertNull("Expected null but was " + v, v);
                entry = region.getEntry(key2);
                assertNotNull(entry);
                assertNull(entry.getValue());
            }
            if (useSubs) {
                Region subregion = region.getSubregion(subname);
                Region.Entry entry = subregion.getEntry(key);
                assertNotNull(entry);
                assertNull(entry.getValue());
                entry = subregion.getEntry(key2);
                assertNotNull(entry);
                assertNull(entry.getValue());
            }
        }
    };
    Invoke.invokeInEveryVMRepeatingIfNecessary(verify, getRepeatTimeoutMs());
}
Also used : RegionEntry(org.apache.geode.internal.cache.RegionEntry) CacheException(org.apache.geode.cache.CacheException) VM(org.apache.geode.test.dunit.VM) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) StoredObject(org.apache.geode.internal.offheap.StoredObject) Host(org.apache.geode.test.dunit.Host) Test(org.junit.Test) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 98 with CacheException

use of org.apache.geode.cache.CacheException in project geode by apache.

the class MultiVMRegionTestCase method testLargeGetInitialImage.

/**
   * Tests that a newly-created mirrored region contains all of the entries of another region, with
   * a large quantity of data.
   */
@Test
public void testLargeGetInitialImage() throws Exception {
    assumeTrue(supportsReplication());
    final String name = this.getUniqueName();
    final Integer[] keys = new Integer[NUM_ENTRIES];
    final byte[][] values = new byte[NUM_ENTRIES][];
    for (int i = 0; i < NUM_ENTRIES; i++) {
        keys[i] = new Integer(i);
        values[i] = new byte[VALUE_SIZE];
        Arrays.fill(values[i], (byte) 0x42);
    }
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    // use VM on different shared memory area
    VM vm2 = host.getVM(2);
    SerializableRunnable create = new CacheSerializableRunnable("Create Mirrored Region") {

        @Override
        public void run2() throws CacheException {
            RegionAttributes ra = getRegionAttributes();
            AttributesFactory factory = new AttributesFactory(ra);
            if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) {
                factory.setDiskStoreName(null);
            }
            factory.setDataPolicy(DataPolicy.REPLICATE);
            createRegion(name, factory.create());
        }
    };
    vm0.invoke(create);
    vm0.invoke(new CacheSerializableRunnable("Put data") {

        @Override
        public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
            for (int i = 0; i < NUM_ENTRIES; i++) {
                region.put(keys[i], values[i]);
            }
        }
    });
    vm2.invoke(create);
    // Destroy the local entries so we know that they are not found by
    // a netSearch
    vm0.invoke(new CacheSerializableRunnable("Remove local entries") {

        @Override
        public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
            region.localDestroyRegion();
        }
    });
    vm2.invoke(new CacheSerializableRunnable("Verify keys/values") {

        @Override
        public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
            assertEquals(NUM_ENTRIES, region.entrySet(false).size());
            for (int i = 0; i < NUM_ENTRIES; i++) {
                Region.Entry entry = region.getEntry(keys[i]);
                assertNotNull(entry);
                if (!(entry.getValue() instanceof byte[])) {
                    fail("getValue returned a " + entry.getValue().getClass() + " instead of the expected byte[]");
                }
                assertTrue(Arrays.equals(values[i], (byte[]) entry.getValue()));
            }
        }
    });
}
Also used : RegionAttributes(org.apache.geode.cache.RegionAttributes) CacheException(org.apache.geode.cache.CacheException) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) Host(org.apache.geode.test.dunit.Host) RegionEntry(org.apache.geode.internal.cache.RegionEntry) AttributesFactory(org.apache.geode.cache.AttributesFactory) VM(org.apache.geode.test.dunit.VM) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) Test(org.junit.Test) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 99 with CacheException

use of org.apache.geode.cache.CacheException in project geode by apache.

the class MultiVMRegionTestCase method testNoRegionKeepAlive.

/**
   * Tests that a region is not kept alive
   */
@Test
public void testNoRegionKeepAlive() throws Exception {
    final String name = this.getUniqueName();
    final Object key = "KEEP_ALIVE_KEY";
    final Object value = "VALUE";
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    vm0.invoke(new CacheSerializableRunnable("Create region") {

        @Override
        public void run2() throws CacheException {
            createRegion(name);
        }
    });
    vm0.invoke(new CacheSerializableRunnable("Populate region") {

        @Override
        public void run2() throws CacheException {
            Region region = getRootRegion().getSubregion(name);
            region.put(key, value);
            assertEquals(value, region.get(key));
        }
    });
    vm0.invoke(new CacheSerializableRunnable("Close cache") {

        @Override
        public void run2() throws CacheException {
            closeCache();
        }
    });
    vm0.invoke(new CacheSerializableRunnable("Re-create cache") {

        @Override
        public void run2() throws CacheException {
            Region region = createRegion(name);
            // otherwise it should not
            if (region.getAttributes().getDataPolicy().withPersistence()) {
                assertEquals(value, region.get(key));
            } else {
                assertNull(region.get(key));
            }
        }
    });
}
Also used : CacheException(org.apache.geode.cache.CacheException) VM(org.apache.geode.test.dunit.VM) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) StoredObject(org.apache.geode.internal.offheap.StoredObject) Host(org.apache.geode.test.dunit.Host) Test(org.junit.Test) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 100 with CacheException

use of org.apache.geode.cache.CacheException in project geode by apache.

the class MultiVMRegionTestCase method testTXSimpleOps.

/**
   * Tests that an entry update is propagated to other caches that have that same entry defined.
   */
@Test
public void testTXSimpleOps() throws Exception {
    assumeTrue(supportsTransactions());
    assertTrue(getRegionAttributes().getScope().isDistributed());
    CacheTransactionManager txMgr = this.getCache().getCacheTransactionManager();
    if (getRegionAttributes().getScope().isGlobal() || getRegionAttributes().getDataPolicy().withPersistence()) {
        // just make sure transactions are not allowed on global or shared regions
        Region rgn = createRegion(getUniqueName());
        txMgr.begin();
        try {
            rgn.put("testTXSimpleOpsKey1", "val");
            fail("expected UnsupportedOperationException");
        } catch (UnsupportedOperationException ok) {
        }
        txMgr.rollback();
        rgn.localDestroyRegion();
        return;
    }
    final String rgnName = getUniqueName();
    SerializableRunnable create = new SerializableRunnable("testTXSimpleOps: Create Region") {

        @Override
        public void run() {
            CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
            MyTransactionListener tl = new MyTransactionListener();
            txMgr2.addListener(tl);
            assertEquals(null, tl.lastEvent);
            assertEquals(0, tl.afterCommitCount);
            assertEquals(0, tl.afterFailedCommitCount);
            assertEquals(0, tl.afterRollbackCount);
            assertEquals(0, tl.closeCount);
            try {
                Region rgn = createRegion(rgnName);
                CountingDistCacheListener cacheListener = new CountingDistCacheListener();
                rgn.getAttributesMutator().addCacheListener(cacheListener);
                cacheListener.assertCount(0, 0, 0, 0);
                getSystem().getLogWriter().info("testTXSimpleOps: Created region");
            } catch (CacheException e) {
                fail("While creating region", e);
            }
        }
    };
    SerializableRunnable newKey = new SerializableRunnable("testTXSimpleOps: Create Region & Create Key") {

        @Override
        public void run() {
            try {
                Region root = getRootRegion();
                Region rgn = root.getSubregion(rgnName);
                rgn.create("key", null);
                CountingDistCacheListener cacheListener = (CountingDistCacheListener) rgn.getAttributes().getCacheListener();
                cacheListener.assertCount(0, 0, 0, 0);
                getSystem().getLogWriter().info("testTXSimpleOps: Created Key");
            } catch (CacheException e) {
                fail("While creating region", e);
            }
        }
    };
    Host host = Host.getHost(0);
    VM vm = host.getVM(0);
    vm.invoke(create);
    vm.invoke(newKey);
    int vmCount = host.getVMCount();
    for (int i = 1; i < vmCount; i++) {
        vm = host.getVM(i);
        vm.invoke(create);
        if (!getRegionAttributes().getDataPolicy().withReplication() && !getRegionAttributes().getDataPolicy().isPreloaded()) {
            vm.invoke(newKey);
        }
    }
    try {
        Region rgn = createRegion(rgnName);
        DMStats dmStats = getSystem().getDistributionManager().getStats();
        long cmtMsgs = dmStats.getSentCommitMessages();
        long commitWaits = dmStats.getCommitWaits();
        txMgr.begin();
        rgn.put("key", "value");
        TransactionId txId = txMgr.getTransactionId();
        txMgr.commit();
        assertEquals(cmtMsgs + 1, dmStats.getSentCommitMessages());
        if (rgn.getAttributes().getScope().isAck()) {
            assertEquals(commitWaits + 1, dmStats.getCommitWaits());
        } else {
            assertEquals(commitWaits, dmStats.getCommitWaits());
        }
        getSystem().getLogWriter().info("testTXSimpleOps: Create/Put Value");
        Invoke.invokeInEveryVM(MultiVMRegionTestCase.class, "assertCacheCallbackEvents", new Object[] { rgnName, txId, "key", null, "value" });
        Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {

            @Override
            public void run2() {
                Region rgn1 = getRootRegion().getSubregion(rgnName);
                assertNotNull("Could not find entry for 'key'", rgn1.getEntry("key"));
                assertEquals("value", rgn1.getEntry("key").getValue());
                CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
                MyTransactionListener tl = (MyTransactionListener) txMgr2.getListeners()[0];
                tl.checkAfterCommitCount(1);
                assertEquals(0, tl.afterFailedCommitCount);
                assertEquals(0, tl.afterRollbackCount);
                assertEquals(0, tl.closeCount);
                assertEquals(rgn1.getCache(), tl.lastEvent.getCache());
                {
                    Collection events;
                    RegionAttributes attr = getRegionAttributes();
                    if (!attr.getDataPolicy().withReplication() || attr.getConcurrencyChecksEnabled()) {
                        events = tl.lastEvent.getPutEvents();
                    } else {
                        events = tl.lastEvent.getCreateEvents();
                    }
                    assertEquals(1, events.size());
                    EntryEvent ev = (EntryEvent) events.iterator().next();
                    assertEquals(tl.expectedTxId, ev.getTransactionId());
                    assertTrue(ev.getRegion() == rgn1);
                    assertEquals("key", ev.getKey());
                    assertEquals("value", ev.getNewValue());
                    assertEquals(null, ev.getOldValue());
                    assertTrue(!ev.getOperation().isLocalLoad());
                    assertTrue(!ev.getOperation().isNetLoad());
                    assertTrue(!ev.getOperation().isLoad());
                    assertTrue(!ev.getOperation().isNetSearch());
                    assertTrue(!ev.getOperation().isExpiration());
                    assertEquals(null, ev.getCallbackArgument());
                    assertEquals(true, ev.isCallbackArgumentAvailable());
                    assertTrue(ev.isOriginRemote());
                    assertTrue(ev.getOperation().isDistributed());
                }
                CountingDistCacheListener cdcL = (CountingDistCacheListener) rgn1.getAttributes().getCacheListeners()[0];
                cdcL.assertCount(0, 1, 0, 0);
            }
        }, getRepeatTimeoutMs());
        txMgr.begin();
        rgn.put("key", "value2");
        txId = txMgr.getTransactionId();
        txMgr.commit();
        getSystem().getLogWriter().info("testTXSimpleOps: Put(update) Value2");
        Invoke.invokeInEveryVM(MultiVMRegionTestCase.class, "assertCacheCallbackEvents", new Object[] { rgnName, txId, "key", "value", "value2" });
        Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {

            @Override
            public void run2() {
                Region rgn1 = getRootRegion().getSubregion(rgnName);
                assertNotNull("Could not find entry for 'key'", rgn1.getEntry("key"));
                assertEquals("value2", rgn1.getEntry("key").getValue());
                CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
                MyTransactionListener tl = (MyTransactionListener) txMgr2.getListeners()[0];
                tl.checkAfterCommitCount(2);
                assertEquals(rgn1.getCache(), tl.lastEvent.getCache());
                {
                    Collection events = tl.lastEvent.getPutEvents();
                    assertEquals(1, events.size());
                    EntryEvent ev = (EntryEvent) events.iterator().next();
                    assertEquals(tl.expectedTxId, ev.getTransactionId());
                    assertTrue(ev.getRegion() == rgn1);
                    assertEquals("key", ev.getKey());
                    assertEquals("value2", ev.getNewValue());
                    assertEquals("value", ev.getOldValue());
                    assertTrue(!ev.getOperation().isLocalLoad());
                    assertTrue(!ev.getOperation().isNetLoad());
                    assertTrue(!ev.getOperation().isLoad());
                    assertTrue(!ev.getOperation().isNetSearch());
                    assertTrue(!ev.getOperation().isExpiration());
                    assertEquals(null, ev.getCallbackArgument());
                    assertEquals(true, ev.isCallbackArgumentAvailable());
                    assertTrue(ev.isOriginRemote());
                    assertTrue(ev.getOperation().isDistributed());
                }
                CountingDistCacheListener cdcL = (CountingDistCacheListener) rgn1.getAttributes().getCacheListeners()[0];
                cdcL.assertCount(0, 2, 0, 0);
            }
        }, getRepeatTimeoutMs());
        txMgr.begin();
        rgn.invalidate("key");
        txId = txMgr.getTransactionId();
        txMgr.commit();
        getSystem().getLogWriter().info("testTXSimpleOps: invalidate key");
        // validate each of the CacheListeners EntryEvents
        Invoke.invokeInEveryVM(MultiVMRegionTestCase.class, "assertCacheCallbackEvents", new Object[] { rgnName, txId, "key", "value2", null });
        Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {

            @Override
            public void run2() {
                Region rgn1 = getRootRegion().getSubregion(rgnName);
                assertNotNull("Could not find entry for 'key'", rgn1.getEntry("key"));
                assertTrue(rgn1.containsKey("key"));
                assertTrue(!rgn1.containsValueForKey("key"));
                CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
                MyTransactionListener tl = (MyTransactionListener) txMgr2.getListeners()[0];
                tl.checkAfterCommitCount(3);
                assertEquals(rgn1.getCache(), tl.lastEvent.getCache());
                {
                    Collection events = tl.lastEvent.getInvalidateEvents();
                    assertEquals(1, events.size());
                    EntryEvent ev = (EntryEvent) events.iterator().next();
                    assertEquals(tl.expectedTxId, ev.getTransactionId());
                    assertTrue(ev.getRegion() == rgn1);
                    assertEquals("key", ev.getKey());
                    assertEquals(null, ev.getNewValue());
                    assertEquals("value2", ev.getOldValue());
                    assertTrue(!ev.getOperation().isLocalLoad());
                    assertTrue(!ev.getOperation().isNetLoad());
                    assertTrue(!ev.getOperation().isLoad());
                    assertTrue(!ev.getOperation().isNetSearch());
                    assertTrue(!ev.getOperation().isExpiration());
                    assertEquals(null, ev.getCallbackArgument());
                    assertEquals(true, ev.isCallbackArgumentAvailable());
                    assertTrue(ev.isOriginRemote());
                    assertTrue(ev.getOperation().isDistributed());
                }
                CountingDistCacheListener cdcL = (CountingDistCacheListener) rgn1.getAttributes().getCacheListeners()[0];
                cdcL.assertCount(0, 2, 1, 0);
            }
        }, getRepeatTimeoutMs());
        txMgr.begin();
        rgn.destroy("key");
        txId = txMgr.getTransactionId();
        txMgr.commit();
        getSystem().getLogWriter().info("testTXSimpleOps: destroy key");
        // validate each of the CacheListeners EntryEvents
        Invoke.invokeInEveryVM(MultiVMRegionTestCase.class, "assertCacheCallbackEvents", new Object[] { rgnName, txId, "key", null, null });
        Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {

            @Override
            public void run2() {
                Region rgn1 = getRootRegion().getSubregion(rgnName);
                assertTrue(!rgn1.containsKey("key"));
                CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
                MyTransactionListener tl = (MyTransactionListener) txMgr2.getListeners()[0];
                tl.checkAfterCommitCount(4);
                assertEquals(rgn1.getCache(), tl.lastEvent.getCache());
                {
                    Collection events = tl.lastEvent.getDestroyEvents();
                    assertEquals(1, events.size());
                    EntryEvent ev = (EntryEvent) events.iterator().next();
                    assertEquals(tl.expectedTxId, ev.getTransactionId());
                    assertTrue(ev.getRegion() == rgn1);
                    assertEquals("key", ev.getKey());
                    assertEquals(null, ev.getNewValue());
                    assertEquals(null, ev.getOldValue());
                    assertTrue(!ev.getOperation().isLocalLoad());
                    assertTrue(!ev.getOperation().isNetLoad());
                    assertTrue(!ev.getOperation().isLoad());
                    assertTrue(!ev.getOperation().isNetSearch());
                    assertTrue(!ev.getOperation().isExpiration());
                    assertEquals(null, ev.getCallbackArgument());
                    assertEquals(true, ev.isCallbackArgumentAvailable());
                    assertTrue(ev.isOriginRemote());
                    assertTrue(ev.getOperation().isDistributed());
                }
                CountingDistCacheListener cdcL = (CountingDistCacheListener) rgn1.getAttributes().getCacheListeners()[0];
                cdcL.assertCount(0, 2, 1, 1);
            }
        }, getRepeatTimeoutMs());
    } catch (Exception e) {
        CacheFactory.getInstance(getSystem()).close();
        getSystem().getLogWriter().fine("testTXSimpleOps: Caused exception in createRegion");
        throw e;
    }
}
Also used : DMStats(org.apache.geode.distributed.internal.DMStats) CacheException(org.apache.geode.cache.CacheException) RegionAttributes(org.apache.geode.cache.RegionAttributes) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) Host(org.apache.geode.test.dunit.Host) TimeoutException(org.apache.geode.cache.TimeoutException) EntryNotFoundException(org.apache.geode.cache.EntryNotFoundException) InvalidDeltaException(org.apache.geode.InvalidDeltaException) IOException(java.io.IOException) CacheException(org.apache.geode.cache.CacheException) EntryExistsException(org.apache.geode.cache.EntryExistsException) CacheWriterException(org.apache.geode.cache.CacheWriterException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) CacheLoaderException(org.apache.geode.cache.CacheLoaderException) CacheTransactionManager(org.apache.geode.cache.CacheTransactionManager) TransactionId(org.apache.geode.cache.TransactionId) VM(org.apache.geode.test.dunit.VM) EntryEvent(org.apache.geode.cache.EntryEvent) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) Collection(java.util.Collection) Test(org.junit.Test) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Aggregations

CacheException (org.apache.geode.cache.CacheException)638 Test (org.junit.Test)445 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)407 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)376 VM (org.apache.geode.test.dunit.VM)375 Region (org.apache.geode.cache.Region)351 Host (org.apache.geode.test.dunit.Host)330 AttributesFactory (org.apache.geode.cache.AttributesFactory)204 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)201 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)191 IOException (java.io.IOException)124 LocalRegion (org.apache.geode.internal.cache.LocalRegion)118 QueryService (org.apache.geode.cache.query.QueryService)107 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)85 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)85 SelectResults (org.apache.geode.cache.query.SelectResults)80 IgnoredException (org.apache.geode.test.dunit.IgnoredException)72 ClientSubscriptionTest (org.apache.geode.test.junit.categories.ClientSubscriptionTest)64 AsyncInvocation (org.apache.geode.test.dunit.AsyncInvocation)61 Cache (org.apache.geode.cache.Cache)59