Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 636D2200AE4 for ; Thu, 9 Jun 2016 20:49:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 620F1160A5C; Thu, 9 Jun 2016 18:49:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 42FB3160A5D for ; Thu, 9 Jun 2016 20:49:42 +0200 (CEST) Received: (qmail 48818 invoked by uid 500); 9 Jun 2016 18:49:41 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 48809 invoked by uid 99); 9 Jun 2016 18:49:41 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2016 18:49:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id DB13DC2585 for ; Thu, 9 Jun 2016 18:49:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id UubOnX9tTuBe for ; Thu, 9 Jun 2016 18:49:34 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 84E935FD39 for ; Thu, 9 Jun 2016 18:49:31 +0000 (UTC) Received: (qmail 47916 invoked by uid 99); 9 Jun 2016 18:49:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2016 18:49:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A2951DFB74; Thu, 9 Jun 2016 18:49:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: klund@apache.org To: commits@geode.incubator.apache.org Date: Thu, 09 Jun 2016 18:50:02 -0000 Message-Id: <254450100f054441b008cdb566cce1a1@git.apache.org> In-Reply-To: <5fb195041e7c484d97757c90612c03fc@git.apache.org> References: <5fb195041e7c484d97757c90612c03fc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [34/54] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4 archived-at: Thu, 09 Jun 2016 18:49:44 -0000 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java index 90fc87c..b24673d 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java @@ -19,177 +19,78 @@ */ package com.gemstone.gemfire.internal.cache; -import com.gemstone.gemfire.cache.*; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static com.gemstone.gemfire.test.dunit.Assert.*; + +import java.io.IOException; +import java.util.List; +import java.util.Properties; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.cache.AttributesFactory; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.DiskAccessException; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.RegionAttributes; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.client.internal.PoolImpl; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; -import com.gemstone.gemfire.cache30.CacheTestCase; -import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.persistence.UninterruptibleFileChannel; -import com.gemstone.gemfire.test.dunit.*; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Properties; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS; -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.NetworkUtils; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * Tests that if a node doing GII experiences DiskAccessException, it should * also not try to recover from the disk - * */ -public class Bug39079DUnitTest extends CacheTestCase { - - protected static String regionName = "IGNORE_EXCEPTION_Bug39079"; +@Category(DistributedTest.class) +public class Bug39079DUnitTest extends JUnit4CacheTestCase { - static Properties props = new Properties(); - - - private VM vm0 = null; - - private static VM vm1 = null; - - private static String REGION_NAME = "IGNORE_EXCEPTION_testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase"; - - private static Cache gemfirecache = null; - - private static Region region; - - protected static File[] dirs = null; + private static final String REGION_NAME_testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase = "IGNORE_EXCEPTION_testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase"; + private static final String REGION_NAME_testGIIDiskAccessException = "IGNORE_EXCEPTION_testGIIDiskAccessException"; - private static final int maxEntries = 10000; - - /** - * Constructor - * - * @param name - */ - public Bug39079DUnitTest(String name) { - super(name); - File file1 = new File(name + "1"); - file1.mkdir(); - file1.deleteOnExit(); - File file2 = new File(name + "2"); - file2.mkdir(); - file2.deleteOnExit(); - dirs = new File[2]; - dirs[0] = file1; - dirs[1] = file2; - } + private VM vm0; + private VM vm1; @Override public final void postSetUp() throws Exception { + disconnectAllFromDS(); + final Host host = Host.getHost(0); vm0 = host.getVM(0); vm1 = host.getVM(1); - vm0.invoke(() -> Bug39079DUnitTest.ignorePreAllocate( Boolean.TRUE )); - vm1.invoke(() -> Bug39079DUnitTest.ignorePreAllocate( Boolean.TRUE )); - } - - /** - * This method is used to create Cache in VM0 - * - * @return CacheSerializableRunnable - */ - - private CacheSerializableRunnable createCacheForVM0() { - SerializableRunnable createCache = new CacheSerializableRunnable( - "createCache") { - public void run2() { - try { - - (new Bug39079DUnitTest("vm0_diskReg")) - .getSystem(); - - assertTrue(getCache() != null); - AttributesFactory factory = new AttributesFactory(); - factory.setScope(Scope.DISTRIBUTED_ACK); - factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); - factory.setDiskSynchronous(false); - factory.setDiskStoreName(getCache().createDiskStoreFactory() - .setDiskDirs(dirs) - .create("Bug39079DUnitTest") - .getName()); - RegionAttributes attr = factory.create(); - getCache().createRegion(regionName, attr); - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Error Creating cache / region "); - } - } - }; - return (CacheSerializableRunnable)createCache; - } - - /** - * This method is used to create Cache in VM1 - * - * @return CacheSerializableRunnable - */ - private CacheSerializableRunnable createCacheForVM1() { - SerializableRunnable createCache = new CacheSerializableRunnable( - "createCache") { - public void run2() { - try { - (new Bug39079DUnitTest("vm1_diskReg")) - .getSystem(); - - - assertTrue("cache found null", getCache() != null); - - AttributesFactory factory = new AttributesFactory(); - factory.setScope(Scope.DISTRIBUTED_ACK); - factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); - factory.setDiskSynchronous(false); - factory.setDiskStoreName(getCache().createDiskStoreFactory() - .setDiskDirs(dirs) - .create("Bug39079DUnitTest") - .getName()); - RegionAttributes attr = factory.create(); - getCache().createRegion(regionName, attr); - - } - catch (Exception ex) { - ex.printStackTrace(); - fail("Error Creating cache / region " + ex); - } - } - }; - return (CacheSerializableRunnable)createCache; + vm0.invoke(() -> ignorePreAllocate(true)); + vm1.invoke(() -> ignorePreAllocate(true)); } @Override public final void postTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); - vm0.invoke(() -> Bug39079DUnitTest.ignorePreAllocate( Boolean.FALSE )); - vm1.invoke(() -> Bug39079DUnitTest.ignorePreAllocate( Boolean.FALSE )); - } - - static void ignorePreAllocate(boolean flag) throws Exception { - DiskStoreImpl.SET_IGNORE_PREALLOCATE = flag; + vm0.invoke(() -> ignorePreAllocate(false)); + vm1.invoke(() -> ignorePreAllocate(false)); } - /** - * If the node expreriences disk access exception during GII, it should + * If the node experiences disk access exception during GII, it should * get destroyed & not attempt to recover from the disk - * */ - - public void testGIIDiskAccessException() { - + @Test + public void testGIIDiskAccessException() throws Exception { vm0.invoke(createCacheForVM0()); vm1.invoke(createCacheForVM1()); + //Create DiskRegion locally in controller VM also - this.getSystem(); + getSystem(); assertTrue(getCache() != null); @@ -197,172 +98,114 @@ public class Bug39079DUnitTest extends CacheTestCase { factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); factory.setDiskSynchronous(false); - factory.setDiskStoreName(getCache().createDiskStoreFactory() - .setDiskDirs(dirs) - .create("Bug39079DUnitTest") - .getName()); + factory.setDiskStoreName(getCache().createDiskStoreFactory().setDiskDirs(getDiskDirs()).create(getClass().getSimpleName()).getName()); RegionAttributes attr = factory.create(); - Region rgn = getCache().createRegion(regionName, attr); + Region region = getCache().createRegion(REGION_NAME_testGIIDiskAccessException, attr); + //Now put entries in the disk region for (int i = 0; i < 100; ++i) { - rgn.put(new Integer(i), new Integer(i)); + region.put(new Integer(i), new Integer(i)); } + //Now close the region in the controller VM - rgn.close(); + region.close(); //Now recreate the region but set the factory such that disk region entry object //used is customized by us to throw exception while writing to disk - DistributedRegion distRegion = new DistributedRegion(regionName, attr, - null, (GemFireCacheImpl)getCache(), new InternalRegionArguments() - .setDestroyLockFlag(true).setRecreateFlag(false) - .setSnapshotInputStream(null).setImageTarget(null)); -// assertTrue("Distributed Region is null", distRegion != null); (cannot be null) + DistributedRegion distRegion = new DistributedRegion( + REGION_NAME_testGIIDiskAccessException, + attr, + null, + (GemFireCacheImpl)getCache(), + new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false).setSnapshotInputStream(null).setImageTarget(null)); + + distRegion.entries.setEntryFactory(TestAbstractDiskRegionEntry.getEntryFactory()); + region = null; - ((AbstractRegionMap)distRegion.entries) - .setEntryFactory(Bug39079DUnitTest.TestAbstractDiskRegionEntry.getEntryFactory()); - rgn = null; try { - rgn = ((GemFireCacheImpl)getCache()).createVMRegion(regionName, attr, - new InternalRegionArguments().setInternalMetaRegion(distRegion) - .setDestroyLockFlag(true).setSnapshotInputStream(null) - .setImageTarget(null)); - } - catch (DiskAccessException dae) { - //Ok + region = ((GemFireCacheImpl)getCache()).createVMRegion( + REGION_NAME_testGIIDiskAccessException, + attr, + new InternalRegionArguments().setInternalMetaRegion(distRegion).setDestroyLockFlag(true).setSnapshotInputStream(null).setImageTarget(null)); + fail("Expected DiskAccessException"); + } catch (DiskAccessException expected) { } - catch (Exception e) { - fail(" test failed because of exception =" + e.toString()); - } - - assertTrue(rgn == null || rgn.isDestroyed()); + assertTrue(region == null || region.isDestroyed()); // TODO: why is this an OR instead of deterministic? } - static class TestAbstractDiskRegionEntry extends VMThinDiskRegionEntryHeapObjectKey { - protected TestAbstractDiskRegionEntry(RegionEntryContext r, Object key, - Object value) { - super(r, key, value); - } - - private static RegionEntryFactory factory = new RegionEntryFactory() { - public final RegionEntry createEntry(RegionEntryContext r, Object key, - Object value) { - - throw new DiskAccessException(new IOException("Test Exception")); - //return new Bug39079DUnitTest.TestAbstractDiskRegionEntry(r, key, value); - } - - public final Class getEntryClass() { - - return Bug39079DUnitTest.TestAbstractDiskRegionEntry.class; - } - - @Override - public RegionEntryFactory makeVersioned() { - return this; - } - - public RegionEntryFactory makeOnHeap() { - return this; - } - }; - - /** - * Overridden setValue method to throw exception - */ - @Override - protected void setValueField(Object v) { - throw new DiskAccessException(new IOException("Test Exception")); - } - - public static RegionEntryFactory getEntryFactory() { - return factory; - } - } - /** * If IOException occurs while updating an entry in an already initialized * DiskRegion ,then the bridge servers should be stopped , if any running - * - * @throws Exception */ - public void testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase() - throws Exception { - // create server cache - Integer port = (Integer)vm0.invoke(() -> Bug39079DUnitTest.createServerCache()); - //create cache client - vm1.invoke(() -> Bug39079DUnitTest.createClientCache( NetworkUtils.getServerHostName(vm0.getHost()), port)); + @Test + public void testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase() throws Exception { + // create server cache + Integer port = vm0.invoke(() -> createServerCache()); + + //create cache client + vm1.invoke(() -> createClientCache(NetworkUtils.getServerHostName(vm0.getHost()), port)); - // validate - vm0.invoke(() -> Bug39079DUnitTest.validateRuningBridgeServerList()); + // validate + vm0.invoke(() -> validateRunningBridgeServerList()); - // close server cache - vm0.invoke(() -> Bug39079DUnitTest.closeCacheAndDisconnect()); - // close client cache - vm1.invoke(() -> Bug39079DUnitTest.closeCacheAndDisconnect()); + // close server cache + vm0.invoke(() -> closeCacheAndDisconnect()); + + // close client cache + vm1.invoke(() -> closeCacheAndDisconnect()); } - - public static Integer createServerCache() throws Exception - { - new Bug39079DUnitTest("temp").createCache(new Properties()); + + private int createServerCache() throws IOException { + createCache(new Properties()); DiskRegionProperties props = new DiskRegionProperties(); - props.setRegionName(REGION_NAME); + props.setRegionName(REGION_NAME_testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase); props.setOverflow(true); props.setRolling(true); - props.setDiskDirs(dirs); + props.setDiskDirs(getDiskDirs()); props.setPersistBackup(true); - region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(gemfirecache, props, Scope.DISTRIBUTED_ACK); + Region region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(getCache(), props, Scope.DISTRIBUTED_ACK); assertNotNull(region); - CacheServer bs1 = gemfirecache.addCacheServer(); + CacheServer bs1 = getCache().addCacheServer(); int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); bs1.setPort(port); bs1.start(); - return new Integer(bs1.getPort()); + return bs1.getPort(); } - public static void closeCacheAndDisconnect() - { - if (gemfirecache != null && !gemfirecache.isClosed()) { - gemfirecache.close(); - gemfirecache.getDistributedSystem().disconnect(); - } + private void closeCacheAndDisconnect() { + closeCache(); + disconnectFromDS(); } - private void createCache(Properties props) throws Exception - { - DistributedSystem ds = getSystem(props); - assertNotNull(ds); - ds.disconnect(); - ds = getSystem(props); - gemfirecache = CacheFactory.create(ds); - assertNotNull(gemfirecache); + private void createCache(Properties props) { + getSystem(props); + assertNotNull(getCache()); } - private static void validateRuningBridgeServerList(){ - /*Region region = gemfirecache.getRegion(Region.SEPARATOR + REGION_NAME); - assertNotNull(region);*/ - try { + private void validateRunningBridgeServerList() throws IOException { + Region region = getCache().getRegion(REGION_NAME_testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase); + try { region.create("key1", new byte[16]); region.create("key2", new byte[16]); -// Get the oplog handle & hence the underlying file & close it - UninterruptibleFileChannel oplogFileChannel = ((LocalRegion)region).getDiskRegion() - .testHook_getChild().getFileChannel(); + + // Get the oplog handle & hence the underlying file & close it + UninterruptibleFileChannel oplogFileChannel = ((LocalRegion)region).getDiskRegion().testHook_getChild().getFileChannel(); + try { oplogFileChannel.close(); region.put("key2", new byte[16]); - }catch(DiskAccessException dae) { - //OK expected - }catch (IOException e) { - Assert.fail("test failed due to ", e); + fail("Expected DiskAccessException"); + } catch(DiskAccessException expected) { } - + ((LocalRegion) region).getDiskStore().waitForClose(); assertTrue(region.getRegionService().isClosed()); region = null; - List bsRunning = gemfirecache.getCacheServers(); + List bsRunning = getCache().getCacheServers(); assertTrue(bsRunning.isEmpty()); } finally { @@ -371,27 +214,123 @@ public class Bug39079DUnitTest extends CacheTestCase { } } } - - public static void createClientCache(String host, Integer port1) - throws Exception { - new Bug39079DUnitTest("temp"); + + private void createClientCache(String host, Integer port1) { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new Bug39079DUnitTest("temp").createCache(props); - PoolImpl p = (PoolImpl)PoolManager.createFactory().addServer(host, - port1.intValue()) - .setSubscriptionEnabled(true).setSubscriptionRedundancy(0) - .setThreadLocalConnections(true).setMinConnections(0).setReadTimeout( - 20000).setRetryAttempts(1).create("Bug39079DUnitTest"); + createCache(props); + + PoolImpl pool = (PoolImpl)PoolManager.createFactory() + .addServer(host, port1.intValue()) + .setSubscriptionEnabled(true).setSubscriptionRedundancy(0).setThreadLocalConnections(true).setMinConnections(0).setReadTimeout(20000).setRetryAttempts(1).create(getClass().getSimpleName()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); - factory.setPoolName(p.getName()); + factory.setPoolName(pool.getName()); RegionAttributes attrs = factory.create(); - Region r = gemfirecache.createRegion(REGION_NAME, attrs); - //getRegion(Region.SEPARATOR + REGION_NAME); - r.registerInterest("ALL_KEYS"); + Region region = getCache().createRegion(REGION_NAME_testBridgeServerStoppingInSynchPersistOnlyForIOExceptionCase, attrs); + region.registerInterest("ALL_KEYS"); + } + + /** + * This method is used to create Cache in VM0 + */ + private CacheSerializableRunnable createCacheForVM0() { + return new CacheSerializableRunnable("createCache") { + @Override + public void run2() { + try { + getSystem(); + assertNotNull(getCache()); + + AttributesFactory factory = new AttributesFactory(); + factory.setScope(Scope.DISTRIBUTED_ACK); + factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); + factory.setDiskSynchronous(false); + factory.setDiskStoreName(getCache().createDiskStoreFactory().setDiskDirs(getDiskDirs()).create(getClass().getSimpleName()).getName()); + + RegionAttributes attr = factory.create(); + getCache().createRegion(REGION_NAME_testGIIDiskAccessException, attr); + } + catch (Exception ex) { + fail("Error Creating cache / region ", ex); + } + } + }; + } + + /** + * This method is used to create Cache in VM1 + */ + private CacheSerializableRunnable createCacheForVM1() { + return new CacheSerializableRunnable("createCache") { + @Override + public void run2() { + try { + getSystem(); + assertNotNull(getCache()); + + AttributesFactory factory = new AttributesFactory(); + factory.setScope(Scope.DISTRIBUTED_ACK); + factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); + factory.setDiskSynchronous(false); + factory.setDiskStoreName(getCache().createDiskStoreFactory().setDiskDirs(getDiskDirs()).create(getClass().getSimpleName()).getName()); + + RegionAttributes attr = factory.create(); + getCache().createRegion(REGION_NAME_testGIIDiskAccessException, attr); + } + catch (Exception ex) { + fail("Error Creating cache / region ", ex); + } + } + }; + } + + private void ignorePreAllocate(boolean flag) throws Exception { + DiskStoreImpl.SET_IGNORE_PREALLOCATE = flag; + } + + private static class TestAbstractDiskRegionEntry extends VMThinDiskRegionEntryHeapObjectKey { + + protected TestAbstractDiskRegionEntry(RegionEntryContext r, Object key, Object value) { + super(r, key, value); + } + + private static RegionEntryFactory factory = new RegionEntryFactory() { + + @Override + public final RegionEntry createEntry(RegionEntryContext r, Object key, Object value) { + throw new DiskAccessException(new IOException("Test Exception")); + } + + @Override + public final Class getEntryClass() { + return getClass(); + } + + @Override + public RegionEntryFactory makeVersioned() { + return this; + } + + @Override + public RegionEntryFactory makeOnHeap() { + return this; + } + }; + + /** + * Overridden setValue method to throw exception + */ + @Override + protected void setValueField(Object v) { + throw new DiskAccessException(new IOException("Test Exception")); + } + + public static RegionEntryFactory getEntryFactory() { + return factory; + } } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java index ccf2311..2c3951a 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java @@ -16,9 +16,14 @@ */ package com.gemstone.gemfire.internal.cache; +import static org.junit.Assert.*; + import java.io.File; import java.util.Properties; +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; @@ -30,31 +35,22 @@ import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionAttributes; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; -import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.internal.cache.CacheObserverAdapter; -import com.gemstone.gemfire.internal.cache.CacheObserverHolder; -import com.gemstone.gemfire.internal.cache.DiskRegionHelperFactory; -import com.gemstone.gemfire.internal.cache.DiskRegionProperties; -import com.gemstone.gemfire.internal.cache.LocalRegion; -import com.gemstone.gemfire.internal.cache.SearchLoadAndWriteProcessor; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.IgnoredException; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * Bug40299 DUNIT Test: The Clear operation during a NetSearchMessage.doGet() in progress can * cause DiskAccessException by accessing cleared oplogs and * eventually destroy region. * The Test verifies that fix prevents this. - * */ - -public class Bug40299DUnitTest extends CacheTestCase -{ +@Category(DistributedTest.class) +public class Bug40299DUnitTest extends JUnit4CacheTestCase { protected static String regionName = "TestRegion"; @@ -66,16 +62,6 @@ public class Bug40299DUnitTest extends CacheTestCase protected static Cache cache = null; - - /** - * Constructor - * - * @param name - */ - public Bug40299DUnitTest(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { final Host host = Host.getHost(0); @@ -101,7 +87,7 @@ public class Bug40299DUnitTest extends CacheTestCase { try { - distributedSystem = (new Bug40299DUnitTest("vm0_diskReg")) + distributedSystem = (new Bug40299DUnitTest()) .getSystem(props); assertTrue(distributedSystem != null); cache = CacheFactory.create(distributedSystem); @@ -286,6 +272,7 @@ public class Bug40299DUnitTest extends CacheTestCase * The Test verifies that fix prevents this. */ + @Test public void testQueryGetWithClear() { IgnoredException.addIgnoredException("Entry has been cleared and is not present on disk"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40632DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40632DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40632DUnitTest.java index 80d5ce4..e35a357 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40632DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40632DUnitTest.java @@ -16,60 +16,25 @@ */ package com.gemstone.gemfire.internal.cache; -import java.util.Collections; -import java.util.Set; -import java.util.concurrent.CancellationException; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; +import static org.junit.Assert.*; -import junit.framework.TestCase; +import org.junit.Test; +import org.junit.experimental.categories.Category; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheLoader; -import com.gemstone.gemfire.cache.CacheLoaderException; -import com.gemstone.gemfire.cache.CacheWriterException; -import com.gemstone.gemfire.cache.EntryEvent; import com.gemstone.gemfire.cache.ExpirationAction; import com.gemstone.gemfire.cache.ExpirationAttributes; -import com.gemstone.gemfire.cache.LoaderHelper; import com.gemstone.gemfire.cache.PartitionAttributes; import com.gemstone.gemfire.cache.PartitionAttributesFactory; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.control.RebalanceOperation; -import com.gemstone.gemfire.cache.control.RebalanceResults; -import com.gemstone.gemfire.cache.control.ResourceManager; -import com.gemstone.gemfire.cache.partition.PartitionMemberInfo; -import com.gemstone.gemfire.cache.partition.PartitionRebalanceInfo; -import com.gemstone.gemfire.cache.partition.PartitionRegionInfo; -import com.gemstone.gemfire.cache.util.CacheListenerAdapter; -import com.gemstone.gemfire.cache30.CacheTestCase; -import com.gemstone.gemfire.distributed.DistributedMember; -import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.PRHARedundancyProvider; -import com.gemstone.gemfire.internal.cache.PartitionedRegion; -import com.gemstone.gemfire.internal.cache.control.InternalResourceManager; -import com.gemstone.gemfire.internal.cache.control.ResourceManagerStats; -import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceObserverAdapter; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.SerializableCallable; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; -/** - * - */ -public class Bug40632DUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class Bug40632DUnitTest extends JUnit4CacheTestCase { - /** - * @param name - */ - public Bug40632DUnitTest(String name) { - super(name); - } - - public void testLocalDestroyIdleTimeout() { + @Test + public void testLocalDestroyIdleTimeout() throws Exception { Cache cache = getCache(); AttributesFactory attr = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); @@ -84,11 +49,11 @@ public class Bug40632DUnitTest extends CacheTestCase { cache.createRegion("region1", attr.create()); fail("We should not have been able to create the region"); } catch(IllegalStateException expected) { - } } - public void testLocalDestroyTimeToLive() { + @Test + public void testLocalDestroyTimeToLive() throws Exception { Cache cache = getCache(); AttributesFactory attr = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); @@ -100,14 +65,14 @@ public class Bug40632DUnitTest extends CacheTestCase { attr.setEntryTimeToLive(new ExpirationAttributes(1000, ExpirationAction.LOCAL_DESTROY)); attr.setPartitionAttributes(prAttr); try { - cache.createRegion("region1", attr.create()); - fail("We should not have been able to create the region"); + cache.createRegion("region1", attr.create()); + fail("We should not have been able to create the region"); } catch(IllegalStateException expected) { - } } - public void testLocalInvalidateIdleTimeout() { + @Test + public void testLocalInvalidateIdleTimeout() throws Exception { Cache cache = getCache(); AttributesFactory attr = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); @@ -119,14 +84,14 @@ public class Bug40632DUnitTest extends CacheTestCase { attr.setEntryIdleTimeout(new ExpirationAttributes(1000, ExpirationAction.LOCAL_INVALIDATE)); attr.setPartitionAttributes(prAttr); try { - cache.createRegion("region1", attr.create()); - fail("We should not have been able to create the region"); + cache.createRegion("region1", attr.create()); + fail("We should not have been able to create the region"); } catch(IllegalStateException expected) { - } } - public void testLocalInvalidateTimeToLive() { + @Test + public void testLocalInvalidateTimeToLive() throws Exception { Cache cache = getCache(); AttributesFactory attr = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); @@ -138,10 +103,9 @@ public class Bug40632DUnitTest extends CacheTestCase { attr.setEntryTimeToLive(new ExpirationAttributes(1000, ExpirationAction.LOCAL_INVALIDATE)); attr.setPartitionAttributes(prAttr); try { - cache.createRegion("region1", attr.create()); - fail("We should not have been able to create the region"); + cache.createRegion("region1", attr.create()); + fail("We should not have been able to create the region"); } catch(IllegalStateException expected) { - } } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java index bb2faf0..dfe502e 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java @@ -16,47 +16,50 @@ */ package com.gemstone.gemfire.internal.cache; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Properties; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.PartitionAttributesFactory; import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.Locator; import com.gemstone.gemfire.distributed.internal.DistributionManager; import com.gemstone.gemfire.distributed.internal.DistributionMessage; import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.InitialImageOperation.RequestImageMessage; -import com.gemstone.gemfire.test.dunit.*; - -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Properties; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import com.gemstone.gemfire.test.dunit.Assert; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; +import com.gemstone.gemfire.test.dunit.NetworkUtils; +import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** - * * This class tests that bucket regions can handle * a failure of the GII target during GII. - * */ -public class Bug41091DUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class Bug41091DUnitTest extends JUnit4CacheTestCase { - /** - * @param name - */ - public Bug41091DUnitTest(String name) { - super(name); - } - @Override public final void postTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); } + @Test public void test() { final Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -82,9 +85,9 @@ public class Bug41091DUnitTest extends CacheTestCase { RequestImageMessage rim = (RequestImageMessage) message; Region region = getCache().getRegion(rim.regionPath); if(region instanceof BucketRegion) { -//We can no longer do any puts until the bucket is completely created, -//so this will hang -// getCache().getRegion("region").put(113, "b"); + //We can no longer do any puts until the bucket is completely created, + //so this will hang + // getCache().getRegion("region").put(113, "b"); getCache().close(); } } @@ -135,7 +138,6 @@ public class Bug41091DUnitTest extends CacheTestCase { } }; vm3.invoke(stopLocator); - } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java index 2607711..d768b59 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java @@ -16,57 +16,51 @@ */ package com.gemstone.gemfire.internal.cache; +import static org.junit.Assert.*; + import java.util.Collections; import java.util.Set; import java.util.TreeSet; +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheClosedException; import com.gemstone.gemfire.cache.DataPolicy; -import com.gemstone.gemfire.cache.DiskStore; import com.gemstone.gemfire.cache.PartitionAttributesFactory; import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException; import com.gemstone.gemfire.distributed.internal.DistributionManager; import com.gemstone.gemfire.distributed.internal.DistributionMessage; import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver; import com.gemstone.gemfire.internal.cache.partitioned.ManageBucketMessage; import com.gemstone.gemfire.internal.cache.partitioned.ManageBucketMessage.ManageBucketReplyMessage; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.RMIException; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** - * - * Test to make sure that we can handle + * Test to make sure that we can handle * a crash of the member directing bucket creation. */ -public class Bug41733DUnitTest extends CacheTestCase { - - - public Bug41733DUnitTest(String name) { - super(name); - } - +@Category(DistributedTest.class) +public class Bug41733DUnitTest extends JUnit4CacheTestCase { - @Override public final void preTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); } - - /** * Test the we can handle a member departing after creating * a bucket on the remote node but before we choose a primary */ + @Test public void testCrashAfterBucketCreation() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -82,7 +76,7 @@ public class Bug41733DUnitTest extends CacheTestCase { public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) { if(message instanceof ManageBucketReplyMessage) { - DistributedTestCase.disconnectFromDS(); + disconnectFromDS(); } } }); @@ -117,6 +111,7 @@ public class Bug41733DUnitTest extends CacheTestCase { * Test the we can handle a member departing while we are * in the process of creating the bucket on the remote node. */ + @Test public void testCrashDuringBucketCreation() throws Throwable { Host host = Host.getHost(0); final VM vm0 = host.getVM(0); @@ -132,7 +127,7 @@ public class Bug41733DUnitTest extends CacheTestCase { public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) { if(message instanceof ManageBucketMessage) { - vm0.invoke(() -> DistributedTestCase.disconnectFromDS()); + vm0.invoke(() -> disconnectFromDS()); } } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java index fc7b443..05966b3 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java @@ -16,18 +16,35 @@ */ package com.gemstone.gemfire.internal.cache; -import com.gemstone.gemfire.cache.*; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static com.gemstone.gemfire.test.dunit.Assert.*; + +import java.util.Properties; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.cache.AttributesFactory; +import com.gemstone.gemfire.cache.CacheException; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.EvictionAttributes; +import com.gemstone.gemfire.cache.InterestPolicy; +import com.gemstone.gemfire.cache.InterestResultPolicy; +import com.gemstone.gemfire.cache.PartitionAttributesFactory; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.Scope; +import com.gemstone.gemfire.cache.SubscriptionAttributes; import com.gemstone.gemfire.cache.client.PoolFactory; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.cache30.ClientServerTestCase; import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.test.dunit.*; - -import java.util.Properties; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS; -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT; +import com.gemstone.gemfire.test.dunit.Assert; +import com.gemstone.gemfire.test.dunit.DistributedTestUtils; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.NetworkUtils; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * Test for bug 41957. @@ -37,17 +54,15 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties * * @since GemFire 6.5 */ - public class Bug41957DUnitTest extends ClientServerTestCase { - - public Bug41957DUnitTest(String name) { - super(name); - } +@Category(DistributedTest.class) +public class Bug41957DUnitTest extends ClientServerTestCase { @Override public final void postTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); } + @Test public void testBug41957() { final Host host = Host.getHost(0); final VM server = host.getVM(0); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug42055DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug42055DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug42055DUnitTest.java index c68c5eb..43164d9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug42055DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug42055DUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache; +import org.junit.experimental.categories.Category; +import org.junit.Test; + +import static org.junit.Assert.*; + +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; + import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.DataPolicy; @@ -35,16 +44,18 @@ import com.gemstone.gemfire.test.dunit.VM; * we fault out and in a delta object. * */ -public class Bug42055DUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class Bug42055DUnitTest extends JUnit4CacheTestCase { /** * @param name */ - public Bug42055DUnitTest(String name) { - super(name); + public Bug42055DUnitTest() { + super(); } + @Test public void testPROverflow() throws Exception { final Host host = Host.getHost(0); VM vm0 = host.getVM(0); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java index 7a6ff90..9cb0eb9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache; +import org.junit.experimental.categories.Category; +import org.junit.Test; + +import static org.junit.Assert.*; + +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; + import java.util.Map.Entry; import com.gemstone.gemfire.cache.Cache; @@ -28,14 +37,16 @@ import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableRunnable; -public class Bug45164DUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class Bug45164DUnitTest extends JUnit4CacheTestCase { private static final int count = 10000; private static final int stride = 3; - public Bug45164DUnitTest(String name) { - super(name); + public Bug45164DUnitTest() { + super(); } + @Test public void testIterateWhileDestroy() throws Throwable { SerializableRunnable destroy = new SerializableRunnable() { @Override http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45934DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45934DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45934DUnitTest.java index eb4faf6..6702a64 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45934DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45934DUnitTest.java @@ -16,23 +16,33 @@ */ package com.gemstone.gemfire.internal.cache; -import com.gemstone.gemfire.cache.*; -import com.gemstone.gemfire.cache30.CacheTestCase; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.RegionFactory; +import com.gemstone.gemfire.cache.RegionShortcut; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.internal.util.DelayedAction; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; -import java.util.HashMap; -import java.util.Map; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +@Category(DistributedTest.class) +public class Bug45934DUnitTest extends JUnit4CacheTestCase { -public class Bug45934DUnitTest extends CacheTestCase { - public Bug45934DUnitTest(String name) { - super(name); - } - + @Test public void testNormal() throws Exception { int count = 1000; Host host = Host.getHost(0); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java index d3b3963..4575670 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache; +import org.junit.experimental.categories.Category; +import org.junit.Test; + +import static org.junit.Assert.*; + +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; + import com.gemstone.gemfire.cache.CacheTransactionManager; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.client.ClientCache; @@ -28,12 +37,13 @@ import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.VM; +@Category(DistributedTest.class) public class Bug47667DUnitTest extends LocatorTestBase { private static final long serialVersionUID = 2859534245283086765L; - public Bug47667DUnitTest(String name) { - super(name); + public Bug47667DUnitTest() { + super(); } @Override @@ -46,6 +56,7 @@ public class Bug47667DUnitTest extends LocatorTestBase { disconnectAllFromDS(); } + @Test public void testbug47667() { Host host = Host.getHost(0); VM locator = host.getVM(0); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java index 777ef66..19064c2 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache; +import org.junit.experimental.categories.Category; +import org.junit.Test; + +import static org.junit.Assert.*; + +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -48,13 +57,14 @@ import com.gemstone.gemfire.test.dunit.VM; * * */ -public class CacheAdvisorDUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class CacheAdvisorDUnitTest extends JUnit4CacheTestCase { private transient VM[] vms; private transient InternalDistributedMember[] ids; /** Creates a new instance of CacheAdvisorDUnitTest */ - public CacheAdvisorDUnitTest(String name) { - super(name); + public CacheAdvisorDUnitTest() { + super(); } /** @@ -82,6 +92,7 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { this.ids = (InternalDistributedMember[])idList.toArray(new InternalDistributedMember[idList.size()]); } + @Test public void testGenericAdvice() throws Exception { final RegionAttributes attrs = new AttributesFactory().create(); assertTrue(attrs.getScope().isDistributedNoAck()); @@ -108,6 +119,7 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { assertEquals("Unexpected advice for subregion=" + rgn, expected, actual); } + @Test public void testNetWriteAdvice() throws Exception { final String rgnName = getUniqueName(); Set expected = new HashSet(); @@ -134,6 +146,7 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { assertEquals(expected, rgn.getCacheDistributionAdvisor().adviseNetWrite()); } + @Test public void testNetLoadAdvice() throws Exception { final String rgnName = getUniqueName(); Set expected = new HashSet(); @@ -166,6 +179,7 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { assertEquals(expected, rgn.getCacheDistributionAdvisor().adviseNetLoad()); } + @Test public void testNetLoadAdviceWithAttributesMutator() throws Exception { final String rgnName = getUniqueName(); @@ -263,17 +277,20 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { /** coverage for bug 34255 * @since GemFire 5.0 */ - public void testRegionClose() throws Exception { + @Test + public void testRegionClose() throws Exception { basicTestClose(Operation.REGION_CLOSE); } /** coverage for bug 34255 * @since GemFire 5.0 */ + @Test public void testRegionLocalDestroy() throws Exception { basicTestClose(Operation.REGION_LOCAL_DESTROY); } + @Test public void testCacheClose() throws Exception { basicTestClose(Operation.CACHE_CLOSE); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheLifecycleListenerJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheLifecycleListenerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheLifecycleListenerJUnitTest.java index 4656b91..6f70a27 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheLifecycleListenerJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheLifecycleListenerJUnitTest.java @@ -16,34 +16,33 @@ */ package com.gemstone.gemfire.internal.cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; -import org.junit.Test; -import org.junit.experimental.categories.Category; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; import java.util.Properties; -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS; -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT; -import static org.junit.Assert.*; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; /** * Tests notifications of CacheLifecycleListener from GemFireCacheImpl. - * */ @Category(IntegrationTest.class) public class CacheLifecycleListenerJUnitTest { @Test - public void testAddAndRemoveNull() { + public void testAddAndRemoveNull() throws Exception { GemFireCacheImpl.addCacheLifecycleListener(null); GemFireCacheImpl.removeCacheLifecycleListener(null); } @Test - public void testRemoveNonExistent() { + public void testRemoveNonExistent() throws Exception { final List cacheCreatedCallbacks = new ArrayList(); final List cacheClosedCallbacks = new ArrayList(); final TestCacheLifecycleListener listener = new TestCacheLifecycleListener(cacheCreatedCallbacks, cacheClosedCallbacks); @@ -51,7 +50,7 @@ public class CacheLifecycleListenerJUnitTest { } @Test - public void testCallbacks() { + public void testCallbacks() throws Exception { final List cacheCreatedCallbacks = new ArrayList(); final List cacheClosedCallbacks = new ArrayList(); @@ -94,7 +93,7 @@ public class CacheLifecycleListenerJUnitTest { } @Test - public void testRemoveBeforeCreate() { + public void testRemoveBeforeCreate() throws Exception { final List cacheCreatedCallbacks = new ArrayList(); final List cacheClosedCallbacks = new ArrayList(); @@ -132,7 +131,7 @@ public class CacheLifecycleListenerJUnitTest { } @Test - public void testRemoveBeforeClose() { + public void testRemoveBeforeClose() throws Exception { final List cacheCreatedCallbacks = new ArrayList(); final List cacheClosedCallbacks = new ArrayList(); @@ -174,7 +173,7 @@ public class CacheLifecycleListenerJUnitTest { } @Test - public void testCallbacksRepeat() { + public void testCallbacksRepeat() throws Exception { final List cacheCreatedCallbacks = new ArrayList(); final List cacheClosedCallbacks = new ArrayList(); @@ -243,7 +242,7 @@ public class CacheLifecycleListenerJUnitTest { } @Test - public void testAddAfterCreate() { + public void testAddAfterCreate() throws Exception { final List cacheCreatedCallbacks = new ArrayList(); final List cacheClosedCallbacks = new ArrayList(); @@ -281,7 +280,7 @@ public class CacheLifecycleListenerJUnitTest { } } - static final class CacheLifecycleCallback { + private static final class CacheLifecycleCallback { private final GemFireCacheImpl cache; private final long timeStamp; @@ -296,7 +295,7 @@ public class CacheLifecycleListenerJUnitTest { } } - static final class TestCacheLifecycleListener implements CacheLifecycleListener { + private static final class TestCacheLifecycleListener implements CacheLifecycleListener { private final List cacheCreatedCallbacks; private final List cacheClosedCallbacks; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java index bb0e02d..94aa4fd 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java @@ -21,23 +21,36 @@ */ package com.gemstone.gemfire.internal.cache; -import com.gemstone.gemfire.cache.*; +import static org.junit.Assert.*; + +import java.util.Properties; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.cache.AttributesFactory; +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheException; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.cache.CacheTransactionManager; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.RegionAttributes; +import com.gemstone.gemfire.cache.RegionEvent; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.cache.versions.VersionSource; -import com.gemstone.gemfire.test.dunit.*; - -import java.util.Properties; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; +import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; -/** - * - */ -public class ClearDAckDUnitTest extends DistributedTestCase { - - /** Creates a new instance of ClearDAckDUnitTest */ - public ClearDAckDUnitTest(String name) { - super(name); - } +@Category(DistributedTest.class) +public class ClearDAckDUnitTest extends JUnit4DistributedTestCase { // TODO: reformat static Cache cache; static Properties props = new Properties(); @@ -90,7 +103,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "1234"); // ds = DistributedSystem.connect(props); LogWriterUtils.getLogWriter().info("I am vm0"); - ds = (new ClearDAckDUnitTest("temp")).getSystem(props); + ds = (new ClearDAckDUnitTest()).getSystem(props); cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); @@ -115,7 +128,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "1234"); // ds = DistributedSystem.connect(props); LogWriterUtils.getLogWriter().info("I am vm1"); - ds = (new ClearDAckDUnitTest("temp")).getSystem(props); + ds = (new ClearDAckDUnitTest()).getSystem(props); //DistributedSystem.setThreadsSocketPolicy(false); CacheObserverImpl observer = new CacheObserverImpl(); origObserver = CacheObserverHolder.setInstance(observer); @@ -144,7 +157,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { // props.setProperty(DistributionConfig.SystemConfigurationProperties.MCAST_PORT, "1234"); // ds = DistributedSystem.connect(props); LogWriterUtils.getLogWriter().info("I am vm2"); - ds = (new ClearDAckDUnitTest("temp")).getSystem(props); + ds = (new ClearDAckDUnitTest()).getSystem(props); //DistributedSystem.setThreadsSocketPolicy(false); CacheObserverImpl observer = new CacheObserverImpl(); origObserver = CacheObserverHolder.setInstance(observer); @@ -182,7 +195,8 @@ public class ClearDAckDUnitTest extends DistributedTestCase { //test methods - public void testClearMultiVM(){ + @Test + public void testClearMultiVM(){ Host host = Host.getHost(0); VM vm0 = host.getVM(0); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java index b7795c2..7e54283 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java @@ -22,6 +22,13 @@ package com.gemstone.gemfire.internal.cache; +import static org.junit.Assert.*; + +import java.util.Properties; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheFactory; @@ -31,28 +38,20 @@ import com.gemstone.gemfire.cache.RegionEvent; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.TimeoutException; import com.gemstone.gemfire.distributed.DistributedSystem; -import com.gemstone.gemfire.internal.cache.CacheObserverAdapter; -import com.gemstone.gemfire.internal.cache.CacheObserverHolder; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.ThreadUtils; import com.gemstone.gemfire.test.dunit.VM; - -import java.util.Properties; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * For the Global region subsequent puts should be blocked until the clear * operation is completely done - * */ -public class ClearGlobalDUnitTest extends DistributedTestCase -{ +@Category(DistributedTest.class) +public class ClearGlobalDUnitTest extends JUnit4DistributedTestCase { - /** Creates a new instance of ClearGlobalDUnitTest */ - public ClearGlobalDUnitTest(String name) { - super(name); - } static VM server1 = null; static Cache cache; @@ -106,6 +105,7 @@ public class ClearGlobalDUnitTest extends DistributedTestCase } } + @Test public void testClearGlobalMultiVM() throws Exception { Object[] objArr = new Object[1]; @@ -120,7 +120,7 @@ public class ClearGlobalDUnitTest extends DistributedTestCase public static void createCacheServer1() throws Exception { - ds = (new ClearGlobalDUnitTest("temp")).getSystem(props); + ds = (new ClearGlobalDUnitTest()).getSystem(props); cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.GLOBAL); @@ -131,7 +131,7 @@ public class ClearGlobalDUnitTest extends DistributedTestCase public static void createCacheServer2() throws Exception { - ds = (new ClearGlobalDUnitTest("temp")).getSystem(props); + ds = (new ClearGlobalDUnitTest()).getSystem(props); CacheObserverImpl observer = new CacheObserverImpl(); origObserver = CacheObserverHolder.setInstance(observer); LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER=true; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerGetAllDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerGetAllDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerGetAllDUnitTest.java index bc1c8af..84445b8 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerGetAllDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerGetAllDUnitTest.java @@ -16,7 +16,27 @@ */ package com.gemstone.gemfire.internal.cache; -import com.gemstone.gemfire.cache.*; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static com.gemstone.gemfire.test.dunit.Assert.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.cache.AttributesFactory; +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheException; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.LoaderHelper; +import com.gemstone.gemfire.cache.PartitionAttributesFactory; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.client.PoolFactory; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.server.CacheServer; @@ -25,28 +45,29 @@ import com.gemstone.gemfire.cache30.ClientServerTestCase; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.offheap.MemoryAllocatorImpl; -import com.gemstone.gemfire.test.dunit.*; - -import java.util.*; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import com.gemstone.gemfire.test.dunit.Assert; +import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.DistributedTestUtils; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.NetworkUtils; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * Class ClientServerGetAllDUnitTest test client/server getAll. * * @since GemFire 5.7 */ - public class ClientServerGetAllDUnitTest extends ClientServerTestCase { - - public ClientServerGetAllDUnitTest(String name) { - super(name); - } +@Category(DistributedTest.class) +public class ClientServerGetAllDUnitTest extends ClientServerTestCase { @Override public final void postTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); } + @Test public void testGetAllFromServer() throws Exception { final Host host = Host.getHost(0); final VM server = host.getVM(0); @@ -99,6 +120,7 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties stopBridgeServer(server); } + @Test public void testOffHeapGetAllFromServer() throws Exception { final Host host = Host.getHost(0); final VM server = host.getVM(0); @@ -151,6 +173,7 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties stopBridgeServer(server); } + @Test public void testLargeOffHeapGetAllFromServer() throws Throwable { final Host host = Host.getHost(0); final VM server = host.getVM(0); @@ -261,7 +284,8 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties stopBridgeServer(server); } - + + @Test public void testLargeGetAllFromServer() throws Throwable { final Host host = Host.getHost(0); final VM server = host.getVM(0); @@ -374,6 +398,7 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties stopBridgeServer(server); } + @Test public void testGetAllWithCallbackFromServer() throws Exception { final Host host = Host.getHost(0); final VM server = host.getVM(0); @@ -425,14 +450,17 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties stopBridgeServer(server); } + @Test public void testGetSomeFromServer() throws Exception { testGetFromServer(2); } + @Test public void testGetAllFromClient() throws Exception { testGetFromServer(5); } + @Test public void testGetAllFromServerWithPR() throws Exception { final Host host = Host.getHost(0); final VM server1 = host.getVM(0); @@ -563,7 +591,8 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties IgnoredException.addIgnoredException("Server unreachable", client); stopBridgeServer(server); } - + + @Test public void testGetAllWithExtraKeyFromServer() throws Exception { final Host host = Host.getHost(0); final VM server = host.getVM(0); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerInvalidAndDestroyedEntryDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerInvalidAndDestroyedEntryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerInvalidAndDestroyedEntryDUnitTest.java index d46172b..35b1162 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerInvalidAndDestroyedEntryDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerInvalidAndDestroyedEntryDUnitTest.java @@ -16,58 +16,76 @@ */ package com.gemstone.gemfire.internal.cache; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.LogWriter; -import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.EntryEvent; +import com.gemstone.gemfire.cache.InterestResultPolicy; +import com.gemstone.gemfire.cache.Operation; +import com.gemstone.gemfire.cache.PartitionAttributesFactory; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.RegionFactory; +import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.cache.client.ClientCache; import com.gemstone.gemfire.cache.client.ClientCacheFactory; import com.gemstone.gemfire.cache.client.ClientRegionShortcut; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; -import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.cache.tier.InterestType; -import com.gemstone.gemfire.test.dunit.*; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import com.gemstone.gemfire.test.dunit.Assert; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; +import com.gemstone.gemfire.test.dunit.SerializableCallable; +import com.gemstone.gemfire.test.dunit.SerializableCallableIF; +import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * This tests the fix for bug #43407 under a variety of configurations and * also tests that tombstones are treated in a similar manner. The ticket * complains that a client that does a get(K) does not end up with the entry * in its cache if K is invalid on the server. - * */ -public class ClientServerInvalidAndDestroyedEntryDUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class ClientServerInvalidAndDestroyedEntryDUnitTest extends JUnit4CacheTestCase { - public ClientServerInvalidAndDestroyedEntryDUnitTest(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { disconnectAllFromDS(); } + @Test public void testClientGetsInvalidEntry() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsInvalidEntry(regionName, false, false); } + @Test public void testClientGetsInvalidEntryPR() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsInvalidEntry(regionName, true, false); } + @Test public void testClientGetsTombstone() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsTombstone(regionName, false, false); } + @Test public void testClientGetsTombstonePR() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsTombstone(regionName, true, false); @@ -79,21 +97,25 @@ public class ClientServerInvalidAndDestroyedEntryDUnitTest extends CacheTestCase + @Test public void testClientGetsInvalidEntryTX() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsInvalidEntry(regionName, false, true); } + @Test public void testClientGetsInvalidEntryPRTX() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsInvalidEntry(regionName, true, true); } + @Test public void testClientGetsTombstoneTX() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsTombstone(regionName, false, true); } + @Test public void testClientGetsTombstonePRTX() throws Exception { final String regionName = getUniqueName()+"Region"; doTestClientGetsTombstone(regionName, true, true); @@ -102,11 +124,13 @@ public class ClientServerInvalidAndDestroyedEntryDUnitTest extends CacheTestCase // tests for bug #46780, tombstones left in client after RI + @Test public void testRegisterInterestRemovesOldEntry() throws Exception { final String regionName = getUniqueName()+"Region"; doTestRegisterInterestRemovesOldEntry(regionName, false); } + @Test public void testRegisterInterestRemovesOldEntryPR() throws Exception { final String regionName = getUniqueName()+"Region"; doTestRegisterInterestRemovesOldEntry(regionName, true); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionCCEDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionCCEDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionCCEDUnitTest.java index f9a0ea8..d7b5827 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionCCEDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionCCEDUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache; +import org.junit.experimental.categories.Category; +import org.junit.Test; + +import static org.junit.Assert.*; + +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; + import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -32,6 +41,7 @@ import com.gemstone.gemfire.test.dunit.VM; /** * test client initiated transactions with concurrency checks enabled. */ +@Category(DistributedTest.class) public class ClientServerTransactionCCEDUnitTest extends ClientServerTransactionDUnitTest { @@ -48,8 +58,8 @@ public class ClientServerTransactionCCEDUnitTest extends */ private static final long serialVersionUID = -6785438240204988439L; - public ClientServerTransactionCCEDUnitTest(String name) { - super(name); + public ClientServerTransactionCCEDUnitTest() { + super(); } @Override