Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 21C3E183DA for ; Tue, 26 Apr 2016 23:17:26 +0000 (UTC) Received: (qmail 72932 invoked by uid 500); 26 Apr 2016 23:17:26 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 72907 invoked by uid 500); 26 Apr 2016 23:17: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 72898 invoked by uid 99); 26 Apr 2016 23:17:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2016 23:17:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 52D90C0257 for ; Tue, 26 Apr 2016 23:17:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 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=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id y50HbAaNI8p8 for ; Tue, 26 Apr 2016 23:17:16 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id D3EBA5F489 for ; Tue, 26 Apr 2016 23:17:14 +0000 (UTC) Received: (qmail 72083 invoked by uid 99); 26 Apr 2016 23:17:14 -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; Tue, 26 Apr 2016 23:17:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E6D0EDFE16; Tue, 26 Apr 2016 23:17:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: klund@apache.org To: commits@geode.incubator.apache.org Date: Tue, 26 Apr 2016 23:17:18 -0000 Message-Id: In-Reply-To: <267eaa41032643088705f050c12bb054@git.apache.org> References: <267eaa41032643088705f050c12bb054@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/16] incubator-geode git commit: Updating and fixing tests http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java index bdd8654..399f1ca 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java @@ -771,7 +771,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase { } }; Wait.waitForCriterion(wc, 60000, 1000, true); -// assertEquals(4/*numBuckets*/, prMetaData.getBucketServerLocationsMap_TEST_ONLY().size()); +// assertIndexDetailsEquals(4/*numBuckets*/, prMetaData.getBucketServerLocationsMap_TEST_ONLY().size()); } public void testMetadataFetchOnlyThroughputAll() { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleNodeOperationsJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleNodeOperationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleNodeOperationsJUnitTest.java index beec9c6..b8d75a5 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleNodeOperationsJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleNodeOperationsJUnitTest.java @@ -1064,8 +1064,8 @@ public class PartitionedRegionSingleNodeOperationsJUnitTest .values().iterator(); while (buckRegionIterator.hasNext()) { Region bucket = (Region)buckRegionIterator.next(); -// assertEquals(Scope.LOCAL, bucket.getAttributes().getScope()); -// assertEquals(DataPolicy.NORMAL, bucket.getAttributes().getDataPolicy()); +// assertIndexDetailsEquals(Scope.LOCAL, bucket.getAttributes().getScope()); +// assertIndexDetailsEquals(DataPolicy.NORMAL, bucket.getAttributes().getDataPolicy()); assertEquals(BucketRegion.class, bucket.getClass()); } @@ -1079,8 +1079,8 @@ public class PartitionedRegionSingleNodeOperationsJUnitTest * putSomeValues(pr1); java.util.Iterator buckRegionIterator1 = * pr1.getDataStore().localBucket2RegionMap .values().iterator(); while * (buckRegionIterator1.hasNext()) { Region bucket = - * (Region)buckRegionIterator1.next(); assertEquals(Scope.DISTRIBUTED_ACK, - * bucket.getAttributes().getScope()); assertEquals(MirrorType.KEYS_VALUES, + * (Region)buckRegionIterator1.next(); assertIndexDetailsEquals(Scope.DISTRIBUTED_ACK, + * bucket.getAttributes().getScope()); assertIndexDetailsEquals(MirrorType.KEYS_VALUES, * bucket.getAttributes() .getMirrorType()); } * * pr1.destroyRegion(); @@ -1093,8 +1093,8 @@ public class PartitionedRegionSingleNodeOperationsJUnitTest * pr2.getDataStore().localBucket2RegionMap .values().iterator(); while * (buckRegionIterator2.hasNext()) { Region bucket = * (Region)buckRegionIterator2.next(); - * assertEquals(Scope.DISTRIBUTED_NO_ACK, - * bucket.getAttributes().getScope()); assertEquals(MirrorType.KEYS_VALUES, + * assertIndexDetailsEquals(Scope.DISTRIBUTED_NO_ACK, + * bucket.getAttributes().getScope()); assertIndexDetailsEquals(MirrorType.KEYS_VALUES, * bucket.getAttributes() .getMirrorType()); } pr2.destroyRegion(); */ } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsJUnitTest.java index 089d723..167b89b 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsJUnitTest.java @@ -265,8 +265,8 @@ public class PartitionedRegionStatsJUnitTest * int minRedundantCopies = stats.get("minRedundantCopies").intValue(); * int avgRedundantCopies = stats.get("avgRedundantCopies").intValue(); * - * assertEquals(minRedundantCopies, 2); assertEquals(maxRedundantCopies, - * 2); assertEquals(avgRedundantCopies, 2); + * assertIndexDetailsEquals(minRedundantCopies, 2); assertIndexDetailsEquals(maxRedundantCopies, + * 2); assertIndexDetailsEquals(avgRedundantCopies, 2); */ } @@ -486,8 +486,8 @@ public class PartitionedRegionStatsJUnitTest assertEquals(numEntries , stats.getInt("dataStoreEntryCount")); assertEquals((numEntries - entriesInMem) * entryOverflowSize, diskStats.getNumOverflowBytesOnDisk()); //Disabled for GEODE-93. numEntriesInVM and numOVerflowOnDisk are incorrect -// assertEquals(entriesInMem , diskStats.getNumEntriesInVM()); -// assertEquals((numEntries - entriesInMem) , diskStats.getNumOverflowOnDisk()); +// assertIndexDetailsEquals(entriesInMem , diskStats.getNumEntriesInVM()); +// assertIndexDetailsEquals((numEntries - entriesInMem) , diskStats.getNumOverflowOnDisk()); assertEquals(stats.getLong("dataStoreBytesInUse"), getMemBytes(pr)); assertEquals(diskStats.getNumOverflowBytesOnDisk(), getDiskBytes(pr)); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java index 1daa499..b99024b 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java @@ -280,7 +280,7 @@ public class PartitionedRegionTestUtilsDUnitTest extends // p.put(key1, val1); // assertFalse(p.localCacheContainsKey(key1)); // assertFalse(p.localCacheContainsKey(key2)); -// assertEquals(val1, p.get(key1)); +// assertIndexDetailsEquals(val1, p.get(key1)); // assertTrue(p.localCacheContainsKey(key1)); // assertFalse(p.localCacheContainsKey(key2)); // @@ -290,12 +290,12 @@ public class PartitionedRegionTestUtilsDUnitTest extends // assertFalse(lset.contains(key2)); // // // test localCacheGet -// assertEquals(val1, p.localCacheGet(key1)); +// assertIndexDetailsEquals(val1, p.localCacheGet(key1)); // assertNull(p.localCacheGet(key2)); // p.put(key2, val2); // assertNull(p.localCacheGet(key2)); -// assertEquals(val2, p.get(key2)); -// assertEquals(val2, p.localCacheGet(key2)); +// assertIndexDetailsEquals(val2, p.get(key2)); +// assertIndexDetailsEquals(val2, p.localCacheGet(key2)); // } // }); @@ -424,7 +424,7 @@ public class PartitionedRegionTestUtilsDUnitTest extends val = new Integer(i); p.put(key, val); // Integer gottenVal = (Integer) p.get(key); - // assertEquals("Value for key: " + key + " val " + gottenVal + " wasn't expected " + val, val, gottenVal); + // assertIndexDetailsEquals("Value for key: " + key + " val " + gottenVal + " wasn't expected " + val, val, gottenVal); } // Assert that the proper number of keys are placed in each bucket @@ -433,7 +433,7 @@ public class PartitionedRegionTestUtilsDUnitTest extends assertEquals(s.size(), 1); key = (TestPRKey) s.iterator().next(); assertEquals(i, key.hashCode()); - // assertEquals(new Integer(i), p.get(key)); + // assertIndexDetailsEquals(new Integer(i), p.get(key)); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java index 7afd5fa..9b1f29e 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java @@ -123,7 +123,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase { private final SerializableCallable verifyNoTxState = new SerializableCallable() { public Object call() throws Exception { //TXManagerImpl mgr = getGemfireCache().getTxManager(); - //assertEquals(0, mgr.hostedTransactionsInProgressForTest()); + //assertIndexDetailsEquals(0, mgr.hostedTransactionsInProgressForTest()); final TXManagerImpl mgr = getGemfireCache().getTxManager(); Wait.waitForCriterion(new WaitCriterion() { @Override @@ -356,14 +356,14 @@ public class RemoteTransactionDUnitTest extends CacheTestCase { Region.Entry eR = refRegion.getEntry(custId); assertNotNull(eC); assertNotNull(eR); -// assertEquals(1,custRegion.size()); - // assertEquals(1,orderRegion.size()); - // assertEquals(1,refRegion.size()); +// assertIndexDetailsEquals(1,custRegion.size()); + // assertIndexDetailsEquals(1,orderRegion.size()); + // assertIndexDetailsEquals(1,refRegion.size()); } else { - //assertEquals(0,custRegion.size()); - //assertEquals(0,orderRegion.size()); - //assertEquals(0,refRegion.size()); + //assertIndexDetailsEquals(0,custRegion.size()); + //assertIndexDetailsEquals(0,orderRegion.size()); + //assertIndexDetailsEquals(0,refRegion.size()); try { Region.Entry eC = custRegion.getEntry(custId); assertNull("should have had an EntryNotFoundException:"+eC,eC); @@ -415,13 +415,13 @@ public class RemoteTransactionDUnitTest extends CacheTestCase { assertEquals(expectedCust, custRegion.getEntry(custId).getValue()); /* assertNotNull(orderRegion.getEntry(orderId)); - assertEquals(expectedOrder, orderRegion.getEntry(orderId).getValue()); + assertIndexDetailsEquals(expectedOrder, orderRegion.getEntry(orderId).getValue()); assertNotNull(orderRegion.getEntry(orderId2)); - assertEquals(expectedOrder2, orderRegion.getEntry(orderId2).getValue()); + assertIndexDetailsEquals(expectedOrder2, orderRegion.getEntry(orderId2).getValue()); assertNotNull(orderRegion.getEntry(orderId3)); - assertEquals(expectedOrder3, orderRegion.getEntry(orderId3).getValue()); + assertIndexDetailsEquals(expectedOrder3, orderRegion.getEntry(orderId3).getValue()); */ assertNotNull(refRegion.getEntry(custId)); assertEquals(expectedRef, refRegion.getEntry(custId).getValue()); @@ -2236,7 +2236,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase { assertEquals(6, rr.entrySet().size()); assertNotNull(rr.get(custId)); TXStateProxy tx = mgr.internalSuspend(); - //assertEquals(getCustIdSet(5), rr.entrySet()); + //assertIndexDetailsEquals(getCustIdSet(5), rr.entrySet()); assertEquals(5, rr.entrySet().size()); assertNull(rr.get(custId)); mgr.resume(tx); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SearchLoadAndWriteProcessorTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SearchLoadAndWriteProcessorTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SearchLoadAndWriteProcessorTest.java index 57aca37..3e51fd9 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SearchLoadAndWriteProcessorTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SearchLoadAndWriteProcessorTest.java @@ -16,7 +16,6 @@ */ package com.gemstone.gemfire.internal.cache; -import static org.junit.Assert.*; import static org.mockito.Mockito.*; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java index 0300331..6bac28b 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java @@ -230,7 +230,7 @@ public class SimpleDiskRegionJUnitTest extends DiskRegionTestingBase // region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps); // DiskRegion dr = ((LocalRegion)region).getDiskRegion(); // put100Int(); -// assertEquals(new Integer(1), region.get(new Integer(1))); +// assertIndexDetailsEquals(new Integer(1), region.get(new Integer(1))); // Oplog oplog = dr.getChild(); // int id = oplog.getOplogId(); // StatisticsFactory factory = dr.getOwner().getCache().getDistributedSystem(); @@ -239,7 +239,7 @@ public class SimpleDiskRegionJUnitTest extends DiskRegionTestingBase // dr.setChild(newOplog); // region.clear(); // newOplog = dr.getChild(); -// assertEquals(null, region.get(new Integer(1))); +// assertIndexDetailsEquals(null, region.get(new Integer(1))); // try { // dr.addToOplogSet(id, new File(oplog.getOplogFile() // .getPath()), dr.getNextDir()); @@ -254,7 +254,7 @@ public class SimpleDiskRegionJUnitTest extends DiskRegionTestingBase // oplog.close(); // dr.setIsRecovering(true); // dr.basicInitializeOwner(); -// assertEquals(new Integer(1), region.get(new Integer(1))); +// assertIndexDetailsEquals(new Integer(1), region.get(new Integer(1))); // closeDown(); // } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/VLJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/VLJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/VLJUnitTest.java index 11aaa77..c2b36f8 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/VLJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/VLJUnitTest.java @@ -16,6 +16,8 @@ */ package com.gemstone.gemfire.internal.cache; +import static org.junit.Assert.*; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInput; @@ -24,10 +26,9 @@ import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; +import org.junit.Test; import org.junit.experimental.categories.Category; -import junit.framework.TestCase; - import com.gemstone.gemfire.internal.InternalDataSerializer; import com.gemstone.gemfire.test.junit.categories.UnitTest; @@ -36,10 +37,10 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest; * * TODO these tests need some work. I don't think they really represent * edge cases for this variable length value. - * */ @Category(UnitTest.class) -public class VLJUnitTest extends TestCase { +public class VLJUnitTest { + private ByteArrayOutputStream baos; private DataOutputStream dos; @@ -56,71 +57,85 @@ public class VLJUnitTest extends TestCase { return new DataInputStream(bais); } + @Test public void testZero() throws IOException { InternalDataSerializer.writeUnsignedVL(0, createDOS()); assertEquals(0, InternalDataSerializer.readUnsignedVL(createDIS())); } - + + @Test public void testOne() throws IOException { InternalDataSerializer.writeUnsignedVL(1, createDOS()); assertEquals(1, InternalDataSerializer.readUnsignedVL(createDIS())); } - + + @Test public void testMinusOne() throws IOException { InternalDataSerializer.writeUnsignedVL(-1, createDOS()); assertEquals(-1, InternalDataSerializer.readUnsignedVL(createDIS())); } + @Test public void testMaxByte() throws IOException { InternalDataSerializer.writeUnsignedVL(0x7F, createDOS()); assertEquals(0x7F, InternalDataSerializer.readUnsignedVL(createDIS())); } - + + @Test public void testMaxNegativeByte() throws IOException { InternalDataSerializer.writeUnsignedVL(-0x7F, createDOS()); assertEquals(-0x7F, InternalDataSerializer.readUnsignedVL(createDIS())); } + @Test public void testMinShort() throws IOException { InternalDataSerializer.writeUnsignedVL(0xFF, createDOS()); assertEquals(0xFF, InternalDataSerializer.readUnsignedVL(createDIS())); } - + + @Test public void testMinNegativeShort() throws IOException { InternalDataSerializer.writeUnsignedVL(-0xFF, createDOS()); assertEquals(-0xFF, InternalDataSerializer.readUnsignedVL(createDIS())); } + @Test public void testMaxShort() throws IOException { InternalDataSerializer.writeUnsignedVL(0x7fff, createDOS()); assertEquals(0x7fff, InternalDataSerializer.readUnsignedVL(createDIS())); } - + + @Test public void testMaxNegativeShort() throws IOException { InternalDataSerializer.writeUnsignedVL(-0x7fff, createDOS()); assertEquals(-0x7fff, InternalDataSerializer.readUnsignedVL(createDIS())); } + @Test public void testMin3Byte() throws IOException { InternalDataSerializer.writeUnsignedVL(0xffff, createDOS()); assertEquals(0xffff, InternalDataSerializer.readUnsignedVL(createDIS())); } - + + @Test public void testMin3Negative() throws IOException { InternalDataSerializer.writeUnsignedVL(-0xffff, createDOS()); assertEquals(-0xffff, InternalDataSerializer.readUnsignedVL(createDIS())); } + @Test public void testMaxInt() throws IOException { InternalDataSerializer.writeUnsignedVL(0x7fffffff, createDOS()); assertEquals(0x7fffffff, InternalDataSerializer.readUnsignedVL(createDIS())); } + @Test public void testMinLong() throws IOException { InternalDataSerializer.writeUnsignedVL(0x7fffffffL + 1, createDOS()); assertEquals(0x7fffffffL + 1, InternalDataSerializer.readUnsignedVL(createDIS())); } + @Test public void testMaxLong() throws IOException { InternalDataSerializer.writeUnsignedVL(Long.MAX_VALUE, createDOS()); assertEquals(Long.MAX_VALUE, InternalDataSerializer.readUnsignedVL(createDIS())); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/FilterByPathJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/FilterByPathJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/FilterByPathJUnitTest.java index 3fa2024..fade291 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/FilterByPathJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/FilterByPathJUnitTest.java @@ -16,30 +16,31 @@ */ package com.gemstone.gemfire.internal.cache.control; +import static org.junit.Assert.*; + import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.HashSet; +import org.junit.Test; import org.junit.experimental.categories.Category; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.test.junit.categories.UnitTest; -import junit.framework.TestCase; - -/** - * - */ @Category(UnitTest.class) -public class FilterByPathJUnitTest extends TestCase { +public class FilterByPathJUnitTest { + + @Test public void testDefault() { FilterByPath filter = new FilterByPath(null, null); assertTrue(filter.include(createRegion("a"))); assertTrue(filter.include(createRegion("b"))); assertTrue(filter.include(createRegion("c"))); } - + + @Test public void testInclude() { HashSet included = new HashSet(); included.add("a"); @@ -50,6 +51,7 @@ public class FilterByPathJUnitTest extends TestCase { assertFalse(filter.include(createRegion("c"))); } + @Test public void testExclude() { HashSet excluded = new HashSet(); excluded.add("a"); @@ -59,7 +61,8 @@ public class FilterByPathJUnitTest extends TestCase { assertFalse(filter.include(createRegion("b"))); assertTrue(filter.include(createRegion("c"))); } - + + @Test public void testBoth() { HashSet included = new HashSet(); included.add("a"); @@ -79,17 +82,18 @@ public class FilterByPathJUnitTest extends TestCase { return (Region) Proxy.newProxyInstance(contextClassLoader, new Class[] {Region.class}, handler); } - public static class RegionHandler implements InvocationHandler { + private static class RegionHandler implements InvocationHandler { private String name; public RegionHandler(String name) { this.name = "/"+name; } + + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return name; } - } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryThresholdsJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryThresholdsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryThresholdsJUnitTest.java index 08b2c80..74dc4fe 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryThresholdsJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/MemoryThresholdsJUnitTest.java @@ -16,20 +16,17 @@ */ package com.gemstone.gemfire.internal.cache.control; -import junit.framework.TestCase; +import static org.junit.Assert.*; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import static org.junit.Assert.*; - import com.gemstone.gemfire.internal.cache.control.MemoryThresholds.MemoryState; import com.gemstone.gemfire.test.junit.categories.UnitTest; @Category(UnitTest.class) public class MemoryThresholdsJUnitTest { + @Test public void testDefaults() { MemoryThresholds thresholds = new MemoryThresholds(1000); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java index 26ebc16..6049e14 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/control/RebalanceOperationDUnitTest.java @@ -309,7 +309,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { Cache cache = getCache(); ResourceManager manager = cache.getResourceManager(); RebalanceResults results = doRebalance(false, manager); -// assertEquals(113, results.getTotalBucketCreatesCompleted()); +// assertIndexDetailsEquals(113, results.getTotalBucketCreatesCompleted()); } }); @@ -407,14 +407,14 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { //We actually *will* transfer buckets, because that improves //the balance assertEquals(3, results.getTotalBucketTransfersCompleted()); -// assertEquals(0, results.getTotalBucketTransferBytes()); +// assertIndexDetailsEquals(0, results.getTotalBucketTransferBytes()); Set detailSet = results.getPartitionRebalanceDetails(); assertEquals(1, detailSet.size()); PartitionRebalanceInfo details = detailSet.iterator().next(); assertEquals(0, details.getBucketCreatesCompleted()); assertEquals(0, details.getPrimaryTransfersCompleted()); assertEquals(3, details.getBucketTransfersCompleted()); -// assertEquals(0, details.getBucketTransferBytes()); +// assertIndexDetailsEquals(0, details.getBucketTransferBytes()); if(!simulate) { verifyStats(manager, results); } @@ -544,7 +544,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { } assertEquals(2, info.getPrimaryCount()); } -// assertEquals(0, details.getBucketTransferBytes()); +// assertIndexDetailsEquals(0, details.getBucketTransferBytes()); if(!simulate) { verifyStats(manager, results); } @@ -743,7 +743,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { assertEquals(2, info.getPrimaryCount()); } } - // assertEquals(0, details.getBucketTransferBytes()); + // assertIndexDetailsEquals(0, details.getBucketTransferBytes()); verifyStats(manager, results); } }); @@ -1695,7 +1695,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { ResourceManager manager = cache.getResourceManager(); RebalanceResults results = doRebalance(simulate, manager, INCLUDED, EXCLUDED); Set detailSet = results.getPartitionRebalanceDetails(); -// assertEquals(3, detailSet.size()); +// assertIndexDetailsEquals(3, detailSet.size()); Set names = new HashSet(); for(PartitionRebalanceInfo details: detailSet) { assertEquals(0, details.getBucketCreatesCompleted()); @@ -1825,7 +1825,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { assertEquals(0, results.getTotalBucketCreatesCompleted()); //We don't know how many primaries will move, it depends on //if the move bucket code moves the primary or a redundant bucket - //assertEquals(0, results.getTotalPrimaryTransfersCompleted()); + //assertIndexDetailsEquals(0, results.getTotalPrimaryTransfersCompleted()); assertEquals(8, results.getTotalBucketTransfersCompleted()); assertTrue(0 < results.getTotalBucketTransferBytes()); Set detailSet = results.getPartitionRebalanceDetails(); @@ -1970,7 +1970,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { assertEquals(0, results.getTotalBucketCreatesCompleted()); //We don't know how many primaries will move, it depends on //if the move bucket code moves the primary or a redundant bucket - //assertEquals(0, results.getTotalPrimaryTransfersCompleted()); + //assertIndexDetailsEquals(0, results.getTotalPrimaryTransfersCompleted()); assertEquals(8, results.getTotalBucketTransfersCompleted()); assertTrue(0 < results.getTotalBucketTransferBytes()); Set detailSet = results.getPartitionRebalanceDetails(); @@ -2017,7 +2017,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { assertEquals(4, memberDetails.getPrimaryCount()); afterSize += memberDetails.getSize(); } - //assertEquals(totalSize.longValue(), afterSize); + //assertIndexDetailsEquals(totalSize.longValue(), afterSize); } }; @@ -2038,7 +2038,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { assertEquals(0, results.getTotalBucketCreatesCompleted()); //We don't know how many primaries will move, it depends on //if the move bucket code moves the primary or a redundant bucket - //assertEquals(0, results.getTotalPrimaryTransfersCompleted()); + //assertIndexDetailsEquals(0, results.getTotalPrimaryTransfersCompleted()); assertEquals(6, results.getTotalBucketTransfersCompleted()); assertTrue(0 < results.getTotalBucketTransferBytes()); Set detailSet = results.getPartitionRebalanceDetails(); @@ -2059,7 +2059,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { assertEquals(4, afterDetails.size()); for(PartitionMemberInfo memberDetails: afterDetails) { assertEquals(6, memberDetails.getBucketCount()); -// assertEquals(3, memberDetails.getPrimaryCount()); +// assertIndexDetailsEquals(3, memberDetails.getPrimaryCount()); afterSize += memberDetails.getSize(); } assertEquals(totalSize, afterSize); @@ -2083,10 +2083,10 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { long afterSize = 0; for(PartitionMemberInfo memberDetails: details.getPartitionMemberInfo()) { assertEquals(6, memberDetails.getBucketCount()); - // assertEquals(3, memberDetails.getPrimaryCount()); + // assertIndexDetailsEquals(3, memberDetails.getPrimaryCount()); afterSize += memberDetails.getSize(); } - //assertEquals(totalSize.longValue(), afterSize); + //assertIndexDetailsEquals(totalSize.longValue(), afterSize); } }; @@ -2154,7 +2154,7 @@ public class RebalanceOperationDUnitTest extends CacheTestCase { assertEquals(0, results.getTotalBucketCreatesCompleted()); //We don't know how many primaries will move, it depends on //if the move bucket code moves the primary or a redundant bucket - //assertEquals(0, results.getTotalPrimaryTransfersCompleted()); + //assertIndexDetailsEquals(0, results.getTotalPrimaryTransfersCompleted()); assertEquals(8, results.getTotalBucketTransfersCompleted()); assertTrue(0 < results.getTotalBucketTransferBytes()); Set detailSet = results.getPartitionRebalanceDetails(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java index 9d96d9e..e70d260 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java @@ -589,7 +589,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends P // resultListForMember.add(resultIterator.next()); // // for (Object result : resultListForMember) { - // assertEquals(Boolean.TRUE, result); + // assertIndexDetailsEquals(Boolean.TRUE, result); // } // } for (Object result : resultList) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java index 482ab9a..1a83608 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java @@ -551,7 +551,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e // resultListForMember.add(resultIterator.next()); // // for (Object result : resultListForMember) { - // assertEquals(Boolean.TRUE, result); + // assertIndexDetailsEquals(Boolean.TRUE, result); // } // } for (Object result : resultList) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java index 1f65ad2..bedead7 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java @@ -585,7 +585,7 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion; // resultListForMember.add(resultIterator.next()); // // for (Object result : resultListForMember) { -// assertEquals(Boolean.TRUE, result); +// assertIndexDetailsEquals(Boolean.TRUE, result); // } // } for (Object result : resultList) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRCustomPartitioningDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRCustomPartitioningDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRCustomPartitioningDUnitTest.java index 55ab928..12a143d 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRCustomPartitioningDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRCustomPartitioningDUnitTest.java @@ -399,7 +399,7 @@ public class PRCustomPartitioningDUnitTest extends PartitionResolver rr = pr.getPartitionResolver(); Object o = rr.getRoutingObject(eo); Integer i = new Integer(o.hashCode()% totalNumBuckets); - //assertEquals(bucketId, bucketId); + //assertIndexDetailsEquals(bucketId, bucketId); assertEquals(bucketId, i); } //getLogWriter().severe("Key " + key + " found in bucket " + b); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java index a8df3f6..7d2c0ef 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRFunctionExecutionDUnitTest.java @@ -1615,10 +1615,10 @@ public class PRFunctionExecutionDUnitTest extends ResultCollector rc2 = dataSet.withFilter(testKeysSet).withArgs(testKeysSet) .execute(function); List l2 = ((List)rc2.getResult()); - //assertEquals(pr.getTotalNumberOfBuckets(), l2.size()); + //assertIndexDetailsEquals(pr.getTotalNumberOfBuckets(), l2.size()); assertEquals(3, l2.size()); - // assertEquals(pr.getTotalNumberOfBuckets(), l.size()); + // assertIndexDetailsEquals(pr.getTotalNumberOfBuckets(), l.size()); HashSet foundVals = new HashSet(); for (Iterator i = l2.iterator(); i.hasNext();) { ArrayList subL = (ArrayList)i.next(); @@ -1908,7 +1908,7 @@ public class PRFunctionExecutionDUnitTest extends ResultCollector rc1 = dataSet.withFilter(testKeys).withArgs(Boolean.TRUE) .execute(function.getId()); List l = ((List)rc1.getResult()); - //assertEquals(pr.getTotalNumberOfBuckets(), l.size()); + //assertIndexDetailsEquals(pr.getTotalNumberOfBuckets(), l.size()); assertEquals(1, l.size()); for (Iterator i = l.iterator(); i.hasNext();) { assertEquals(Boolean.TRUE, i.next()); @@ -2256,8 +2256,8 @@ public class PRFunctionExecutionDUnitTest extends return Boolean.TRUE; // for (int i=0; i<4; i++) { // List l = ((List)rc1.getResult()); -// assertEquals(4, l.size()); -// assertEquals(Boolean.TRUE, l.iterator().next()); +// assertIndexDetailsEquals(4, l.size()); +// assertIndexDetailsEquals(Boolean.TRUE, l.iterator().next()); // } // // return Boolean.TRUE; @@ -2735,7 +2735,7 @@ public class PRFunctionExecutionDUnitTest extends try { partitionedregion.put(orderId, order); //assertTrue(partitionedregion.containsKey(orderId)); - //assertEquals(order,partitionedregion.get(orderId)); + //assertIndexDetailsEquals(order,partitionedregion.get(orderId)); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRPerformanceTestDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRPerformanceTestDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRPerformanceTestDUnitTest.java index 4643123..6f34acd 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRPerformanceTestDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRPerformanceTestDUnitTest.java @@ -199,7 +199,7 @@ public class PRPerformanceTestDUnitTest extends assertNotNull(pr); //pr.put(key, Integer.toString(i)); pr.put(key, valueArray); - //assertEquals(valueArray, pr.get(key)); + //assertIndexDetailsEquals(valueArray, pr.get(key)); } entries--; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/extension/SimpleExtensionPointJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/extension/SimpleExtensionPointJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/extension/SimpleExtensionPointJUnitTest.java index 5d0ee56..4fd7837 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/extension/SimpleExtensionPointJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/extension/SimpleExtensionPointJUnitTest.java @@ -30,7 +30,6 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest; /** * Unit tests for {@link SimpleExtensionPoint}. - * * * @since 8.1 */ @@ -99,7 +98,6 @@ public class SimpleExtensionPointJUnitTest { } catch (NoSuchElementException e) { // ignore } - } /** @@ -183,7 +181,7 @@ public class SimpleExtensionPointJUnitTest { public void method1(); } - private class MockImpl implements MockInterface, Extensible { + private static class MockImpl implements MockInterface, Extensible { private SimpleExtensionPoint extensionPoint = new SimpleExtensionPoint(this, this); @@ -198,7 +196,7 @@ public class SimpleExtensionPointJUnitTest { } - private class MockExtension implements Extension { + private static class MockExtension implements Extension { @Override public XmlGenerator getXmlGenerator() { @@ -209,6 +207,5 @@ public class SimpleExtensionPointJUnitTest { public void onCreate(Extensible source, Extensible target) { throw new UnsupportedOperationException(); } - } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/EventIdOptimizationJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/EventIdOptimizationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/EventIdOptimizationJUnitTest.java index 2b81cb4..a9cc187 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/EventIdOptimizationJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/EventIdOptimizationJUnitTest.java @@ -16,12 +16,13 @@ */ package com.gemstone.gemfire.internal.cache.ha; +import static org.junit.Assert.*; + import java.nio.ByteBuffer; +import org.junit.Test; import org.junit.experimental.categories.Category; -import junit.framework.TestCase; - import com.gemstone.gemfire.internal.cache.EventID; import com.gemstone.gemfire.test.junit.categories.UnitTest; @@ -31,15 +32,13 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest; * For client to server messages, the membership id part of event-id is not need * to be sent with each event. Also, the threadId and sequenceId need not be * sent as long if their value is small. This is a junit test for testing the - * methods written in EventID class for the above optmization. + * methods written in EventID class for the above optimization. * For distributed testing for the same , please refer * {@link EventIdOptimizationDUnitTest}. - * - * */ @Category(UnitTest.class) -public class EventIdOptimizationJUnitTest extends TestCase -{ +public class EventIdOptimizationJUnitTest { + /** The long id (threadId or sequenceId) having value equivalent to byte */ private static final long ID_VALUE_BYTE = Byte.MAX_VALUE; @@ -53,164 +52,144 @@ public class EventIdOptimizationJUnitTest extends TestCase private static final long ID_VALUE_LONG = Long.MAX_VALUE; /** - * Constructor - * - * @param arg0 - - * name - */ - public EventIdOptimizationJUnitTest(String arg0) { - super(arg0); - } - - /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for byte-byte * combination for threadId and sequenceId values. - * */ - public void testOptmizationForByteByte() - { + @Test + public void testOptimizationForByteByte() { int expectedLength = 2 + 1 + 1; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_BYTE, ID_VALUE_BYTE, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_BYTE, ID_VALUE_BYTE, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for * short-short combination for threadId and sequenceId values. - * */ - public void testOptmizationForShortShort() - { + @Test + public void testOptimizationForShortShort() { int expectedLength = 2 + 2 + 2; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_SHORT, ID_VALUE_SHORT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_SHORT, ID_VALUE_SHORT, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for int-int * combination for threadId and sequenceId values. - * */ - public void testOptmizationForIntInt() - { + @Test + public void testOptimizationForIntInt() { int expectedLength = 2 + 4 + 4; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_INT, ID_VALUE_INT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_INT, ID_VALUE_INT, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for long-long * combination for threadId and sequenceId values. - * */ - public void testOptmizationForLongLong() - { + @Test + public void testOptimizationForLongLong() { int expectedLength = 2 + 8 + 8; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_LONG, ID_VALUE_LONG, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_LONG, ID_VALUE_LONG, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for byte-short * combinations for threadId and sequenceId values. - * */ - public void testOptmizationForByteShort() - { + @Test + public void testOptimizationForByteShort() { int expectedLength = 2 + 1 + 2; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_BYTE, ID_VALUE_SHORT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_BYTE, ID_VALUE_SHORT, expectedLength); - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_SHORT, ID_VALUE_BYTE, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_SHORT, ID_VALUE_BYTE, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for byte-int * combinations for threadId and sequenceId values. - * */ - public void testOptmizationForByteInt() - { + @Test + public void testOptimizationForByteInt() { int expectedLength = 2 + 1 + 4; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_BYTE, ID_VALUE_INT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_BYTE, ID_VALUE_INT, expectedLength); - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_INT, ID_VALUE_BYTE, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_INT, ID_VALUE_BYTE, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for byte-long * combinations for threadId and sequenceId values. - * */ - public void testOptmizationForByteLong() - { + @Test + public void testOptimizationForByteLong() { int expectedLength = 2 + 1 + 8; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_BYTE, ID_VALUE_LONG, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_BYTE, ID_VALUE_LONG, expectedLength); - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_LONG, ID_VALUE_BYTE, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_LONG, ID_VALUE_BYTE, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for short-int * combinations for threadId and sequenceId values. - * */ - public void testOptmizationForShortInt() - { + @Test + public void testOptimizationForShortInt() { int expectedLength = 2 + 2 + 4; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_SHORT, ID_VALUE_INT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_SHORT, ID_VALUE_INT, expectedLength); - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_INT, ID_VALUE_SHORT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_INT, ID_VALUE_SHORT, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for short-long * combinations for threadId and sequenceId values. - * */ - public void testOptmizationForShortLong() - { + @Test + public void testOptimizationForShortLong() { int expectedLength = 2 + 2 + 8; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_SHORT, ID_VALUE_LONG, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_SHORT, ID_VALUE_LONG, expectedLength); - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_LONG, ID_VALUE_SHORT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_LONG, ID_VALUE_SHORT, expectedLength); } /** - * Tests the eventId optmization APIs + * Tests the eventId optimization APIs * EventID#getOptimizedByteArrayForEventID and * EventID#readEventIdPartsFromOptmizedByteArray for int-long * combinations for threadId and sequenceId values. - * */ - public void testOptmizationForIntLong() - { + @Test + public void testOptimizationForIntLong() { int expectedLength = 2 + 4 + 8; - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_INT, ID_VALUE_LONG, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_INT, ID_VALUE_LONG, expectedLength); - writeReadAndVerifyOpmitizedByteArray(ID_VALUE_LONG, ID_VALUE_INT, + writeReadAndVerifyOptimizedByteArray(ID_VALUE_LONG, ID_VALUE_INT, expectedLength); } @@ -229,9 +208,7 @@ public class EventIdOptimizationJUnitTest extends TestCase * @param expectedArrayLength * expected length of the optimized byte-array */ - private void writeReadAndVerifyOpmitizedByteArray(long threadId, - long sequenceId, int expectedArrayLength) - { + private void writeReadAndVerifyOptimizedByteArray(long threadId, long sequenceId, int expectedArrayLength) { byte[] array = EventID .getOptimizedByteArrayForEventID(threadId, sequenceId); assertEquals("optimized byte-array length not as expected", http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAGIIDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAGIIDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAGIIDUnitTest.java index c7497c3..ba1cd61 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAGIIDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAGIIDUnitTest.java @@ -314,7 +314,7 @@ public class HAGIIDUnitTest extends DistributedTestCase return null; } }; - // assertEquals( "key-1",r.getEntry("key-1").getValue()); + // assertIndexDetailsEquals( "key-1",r.getEntry("key-1").getValue()); // wait until we // have a dead // server @@ -327,7 +327,7 @@ public class HAGIIDUnitTest extends DistributedTestCase } }; Wait.waitForCriterion(ev, 60 * 1000, 200, true); - // assertEquals( "key-2",r.getEntry("key-2").getValue()); + // assertIndexDetailsEquals( "key-2",r.getEntry("key-2").getValue()); // wait until we // have a dead @@ -341,7 +341,7 @@ public class HAGIIDUnitTest extends DistributedTestCase } }; Wait.waitForCriterion(ev, 60 * 1000, 200, true); - // assertEquals( "key-3",r.getEntry("key-3").getValue()); + // assertIndexDetailsEquals( "key-3",r.getEntry("key-3").getValue()); } catch (Exception ex) { Assert.fail("failed while verifyEntries()", ex); @@ -414,7 +414,7 @@ public class HAGIIDUnitTest extends DistributedTestCase } }; Wait.waitForCriterion(ev, 60 * 1000, 200, true); - // assertEquals( "key-2",r.getEntry("key-2").getValue()); + // assertIndexDetailsEquals( "key-2",r.getEntry("key-2").getValue()); // wait until @@ -431,8 +431,8 @@ public class HAGIIDUnitTest extends DistributedTestCase Wait.waitForCriterion(ev, 60 * 1000, 200, true); /* - * assertEquals( "value-1",r.getEntry("key-1").getValue()); assertEquals( - * "value-2",r.getEntry("key-2").getValue()); assertEquals( + * assertIndexDetailsEquals( "value-1",r.getEntry("key-1").getValue()); assertIndexDetailsEquals( + * "value-2",r.getEntry("key-2").getValue()); assertIndexDetailsEquals( * "value-3",r.getEntry("key-3").getValue()); */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARQAddOperationJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARQAddOperationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARQAddOperationJUnitTest.java index 00a906c..1c7b0d0 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARQAddOperationJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARQAddOperationJUnitTest.java @@ -788,7 +788,7 @@ public class HARQAddOperationJUnitTest regionqueue.remove(); for (int i = 0; i < numOfThreads; i++) { - // assertEquals(numOfPuts, + // assertIndexDetailsEquals(numOfPuts, // regionqueue.getLastDispatchedSequenceId(new EventID( // new byte[] { (byte)i }, i, 1))); assertEquals(0, regionqueue.getCurrentCounterSet( http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueDUnitTest.java index 83919f4..ea1ed4a 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueDUnitTest.java @@ -1095,7 +1095,7 @@ public class HARegionQueueDUnitTest extends DistributedTestCase { } }; Wait.waitForCriterion(ev, 60 * 1000, 200, true); - // assertEquals(0, hrq.getAvalaibleIds().size()); + // assertIndexDetailsEquals(0, hrq.getAvalaibleIds().size()); } public void testForDuplicateEvents() http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/ThreadIdentifierJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/ThreadIdentifierJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/ThreadIdentifierJUnitTest.java index 9e280fc..66ee622 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/ThreadIdentifierJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/ThreadIdentifierJUnitTest.java @@ -16,6 +16,9 @@ */ package com.gemstone.gemfire.internal.cache.ha; +import static org.junit.Assert.*; + +import org.junit.Test; import org.junit.experimental.categories.Category; import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier.WanType; @@ -24,8 +27,9 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest; import junit.framework.TestCase; @Category(UnitTest.class) -public class ThreadIdentifierJUnitTest extends TestCase { +public class ThreadIdentifierJUnitTest { + @Test public void testPutAllId() { int id = 42; int bucketNumber = 113; @@ -35,7 +39,8 @@ public class ThreadIdentifierJUnitTest extends TestCase { assertTrue(ThreadIdentifier.isPutAllFakeThreadID(putAll)); assertEquals(42, ThreadIdentifier.getRealThreadID(putAll)); } - + + @Test public void testWanId() { int id = 42; @@ -69,7 +74,8 @@ public class ThreadIdentifierJUnitTest extends TestCase { assertTrue(WanType.PARALLEL.matches(real_tid_with_wan)); } } - + + @Test public void testWanAndPutAllId() { int id = 42; int bucketNumber = 113; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java index 867c214..8f556dc 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java @@ -672,7 +672,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase { // if (this.lockGrantor == null) { // this.lockGrantor = id; // } else { -// assertEquals("assertGrantorIsConsistent failed", lockGrantor, id); +// assertIndexDetailsEquals("assertGrantorIsConsistent failed", lockGrantor, id); // } // } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java index 39bb5ea..e08a268 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java @@ -16,11 +16,11 @@ */ package com.gemstone.gemfire.internal.cache.partitioned; +import static org.junit.Assert.*; import static org.mockito.Mockito.*; import java.io.IOException; -import org.apache.logging.log4j.Logger; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -34,16 +34,13 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion; import com.gemstone.gemfire.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesReplyMessage; import com.gemstone.gemfire.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesResponse; import com.gemstone.gemfire.internal.cache.versions.VersionTag; -import com.gemstone.gemfire.internal.logging.LogService; import com.gemstone.gemfire.test.fake.Fakes; import com.gemstone.gemfire.test.junit.categories.UnitTest; -import junit.framework.TestCase; - @Category(UnitTest.class) -public class FetchEntriesMessageJUnitTest extends TestCase { - protected static final Logger logger = LogService.getLogger(); - GemFireCacheImpl cache; +public class FetchEntriesMessageJUnitTest { + + private GemFireCacheImpl cache; private VersionTag createVersionTag(boolean validVersionTag) throws ClassNotFoundException, IOException { VersionTag tag = VersionTag.create(cache.getMyId()); @@ -72,7 +69,7 @@ public class FetchEntriesMessageJUnitTest extends TestCase { } @Test - public void testProcessChunk() throws IOException, ClassNotFoundException { + public void testProcessChunk() throws Exception { cache = Fakes.cache(); PartitionedRegion pr = mock(PartitionedRegion.class); InternalDistributedSystem system = cache.getDistributedSystem(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/OfflineMembersDetailsJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/OfflineMembersDetailsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/OfflineMembersDetailsJUnitTest.java index b752d9c..9710c63 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/OfflineMembersDetailsJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/OfflineMembersDetailsJUnitTest.java @@ -25,20 +25,17 @@ import java.net.InetAddress; import java.util.HashSet; import java.util.Set; +import org.junit.Test; import org.junit.experimental.categories.Category; -import junit.framework.TestCase; - import com.gemstone.gemfire.internal.cache.persistence.DiskStoreID; import com.gemstone.gemfire.internal.cache.persistence.PersistentMemberID; import com.gemstone.gemfire.test.junit.categories.UnitTest; -/** - * - */ @Category(UnitTest.class) -public class OfflineMembersDetailsJUnitTest extends TestCase { - +public class OfflineMembersDetailsJUnitTest { + + @Test public void testSerialization() throws Exception { Set[] offlineMembers = new Set[5]; for(int i =0; i < offlineMembers.length; i++) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoadModelJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoadModelJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoadModelJUnitTest.java index 35e48bc..97a5fd8 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoadModelJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoadModelJUnitTest.java @@ -42,7 +42,6 @@ import org.junit.experimental.categories.Category; import com.gemstone.gemfire.DataSerializer; import com.gemstone.gemfire.cache.partition.PartitionMemberInfo; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; -import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes; import com.gemstone.gemfire.internal.cache.partitioned.rebalance.BucketOperator.Completion; import com.gemstone.gemfire.internal.cache.partitioned.rebalance.CompositeDirector; import com.gemstone.gemfire.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel; @@ -52,12 +51,9 @@ import com.gemstone.gemfire.internal.cache.partitioned.rebalance.SimulatedBucket import com.gemstone.gemfire.internal.cache.persistence.PersistentMemberID; import com.gemstone.gemfire.test.junit.categories.UnitTest; -/** - * - */ -@SuppressWarnings("synthetic-access") @Category(UnitTest.class) public class PartitionedRegionLoadModelJUnitTest { + private static final int MAX_MOVES = 5000; private static final boolean DEBUG = true; @@ -72,7 +68,6 @@ public class PartitionedRegionLoadModelJUnitTest { * This test checks basic redundancy satisfaction. It creates two * buckets with low redundancy and 1 bucket with full redundancy and excepts * copies of the low redundancy buckets to be made. - * @throws Exception */ @Test public void testRedundancySatisfaction() throws Exception { @@ -106,7 +101,6 @@ public class PartitionedRegionLoadModelJUnitTest { * This test creates buckets with low redundancy, but only 1 of the buckets * is small enough to be copied. The other bucket should be rejected because * it is too big.. - * @throws Exception */ @Test public void testRedundancySatisfactionWithSizeLimit() throws Exception { @@ -152,7 +146,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * This test makes sure we ignore the size limit if requested - * @throws Exception */ @Test public void testRedundancySatisfactionDoNotEnforceLocalMaxMemory() throws Exception { @@ -188,7 +181,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Tests to make sure that redundancy satisfaction prefers to * make redundant copies on members with remote IP addresses. - * @throws Exception */ @Test public void testRedundancySatisfactionPreferRemoteIp() throws Exception { @@ -256,7 +248,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Tests to make sure that redundancy satisfaction balances * between nodes to ensure an even load. - * @throws Exception */ @Test public void testRedundancySatisfactionBalanced() throws Exception { @@ -286,7 +277,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Tests to make sure that redundancy satisfaction balances * between nodes to ensure an even load. - * @throws Exception */ @Test public void testColocatedRegions() throws Exception { @@ -367,7 +357,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test that we enforce local max memory on a per region basis * IE if one of the regions has a low lmm, it will prevent a bucket move - * @throws Exception */ @Test public void testColocationEnforceLocalMaxMemory() throws Exception { @@ -404,7 +393,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test that each region indivually honors it's enforce local max * memory flag. - * @throws Exception */ @Test public void testColocationIgnoreEnforceLocalMaxMemory() throws Exception { @@ -444,8 +432,7 @@ public class PartitionedRegionLoadModelJUnitTest { * Test which illustrates the problem with our greedy algorithm. It doesn't * necessarily end up with a balanced result. * - * TODO rebalance - change this test of fix the algorithm? - * @throws Exception + * TODO rebalance - change this test or fix the algorithm? */ @Ignore @Test @@ -471,13 +458,13 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Tests to make sure that redundancy satisfaction balances * between nodes to ensure an even load. - * @throws Exception */ @Test public void testRedundancySatisfactionWithFailures() throws Exception { InternalDistributedMember member1 = new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 1); final InternalDistributedMember member2 = new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 2); InternalDistributedMember member3 = new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 3); + MyBucketOperator op = new MyBucketOperator() { @Override public void createRedundantBucket( @@ -489,7 +476,6 @@ public class PartitionedRegionLoadModelJUnitTest { super.createRedundantBucket(targetMember, i, colocatedRegionBytes, completion); } } - }; PartitionedRegionLoadModel model = new PartitionedRegionLoadModel(op ,1, 4, getAddressComparor(false), Collections.emptySet(), null); @@ -516,7 +502,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test that redundancy satisfation can handle asynchronous failures * and complete the job correctly. - * @throws Exception */ @Test public void testRedundancySatisfactionWithAsyncFailures() throws Exception { @@ -568,7 +553,6 @@ public class PartitionedRegionLoadModelJUnitTest { * Very basic test of moving primaries. Creates two nodes and four buckets, with a copy * of each bucket on both nodes. All of the primaries are on one node. It expects half the * primaries to move to the other node. - * @throws Exception */ @Test public void testMovePrimaries() throws Exception { @@ -596,7 +580,6 @@ public class PartitionedRegionLoadModelJUnitTest { * Test that we can move primaries if failures occur during the move. * In this case member2 is bad, so primaries should move * to member3 instead. - * @throws Exception */ @Test public void testMovePrimariesWithFailures() throws Exception { @@ -636,7 +619,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test of moving primaries when nodes are weighted relative to each other - * @throws Exception */ @Test public void testMovePrimariesWithWeights() throws Exception { @@ -676,9 +658,6 @@ public class PartitionedRegionLoadModelJUnitTest { * Member1 P P P P P P X X X * Member2 R R R R R R P P R * Member3 X X X X X X R R P - * - * - * @throws Exception */ @Test public void testPrimaryShuffle() throws Exception { @@ -710,7 +689,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test a case where we seem to get into an infinite loop while balancing primaries. - * @throws Exception */ @Test public void testBug39953() throws Exception { @@ -740,7 +718,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Very basic test of moving buckets. Creates two nodes and four buckets, with buckets only on one node. Half of the buckets should move to the other node. - * @throws Exception */ @Test public void testMoveBuckets() throws Exception { @@ -768,15 +745,14 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test that moving buckets will work if there are failures while moving buckets * member2 refuses the buckets, so the buckets should move to member3 - * @throws Exception */ @Test public void testMoveBucketsWithFailures() throws Exception { InternalDistributedMember member1 = new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 1); final InternalDistributedMember member2 = new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 2); InternalDistributedMember member3 = new InternalDistributedMember(InetAddress.getByName("127.0.0.1"), 3); + MyBucketOperator op = new MyBucketOperator() { - @Override public boolean moveBucket(InternalDistributedMember source, InternalDistributedMember target, int id, @@ -787,6 +763,7 @@ public class PartitionedRegionLoadModelJUnitTest { return super.moveBucket(source, target, id, colocatedRegionBytes); } }; + PartitionedRegionLoadModel model = new PartitionedRegionLoadModel(op ,0, 4, getAddressComparor(false), Collections.emptySet(), null); //Create some imbalanced nodes PartitionMemberInfoImpl details1 = buildDetails(member1, 500, 500, new long[] {1,1,1,1}, new long[] {1,1,1,1}); @@ -810,7 +787,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test to make sure that we honor the weight * of a node while moving buckets. - * @throws Exception */ @Test public void testMoveBucketsWithWeights() throws Exception { @@ -841,7 +817,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test to make sure we honor the size of buckets when * choosing which buckets to move. - * @throws Exception */ @Test public void testMoveBucketsWithSizes() throws Exception { @@ -872,7 +847,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test to move buckets with redundancy. * Makes sure that buckets and primaries are balanced - * @throws Exception */ @Test public void testMoveBucketsWithRedundancy() throws Exception { @@ -914,7 +888,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test to move buckets with some large buckets (to make sure there are no issues with buffer overflow); * Makes sure that buckets and primaries are balanced - * @throws Exception */ @Test public void testMoveLargeBucketsWithRedundancy() throws Exception { @@ -958,7 +931,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test to make sure that moving buckets * honors size restrictions for VMs. - * @throws Exception */ @Test public void testMoveBucketsWithSizeLimits() throws Exception { @@ -995,7 +967,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test to make sure that moving buckets * honors size critical members - * @throws Exception */ @Test public void testMoveBucketsWithCriticalMember() throws Exception { @@ -1025,7 +996,8 @@ public class PartitionedRegionLoadModelJUnitTest { assertEquals(expectedMoves, new HashSet(bucketOperator.bucketMoves)); } - /** Test to make sure two runs with the same information + /** + * Test to make sure two runs with the same information * perform the same moves. */ @Test @@ -1069,9 +1041,9 @@ public class PartitionedRegionLoadModelJUnitTest { /** * This is more of a simulation than a test */ - @Ignore + @Ignore("not a real test") @Test - public void z_testRandom() throws Exception { + public void testRandom() throws Exception { long seed = System.nanoTime(); System.out.println("random seed=" + seed); try { @@ -1130,7 +1102,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * This test makes sure that we rebalance correctly * with multiple levels of colocation. See bug #40943 - * @throws Exception */ @Test public void testManyColocatedRegions() throws Exception { @@ -1163,7 +1134,6 @@ public class PartitionedRegionLoadModelJUnitTest { /** * Test to make sure than redundancy satisfaction ignores offline members - * @throws Exception */ @Test public void testRedundancySatisficationWithOfflineMembers() throws Exception { @@ -1173,9 +1143,7 @@ public class PartitionedRegionLoadModelJUnitTest { PartitionMemberInfoImpl details1 = buildDetails(member1, 200, 200, new long[] {30,0,28,30,23}, new long[] {1,0,1,1,1}); PartitionMemberInfoImpl details2 = buildDetails(member2, 200, 200, new long[] {0,23,0,0,0}, new long[] {0,1,0,0,0}); - - - + //Two buckets have an offline members Set o = Collections.singleton(new PersistentMemberID()); Set x = Collections.emptySet(); @@ -1201,8 +1169,6 @@ public class PartitionedRegionLoadModelJUnitTest { PartitionMemberInfoImpl details1 = buildDetails(member1, 480, 480, new long[] {1,1,1,1,1,1}, new long[] {1,1,1,1,1,1}); PartitionMemberInfoImpl details2 = buildDetails(member2, 480, 480, new long[] {0,0,0,0,0,0}, new long[] {0,0,0,0,0,0}); - - //Each bucket has an offline member Set o = Collections.singleton(new PersistentMemberID()); Set x = Collections.emptySet(); @@ -1282,20 +1248,24 @@ public class PartitionedRegionLoadModelJUnitTest { private static AddressComparor getAddressComparor(final boolean enforceUniqueZones) { return new AddressComparor() { + + @Override public boolean areSameZone(InternalDistributedMember member1, InternalDistributedMember member2) { return member1.getInetAddress().equals(member2.getInetAddress()); } + @Override public boolean enforceUniqueZones() { return enforceUniqueZones; } }; } - public static class Create { - public final InternalDistributedMember targetMember; - public final int bucketId; + private static class Create { + + private final InternalDistributedMember targetMember; + private final int bucketId; public Create(InternalDistributedMember targetMember, int bucketId) { this.targetMember = targetMember; @@ -1336,15 +1306,17 @@ public class PartitionedRegionLoadModelJUnitTest { return false; return true; } - + + @Override public String toString() { return "Create[member=" + targetMember+",bucketId=" + bucketId +"]"; } } - public static class Remove { - public final InternalDistributedMember targetMember; - public final int bucketId; + private static class Remove { + + private final InternalDistributedMember targetMember; + private final int bucketId; public Remove(InternalDistributedMember targetMember, int bucketId) { this.targetMember = targetMember; @@ -1385,21 +1357,24 @@ public class PartitionedRegionLoadModelJUnitTest { return false; return true; } - + + @Override public String toString() { return "Remove[member=" + targetMember+",bucketId=" + bucketId +"]"; } } - public static class Move { - public final InternalDistributedMember sourceMember; - public final InternalDistributedMember targetMember; + private static class Move { + + private final InternalDistributedMember sourceMember; + private final InternalDistributedMember targetMember; public Move(InternalDistributedMember sourceMember, InternalDistributedMember targetMember) { this.sourceMember = sourceMember; this.targetMember = targetMember; } + @Override public int hashCode() { final int prime = 31; @@ -1410,6 +1385,7 @@ public class PartitionedRegionLoadModelJUnitTest { + ((this.targetMember == null) ? 0 : this.targetMember.hashCode()); return result; } + @Override public boolean equals(Object obj) { if (this == obj) @@ -1431,19 +1407,20 @@ public class PartitionedRegionLoadModelJUnitTest { return false; return true; } - + + @Override public String toString() { return "Move[source=" + sourceMember+",target=" + targetMember + "]"; } } - public static class MyBucketOperator extends SimulatedBucketOperator { - public List creates = new ArrayList(); - public List removes = new ArrayList(); - public List primaryMoves = new ArrayList(); - public List bucketMoves = new ArrayList(); + private static class MyBucketOperator extends SimulatedBucketOperator { + + private List creates = new ArrayList(); + private List removes = new ArrayList(); + private List primaryMoves = new ArrayList(); + private List bucketMoves = new ArrayList(); private MoveType lastMove = null; - @Override public void createRedundantBucket( @@ -1489,18 +1466,18 @@ public class PartitionedRegionLoadModelJUnitTest { lastMove = MoveType.REMOVE; return true; } - - } - public static class BucketOperatorWithFailures extends MyBucketOperator { - List pendingSuccesses = new ArrayList(); - List pendingFailures = new ArrayList(); - Set badMembers = new HashSet (); + private static class BucketOperatorWithFailures extends MyBucketOperator { + + private List pendingSuccesses = new ArrayList(); + private List pendingFailures = new ArrayList(); + private Set badMembers = new HashSet (); public void addBadMember(InternalDistributedMember member) { this.badMembers.add(member); } + @Override public void createRedundantBucket(InternalDistributedMember targetMember, int i, Map colocatedRegionBytes, Completion completion) { @@ -1508,6 +1485,7 @@ public class PartitionedRegionLoadModelJUnitTest { pendingFailures.add(completion); } else { super.createRedundantBucket(targetMember, i, colocatedRegionBytes, new Completion() { + @Override public void onSuccess() { } @@ -1518,11 +1496,11 @@ public class PartitionedRegionLoadModelJUnitTest { }); pendingSuccesses.add(completion); -; } + } } } - private static enum MoveType { + private enum MoveType { CREATE, MOVE_PRIMARY, MOVE_BUCKET, @@ -1541,15 +1519,18 @@ public class PartitionedRegionLoadModelJUnitTest { this.offlineMembers = offlineMembers; } + @Override public Set getOfflineMembers(int bucketId) { return this.offlineMembers; } + @Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { offlineMembers = DataSerializer.readObject(in); } + @Override public void toData(DataOutput out) throws IOException { DataSerializer.writeObject(offlineMembers, out);