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 567C5200B33 for ; Wed, 15 Jun 2016 02:08:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 54EB8160A5F; Wed, 15 Jun 2016 00:08:28 +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 544C6160A06 for ; Wed, 15 Jun 2016 02:08:26 +0200 (CEST) Received: (qmail 92260 invoked by uid 500); 15 Jun 2016 00:08:25 -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 92246 invoked by uid 99); 15 Jun 2016 00:08:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jun 2016 00:08:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 7466018053F for ; Wed, 15 Jun 2016 00:08:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-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 (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id qlPIkQpNM0bu for ; Wed, 15 Jun 2016 00:07:47 +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 BF02060D7C for ; Wed, 15 Jun 2016 00:07:19 +0000 (UTC) Received: (qmail 83115 invoked by uid 99); 15 Jun 2016 00:07:18 -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 00:07:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DFC5DEBFBD; Wed, 15 Jun 2016 00:07:17 +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 00:07:31 -0000 Message-Id: In-Reply-To: <60f2027f4d98435cba2ee6ef29b9a036@git.apache.org> References: <60f2027f4d98435cba2ee6ef29b9a036@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/94] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4 archived-at: Wed, 15 Jun 2016 00:08:28 -0000 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java index 5710ad2..6bfbff3 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java @@ -16,6 +16,17 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static org.junit.Assert.*; + +import java.util.Collections; +import java.util.Iterator; +import java.util.Properties; +import java.util.Set; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.InterestResultPolicy; @@ -26,19 +37,22 @@ import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.internal.cache.*; -import com.gemstone.gemfire.test.dunit.*; - -import java.util.Collections; -import java.util.Iterator; -import java.util.Properties; -import java.util.Set; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import com.gemstone.gemfire.internal.cache.CacheServerImpl; +import com.gemstone.gemfire.internal.cache.FilterProfile; +import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; +import com.gemstone.gemfire.internal.cache.LocalRegion; +import com.gemstone.gemfire.internal.cache.PoolFactoryImpl; +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.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** - * - * * We have 2 servers and One client which registers some keys with durable * interest and some without it. We maintain queues on only One server as * redundancy level is one. Following 2 tests have the two TestCase scenarios @@ -59,9 +73,9 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties * Unregister Some Keys (Here K1, K3) // Step 12: Modify values on the server * for all the Keys // Step 13: Check the values for the ones not unregistered * and the Unregistered Keys' Values should be null - * */ -public class DurableRegistrationDUnitTest extends DistributedTestCase { +@Category(DistributedTest.class) +public class DurableRegistrationDUnitTest extends JUnit4DistributedTestCase { private VM server1VM; @@ -83,8 +97,8 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase { private static final String K4 = "KEY_STONE4"; - public DurableRegistrationDUnitTest(String name) { - super(name); + public DurableRegistrationDUnitTest() { + super(); } @Override @@ -97,6 +111,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase { CacheServerTestUtil.disableShufflingOfEndpoints(); } + @Test public void testSimpleDurableClient() { // Step 1: Starting the servers @@ -215,6 +230,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase { } + @Test public void testSimpleDurableClientWithRegistration() { // Step 1: Starting the servers PORT1 = ((Integer)this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer( regionName, new Boolean(true) @@ -366,6 +382,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase { } + @Test public void testDurableClientWithRegistrationHA() { // Step 1: Start server1 @@ -459,6 +476,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase { } + @Test public void testDurableClientDisConnectWithRegistrationHA() { // Step 1: Start server1 http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java index 12ad99d..46fd108 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.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.Properties; + +import org.junit.Ignore; +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.InterestResultPolicy; +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; @@ -25,22 +41,24 @@ import com.gemstone.gemfire.distributed.DistributedSystem; 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.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.IgnoredException; +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; /** - * * Tests that the Matris defined in ServerResponseMatrix is * applied or not * * @since GemFire 5.1 - * */ -public class DurableResponseMatrixDUnitTest extends DistributedTestCase -{ +@Category(DistributedTest.class) +public class DurableResponseMatrixDUnitTest extends JUnit4DistributedTestCase { protected static Cache cache = null; @@ -52,11 +70,6 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase public static final String KEY = "KeyMatrix1" ; - /** constructor */ - public DurableResponseMatrixDUnitTest(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { final Host host = Host.getHost(0); @@ -68,6 +81,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase IgnoredException.addIgnoredException("Connection reset||Unexpected IOException"); } + @Test public void testRegisterInterestResponse_NonExistent_Invalid() throws Exception { @@ -78,6 +92,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase assertEquals(null, r.getEntry(KEY).getValue()); // invalidate } + @Test public void testRegisterInterestResponse_NonExistent_Valid() throws Exception { server1.invoke(() -> DurableResponseMatrixDUnitTest.updateEntry( KEY, "ValueMatrix1" )); @@ -86,7 +101,9 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase assertEquals("ValueMatrix1", r.getEntry(KEY).getValue()); } - public void BROKEN_testRegisterInterestResponse_Valid_Invalid() throws Exception + @Ignore("TODO: test is broken and disabled") + @Test + public void testRegisterInterestResponse_Valid_Invalid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); r.put(KEY, "ValueMatrix1"); @@ -95,6 +112,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase assertEquals("ValueMatrix1", r.getEntry(KEY).getValue()); } + @Test public void testRegisterInterestResponse_Valid_Valid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -103,6 +121,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase assertEquals("ValueMatrix1", r.getEntry(KEY).getValue()); } + @Test public void testRegisterInterestResponse_Invalid_Invalid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -112,7 +131,9 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase assertEquals(null, r.getEntry(KEY).getValue()); } - public void BROKEN_testRegisterInterestResponse_Invalid_Valid() + @Ignore("TODO: test is broken and disabled") + @Test + public void testRegisterInterestResponse_Invalid_Valid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -122,6 +143,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase assertEquals("ValueMatrix1", r.getEntry(KEY).getValue()); } + @Test public void testRegisterInterestResponse_Destroyed_Invalid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -133,6 +155,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase assertEquals(null, r.getEntry(KEY).getValue()); // invalidate } + @Test public void testRegisterInterestResponse_Destroyed_Valid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -142,6 +165,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase r.registerInterest(KEY, InterestResultPolicy.KEYS_VALUES); assertEquals("ValueMatrix1", r.getEntry(KEY).getValue()); } + @Test public void testRegisterInterest_Destroy_Concurrent() throws Exception { PoolImpl.BEFORE_REGISTER_CALLBACK_FLAG = true; @@ -188,6 +212,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase Wait.waitForCriterion(ev, 120 * 1000, 200, true); } + @Test public void testNotification_NonExistent_Create() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -196,6 +221,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix1"); } + @Test public void testNotification_NonExistent_Update() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -205,6 +231,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix2"); } + @Test public void testNotification_NonExistent_Invalid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -214,6 +241,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, null); // invalidate } + @Test public void testNotification_NonExistent_Destroy() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -223,6 +251,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, null); // destroyed } + @Test public void testNotification_Valid_Create() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -232,6 +261,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix1"); } + @Test public void testNotification_Valid_Update() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -241,7 +271,9 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix2"); } - public void BROKEN_testNotification_Valid_Invalid() throws Exception + @Ignore("TODO: test is broken and disabled") + @Test + public void testNotification_Valid_Invalid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); r.put(KEY, "DummyValue"); @@ -250,6 +282,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, null); // invalidate } + @Test public void testNotification_Valid_Destroy() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -259,6 +292,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, null); // destroyed } + @Test public void testNotification_Invalid_Create() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -268,6 +302,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix1"); } + @Test public void testNotification_Invalid_Update() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -277,7 +312,9 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix1"); } - public void BROKEN_testNotification_Invalid_Invalid() throws Exception + @Ignore("TODO: test is broken and disabled") + @Test + public void testNotification_Invalid_Invalid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); invalidateEntry(KEY); @@ -286,6 +323,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, null); // invalidate } + @Test public void testNotification_Invalid_Destroy() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -295,6 +333,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, null); // destroyed } + @Test public void testNotification_LocalInvalid_Create() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -304,6 +343,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix1"); } + @Test public void testNotification_LocalInvalid_Update() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -313,7 +353,9 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, "ValueMatrix1"); } - public void BROKEN_testNotification_LocalInvalid_Invalid() throws Exception + @Ignore("TODO: test is broken and disabled") + @Test + public void testNotification_LocalInvalid_Invalid() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); localInvalidateEntry(KEY); @@ -322,6 +364,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase waitForValue(r, KEY, null); // invalidate } + @Test public void testNotification_LocalInvalid_Destroy() throws Exception { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); @@ -415,7 +458,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase final int durableClientTimeout = 60; // keep the client alive for 60 s Properties props = getClientDistributedSystemProperties(durableClientId, durableClientTimeout); - new DurableResponseMatrixDUnitTest("temp").createCache(props); + new DurableResponseMatrixDUnitTest().createCache(props); Pool p = PoolManager.createFactory() .addServer(host, PORT1.intValue()) .setSubscriptionEnabled(true) @@ -445,7 +488,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase public static Integer createServerCache() throws Exception { Properties props = new Properties(); - new DurableResponseMatrixDUnitTest("temp").createCache(props); + new DurableResponseMatrixDUnitTest().createCache(props); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java index 1b81297..a18adf7 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java @@ -16,31 +16,52 @@ */ 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.CacheWriter; +import com.gemstone.gemfire.cache.CacheWriterException; +import com.gemstone.gemfire.cache.DataPolicy; +import com.gemstone.gemfire.cache.EntryEvent; +import com.gemstone.gemfire.cache.MirrorType; +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.cache.server.CacheServer; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.cache.util.CacheWriterAdapter; import com.gemstone.gemfire.cache30.ClientServerTestCase; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.AvailablePort; -import com.gemstone.gemfire.internal.cache.*; -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.internal.cache.CacheObserverAdapter; +import com.gemstone.gemfire.internal.cache.CacheObserverHolder; +import com.gemstone.gemfire.internal.cache.EntryEventImpl; +import com.gemstone.gemfire.internal.cache.EventID; +import com.gemstone.gemfire.internal.cache.RegionEventImpl; +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 EventID generated from Cache Client is correctly passed on to * the cache server for create, update, remove and destroy operations.It also checks * that peer nodes also get the same EventID. - * - * */ +@Category(DistributedTest.class) +public class EventIDVerificationDUnitTest extends JUnit4DistributedTestCase { -public class EventIDVerificationDUnitTest extends DistributedTestCase -{ private static Cache cache = null; static VM vm0 = null; @@ -51,7 +72,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase private static int PORT2; - private static final String REGION_NAME = "EventIDVerificationDUnitTest_region"; + private static final String REGION_NAME = EventIDVerificationDUnitTest.class.getSimpleName() + "_region"; protected static EventID eventId; @@ -61,8 +82,8 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase /* Constructor */ - public EventIDVerificationDUnitTest(String name) { - super(name); + public EventIDVerificationDUnitTest() { + super(); } @Override @@ -81,6 +102,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase CacheObserverHolder.setInstance(new CacheObserverAdapter()); } + @Test public void testEventIDOnServer() { createEntry(); @@ -106,6 +128,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase * also checks that peer nodes also get the same EventID. * */ + @Test public void testEventIDPrapogationOnServerDuringRegionDestroy() { destroyRegion(); @@ -120,6 +143,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase * also checks that peer nodes also get the same EventID. */ + @Test public void testEventIDPrapogationOnServerDuringRegionClear() { clearRegion(); @@ -148,7 +172,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new EventIDVerificationDUnitTest("temp").createCache(props); + new EventIDVerificationDUnitTest().createCache(props); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setMirrorType(MirrorType.NONE); @@ -263,7 +287,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase public static Integer createServerCache() throws Exception { - new EventIDVerificationDUnitTest("temp").createCache(new Properties()); + new EventIDVerificationDUnitTest().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java index 08467b0..6f5b4c7 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java @@ -16,8 +16,14 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; +import static org.junit.Assert.*; + import java.util.Properties; +import org.junit.Ignore; +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; @@ -32,9 +38,10 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.cache.EventID; import com.gemstone.gemfire.internal.cache.InternalCacheEvent; import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; 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 EventID generated from a peer is correctly passed on to the @@ -42,17 +49,15 @@ import com.gemstone.gemfire.test.dunit.VM; * GLOBAL scope the EventIDs should be same in P2P for a propagation of given * operation. In case of NO-ACK EventIDs should be different.Currently this test * is commented because of a bug. - * - * */ +@Category(DistributedTest.class) +public class EventIDVerificationInP2PDUnitTest extends JUnit4DistributedTestCase { -public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase -{ private static Cache cache = null; static VM vm0 = null; - private static final String REGION_NAME = "EventIDVerificationInP2PDUnitTest_region"; + private static final String REGION_NAME = EventIDVerificationInP2PDUnitTest.class.getSimpleName() + "_region"; protected static EventID eventId; @@ -64,12 +69,6 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase static int GLOBAL = 2; - /* Constructor */ - - public EventIDVerificationInP2PDUnitTest(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { final Host host = Host.getHost(0); @@ -77,6 +76,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase receiver = false; } + @Test public void testEventIDsDACK() throws Exception { createServerCache(new Integer(DISTRIBUTED_ACK)); @@ -84,6 +84,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase verifyOperations(); } + @Test public void testEventIDsGLOBAL() throws Exception { createServerCache(new Integer(GLOBAL)); @@ -91,8 +92,9 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase verifyOperations(); } - public void _testEventIDsNOACK() throws Exception - { + @Ignore("TODO") + @Test + public void testEventIDsNOACK() throws Exception { createServerCache(new Integer(0)); vm0.invoke(() -> EventIDVerificationInP2PDUnitTest.createServerCache( new Integer(0) )); @@ -122,7 +124,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase public static void createServerCache(Integer type) throws Exception { - new EventIDVerificationInP2PDUnitTest("temp").createCache(new Properties()); + new EventIDVerificationInP2PDUnitTest().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); if (type.intValue() == DISTRIBUTED_ACK) factory.setScope(Scope.DISTRIBUTED_ACK); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java index 901d837..9cf6095 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; +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.IOException; import java.io.Serializable; import java.util.Map; @@ -54,12 +63,13 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * */ -public class ForceInvalidateEvictionDUnitTest extends CacheTestCase { +@Category(DistributedTest.class) +public class ForceInvalidateEvictionDUnitTest extends JUnit4CacheTestCase { private static final long serialVersionUID = -11364213547039967L; - public ForceInvalidateEvictionDUnitTest(String name) { - super(name); + public ForceInvalidateEvictionDUnitTest() { + super(); } private void doPropagationTest(VM sourceVM, VM destinationVm, boolean validateCallbacks, boolean validateContent) { @@ -95,6 +105,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase { removeListener(destinationVm); } + @Test public void testPRToAccessor() { Host host = Host.getHost(0); @@ -113,6 +124,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase { doPropagationTest(vm1, vm2, true, false); } + @Test public void testBridgeClientWithPR() { Host host = Host.getHost(0); @@ -132,6 +144,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase { doPropagationTest(vm1, vm3, true, true); } + @Test public void testBridgeClientWithAccessorServer() { Host host = Host.getHost(0); @@ -149,6 +162,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase { doPropagationTest(vm0, vm3, true, true); } + @Test public void testBridgeClientWithAccessorSource() { 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/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java index f0daf23..b75ca4c 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java @@ -16,23 +16,27 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; -import com.gemstone.gemfire.internal.cache.OffHeapTestUtil; -import com.gemstone.gemfire.test.dunit.Invoke; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; import java.util.Properties; -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import org.junit.experimental.categories.Category; + +import com.gemstone.gemfire.internal.cache.OffHeapTestUtil; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * Runs force invalidate eviction tests with off-heap regions. * @since Geode 1.0 */ +@Category(DistributedTest.class) public class ForceInvalidateOffHeapEvictionDUnitTest extends ForceInvalidateEvictionDUnitTest { - public ForceInvalidateOffHeapEvictionDUnitTest(String name) { - super(name); + public ForceInvalidateOffHeapEvictionDUnitTest() { + super(); } @Override http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java index a82061e..55af1bf 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java @@ -19,6 +19,10 @@ package com.gemstone.gemfire.internal.cache.tier.sockets; import static com.gemstone.gemfire.test.dunit.Invoke.*; import static com.jayway.awaitility.Awaitility.*; import static com.jayway.awaitility.Duration.*; +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.experimental.categories.Category; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; @@ -33,9 +37,10 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.HARegion; import com.gemstone.gemfire.internal.cache.LocalRegion; import com.gemstone.gemfire.internal.cache.ha.HAHelper; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; +import com.gemstone.gemfire.test.junit.categories.DistributedTest; /** * This is the bugtest for bug no. 36738. When Object of class @@ -47,7 +52,8 @@ import com.gemstone.gemfire.test.dunit.VM; * 3. Create server2 and HARegion in it so that GII will happen. * 4. Perform get operations from server2. */ -public class HABug36738DUnitTest extends DistributedTestCase { +@Category(DistributedTest.class) +public class HABug36738DUnitTest extends JUnit4DistributedTestCase { private static final String REGION_NAME = "HABug36738DUnitTest_Region"; private static final String HAREGION_NAME = "haRegion"; @@ -57,8 +63,8 @@ public class HABug36738DUnitTest extends DistributedTestCase { private Region haRegion; - public HABug36738DUnitTest(String name) { - super(name); + public HABug36738DUnitTest() { + super(); } @Override @@ -67,6 +73,7 @@ public class HABug36738DUnitTest extends DistributedTestCase { invokeInEveryVM( () -> cache = null ); } + @Test public void testBug36768() throws Exception { final VM server1 = Host.getHost(0).getVM(0); final VM server2 = Host.getHost(0).getVM(1); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java index d236bc5..9ca8e40 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java @@ -16,20 +16,31 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; +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.test.dunit.IgnoredException; import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.VM; @SuppressWarnings("serial") +@Category(DistributedTest.class) public class HAInterestPart1DUnitTest extends HAInterestTestCase { - public HAInterestPart1DUnitTest(String name) { - super(name); + public HAInterestPart1DUnitTest() { + super(); } /** * Tests whether interest is registered or not on both primary and secondaries */ + @Test public void testInterestRegistrationOnBothPrimaryAndSecondary() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -47,6 +58,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase { * Tests whether interest is registered on both primary and secondaries and * verify their responses */ + @Test public void testInterestRegistrationResponseOnBothPrimaryAndSecondary() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -61,6 +73,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase { * Tests whether re-registration of interest causes duplicates on server side * interest map */ + @Test public void testRERegistrationWillNotCreateDuplicateKeysOnServerInterstMaps() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -80,6 +93,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase { * failover and should pick new primary and get server keys in response of * registerInterest */ + @Test public void testPrimaryFailureInRegisterInterest() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -101,6 +115,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase { * Tests if Secondary fails during interest registration should add to dead Ep * list */ + @Test public void testSecondaryFailureInRegisterInterest() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -123,6 +138,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase { * server to dead ep list and expect serverKeys as a response from * registration on newly selected primary */ + @Test public void testBothPrimaryAndSecondaryFailureInRegisterInterest() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -147,6 +163,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase { * expect serverKeys as a response from registration on newly selected primary * */ + @Test public void testProbablePrimaryFailureInRegisterInterest() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -167,6 +184,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase { * Tests if DeadServerMonitor on detecting an EP as alive should register * client ( create CCP) as welll as register IL */ + @Test public void testInterstRegistrationOnRecoveredEPbyDSM() throws Exception { IgnoredException.addIgnoredException("SocketException"); IgnoredException.addIgnoredException("Unexpected IOException"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java index 8a30f08..67f3c41 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java @@ -16,6 +16,15 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; +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.EntryDestroyedException; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.client.ServerConnectivityException; @@ -26,16 +35,18 @@ import com.gemstone.gemfire.test.dunit.Wait; import com.gemstone.gemfire.test.dunit.WaitCriterion; @SuppressWarnings({"rawtypes", "serial"}) +@Category(DistributedTest.class) public class HAInterestPart2DUnitTest extends HAInterestTestCase { - public HAInterestPart2DUnitTest(String name) { - super(name); + public HAInterestPart2DUnitTest() { + super(); } /** * Tests if Primary fails during interest un registration should initiate * failover should pick new primary */ + @Test public void testPrimaryFailureInUNregisterInterest() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -62,6 +73,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase { * Tests if Secondary fails during interest un registration should add to dead * Ep list */ + @Test public void testSecondaryFailureInUNRegisterInterest() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -84,6 +96,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase { * before interest registration then interest should be registered on the newly * detected live server as well */ + @Test public void testDSMDetectsServerLiveJustBeforeInterestRegistration() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); createEntriesK1andK2(); @@ -110,6 +123,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase { * After interest registration then interest should be registered on the newly * detected live server as well */ + @Test public void testDSMDetectsServerLiveJustAfterInterestRegistration() throws Exception { createClientPoolCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); @@ -142,6 +156,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase { * part of recovery it refreshes registered entries from the server, because it * is primary */ + @Test public void testRefreshEntriesFromPrimaryWhenDSMDetectsServerLive() throws Exception { IgnoredException.addIgnoredException(ServerConnectivityException.class.getName()); @@ -214,6 +229,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase { * this live server and verify that as a part of recovery it does not * refreshes registered entries from the server, because it is secondary */ + @Test public void testGIIFromSecondaryWhenDSMDetectsServerLive() throws Exception { server1.invoke(() -> HAInterestTestCase.closeCache()); server2.invoke(() -> HAInterestTestCase.closeCache()); @@ -249,6 +265,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase { * * @throws Exception */ + @Test public void testBug35945() throws Exception { PORT1 = ((Integer) server1.invoke(() -> HAInterestTestCase.createServerCache())).intValue(); server1.invoke(() -> HAInterestTestCase.createEntriesK1andK2()); @@ -315,6 +332,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase { * Tests if failure occurred in Interest recovery thread, then it should select * new endpoint to register interest */ + @Test public void testInterestRecoveryFailure() throws Exception { IgnoredException.addIgnoredException("Server unreachable"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java index 7120f28..2c12118 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java @@ -16,7 +16,26 @@ */ 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.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Set; + +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.InterestResultPolicy; +import com.gemstone.gemfire.cache.MirrorType; +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.Connection; import com.gemstone.gemfire.cache.client.internal.PoolImpl; @@ -31,19 +50,21 @@ import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter; import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder; import com.gemstone.gemfire.internal.cache.LocalRegion; import com.gemstone.gemfire.internal.cache.tier.InterestType; -import com.gemstone.gemfire.test.dunit.*; - -import java.io.IOException; -import java.util.*; - -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.IgnoredException; +import com.gemstone.gemfire.test.dunit.ThreadUtils; +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; /** * Tests Interest Registration Functionality */ +@Category(DistributedTest.class) @SuppressWarnings({"deprecation", "rawtypes", "serial", "unchecked"}) -public class HAInterestTestCase extends DistributedTestCase { +public class HAInterestTestCase extends JUnit4DistributedTestCase { protected static final int TIMEOUT_MILLIS = 60 * 1000; protected static final int INTERVAL_MILLIS = 10; @@ -77,10 +98,6 @@ public class HAInterestTestCase extends DistributedTestCase { protected volatile static boolean exceptionOccured = false; - public HAInterestTestCase(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { host = Host.getHost(0); @@ -874,7 +891,7 @@ public class HAInterestTestCase extends DistributedTestCase { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new HAInterestTestCase("temp").createCache(props); + new HAInterestTestCase().createCache(props); CacheServerTestUtil.disableShufflingOfEndpoints(); PoolImpl p; try { @@ -908,7 +925,7 @@ public class HAInterestTestCase extends DistributedTestCase { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new HAInterestTestCase("temp").createCache(props); + new HAInterestTestCase().createCache(props); CacheServerTestUtil.disableShufflingOfEndpoints(); PoolImpl p; try { @@ -943,7 +960,7 @@ public class HAInterestTestCase extends DistributedTestCase { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new HAInterestTestCase("temp").createCache(props); + new HAInterestTestCase().createCache(props); PoolImpl p = (PoolImpl) PoolManager.createFactory() .addServer(hostName, PORT1) .setSubscriptionEnabled(true) @@ -964,7 +981,7 @@ public class HAInterestTestCase extends DistributedTestCase { } public static Integer createServerCache() throws Exception { - new HAInterestTestCase("temp").createCache(new Properties()); + new HAInterestTestCase().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setEnableBridgeConflation(true); @@ -983,7 +1000,7 @@ public class HAInterestTestCase extends DistributedTestCase { } public static Integer createServerCacheWithLocalRegion() throws Exception { - new HAInterestTestCase("temp").createCache(new Properties()); + new HAInterestTestCase().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(true); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java index dae8d2a..4f62f67 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java @@ -16,7 +16,26 @@ */ 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.Collection; +import java.util.Iterator; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import com.jayway.awaitility.Awaitility; +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.NoSubscriptionServersAvailableException; +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.Connection; import com.gemstone.gemfire.cache.client.internal.PoolImpl; @@ -27,24 +46,27 @@ import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.CacheServerImpl; import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter; import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder; -import com.gemstone.gemfire.test.dunit.*; +import com.gemstone.gemfire.test.dunit.Assert; +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.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.junit.categories.FlakyTest; -import com.jayway.awaitility.Awaitility; -import org.junit.experimental.categories.Category; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS; -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT; /** * Test to verify Startup. and failover during startup. */ -public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { +@Category(DistributedTest.class) +public class HAStartupAndFailoverDUnitTest extends JUnit4DistributedTestCase { + + private static final String REGION_NAME = HAStartupAndFailoverDUnitTest.class.getSimpleName() + "_region"; + protected static Cache cache = null; + VM server1 = null; VM server2 = null; VM server3 = null; @@ -60,13 +82,6 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { //To verify the primary identification on client side toggeled after notification on client side protected static boolean identifiedPrimary = false; - private static final String REGION_NAME = "HAStartupAndFailoverDUnitTest_region"; - - /** constructor */ - public HAStartupAndFailoverDUnitTest(String name) { - super(name); - } - @Override public final void postSetUp() throws Exception { final Host host = Host.getHost(0); @@ -86,9 +101,9 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { /** * Stops primary server one by one to ensure new primary is selected - * */ - public void testPrimaryFailover() throws Exception + @Test + public void testPrimaryFailover() throws Exception { createClientCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); @@ -136,7 +151,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { * new primary will be selected * */ - public void testExceptionWhileMakingPrimary()throws Exception + @Test + public void testExceptionWhileMakingPrimary()throws Exception { createClientCacheWithIncorrectPrimary(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); @@ -165,7 +181,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { * new primary will be selected * */ - public void testTwoPrimaryFailedOneAfterTheAnother() throws Exception + @Test + public void testTwoPrimaryFailedOneAfterTheAnother() throws Exception { createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); @@ -194,7 +211,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { * verify that Primary Should Be Null And EPList Should Be Empty When All Servers Are Dead */ @Category(FlakyTest.class) // GEODE-1045: random ports, time senstive, waitForCriterion - public void testPrimaryShouldBeNullAndEPListShouldBeEmptyWhenAllServersAreDead() throws Exception { + @Test + public void testPrimaryShouldBeNullAndEPListShouldBeEmptyWhenAllServersAreDead() throws Exception { createClientCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); verifyPrimaryShouldNotBeNullAndEPListShouldNotBeEmpty(); server1.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer()); @@ -208,7 +226,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { * Tests failover initialization by cacheClientUpdater Thread * on failure in Primary Server */ - public void testCacheClientUpdatersInitiatesFailoverOnPrimaryFailure() throws Exception + @Test + public void testCacheClientUpdatersInitiatesFailoverOnPrimaryFailure() throws Exception { createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive()); @@ -226,7 +245,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { * Tests failover initialization by cacheClientUpdater * Thread on failure on Secondary server */ - public void testCacheClientUpdaterInitiatesFailoverOnSecondaryFailure() throws Exception + @Test + public void testCacheClientUpdaterInitiatesFailoverOnSecondaryFailure() throws Exception { createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive()); @@ -244,7 +264,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { * Tests failover initialization by cacheClientUpdater Thread failure on both * Primary and Secondary server */ - public void testCacheClientUpdaterInitiatesFailoverOnBothPrimaryAndSecondaryFailure() throws Exception + @Test + public void testCacheClientUpdaterInitiatesFailoverOnBothPrimaryAndSecondaryFailure() throws Exception { createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); @@ -262,7 +283,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { /** * Tests failover initialization by cacheClientUpdater Thread */ - public void testCacheClientUpdaterInitiatesFailoverOnBothPrimaryAndSecondaryFailureWithServerMonitors() throws Exception + @Test + public void testCacheClientUpdaterInitiatesFailoverOnBothPrimaryAndSecondaryFailureWithServerMonitors() throws Exception { createClientCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost())); @@ -278,7 +300,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { /** * Tests failover initialization by cache operation Threads on secondary */ - public void testInitiateFailoverByCacheOperationThreads_Secondary() throws Exception { + @Test + public void testInitiateFailoverByCacheOperationThreads_Secondary() throws Exception { //Stop the 3rd server to guarantee the client put will go to the first server server3.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer()); // create a client with no client updater thread @@ -537,7 +560,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new HAStartupAndFailoverDUnitTest("temp").createCache(props); + new HAStartupAndFailoverDUnitTest().createCache(props); PoolImpl p = (PoolImpl)PoolManager.createFactory() .addServer(host, PORT1.intValue()) .addServer(host, PORT2.intValue()) @@ -566,7 +589,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new HAStartupAndFailoverDUnitTest("temp").createCache(props); + new HAStartupAndFailoverDUnitTest().createCache(props); PoolImpl p = (PoolImpl)PoolManager.createFactory() .addServer(host, PORT1.intValue()) .addServer(host, PORT2.intValue()) @@ -597,7 +620,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new HAStartupAndFailoverDUnitTest("temp").createCache(props); + new HAStartupAndFailoverDUnitTest().createCache(props); CacheServerTestUtil.disableShufflingOfEndpoints(); PoolImpl p; @@ -635,7 +658,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new HAStartupAndFailoverDUnitTest("temp").createCache(props); + new HAStartupAndFailoverDUnitTest().createCache(props); final int INCORRECT_PORT = 1; PoolImpl p = (PoolImpl)PoolManager.createFactory() .addServer(host, INCORRECT_PORT) @@ -662,7 +685,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase { public static Integer createServerCache() throws Exception { - new HAStartupAndFailoverDUnitTest("temp").createCache(new Properties()); + new HAStartupAndFailoverDUnitTest().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setEnableBridgeConflation(true); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java index 28f70b3..5879bd4 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java @@ -16,9 +16,30 @@ */ package com.gemstone.gemfire.internal.cache.tier.sockets; +import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*; +import static com.gemstone.gemfire.test.dunit.DistributedTestUtils.*; +import static org.junit.Assert.*; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Properties; +import java.util.Random; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; + import com.gemstone.gemfire.DataSerializable; import com.gemstone.gemfire.Instantiator; -import com.gemstone.gemfire.cache.*; +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.MirrorType; +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; @@ -31,19 +52,19 @@ import com.gemstone.gemfire.internal.cache.CacheServerImpl; import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter; import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder; import com.gemstone.gemfire.internal.cache.EventID; -import com.gemstone.gemfire.test.dunit.*; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; -import java.util.Properties; -import java.util.Random; - -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS; -import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT; -import static com.gemstone.gemfire.test.dunit.DistributedTestUtils.unregisterInstantiatorsInThisVM; +import com.gemstone.gemfire.test.dunit.Assert; +import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; +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; + +@Category(DistributedTest.class) +public class InstantiatorPropagationDUnitTest extends JUnit4DistributedTestCase { -public class InstantiatorPropagationDUnitTest extends DistributedTestCase { private static Cache cache = null; private static VM client1 = null; @@ -62,7 +83,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { private static int instanceCountWithOnePut = 1; - private static final String REGION_NAME = "ClientServerInstantiatorRegistrationDUnitTest"; + private static final String REGION_NAME = InstantiatorPropagationDUnitTest.class.getSimpleName() + "_region"; protected static EventID eventId; @@ -70,14 +91,6 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { public static boolean testObject20Loaded = false; - - - - public InstantiatorPropagationDUnitTest(String name) { - super(name); - // TODO Auto-generated constructor stub - } - @Override public final void postSetUp() throws Exception { final Host host = Host.getHost(0); @@ -96,12 +109,11 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { assertNotNull(cache); } - public static void createClientCache(String host, Integer port1) - throws Exception { + public static void createClientCache(String host, Integer port1) throws Exception { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new InstantiatorPropagationDUnitTest("temp").createCache(props); + new InstantiatorPropagationDUnitTest().createCache(props); Pool p = PoolManager.createFactory().addServer(host, port1.intValue()) .setMinConnections(1).setSubscriptionEnabled(true).setPingInterval(200) .create("ClientServerInstantiatorRegistrationDUnitTestPool"); @@ -123,7 +135,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { } public static Integer createServerCache(Integer maxThreads) throws Exception { - new InstantiatorPropagationDUnitTest("temp").createCache(new Properties()); + new InstantiatorPropagationDUnitTest().createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setMirrorType(MirrorType.KEYS_VALUES); @@ -451,6 +463,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { * Verified if the 2 instantiators get propagated to client when client gets * connected. */ + @Test public void testServerUpFirstClientLater() throws Exception { PORT1 = initServerCache(server1); @@ -520,6 +533,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { * the client is connected to(server1), to the other server(server2) in the DS * and the client(client2) that is connected to server2. */ + @Test public void testInstantiatorsWith2ClientsN2Servers() throws Exception { PORT1 = initServerCache(server1); PORT2 = initServerCache(server2); @@ -559,6 +573,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { * instantiators. Client1 should have only 1 instantiator since the server1 * was stopped when 2 instantiators were added on it. */ + @Test public void testInstantiatorsWithServerKill() throws Exception { PORT1 = initServerCache(server1); PORT2 = initServerCache(server2); @@ -605,6 +620,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { * stopped.So registering an instantiator on server should propagate that to * client as well. */ + @Test public void testInstantiators() throws Exception { PORT1 = initServerCache(server1); PORT2 = initServerCache(server2); @@ -642,7 +658,9 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { * Test's Number of Instantiators at all clients & servers with one Server * being stopped and then restarted */ - public void _testInstantiatorsWithServerKillAndReInvoked() throws Exception { + @Ignore("TODO") + @Test + public void testInstantiatorsWithServerKillAndReInvoked() throws Exception { PORT1 = initServerCache(server1); PORT2 = initServerCache(server2); client1 @@ -696,8 +714,8 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { * client(client1). Verified, if that instantiator gets propagated to the * server the client is connected to(server1), to client2, to the other * server(server2) in the DS and the client that is connected to server2. - * */ + @Test public void testInstantiatorCount() throws Exception { PORT1 = initServerCache(server1); PORT2 = initServerCache(server2); @@ -730,12 +748,11 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { unregisterInstantiatorsInAllVMs(); } - public static void createClientCache_EventId(String host, Integer port1) throws Exception - { + public static void createClientCache_EventId(String host, Integer port1) throws Exception { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); - new InstantiatorPropagationDUnitTest("temp").createCache(props); + new InstantiatorPropagationDUnitTest().createCache(props); Pool p = PoolManager.createFactory() .addServer(host, port1.intValue()) .setSubscriptionEnabled(true) @@ -745,14 +762,14 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { factory.setPoolName(p.getName()); cache.createRegion(REGION_NAME, factory.create()); } + /** * Test's same eventId being same for the Instantiators at all clients & * servers - * */ - // disabled - the eventID received does not match the sender's eventID. Why is this a requirement anyway? - public void _testInstantiatorsEventIdVerificationClientsAndServers() - throws Exception { + @Ignore("TODO: disabled - the eventID received does not match the sender's eventID. Why is this a requirement anyway?") + @Test + public void _testInstantiatorsEventIdVerificationClientsAndServers() throws Exception { PORT1 = initServerCache(server1, 1); PORT2 = initServerCache(server2, 2); @@ -773,11 +790,10 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { assertTrue("EventId found Different", pass.booleanValue()); PoolImpl.IS_INSTANTIATOR_CALLBACK = false; - } - public void testLazyRegistrationOfInstantiators() - throws Exception { + @Test + public void testLazyRegistrationOfInstantiators() throws Exception { try { PORT1 = initServerCache(server1); PORT2 = initServerCache(server2); @@ -829,12 +845,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { /** * this method initializes the appropriate server cache - * - * @param server - * @param serverNo - * @return portNo. */ - private int initServerCache(VM server, int serverNo) { Object[] args = new Object[] { new Integer(getMaxThreads()) }; @@ -852,15 +863,9 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { /** * This method creates the server cache - * - * @param maxThreads - * @return - * @throws Exception */ - public static Integer createServerCacheTwo(Integer maxThreads) - throws Exception - { - new InstantiatorPropagationDUnitTest("temp") + public static Integer createServerCacheTwo(Integer maxThreads) throws Exception { + new InstantiatorPropagationDUnitTest() .createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); @@ -879,15 +884,9 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { /** * This method creates the server cache - * - * @param maxThreads - * @return - * @throws Exception */ - public static Integer createServerCacheOne(Integer maxThreads) - throws Exception - { - new InstantiatorPropagationDUnitTest("temp") + public static Integer createServerCacheOne(Integer maxThreads) throws Exception { + new InstantiatorPropagationDUnitTest() .createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); @@ -903,8 +902,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { return new Integer(port); } - public static void setClientServerObserver1() - { + public static void setClientServerObserver1() { PoolImpl.IS_INSTANTIATOR_CALLBACK = true; ClientServerObserverHolder .setInstance(new ClientServerObserverAdapter() { @@ -921,8 +919,6 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { /** * sets the EventId value in the VM - * - * @param eventID */ public static void setEventId(EventID eventID) { @@ -944,6 +940,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase { } } +// TODO: move the following classes to be inner classes abstract class ConfigurableObject { public abstract void init(int index); @@ -951,9 +948,6 @@ abstract class ConfigurableObject { public abstract void validate(int index); } - - - class TestObject1 extends ConfigurableObject implements DataSerializable { private int field1; @@ -966,32 +960,37 @@ class TestObject1 extends ConfigurableObject implements DataSerializable { */ static { Instantiator.register(new Instantiator(TestObject1.class, -100123) { + @Override public DataSerializable newInstance() { return new TestObject1(); } }); } + @Override public void init(int index) { Random random = new Random(); this.field1 = random.nextInt(); } + @Override public int getIndex() { return 1; } + @Override public void validate(int index) { } + @Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.field1 = in.readInt(); } + @Override public void toData(DataOutput out) throws IOException { out.writeInt(this.field1); } - } class TestObject2 extends ConfigurableObject implements DataSerializable { @@ -1003,6 +1002,7 @@ class TestObject2 extends ConfigurableObject implements DataSerializable { static { Instantiator.register(new Instantiator(TestObject2.class, -100122) { + @Override public DataSerializable newInstance() { return new TestObject2(); } @@ -1012,27 +1012,30 @@ class TestObject2 extends ConfigurableObject implements DataSerializable { /** * Initializes a Instantiator1DUnitTestObject1. */ - + @Override public void init(int index) { Random random = new Random(); this.field1 = random.nextInt(); } + @Override public int getIndex() { return 1; } + @Override public void validate(int index) { } + @Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.field1 = in.readInt(); } + @Override public void toData(DataOutput out) throws IOException { out.writeInt(this.field1); } - } class TestObject3 extends ConfigurableObject implements DataSerializable { @@ -1044,6 +1047,7 @@ class TestObject3 extends ConfigurableObject implements DataSerializable { static { Instantiator.register(new Instantiator(TestObject3.class, -121) { + @Override public DataSerializable newInstance() { return new TestObject3(); } @@ -1053,22 +1057,27 @@ class TestObject3 extends ConfigurableObject implements DataSerializable { /** * Initializes a Instantiator1DUnitTestObject1. */ + @Override public void init(int index) { Random random = new Random(); this.field1 = random.nextInt(); } + @Override public int getIndex() { return 1; } + @Override public void validate(int index) { } + @Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.field1 = in.readInt(); } + @Override public void toData(DataOutput out) throws IOException { out.writeInt(this.field1); } @@ -1083,6 +1092,7 @@ class TestObject4 extends ConfigurableObject implements DataSerializable { static { Instantiator.register(new Instantiator(TestObject4.class, -122) { + @Override public DataSerializable newInstance() { return new TestObject4(); } @@ -1092,22 +1102,27 @@ class TestObject4 extends ConfigurableObject implements DataSerializable { /** * Initializes a Instantiator1DUnitTestObject1. */ + @Override public void init(int index) { Random random = new Random(); this.field1 = random.nextInt(); } + @Override public int getIndex() { return 1; } + @Override public void validate(int index) { } + @Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.field1 = in.readInt(); } + @Override public void toData(DataOutput out) throws IOException { out.writeInt(this.field1); } @@ -1122,6 +1137,7 @@ class TestObject5 extends ConfigurableObject implements DataSerializable { static { Instantiator.register(new Instantiator(TestObject5.class, -123) { + @Override public DataSerializable newInstance() { return new TestObject5(); } @@ -1131,22 +1147,27 @@ class TestObject5 extends ConfigurableObject implements DataSerializable { /** * Initializes a Instantiator1DUnitTestObject1. */ + @Override public void init(int index) { Random random = new Random(); this.field1 = random.nextInt(); } + @Override public int getIndex() { return 1; } + @Override public void validate(int index) { } + @Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.field1 = in.readInt(); } + @Override public void toData(DataOutput out) throws IOException { out.writeInt(this.field1); } @@ -1161,6 +1182,7 @@ class TestObject6 extends ConfigurableObject implements DataSerializable { static { Instantiator.register(new Instantiator(TestObject6.class, -124) { + @Override public DataSerializable newInstance() { return new TestObject6(); }