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 3ABD5200B29 for ; Wed, 15 Jun 2016 18:42:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3919F160A19; Wed, 15 Jun 2016 16:42:03 +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 01868160A60 for ; Wed, 15 Jun 2016 18:42:00 +0200 (CEST) Received: (qmail 49104 invoked by uid 500); 15 Jun 2016 16:42:00 -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 49004 invoked by uid 99); 15 Jun 2016 16:42:00 -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; Wed, 15 Jun 2016 16:42:00 +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 78A27C3294 for ; Wed, 15 Jun 2016 16:41:59 +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-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 0weiIH97-as9 for ; Wed, 15 Jun 2016 16:41:53 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 993BD60D39 for ; Wed, 15 Jun 2016 16:41:44 +0000 (UTC) Received: (qmail 47644 invoked by uid 99); 15 Jun 2016 16:41:43 -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; Wed, 15 Jun 2016 16:41:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 49602ED310; Wed, 15 Jun 2016 16:41:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hiteshkhamesra@apache.org To: commits@geode.incubator.apache.org Date: Wed, 15 Jun 2016 16:41:59 -0000 Message-Id: In-Reply-To: <3e2b112170344880b6f31de13b419371@git.apache.org> References: <3e2b112170344880b6f31de13b419371@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [18/97] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4 archived-at: Wed, 15 Jun 2016 16:42:03 -0000 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java index 426d0ca..977b2bd 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java @@ -16,7 +16,8 @@ */ package com.gemstone.gemfire.internal.cache.partitioned; -import static com.gemstone.gemfire.internal.lang.ThrowableUtils.getRootCause; +import static com.gemstone.gemfire.internal.lang.ThrowableUtils.*; +import static org.junit.Assert.*; import java.io.IOException; import java.util.Set; @@ -24,6 +25,9 @@ import java.util.TreeSet; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.InternalGemFireError; import com.gemstone.gemfire.admin.AdminDistributedSystemFactory; import com.gemstone.gemfire.admin.AdminException; @@ -32,58 +36,41 @@ import com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheClosedException; -import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.DataPolicy; import com.gemstone.gemfire.cache.DiskStore; +import com.gemstone.gemfire.cache.EntryEvent; import com.gemstone.gemfire.cache.EvictionAction; import com.gemstone.gemfire.cache.EvictionAttributes; -import com.gemstone.gemfire.cache.MirrorType; import com.gemstone.gemfire.cache.PartitionAttributesFactory; import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionDestroyedException; -import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.client.ServerConnectivityException; import com.gemstone.gemfire.cache.server.CacheServer; -import com.gemstone.gemfire.cache30.CacheSerializableRunnable; -import com.gemstone.gemfire.cache.EntryEvent; -import com.gemstone.gemfire.cache.PartitionAttributesFactory; -import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; -import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; -import com.gemstone.gemfire.internal.admin.remote.ShutdownAllRequest; import com.gemstone.gemfire.internal.cache.DiskRegion; import com.gemstone.gemfire.internal.cache.PartitionedRegion; -import com.gemstone.gemfire.internal.cache.PutAllPartialResultException; import com.gemstone.gemfire.internal.cache.control.InternalResourceManager; import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceObserver; import com.gemstone.gemfire.test.dunit.Assert; 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.Invoke; -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.Wait; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * Tests the basic use cases for PR persistence. - * */ -public class ShutdownAllDUnitTest extends CacheTestCase { - protected static HangingCacheListener listener; +@Category(DistributedTest.class) +public class ShutdownAllDUnitTest extends JUnit4CacheTestCase { + private static HangingCacheListener listener; - final String expectedExceptions = InternalGemFireError.class.getName()+"||ShutdownAllRequest: disconnect distributed without response"; + private static final String expectedExceptions = InternalGemFireError.class.getName()+"||ShutdownAllRequest: disconnect distributed without response"; - public ShutdownAllDUnitTest(String name) { - super(name); - } - /** - * - */ private static final int MAX_WAIT = 600 * 1000; @Override @@ -91,9 +78,10 @@ public class ShutdownAllDUnitTest extends CacheTestCase { //Get rid of any existing distributed systems. We want //to make assertions about the number of distributed systems //we shut down, so we need to start with a clean slate. - DistributedTestCase.disconnectAllFromDS(); + disconnectAllFromDS(); } + @Test public void testShutdownAll2Servers() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -136,6 +124,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { checkData(vm0, numBuckets, 113, "b", "region"); } + @Test public void testShutdownAllWithEncounterIGE1() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -161,6 +150,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { vm0.invoke(removeExceptionTag1(expectedExceptions)); } + @Test public void testShutdownAllWithEncounterIGE2() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -198,6 +188,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { vm1.invoke(removeExceptionTag1(expectedExceptions)); } + @Test public void testShutdownAllOneServerAndRecover() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -219,6 +210,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { createData(vm0, 1, 10, "b", "region"); } + @Test public void testPRWithDR() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -244,6 +236,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { checkData(vm0, 0, 1, "c", "region_dr"); } + @Test public void testShutdownAllFromServer() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -282,6 +275,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { } // shutdownAll, then restart to verify + @Test public void testCleanStop() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -326,6 +320,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { } // shutdownAll, then restart to verify + @Test public void testCleanStopWithConflictCachePort() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -364,6 +359,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { } /* + @Test public void testStopNonPersistRegions() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -388,6 +384,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { } */ + @Test public void testMultiPRDR() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -428,6 +425,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { } + @Test public void testShutdownAllTimeout() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -523,6 +521,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase { * members waiting on recovery. * @throws Throwable */ + @Test public void testShutdownAllWithMembersWaiting() throws Throwable { 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/partitioned/StreamingPartitionOperationManyDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationManyDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationManyDUnitTest.java index abc088a..fc7bed3 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationManyDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationManyDUnitTest.java @@ -19,6 +19,15 @@ // package com.gemstone.gemfire.internal.cache.partitioned; +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.Iterator; import java.util.List; @@ -47,7 +56,8 @@ import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; -public class StreamingPartitionOperationManyDUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class StreamingPartitionOperationManyDUnitTest extends JUnit4CacheTestCase { /* SerializableRunnable object to create a PR */ CacheSerializableRunnable createPrRegionWithDS_DACK = new CacheSerializableRunnable("createPrRegionWithDS") { @@ -66,10 +76,11 @@ public class StreamingPartitionOperationManyDUnitTest extends CacheTestCase { }; - public StreamingPartitionOperationManyDUnitTest(String name) { - super(name); + public StreamingPartitionOperationManyDUnitTest() { + super(); } + @Test public void testStreamingManyProvidersNoExceptions() throws Exception { // final String name = this.getUniqueName(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java index f5e0b71..d4a4fa5 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java @@ -20,6 +20,15 @@ // package com.gemstone.gemfire.internal.cache.partitioned; +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.io.Serializable; import java.util.ArrayList; import java.util.Collections; @@ -51,7 +60,8 @@ import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.VM; -public class StreamingPartitionOperationOneDUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class StreamingPartitionOperationOneDUnitTest extends JUnit4CacheTestCase { /* SerializableRunnable object to create PR */ CacheSerializableRunnable createPrRegionWithDS_DACK = new CacheSerializableRunnable("createPrRegionWithDS") { @@ -76,10 +86,11 @@ public class StreamingPartitionOperationOneDUnitTest extends CacheTestCase { } - public StreamingPartitionOperationOneDUnitTest(String name) { - super(name); + public StreamingPartitionOperationOneDUnitTest() { + super(); } + @Test public void testStreamingPartitionOneProviderNoExceptions() throws Exception { // final String name = this.getUniqueName(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java index 3fcd791..12aabc8 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache.partitioned.fixed; +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.List; @@ -36,10 +45,11 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest; * This Dunit test class have multiple tests to tests different validations of * static partitioning */ +@Category(DistributedTest.class) public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { - public FixedPartitioningDUnitTest(String name) { - super(name); + public FixedPartitioningDUnitTest() { + super(); } private static final long serialVersionUID = 1L; @@ -57,6 +67,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * This test validates that null partition name cannot be added in * FixedPartitionAttributes */ + @Test public void testNullPartitionName() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -83,6 +94,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * */ + @Test public void testSamePartitionNameTwice() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -110,6 +122,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * This test validates that FixedPartitionAttributes cannot be defined for * accessor nodes */ + @Test public void testFixedPartitionAttributes_Accessor() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -139,6 +152,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * condition is not met. */ + @Test public void testSamePartitionName_Primary_OnTwoMembers() { IgnoredException ex = IgnoredException.addIgnoredException("DuplicatePrimaryPartitionException"); try { @@ -181,6 +195,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * the nodes then illegalStateException will be thrown */ + @Test public void testSamePartitionName_DifferentNumBuckets() { IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException"); try { @@ -222,6 +237,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * if this condition is not met. */ + @Test public void testNumberOfPartitions() { IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException"); try { @@ -278,6 +294,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * greater than totalNumBuckets. */ + @Test public void testNumBuckets_totalNumBuckets() { IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException"); try { @@ -323,6 +340,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * This test validates that if the required partition is not available at the * time of entry operation then PartitionNotAvailabelException is thrown */ + @Test public void testPut_PartitionNotAvailableException() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -360,6 +378,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * partition attributes defined */ + @Test public void test_DataStoreWithoutPartition_DataStoreWithPartition() { IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException"); try { @@ -390,6 +409,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * partition attributes defined */ + @Test public void test_DataStoreWithPartition_DataStoreWithoutPartition() { IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException"); try { @@ -418,6 +438,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * This tests validate that accessor member does the put on datastores as per * primary FixedPartitionAttributes defined on datastores */ + @Test public void testPut_ValidateDataOnMember_OnlyPrimary_Accessor() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes( "Quarter", null, 0, 0, 12, @@ -454,6 +475,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { } @Category(FlakyTest.class) // GEODE-567: async actions, waitForCriterion, time sensitive, non-thread-safe test hook, eats exceptions (partially fixed) + @Test public void testBug43283() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -527,6 +549,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * datastores. */ + @Test public void testPut_ValidateDataOnMember_OnlyPrimary_Datastore() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -574,6 +597,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * This test validate that a delete operation on empty region will throw * EntryNotFoundException */ + @Test public void testDelete_WithoutPut() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -626,6 +650,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * datastores. But No resolver is provided. So IllegalStateException in expected */ + @Test public void testPut_NoResolver() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -673,6 +698,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * datastores. here CallBack implements FixedPartitionResolver. */ + @Test public void testPut_CallBackWithResolver() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -721,6 +747,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * FixedPartitionResolver will do custom partitioning as per resolver. */ + @Test public void testPut_WithResolver_NoFPAs() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes( "Quarter", null, 0, 40, 12, @@ -751,6 +778,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { */ + @Test public void testPut_FixedPartitionResolver_NoResolver() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -800,6 +828,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * IllegalStateException is expected. */ + @Test public void testPut_FixedPartitionResolver_PartitionResolver() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -847,6 +876,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * datastores with only one bucket per partition. */ + @Test public void testFPR_DefaultNumBuckets() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -894,6 +924,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * primary and secondary FixedPartitionAttributes defined on datastores. */ + @Test public void testPut_ValidateDataOnMember_PrimarySecondary_Accessor() { createCacheOnMember(); createRegionWithPartitionAttributes("Quarter", null, 3, 0, 12, @@ -964,6 +995,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * datastores. */ + @Test public void testPut_ValidateDataOnMember_PrimarySecondary_Datastore() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -1026,6 +1058,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * */ + @Test public void testPut_ValidateDataOnMember_OnlySecondary_Datastore() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -1105,6 +1138,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * * */ + @Test public void testPut_ValidateDataOnMember_PrimarySecondary_Accessor_CacheClosed() { createCacheOnMember(); createRegionWithPartitionAttributes("Quarter", null, 3, 0, 12, @@ -1213,6 +1247,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * Member4 = Q4(9,10,11) Q1(0,1,2) */ + @Test public void testPut_ValidateDataOnMember_PrimarySecondary_Datastore_CacheClosed() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -1294,6 +1329,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter( 6, 3 )); } + @Test public void test_Bug46619_Put_ValidateDataOnMember_PrimarySecondary_Datastore_CacheClosed() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember_DisableMovePrimary()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -1416,6 +1452,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase { * */ + @Test public void testPut_ValidateDataOnMember_MultiplePrimaries_Datastore_CacheClosed() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java index cbef135..8a1a49c 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java @@ -16,8 +16,32 @@ */ package com.gemstone.gemfire.internal.cache.partitioned.fixed; +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Properties; +import java.util.Set; + +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.SystemFailure; -import com.gemstone.gemfire.cache.*; +import com.gemstone.gemfire.cache.AttributesFactory; +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.DiskStore; +import com.gemstone.gemfire.cache.FixedPartitionAttributes; +import com.gemstone.gemfire.cache.PartitionAttributesFactory; +import com.gemstone.gemfire.cache.PartitionResolver; +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; @@ -26,31 +50,35 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.FileUtil; -import com.gemstone.gemfire.internal.cache.*; -import com.gemstone.gemfire.internal.cache.execute.data.*; +import com.gemstone.gemfire.internal.cache.FixedPartitionAttributesImpl; +import com.gemstone.gemfire.internal.cache.HARegion; +import com.gemstone.gemfire.internal.cache.PartitionRegionConfig; +import com.gemstone.gemfire.internal.cache.PartitionedRegion; +import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper; +import com.gemstone.gemfire.internal.cache.execute.data.CustId; import com.gemstone.gemfire.internal.cache.execute.data.Customer; import com.gemstone.gemfire.internal.cache.execute.data.Order; +import com.gemstone.gemfire.internal.cache.execute.data.OrderId; import com.gemstone.gemfire.internal.cache.execute.data.Shipment; +import com.gemstone.gemfire.internal.cache.execute.data.ShipmentId; import com.gemstone.gemfire.internal.cache.partitioned.PartitionedRegionObserver; import com.gemstone.gemfire.internal.cache.partitioned.PartitionedRegionObserverAdapter; import com.gemstone.gemfire.internal.cache.partitioned.PartitionedRegionObserverHolder; -import com.gemstone.gemfire.test.dunit.*; - -import java.io.File; -import java.io.IOException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * This is the base class to do operations */ +@Category(DistributedTest.class) +public class FixedPartitioningTestBase extends JUnit4DistributedTestCase { -public class FixedPartitioningTestBase extends DistributedTestCase { - - private static final long serialVersionUID = 1L; - - protected static String Quarter1 = "Q1"; + protected static String Quarter1 = "Q1"; protected static String Quarter2 = "Q2"; protected static String Quarter3 = "Q3"; protected static String Quarter4 = "Q4"; @@ -95,17 +123,17 @@ public class FixedPartitioningTestBase extends DistributedTestCase { OCT, NOV, DEC }; - public FixedPartitioningTestBase(String name) { - super(name); + public FixedPartitioningTestBase() { + super(); } public static void createCacheOnMember() { - new FixedPartitioningTestBase("Temp").createCache(); + new FixedPartitioningTestBase().createCache(); } public static void createCacheOnMember_DisableMovePrimary() { System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "DISABLE_MOVE_PRIMARIES_ON_STARTUP", "true"); - new FixedPartitioningTestBase("Temp").createCache(); + new FixedPartitioningTestBase().createCache(); } private void createCache() { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java index b508b56..bfccf52 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache.partitioned.fixed; +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.List; @@ -25,11 +34,12 @@ import com.gemstone.gemfire.test.dunit.AsyncInvocation; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.Wait; +@Category(DistributedTest.class) public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends FixedPartitioningTestBase { - public FixedPartitioningWithColocationAndPersistenceDUnitTest(String name) { - super(name); + public FixedPartitioningWithColocationAndPersistenceDUnitTest() { + super(); } private static final long serialVersionUID = 1L; @@ -49,6 +59,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * */ + @Test public void testColocation_WithFPROnChildRegion() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -90,6 +101,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * */ + @Test public void testColocation_FPRs_ChildUsingAttributesOfParent() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -203,6 +215,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends } } + @Test public void testColocation_FPR_Persistence_ChildUsingAttributesOfParent() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -321,6 +334,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * scenario, */ + @Test public void testColocation_FPRs_ChildUsingAttributesOfParent_HA() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -479,6 +493,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends } } + @Test public void testColocation_FPR_Persistence_ChildUsingAttributesOfParent_HA() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -641,6 +656,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * Tests validate the behavior of FPR with persistence when one member is kept * alive and other members goes down and come up */ + @Test public void testFPR_Persistence_OneMemberAlive() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -706,6 +722,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * down and comes up. * */ + @Test public void testFPR_Persistence() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -780,6 +797,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * Tests validate the behavior of FPR with persistence and with colocation * when one member is kept alive and other members goes down and come up */ + @Test public void testColocation_FPR_Persistence_Colocation_OneMemberAlive() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -886,6 +904,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * */ + @Test public void testColocation_FPR_Persistence_Colocation() { try { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); @@ -964,6 +983,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends } } + @Test public void testFPR_Persistence2() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -1026,6 +1046,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter( 6, 6 )); } + @Test public void testFPR_Persistence3() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); FixedPartitionAttributes fpa1 = FixedPartitionAttributes @@ -1143,6 +1164,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends * cache is closed respectively. Member2 is brought back and persisted data is * verified. */ + @Test public void testPR_Persistence() { member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember()); member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes( "Quarter", null, http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/BackupInspectorJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/BackupInspectorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/BackupInspectorJUnitTest.java index dbb58bc..54c1f61 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/BackupInspectorJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/BackupInspectorJUnitTest.java @@ -35,14 +35,7 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest; /** * TODO: fails when running integrationTest from gradle command-line on Windows 7 - * -com.gemstone.gemfire.internal.cache.DiskRegionJUnitTest > testAssertionErrorIfMissingOplog FAILED - junit.framework.AssertionFailedError - at junit.framework.Assert.fail(Assert.java:55) - at junit.framework.Assert.assertTrue(Assert.java:22) - at junit.framework.Assert.assertTrue(Assert.java:31) - at com.gemstone.gemfire.internal.cache.DiskRegionJUnitTest.testAssertionErrorIfMissingOplog(DiskRegionJUnitTest.java:2630) - * + * * Tests for the BackupInspector. */ @Category(IntegrationTest.class) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java index 7e0fb44..f7c011d 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache.persistence; +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.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.File; @@ -25,8 +34,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import util.TestException; - import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; @@ -76,12 +83,13 @@ import com.gemstone.gemfire.test.dunit.VM; import com.gemstone.gemfire.test.dunit.Wait; import com.gemstone.gemfire.test.dunit.WaitCriterion; +@Category(DistributedTest.class) public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase { private static final int TEST_REPLICATED_TOMBSTONE_TIMEOUT = 1000; - public PersistentRVVRecoveryDUnitTest(String name) { - super(name); + public PersistentRVVRecoveryDUnitTest() { + super(); } @Override @@ -89,6 +97,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase Invoke.invokeInEveryVM(PersistentRecoveryOrderDUnitTest.class, "resetAckWaitThreshold"); } + @Test public void testNoConcurrencyChecks () { Cache cache = getCache(); RegionFactory rf = new RegionFactory(); @@ -106,6 +115,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase * Test that we can recover the RVV information with some normal * usage. */ + @Test public void testRecoveryWithKRF() throws Throwable { doTestRecovery(new Runnable() { @Override @@ -118,6 +128,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase /** * Test that we can recover the RVV information if the krf is missing */ + @Test public void testRecoveryWithoutKRF() throws Throwable { doTestRecovery(new Runnable() { @Override @@ -134,6 +145,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase /** * Test that we correctly recover and expire recovered tombstones, with compaction enabled */ + @Test public void testLotsOfTombstones() throws Throwable { Host host = Host.getHost(0); final VM vm0 = host.getVM(0); @@ -339,6 +351,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase * then it must not get applied. Which is Bug #45921. * */ + @Test public void testConflictChecksDuringConcurrentDeltaGIIAndOtherOp() { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -402,7 +415,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase try { async.join(3000); } catch (InterruptedException e) { - new TestException("VM1 entry destroy did not finish in 3000 ms"); + new AssertionError("VM1 entry destroy did not finish in 3000 ms"); } vm1.invoke(new CacheSerializableRunnable("Verifying entry version in new node VM1") { @@ -531,6 +544,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase * Test that we skip conflict checks with entries that are on * disk compared to entries that come in as part of a GII */ + @Test public void testSkipConflictChecksForGIIdEntries() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); @@ -580,6 +594,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase * Test that we skip conflict checks with entries that are on * disk compared to entries that come in as part of a concurrent operation */ + @Test public void testSkipConflictChecksForConcurrentOps() throws Throwable { Host host = Host.getHost(0); final VM vm0 = host.getVM(0); @@ -653,6 +668,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase * Test that with concurrent updates to an async disk region, * we correctly update the RVV On disk */ + @Test public void testUpdateRVVWithAsyncPersistence() throws Throwable { Host host = Host.getHost(0); final VM vm0 = host.getVM(1); @@ -736,6 +752,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase * Test that when we generate a krf, we write the version tag * that matches the entry in the crf. */ + @Test public void testWriteCorrectVersionToKrf() throws Throwable { Host host = Host.getHost(0); final VM vm0 = host.getVM(1); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java index dabdd3c..b61cd25 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java @@ -16,12 +16,41 @@ */ package com.gemstone.gemfire.internal.cache.persistence; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static com.gemstone.gemfire.internal.lang.ThrowableUtils.*; +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.admin.AdminDistributedSystem; import com.gemstone.gemfire.admin.AdminDistributedSystemFactory; import com.gemstone.gemfire.admin.AdminException; import com.gemstone.gemfire.admin.DistributedSystemConfig; -import com.gemstone.gemfire.cache.*; +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.DiskStoreFactory; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.RegionDestroyedException; +import com.gemstone.gemfire.cache.RegionFactory; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.persistence.ConflictingPersistentDataException; import com.gemstone.gemfire.cache.persistence.PersistentID; import com.gemstone.gemfire.cache.persistence.PersistentReplicatesOfflineException; @@ -37,36 +66,36 @@ import com.gemstone.gemfire.internal.HeapDataOutputStream; import com.gemstone.gemfire.internal.Version; import com.gemstone.gemfire.internal.cache.AbstractUpdateOperation.AbstractUpdateMessage; import com.gemstone.gemfire.internal.cache.DestroyRegionOperation.DestroyRegionMessage; -import com.gemstone.gemfire.internal.cache.*; +import com.gemstone.gemfire.internal.cache.DiskRegion; +import com.gemstone.gemfire.internal.cache.DiskRegionStats; +import com.gemstone.gemfire.internal.cache.DistributedRegion; +import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.InitialImageOperation.RequestImageMessage; +import com.gemstone.gemfire.internal.cache.InternalRegionArguments; +import com.gemstone.gemfire.internal.cache.LocalRegion; +import com.gemstone.gemfire.internal.cache.TXManagerImpl; import com.gemstone.gemfire.internal.cache.versions.RegionVersionHolder; import com.gemstone.gemfire.internal.cache.versions.RegionVersionVector; -import com.gemstone.gemfire.test.dunit.*; -import org.junit.Ignore; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; -import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; - -import static com.gemstone.gemfire.internal.lang.ThrowableUtils.getRootCause; -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.Host; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; +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.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * This is a test of how persistent distributed * regions recover. This test makes sure that when * multiple VMs are persisting the same region, they recover * with the latest data during recovery. - * - * */ +@Category(DistributedTest.class) public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBase { - public PersistentRecoveryOrderDUnitTest(String name) { - super(name); - } public static void resetAckWaitThreshold() { if (SAVED_ACK_WAIT_THRESHOLD != null) { @@ -77,9 +106,9 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa /** * Tests to make sure that a persistent region will wait * for any members that were online when is crashed before starting up. - * @throws Throwable */ - public void testWaitForLatestMember() throws Throwable { + @Test + public void testWaitForLatestMember() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -129,9 +158,10 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa /** * Tests to make sure that we stop waiting for a member * that we revoke. - * @throws Throwable + * @throws Exception */ - public void testRevokeAMember() throws Throwable { + @Test + public void testRevokeAMember() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -264,9 +294,10 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa /** * Tests to make sure that we can revoke a member * before initialization, and that member will stay revoked - * @throws Throwable + * @throws Exception */ - public void testRevokeAHostBeforeInitialization() throws Throwable { + @Test + public void testRevokeAHostBeforeInitialization() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -356,9 +387,10 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa /** * Test which members show up in the list of members we're waiting on. - * @throws Throwable + * @throws Exception */ - public void testWaitingMemberList() throws Throwable { + @Test + public void testWaitingMemberList() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -497,9 +529,10 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * A crashes. * B crashes. * B starts up. It should not wait for A. - * @throws Throwable + * @throws Exception */ - public void testDontWaitForOldMember() throws Throwable { + @Test + public void testDontWaitForOldMember() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -528,9 +561,10 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * Tests that if two members crash simultaneously, they * negotiate which member should initialize with what is * on disk and which member should copy data from that member. - * @throws Throwable + * @throws Exception */ - public void testSimultaneousCrash() throws Throwable { + @Test + public void testSimultaneousCrash() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -587,7 +621,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * AC are started, they should figure out who * has the latest data, without needing B. */ - public void testTransmitCrashedMembers() throws Throwable { + @Test + public void testTransmitCrashedMembers() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -630,7 +665,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * Tests that a persistent region cannot recover from * a non persistent region. */ - public void testRecoverFromNonPeristentRegion() throws Throwable { + @Test + public void testRecoverFromNonPeristentRegion() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -661,7 +697,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa checkForEntry(vm1); } - public void testFinishIncompleteInitializationNoSend() throws Throwable { + @Test + public void testFinishIncompleteInitializationNoSend() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -792,11 +829,13 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa return vm.invokeAsync(createRegion); } - public void testPersistConflictOperations() throws Throwable { + @Test + public void testPersistConflictOperations() throws Exception { doTestPersistConflictOperations(true); } - public void testPersistConflictOperationsAsync() throws Throwable { + @Test + public void testPersistConflictOperationsAsync() throws Exception { doTestPersistConflictOperations(false); } @@ -808,7 +847,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * tag, while another member will persist both of the 2 operations. * Overall, their RVV should match after the operations. */ - public void doTestPersistConflictOperations(boolean diskSync) throws Throwable { + public void doTestPersistConflictOperations(boolean diskSync) throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -959,7 +998,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * of crashed members to other persistent regions, So that the persistent * regions can negotiate who has the latest data during recovery. */ - public void testTransmitCrashedMembersWithNonPeristentRegion() throws Throwable { + @Test + public void testTransmitCrashedMembersWithNonPeristentRegion() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1001,7 +1041,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa checkForEntry(vm2); } - public void testSplitBrain() throws Throwable { + @Test + public void testSplitBrain() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1045,7 +1086,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * while a GII is in progress, we wait * for the member to come back for starting. */ - public void testCrashDuringGII() throws Throwable { + @Test + public void testCrashDuringGII() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1147,7 +1189,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * Test to make sure we don't leak any persistent ids if a member does GII * while a distributed destroy is in progress */ - public void testGIIDuringDestroy() throws Throwable { + @Test + public void testGIIDuringDestroy() throws Exception { Host host = Host.getHost(0); final VM vm0 = host.getVM(0); final VM vm1 = host.getVM(1); @@ -1244,7 +1287,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa }); } - public void testCrashDuringPreparePersistentId() throws Throwable { + @Test + public void testCrashDuringPreparePersistentId() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1305,7 +1349,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa checkForEntry(vm1); } - public void testSplitBrainWithNonPersistentRegion() throws Throwable { + @Test + public void testSplitBrainWithNonPersistentRegion() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1340,7 +1385,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa checkForRecoveryStat(vm1, true); } - public void testMissingEntryOnDisk() throws Throwable { + @Test + public void testMissingEntryOnDisk() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1399,9 +1445,10 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa /** * Tests to make sure that we stop waiting for a member * that we revoke. - * @throws Throwable + * @throws Exception */ - public void testCompactFromAdmin() throws Throwable { + @Test + public void testCompactFromAdmin() throws Exception { Host host = Host.getHost(0); final VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1478,7 +1525,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa vm1.invoke(compactVM); } - public void testCloseDuringRegionOperation() throws Throwable { + @Test + public void testCloseDuringRegionOperation() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1555,8 +1603,9 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa checkConcurrentCloseValue(vm0, vm1, 1, lastSuccessfulInt1); } - @Ignore("Disabled due to bug #52240") - public void DISABLED_testCloseDuringRegionOperationWithTX() throws Throwable { + @Ignore("TODO: Disabled due to bug #52240") + @Test + public void testCloseDuringRegionOperationWithTX() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -1641,7 +1690,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa * * This is bug XX. */ - public void testRecoverAfterConflict() throws Throwable { + @Test + public void testRecoverAfterConflict() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderOldConfigDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderOldConfigDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderOldConfigDUnitTest.java index bddf85d..5d4c367 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderOldConfigDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderOldConfigDUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache.persistence; +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.io.File; import com.gemstone.gemfire.cache.Cache; @@ -32,11 +41,12 @@ import com.gemstone.gemfire.test.dunit.VM; /** * */ +@Category(DistributedTest.class) public class PersistentRecoveryOrderOldConfigDUnitTest extends PersistentRecoveryOrderDUnitTest { - public PersistentRecoveryOrderOldConfigDUnitTest(String name) { - super(name); + public PersistentRecoveryOrderOldConfigDUnitTest() { + super(); // TODO Auto-generated constructor stub } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java index 1500269..5c68f38 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java @@ -16,44 +16,37 @@ */ package com.gemstone.gemfire.internal.cache.persistence; +import static org.junit.Assert.*; + import java.io.File; import java.io.IOException; import java.util.Map; import java.util.Set; -import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.DataPolicy; import com.gemstone.gemfire.cache.DiskStore; import com.gemstone.gemfire.cache.DiskStoreFactory; import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionExistsException; import com.gemstone.gemfire.cache.RegionFactory; import com.gemstone.gemfire.cache.Scope; -import com.gemstone.gemfire.cache.TimeoutException; -import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.internal.FileUtil; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; -import com.gemstone.gemfire.internal.cache.InternalRegionArguments; -import com.gemstone.gemfire.internal.cache.RegionFactoryImpl; import com.gemstone.gemfire.test.dunit.AsyncInvocation; import com.gemstone.gemfire.test.dunit.Invoke; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; import com.gemstone.gemfire.test.dunit.Wait; import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase; -public abstract class PersistentReplicatedTestBase extends CacheTestCase { +public abstract class PersistentReplicatedTestBase extends JUnit4CacheTestCase { protected static final int MAX_WAIT = 30 * 1000; protected static String REGION_NAME = "region"; protected File diskDir; protected static String SAVED_ACK_WAIT_THRESHOLD; - public PersistentReplicatedTestBase(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { Invoke.invokeInEveryVM(PersistentReplicatedTestBase.class,"setRegionName", new Object[]{getUniqueName()}); @@ -159,7 +152,7 @@ public abstract class PersistentReplicatedTestBase extends CacheTestCase { return vm0.invokeAsync(close); } - protected void createNonPersistentRegion(VM vm) throws Throwable { + protected void createNonPersistentRegion(VM vm) throws Exception { SerializableRunnable createRegion = new SerializableRunnable("Create non persistent region") { public void run() { Cache cache = getCache(); @@ -172,13 +165,13 @@ public abstract class PersistentReplicatedTestBase extends CacheTestCase { vm.invoke(createRegion); } - protected AsyncInvocation createPersistentRegionWithWait(VM vm) throws Throwable { + protected AsyncInvocation createPersistentRegionWithWait(VM vm) throws Exception { return _createPersistentRegion(vm, true); } - protected void createPersistentRegion(VM vm) throws Throwable { + protected void createPersistentRegion(VM vm) throws Exception { _createPersistentRegion(vm, false); } - private AsyncInvocation _createPersistentRegion(VM vm, boolean wait) throws Throwable { + private AsyncInvocation _createPersistentRegion(VM vm, boolean wait) throws Exception { AsyncInvocation future = createPersistentRegionAsync(vm); long waitTime = wait ? 500 : MAX_WAIT; future.join(waitTime); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/snapshot/GFSnapshotJUnitPerformanceTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/snapshot/GFSnapshotJUnitPerformanceTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/snapshot/GFSnapshotJUnitPerformanceTest.java index 95642a2..f44bad6 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/snapshot/GFSnapshotJUnitPerformanceTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/snapshot/GFSnapshotJUnitPerformanceTest.java @@ -22,26 +22,37 @@ import java.util.Map.Entry; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; -import static org.junit.Assert.*; - -import junit.framework.TestCase; - import com.gemstone.gemfire.cache.snapshot.SnapshotIterator; import com.gemstone.gemfire.internal.cache.snapshot.GFSnapshot.GFSnapshotExporter; import com.gemstone.gemfire.internal.cache.snapshot.GFSnapshot.GFSnapshotImporter; import com.gemstone.gemfire.internal.cache.snapshot.GFSnapshot.SnapshotWriter; import com.gemstone.gemfire.internal.cache.snapshot.SnapshotPacket.SnapshotRecord; -import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import com.gemstone.gemfire.test.junit.categories.PerformanceTest; -@Category(IntegrationTest.class) +@Category(PerformanceTest.class) +@Ignore("Test has no assertions and will always pass") public class GFSnapshotJUnitPerformanceTest { - private final File f = new File("test.snapshot"); + private static final String val = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + private File f; + + @Before + public void setUp() throws Exception { + f = new File("test.snapshot"); + } + + @After + public void tearDown() throws Exception { + if (f.exists()) { + f.delete(); + } + } + @Test public void testStreamWritePerformance() throws IOException { int i = 0; @@ -148,11 +159,4 @@ public class GFSnapshotJUnitPerformanceTest { out.close(); } } - - @After - public void tearDown() throws Exception { - if (f.exists()) { - f.delete(); - } - } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java index e21e780..a643c95 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java @@ -16,8 +16,13 @@ */ package com.gemstone.gemfire.internal.cache.tier; +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; @@ -30,16 +35,19 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.tier.sockets.DeltaEOFException; import com.gemstone.gemfire.internal.cache.tier.sockets.FaultyDelta; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.Invoke; 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; + /** * Test delta propagation for faulty delta implementation * @since GemFire 6.1 */ -public class Bug40396DUnitTest extends DistributedTestCase { +@Category(DistributedTest.class) +public class Bug40396DUnitTest extends JUnit4DistributedTestCase { private static Cache cache; private static final String REGION_NAME="Bug40396DUnitTest_region"; @@ -54,8 +62,8 @@ public class Bug40396DUnitTest extends DistributedTestCase { private static final int PUT_COUNT = 10; - public Bug40396DUnitTest(String name) { - super(name); + public Bug40396DUnitTest() { + super(); } @Override @@ -71,7 +79,7 @@ public class Bug40396DUnitTest extends DistributedTestCase { */ public static Integer createServerCache() throws Exception { - new Bug40396DUnitTest("temp").createCache(new Properties()); + new Bug40396DUnitTest().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); @@ -160,6 +168,7 @@ public class Bug40396DUnitTest extends DistributedTestCase { * This test does the following 1)send faulty implementation (Reading more in * fromDelta then what sent by toDelta) of delta raises EOF exception
*/ + @Test public void testForFaultyDeltaImplementationForEOFEX() { boolean matched = false; ((Integer)server.invoke(() -> Bug40396DUnitTest.createServerCache())).intValue(); @@ -187,6 +196,7 @@ public class Bug40396DUnitTest extends DistributedTestCase { * incorrect order from toDelta, raises delta raises array index out of bound * exception
*/ + @Test public void testForFaultyDeltaImplementationForAIOBEX() { boolean matched = false; ((Integer)server.invoke(() -> Bug40396DUnitTest.createServerCache())).intValue(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java index e447917..f49f068 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java @@ -16,7 +16,21 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; -import com.gemstone.gemfire.cache.*; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +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; +import com.gemstone.gemfire.cache.DataPolicy; +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.ConnectionFactoryImpl; import com.gemstone.gemfire.cache.client.internal.PoolImpl; @@ -24,20 +38,19 @@ import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.tier.ConnectionProxy; -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.Host; +import com.gemstone.gemfire.test.dunit.NetworkUtils; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** - * * Test to verify that server responds to a higher versioned client. */ +@Category(DistributedTest.class) +public class BackwardCompatibilityHigherVersionClientDUnitTest extends JUnit4DistributedTestCase { -public class BackwardCompatibilityHigherVersionClientDUnitTest extends - DistributedTestCase { /** the cache */ private static Cache cache = null; @@ -60,11 +73,6 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends private static short currentClientVersion = ConnectionProxy.VERSION.ordinal(); - /** constructor */ - public BackwardCompatibilityHigherVersionClientDUnitTest(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { final Host host = Host.getHost(0); @@ -84,12 +92,11 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends public static void createClientCache(String host, Integer port1) throws Exception { - new BackwardCompatibilityHigherVersionClientDUnitTest("temp"); + new BackwardCompatibilityHigherVersionClientDUnitTest(); Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new BackwardCompatibilityHigherVersionClientDUnitTest("temp") - .createCache(props); + new BackwardCompatibilityHigherVersionClientDUnitTest().createCache(props); PoolImpl p = (PoolImpl)PoolManager.createFactory().addServer(host, port1.intValue()).setSubscriptionEnabled(true) .setSubscriptionRedundancy(1).setThreadLocalConnections(true) @@ -108,7 +115,7 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends } public static Integer createServerCache() throws Exception { - new BackwardCompatibilityHigherVersionClientDUnitTest("temp") + new BackwardCompatibilityHigherVersionClientDUnitTest() .createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); @@ -146,6 +153,7 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends /** * Verify that server responds to a higher versioned client. */ + @Test public void testHigherVersionedClient() { Integer port1 = ((Integer)server1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.createServerCache())); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java index 4b31e49..8a5d29c 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java @@ -16,7 +16,20 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; -import com.gemstone.gemfire.cache.*; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +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; +import com.gemstone.gemfire.cache.MirrorType; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.client.internal.Connection; import com.gemstone.gemfire.cache.client.internal.PoolImpl; @@ -26,12 +39,14 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.ServerLocation; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.EventID; -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.Host; +import com.gemstone.gemfire.test.dunit.NetworkUtils; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * The Region Destroy Operation from Cache Client does not pass the Client side @@ -39,9 +54,8 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties * object in the DestroyRegionMessage. This can cause sender to recieve it own * region destruction message. */ - -public class Bug36269DUnitTest extends DistributedTestCase -{ +@Category(DistributedTest.class) +public class Bug36269DUnitTest extends JUnit4DistributedTestCase { VM server1 = null; @@ -57,24 +71,16 @@ public class Bug36269DUnitTest extends DistributedTestCase private static PoolImpl pool = null; - /** constructor */ - public Bug36269DUnitTest(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { disconnectAllFromDS(); final Host host = Host.getHost(0); - // Server1 VM server1 = host.getVM(0); - - // Server2 VM server2 = host.getVM(1); - PORT1 = ((Integer)server1.invoke(() -> Bug36269DUnitTest.createServerCache())).intValue(); - PORT2 = ((Integer)server2.invoke(() -> Bug36269DUnitTest.createServerCache())).intValue(); + PORT1 = server1.invoke(() -> Bug36269DUnitTest.createServerCache()); + PORT2 = server2.invoke(() -> Bug36269DUnitTest.createServerCache()); } private void createCache(Properties props) throws Exception @@ -84,32 +90,20 @@ public class Bug36269DUnitTest extends DistributedTestCase assertNotNull(cache); } -// static private final String WAIT_PROPERTY = "Bug36269DUnitTest.maxWaitTime"; -// -// static private final int WAIT_DEFAULT = 60000; - /** * This tests whether the region destroy are not received by the sender - * */ - public void testRegionDestroyNotReceivedBySender() throws Exception - { - try { - createClientCache(); - acquireConnectionsAndDestroyRegion(NetworkUtils.getServerHostName(Host.getHost(0))); - server1.invoke(() -> Bug36269DUnitTest.verifyRegionDestroy()); - server2.invoke(() -> Bug36269DUnitTest.verifyRegionDestroy()); - Wait.pause(5000); - verifyNoRegionDestroyOnOriginator(); - } - catch (Exception ex) { - fail("failed gggg testRegionDestroyNotReceivedBySender " + ex); - } - + @Test + public void testRegionDestroyNotReceivedBySender() throws Exception { + createClientCache(); + acquireConnectionsAndDestroyRegion(NetworkUtils.getServerHostName(Host.getHost(0))); + server1.invoke(() -> Bug36269DUnitTest.verifyRegionDestroy()); + server2.invoke(() -> Bug36269DUnitTest.verifyRegionDestroy()); + Wait.pause(5000); + verifyNoRegionDestroyOnOriginator(); } - public static void acquireConnectionsAndDestroyRegion(String host) - { + public static void acquireConnectionsAndDestroyRegion(String host) { try { Connection desCon = pool.acquireConnection(new ServerLocation(host, PORT2)); ServerRegionProxy srp = new ServerRegionProxy(Region.SEPARATOR + REGION_NAME, pool); @@ -120,13 +114,11 @@ public class Bug36269DUnitTest extends DistributedTestCase } } - public static void createClientCache() throws Exception - { - + public static void createClientCache() throws Exception { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new Bug36269DUnitTest("temp").createCache(props); + new Bug36269DUnitTest().createCache(props); CacheServerTestUtil.disableShufflingOfEndpoints(); PoolImpl p; String host = NetworkUtils.getServerHostName(Host.getHost(0)); @@ -150,12 +142,11 @@ public class Bug36269DUnitTest extends DistributedTestCase pool = p; assertNotNull(pool); cache.createRegion(REGION_NAME, factory.create()); - } public static Integer createServerCache() throws Exception { - new Bug36269DUnitTest("temp").createCache(new Properties()); + new Bug36269DUnitTest().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setMirrorType(MirrorType.KEYS_VALUES); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java index 14acf01..9af315e 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java @@ -16,7 +16,23 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; -import com.gemstone.gemfire.cache.*; +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 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; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.RegionAttributes; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.client.Pool; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.client.internal.PoolImpl; @@ -26,14 +42,13 @@ import com.gemstone.gemfire.distributed.internal.ServerLocation; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter; import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder; -import com.gemstone.gemfire.test.dunit.*; - -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 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.VM; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * Bug Test for bug#36457 @@ -43,8 +58,9 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties * error because the region has been destroyed on the server and hence falsely * marks the server dead. */ -public class Bug36457DUnitTest extends DistributedTestCase -{ +@Category(DistributedTest.class) +public class Bug36457DUnitTest extends JUnit4DistributedTestCase { + private static Cache cache = null; private VM server1 = null; @@ -60,8 +76,8 @@ public class Bug36457DUnitTest extends DistributedTestCase private static final String regionName = "Bug36457DUnitTest_Region"; /** constructor */ - public Bug36457DUnitTest(String name) { - super(name); + public Bug36457DUnitTest() { + super(); } @Override @@ -89,7 +105,7 @@ public class Bug36457DUnitTest extends DistributedTestCase Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new Bug36457DUnitTest("temp").createCache(props); + new Bug36457DUnitTest().createCache(props); Pool p = PoolManager.createFactory() .addServer(host, port1.intValue()) .addServer(host, port2.intValue()) @@ -114,7 +130,7 @@ public class Bug36457DUnitTest extends DistributedTestCase public static Integer createServerCache() throws Exception { - new Bug36457DUnitTest("temp").createCache(new Properties()); + new Bug36457DUnitTest().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); @@ -146,6 +162,7 @@ public class Bug36457DUnitTest extends DistributedTestCase } } + @Test public void testBug36457() { Integer port1 = ((Integer)server1.invoke(() -> Bug36457DUnitTest.createServerCache())); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java index e53a1e0..7a4791f 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java @@ -16,6 +16,22 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; +import static org.junit.Assert.*; + +import java.util.ArrayList; +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.Cache; +import com.gemstone.gemfire.cache.CacheFactory; +import com.gemstone.gemfire.cache.Region; +import com.gemstone.gemfire.cache.RegionAttributes; +import com.gemstone.gemfire.cache.RegionDestroyedException; +import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.client.ServerOperationException; @@ -23,19 +39,24 @@ import com.gemstone.gemfire.cache.client.internal.PoolImpl; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.AvailablePort; +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.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; import com.gemstone.gemfire.test.dunit.*; 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 com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; /** * bug test for bug 36805 - * - * + * * When server is running but region is not created on server. Client sends * register interest request, server checks for region, and if region is not * exist on server, it throws an exception to the client. Hence, client marks @@ -43,10 +64,10 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties * * To avoid this, there should not be any check of region before registration. * And region registration should not fail due to non existent region. - * */ -public class Bug36805DUnitTest extends DistributedTestCase -{ +@Category(DistributedTest.class) +public class Bug36805DUnitTest extends JUnit4DistributedTestCase { + private static Cache cache = null; private VM server1 = null; @@ -64,8 +85,8 @@ public class Bug36805DUnitTest extends DistributedTestCase private static final String regionName = "Bug36805DUnitTest_Region"; /** constructor */ - public Bug36805DUnitTest(String name) { - super(name); + public Bug36805DUnitTest() { + super(); } @Override @@ -93,7 +114,7 @@ public class Bug36805DUnitTest extends DistributedTestCase Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new Bug36805DUnitTest("temp").createCache(props); + new Bug36805DUnitTest().createCache(props); PoolImpl p = (PoolImpl)PoolManager.createFactory() .addServer(host, port1.intValue()) .addServer(host, port2.intValue()) @@ -112,7 +133,7 @@ public class Bug36805DUnitTest extends DistributedTestCase public static Integer createServerCache() throws Exception { - new Bug36805DUnitTest("temp").createCache(new Properties()); + new Bug36805DUnitTest().createCache(new Properties()); // no region is created on server int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); CacheServer server1 = cache.addCacheServer(); @@ -140,6 +161,7 @@ public class Bug36805DUnitTest extends DistributedTestCase } } + @Test public void testBug36805() { Integer port1 = ((Integer)server1.invoke(() -> Bug36805DUnitTest.createServerCache()));