You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/06/09 20:14:56 UTC
[28/70] [abbrv] [partial] incubator-geode git commit: GEODE-837:
update tests from JUnit3 to JUnit4
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDestroyDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDestroyDUnitTest.java
index abfb7d2..d0b5832 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDestroyDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDestroyDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.Iterator;
import com.gemstone.gemfire.cache.AttributesFactory;
@@ -43,14 +52,15 @@ import com.gemstone.gemfire.test.dunit.Wait;
*
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionDestroyDUnitTest extends
PartitionedRegionDUnitTestCase
{
//////constructor //////////
- public PartitionedRegionDestroyDUnitTest(String name) {
+ public PartitionedRegionDestroyDUnitTest() {
- super(name);
+ super();
}//end of constructor
public static final String PR_PREFIX = "PR";
@@ -61,6 +71,7 @@ public class PartitionedRegionDestroyDUnitTest extends
VM vm0, vm1,vm2,vm3;
+ @Test
public void testDestroyRegion() throws Exception, Throwable
{
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/PartitionedRegionEntryCountDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEntryCountDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEntryCountDUnitTest.java
index 0f0583f..ff5413c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEntryCountDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEntryCountDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.EvictionAction;
@@ -34,13 +43,11 @@ import com.gemstone.gemfire.test.dunit.VM;
*
*
*/
-public class PartitionedRegionEntryCountDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionEntryCountDUnitTest extends JUnit4CacheTestCase {
private static final long serialVersionUID = 19808034671087558L;
- public PartitionedRegionEntryCountDUnitTest(final String name) {
- super(name);
- }
-
+ @Test
public void testTotalEntryCountAfterLocalDestroyEviction() {
final Host host = Host.getHost(0);
final VM vm1 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEvictionDUnitTest.java
index 4e36ea8..c960332 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEvictionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionEvictionDUnitTest.java
@@ -16,30 +16,55 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.InterestPolicy;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.SubscriptionAttributes;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.cache.util.ObjectSizerImpl;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.cache.control.HeapMemoryMonitor;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
import com.gemstone.gemfire.internal.cache.lru.HeapLRUCapacityController;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
- public PartitionedRegionEvictionDUnitTest(final String name) {
- super(name);
- }
-
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class PartitionedRegionEvictionDUnitTest extends JUnit4CacheTestCase {
+
+ @Test
public void testHeapLRUWithOverflowToDisk() {
final Host host = Host.getHost(0);
final VM vm2 = host.getVM(2);
@@ -186,6 +211,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "memoryEventTolerance");
}
+ @Test
public void testHeapLRUWithLocalDestroy() {
final Host host = Host.getHost(0);
final VM vm2 = host.getVM(2);
@@ -305,6 +331,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
assertEquals((3 * bucketsToCreate * (redundantCopies + 1)), totalEvicted);
}
+ @Test
public void testMemoryLRUWithOverflowToDisk() {
final Host host = Host.getHost(0);
final VM vm2 = host.getVM(2);
@@ -413,6 +440,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testMemoryLRUWithLocalDestroy() {
final Host host = Host.getHost(0);
final VM vm2 = host.getVM(2);
@@ -491,6 +519,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
assertTrue(2 *extraEntries<= totalEvicted);
}
+ @Test
public void testEntryLRUWithOverflowToDisk() {
final Host host = Host.getHost(0);
final VM vm2 = host.getVM(2);
@@ -583,6 +612,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
public boolean verify(long expectedEvictions) { return false; }
};
+ @Test
public void testEntryLRUWithLocalDestroy() {
final Host host = Host.getHost(0);
final VM vm2 = host.getVM(2);
@@ -719,6 +749,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
}
// Test to validate the Eviction Attribute : LRU Check
+ @Test
public void testEvictionValidationForLRUEntry() {
final Host host = Host.getHost(0);
final VM testAccessor = host.getVM(1);
@@ -863,6 +894,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
}
// Test to validate the Eviction Attribute : LRU Action
+ @Test
public void testEvictionValidationForLRUAction() {
final Host host = Host.getHost(0);
final VM testDatastore = host.getVM(2);
@@ -953,6 +985,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
}
// Test to validate the Eviction Attribute : LRU Maximum
+ @Test
public void testEvictionValidationForLRUMaximum() {
final Host host = Host.getHost(0);
final VM testDatastore = host.getVM(2);
@@ -1000,6 +1033,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
}
// Test to validate the Eviction Attribute for LRUHeap
+ @Test
public void testEvictionValidationForLRUHeap() {
final Host host = Host.getHost(0);
final VM testDatastore = host.getVM(2);
@@ -1122,6 +1156,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
}
// Test to validate an accessor can set the initial attributes
+ @Test
public void testEvictionValidationWhenInitializedByAccessor() {
final Host host = Host.getHost(0);
final VM testDatastore = host.getVM(2);
@@ -1173,6 +1208,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
}
// Test to validate the Eviction Attribute : HeapLRU Interval
+ @Test
public void testEvictionValidationForLRUMemory() {
final Host host = Host.getHost(0);
final VM firstDatastore = host.getVM(1);
@@ -1416,6 +1452,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
}
+ @Test
public void testEvictionValidationForLRUEntry_AccessorFirst() {
final Host host = Host.getHost(0);
final VM firstAccessor = host.getVM(0);
@@ -1491,6 +1528,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
testDatastore.invoke(createSecondDataStore);
}
+ @Test
public void testEvictionValidationForLRUEntry_DatastoreFirst() {
final Host host = Host.getHost(0);
final VM firstAccessor = host.getVM(0);
@@ -1566,6 +1604,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
testAccessor.invoke(createSecondAccessor);
}
+ @Test
public void testEvictionValidationForLRUEntry_TwoAccessors() {
final Host host = Host.getHost(0);
final VM firstAccessor = host.getVM(0);
@@ -1644,6 +1683,7 @@ public class PartitionedRegionEvictionDUnitTest extends CacheTestCase {
* Test that gets do not need to acquire a lock on the region
* entry when LRU is enabled. This is bug 42265
*/
+ @Test
public void testEntryLRUDeadlock() {
final Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHADUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHADUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHADUnitTest.java
index 1676177..3621a4a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHADUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHADUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Properties;
@@ -48,13 +57,14 @@ import com.gemstone.gemfire.test.dunit.VM;
/**
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionHADUnitTest extends PartitionedRegionDUnitTestCase
{
//////constructor //////////
- public PartitionedRegionHADUnitTest(String name) {
+ public PartitionedRegionHADUnitTest() {
- super(name);
+ super();
}//end of constructor
public static final String PR_PREFIX = "PR";
@@ -72,6 +82,7 @@ public class PartitionedRegionHADUnitTest extends PartitionedRegionDUnitTestCase
* of sequential cache.close() events.
* @throws Exception
*/
+ @Test
public void testBucketFailOverDuringCacheClose() throws Exception {
final String regionName = getUniqueName();
@@ -184,6 +195,7 @@ public class PartitionedRegionHADUnitTest extends PartitionedRegionDUnitTestCase
}
//////////test methods ////////////////
+ @Test
public void testGrabBackupBuckets() throws Throwable
{
@@ -390,6 +402,7 @@ public class PartitionedRegionHADUnitTest extends PartitionedRegionDUnitTestCase
* @see PartitionedRegionSingleNodeOperationsJUnitTest#test018BucketScope()
* @throws Exception
*/
+ @Test
public void testBucketsScope() throws Exception
{
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
index f024ebb..ad88b90 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -51,6 +60,7 @@ import com.gemstone.gemfire.test.dunit.VM;
* cleanup for multiple failed nodes.</br>
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends
PartitionedRegionDUnitTestCase
{
@@ -63,9 +73,9 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends
*
* @param name
*/
- public PartitionedRegionHAFailureAndRecoveryDUnitTest(String name) {
+ public PartitionedRegionHAFailureAndRecoveryDUnitTest() {
- super(name);
+ super();
}
/**
@@ -78,6 +88,7 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends
* (5) Validate Failed node's bucket2Node Region metadata. </br>
*/
+ @Test
public void testMetaDataCleanupOnSinglePRNodeFail() throws Throwable
{
// create the VM's
@@ -187,6 +198,7 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends
* (4) Validate all Failed node's config metadata </br> <br>
* (5) Validate all Failed node's bucket2Node Region metadata. </br>
*/
+ @Test
public void testMetaDataCleanupOnMultiplePRNodeFail() throws Throwable
{
// create the VM's
@@ -412,6 +424,7 @@ public class PartitionedRegionHAFailureAndRecoveryDUnitTest extends
* Test for peer recovery of buckets when a member is removed from the distributed system
* @throws Throwable
*/
+ @Test
public void testRecoveryOfSingleMemberFailure() throws Throwable
{
final String uniqName = getUniqueName();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionInvalidateDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionInvalidateDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionInvalidateDUnitTest.java
index 6cd4f6a..364a4ee 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionInvalidateDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionInvalidateDUnitTest.java
@@ -19,6 +19,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheWriterException;
import com.gemstone.gemfire.cache.EntryEvent;
@@ -36,11 +45,11 @@ import com.gemstone.gemfire.test.dunit.VM;
* This tests invalidateRegion functionality on partitioned regions
*
*/
-public class PartitionedRegionInvalidateDUnitTest extends
- CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionInvalidateDUnitTest extends JUnit4CacheTestCase {
- public PartitionedRegionInvalidateDUnitTest(String name) {
- super(name);
+ public PartitionedRegionInvalidateDUnitTest() {
+ super();
}
void createRegion(String name, boolean accessor, int redundantCopies) {
@@ -51,6 +60,7 @@ public class PartitionedRegionInvalidateDUnitTest extends
getCache().createRegion(name, af.create());
}
+ @Test
public void testSingleVMInvalidate() {
Host host = Host.getHost(0);
VM vm = host.getVM(0);
@@ -85,6 +95,7 @@ public class PartitionedRegionInvalidateDUnitTest extends
});
}
+ @Test
public void testMultiVMInvalidate() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryDUnitTest.java
index d6693de..43401af 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryDUnitTest.java
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -25,6 +26,9 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.cache.Cache;
@@ -37,15 +41,14 @@ import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* This class is to test localMaxMemory property of partition region while
* creation of bucket.
- *
*/
-public class PartitionedRegionLocalMaxMemoryDUnitTest extends
- PartitionedRegionDUnitTestCase
-{
+@Category(DistributedTest.class)
+public class PartitionedRegionLocalMaxMemoryDUnitTest extends PartitionedRegionDUnitTestCase {
/** Prefix is used in name of Partition Region */
private static String prPrefix = null;
@@ -59,10 +62,6 @@ public class PartitionedRegionLocalMaxMemoryDUnitTest extends
/** to store references of 4 vms */
VM vm[] = new VM[4];
- public PartitionedRegionLocalMaxMemoryDUnitTest(String name) {
- super(name);
- }
-
/**
* This test performs following operations
* <br>1.Create Partition region with localMaxMemory
@@ -73,6 +72,7 @@ public class PartitionedRegionLocalMaxMemoryDUnitTest extends
* <br>4.Test should throw PartitionedRegionStorageException
* when it tries to create new bucket</br>
*/
+ @Test
public void testLocalMaxMemoryInPartitionedRegion()
{
Host host = Host.getHost(0);
@@ -107,6 +107,7 @@ public class PartitionedRegionLocalMaxMemoryDUnitTest extends
* This test makes sure that we don't enforce the localMaxMemory setting
* when eviction is enabled.
*/
+ @Test
public void testLocalMaxMemoryInPartitionedRegionWithEviction()
{
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/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
index e0a87b0..d43e87d 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
@@ -16,15 +16,18 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.EvictionAttributes;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests PartitionedRegion localMaxMemory with Off-Heap memory.
@@ -32,12 +35,9 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
* @since Geode 1.0
*/
@SuppressWarnings({ "deprecation", "serial" })
+@Category(DistributedTest.class)
public class PartitionedRegionLocalMaxMemoryOffHeapDUnitTest extends PartitionedRegionLocalMaxMemoryDUnitTest {
- public PartitionedRegionLocalMaxMemoryOffHeapDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void preTearDownAssertions() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionMultipleDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionMultipleDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionMultipleDUnitTest.java
index aca9ff1..6ed7dcf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionMultipleDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionMultipleDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.Region;
@@ -32,6 +41,7 @@ import com.gemstone.gemfire.test.dunit.VM;
*
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionMultipleDUnitTest extends
PartitionedRegionDUnitTestCase
{
@@ -61,8 +71,8 @@ public class PartitionedRegionMultipleDUnitTest extends
int localMaxMemory = 200;
/** constructor */
- public PartitionedRegionMultipleDUnitTest(String name) {
- super(name);
+ public PartitionedRegionMultipleDUnitTest() {
+ super();
}
/**
@@ -75,6 +85,7 @@ public class PartitionedRegionMultipleDUnitTest extends
* 4. Performs get() operations on all partitioned region and check the
* returned values.</br>
*/
+ @Test
public void testPartitionedRegionPutAndGet() throws Throwable
{
Host host = Host.getHost(0);
@@ -129,6 +140,7 @@ public class PartitionedRegionMultipleDUnitTest extends
* 4. Performs get() operations for destroyed keys on all partitioned region
* and checks the returned values is not null .</br>
*/
+ @Test
public void testPartitionedRegionDestroyKeys() throws Throwable
{
@@ -195,6 +207,7 @@ public class PartitionedRegionMultipleDUnitTest extends
* partitioned region from all the VM's</br><br>
* 4. Chekcs containsKey and ContainsValueForKey APIs</br>
*/
+ @Test
public void testPartitionedRegionDestroyAndContainsAPI() throws Throwable
{
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/PartitionedRegionOffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
index 0b6c259..40d4c49 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
@@ -16,23 +16,22 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
import com.gemstone.gemfire.internal.cache.control.OffHeapMemoryMonitor;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class PartitionedRegionOffHeapEvictionDUnitTest extends
- PartitionedRegionEvictionDUnitTest {
-
- public PartitionedRegionOffHeapEvictionDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class PartitionedRegionOffHeapEvictionDUnitTest extends PartitionedRegionEvictionDUnitTest {
@Override
public final void preTearDownAssertions() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionPRIDDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionPRIDDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionPRIDDUnitTest.java
index b24e660..a4b21a9 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionPRIDDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionPRIDDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -35,6 +44,7 @@ import com.gemstone.gemfire.test.dunit.VM;
* This class tests PRID generation in multiple partiton
* regions on 4 VMs
*/
+@Category(DistributedTest.class)
public class PartitionedRegionPRIDDUnitTest extends
PartitionedRegionDUnitTestCase
{
@@ -51,8 +61,8 @@ public class PartitionedRegionPRIDDUnitTest extends
/** to store references of 4 vms */
VM vm[] = new VM[4];
- public PartitionedRegionPRIDDUnitTest(String name) {
- super(name);
+ public PartitionedRegionPRIDDUnitTest() {
+ super();
}
/**
@@ -61,6 +71,7 @@ public class PartitionedRegionPRIDDUnitTest extends
* generation
*
*/
+ @Test
public void testPRIDGenerationInMultiplePartitionRegion() throws Exception
{
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/PartitionedRegionQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryDUnitTest.java
index 4c284da..1160d4b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionQueryDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.io.Serializable;
import java.sql.Date;
import java.util.Arrays;
@@ -69,18 +78,20 @@ import com.gemstone.gemfire.test.dunit.VM;
/**
*
*/
-public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionQueryDUnitTest extends JUnit4CacheTestCase {
/**
* @param name
*/
- public PartitionedRegionQueryDUnitTest(String name) {
- super(name);
+ public PartitionedRegionQueryDUnitTest() {
+ super();
// TODO Auto-generated constructor stub
}
private static final AtomicReference<RebalanceResults> rebalanceResults = new AtomicReference<RebalanceResults>();
+ @Test
public void testReevaluationDueToUpdateInProgress() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -148,6 +159,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* 3. While the query is executing, several buckets are
* moved.
*/
+ @Test
public void testRebalanceDuringQueryEvaluation() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -206,6 +218,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* 2. Buckets are moved
* 3. Check to make sure we don't have lingering bucket indexes with bucket regions already destroyed
*/
+ @Test
public void testRebalanceWithIndex() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -256,6 +269,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
/**
* tests trace for pr queries when <trace> is used and query verbose is set to true on local and remote servers
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOnBothServers() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -329,6 +343,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* tests trace for pr queries when <trace> is used and query verbose is set to true on local but false on remote servers
* All flags should be true still as the <trace> is OR'd with query verbose flag
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOnLocalServerOnly() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -400,6 +415,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* tests trace for pr queries when <trace> is NOT used and query verbose is set to true on local but false on remote
* The remote should not send a pr query trace info back because trace was not requested
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOffLocalServerVerboseOn() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -472,6 +488,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* We don't output the string or do anything on the local side, but we still pull off the object due to the remote server
* generating and sending it over
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOffRemoteServerOnly() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -544,6 +561,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* tests trace for pr queries when <trace> is used and query verbose is set to false on local and remote servers
* trace is OR'd so the entire trace process should be invoked
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOnRemoteServerOnly() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -617,6 +635,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* The local node still receives the pr trace info from the remote node due to query verbose being on
* however nothing is used on the local side
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOffRemoteServerOn() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -689,6 +708,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* tests trace for pr queries when <trace> is NOT used and query verbose is set to false on local and remote servers
* None of our hooks should have triggered
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOffQueryVerboseOff() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -760,6 +780,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
* tests trace for pr queries when <trace> is used and query verbose is set to false on local and remote servers
* All hooks should have triggered due to trace being used
*/
+ @Test
public void testPartitionRegionDebugMessageQueryTraceOnQueryVerboseOff() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -827,6 +848,7 @@ public class PartitionedRegionQueryDUnitTest extends CacheTestCase {
}
+ @Test
public void testOrderByOnPRWithReservedKeywords() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
index 1d06545..e6be8d4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
@@ -16,20 +16,30 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache30.CacheTestCase;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.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.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class PartitionedRegionRedundancyZoneDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionRedundancyZoneDUnitTest extends JUnit4CacheTestCase {
@Override
public final void postTearDownCacheTestCase() throws Exception {
@@ -40,15 +50,12 @@ public class PartitionedRegionRedundancyZoneDUnitTest extends CacheTestCase {
disconnectAllFromDS();
}
- public PartitionedRegionRedundancyZoneDUnitTest(String name) {
- super(name);
- }
-
/**
* Test that we don't try to put buckets in the same
* zone when we don't have enough zones.
*/
- public void testNotEnoughZones() throws Throwable {
+ @Test
+ public void testNotEnoughZones() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -80,10 +87,6 @@ public class PartitionedRegionRedundancyZoneDUnitTest extends CacheTestCase {
//buckets on vm0 or vm1. At that point we will add another bucket to that
//member to bring it's primary count up to two.
assertTrue(counts, vm0Count >= 2 && vm1Count >=2);
-
-// assertIndexDetailsEquals(counts, 3, vm0Count);
-// assertIndexDetailsEquals(counts, 3, vm1Count);
-// assertIndexDetailsEquals(counts, 6, vm2Count);
}
protected void checkBucketCount(VM vm0, final int numLocalBuckets) {
@@ -108,7 +111,7 @@ public class PartitionedRegionRedundancyZoneDUnitTest extends CacheTestCase {
});
}
- protected DistributedMember createPR(VM vm, int redundancy) throws Throwable {
+ protected DistributedMember createPR(VM vm, int redundancy) throws Exception {
SerializableCallable createPrRegion = new SerializableCallable("createRegion") {
public Object call()
{
@@ -135,27 +138,24 @@ public class PartitionedRegionRedundancyZoneDUnitTest extends CacheTestCase {
}
});
-
}
- protected void createData(VM vm, final int startKey, final int endKey,
- final String value) {
- createData(vm, startKey, endKey,value, "region1");
- }
+ protected void createData(VM vm, final int startKey, final int endKey, final String value) {
+ createData(vm, startKey, endKey,value, "region1");
+ }
+
+ protected void createData(VM vm, final int startKey, final int endKey, final String value, final String regionName) {
+ SerializableRunnable createData = new SerializableRunnable("createData") {
- protected void createData(VM vm, final int startKey, final int endKey,
- final String value, final String regionName) {
- SerializableRunnable createData = new SerializableRunnable("createData") {
-
- public void run() {
- Cache cache = getCache();
- Region region = cache.getRegion(regionName);
-
- for(int i =startKey; i < endKey; i++) {
- region.put(i, value);
- }
- }
- };
- vm.invoke(createData);
+ public void run() {
+ Cache cache = getCache();
+ Region region = cache.getRegion(regionName);
+
+ for(int i =startKey; i < endKey; i++) {
+ region.put(i, value);
+ }
}
+ };
+ vm.invoke(createData);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSerializableObjectJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSerializableObjectJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSerializableObjectJUnitTest.java
index 1b2205e..5a50487 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSerializableObjectJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSerializableObjectJUnitTest.java
@@ -23,51 +23,47 @@ package com.gemstone.gemfire.internal.cache;
*
*/
-import java.util.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
-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.cache.Region;
-import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import junit.framework.TestCase;
-
@Category(IntegrationTest.class)
-public class PartitionedRegionSerializableObjectJUnitTest
-{
- String regionName = "SerizableRegion";
+public class PartitionedRegionSerializableObjectJUnitTest {
+
+ private String regionName = "SerizableRegion";
/** It is common region for all the threads */
- Region root;
+ private Region root;
/**
* It is map to store thread name and list of objects which are created by
* that thread.
*/
- static Map thread2List = new HashMap();
+ private static Map thread2List = new HashMap();
- static int MAX_COUNT = 10;
+ private static int MAX_COUNT = 10;
- static int MAX_THREADS = 10;
+ private static int MAX_THREADS = 10;
/**
* This test creates a region and threads. This Region is common to all the
* threads which perform get, put operations on that region. Object used
* during these operations are serializable. key and value in the partition
* region are same.
- *
*/
@Test
- public void testOperationsWithSerializableObject()
- {
-
+ public void testOperationsWithSerializableObject() {
int localMaxMemory = 50;
Thread threadArr[] = new Thread[10];
root = PartitionedRegionTestHelper.createPartitionedRegion(regionName,
@@ -103,16 +99,15 @@ public class PartitionedRegionSerializableObjectJUnitTest
* This class creates thread that take list of the objects from thread2List
* Map and performs get operation with these objects as key and verifying
* result with itself because key and values are same in the partition Region
- *
*/
- public class getThread extends Thread
- {
+ private class getThread extends Thread {
+
getThread(String threadName) {
super(threadName);
}
- public void run()
- {
+ @Override
+ public void run() {
Region pr = PartitionedRegionTestHelper
.getExistingRegion(Region.SEPARATOR + regionName);
assertNotNull(pr);
@@ -141,17 +136,15 @@ public class PartitionedRegionSerializableObjectJUnitTest
* This class create threads that put the serializable objects in the partion
* region and also add the the list of the serializable objects to the
* thread2List map
- *
*/
+ private class putThread extends Thread {
- public class putThread extends Thread
- {
putThread(String threadName) {
super(threadName);
}
- public void run()
- {
+ @Override
+ public void run() {
Region pr = PartitionedRegionTestHelper
.getExistingRegion(Region.SEPARATOR + regionName);
assertNotNull(pr);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/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 18ca858..bf57a20 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
@@ -16,9 +16,41 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+
+import com.jayway.awaitility.Awaitility;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.DataSerializer;
-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.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+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.ClientMetadataService;
@@ -29,7 +61,6 @@ import com.gemstone.gemfire.cache.execute.FunctionService;
import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.ServerLocation;
@@ -39,26 +70,22 @@ import com.gemstone.gemfire.internal.cache.execute.data.CustId;
import com.gemstone.gemfire.internal.cache.execute.data.OrderId;
import com.gemstone.gemfire.internal.cache.execute.data.ShipmentId;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.jayway.awaitility.Awaitility;
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
-
- private static final long serialVersionUID = 1L;
+@Category(DistributedTest.class)
+public class PartitionedRegionSingleHopDUnitTest extends JUnit4CacheTestCase {
private static final String PR_NAME = "single_hop_pr";
@@ -84,10 +111,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
private static Locator locator = null;
- public PartitionedRegionSingleHopDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
IgnoredException.addIgnoredException("Connection refused");
@@ -138,7 +161,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
locator = Locator.startLocatorAndDS(locatorPort, logFile, null, props);
}
catch (IOException e) {
- e.printStackTrace();
+ fail("failed to startLocatorInVM", e);
}
}
@@ -150,10 +173,8 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
int redundantCopies, int totalNoofBuckets) {
Properties props = new Properties();
- props = new Properties();
props.setProperty(LOCATORS, locString);
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
@@ -229,7 +250,10 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
cms.getClientPRMetadata_TEST_ONLY().clear();
}
- // 2 peers 2 servers 1 accessor.No client.Should work without any exceptions.
+ /**
+ * 2 peers 2 servers 1 accessor.No client.Should work without any exceptions.
+ */
+ @Test
public void test_NoClient() {
member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
@@ -269,9 +293,12 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
verifyEmptyStaticData();
}
- // 2 AccessorServers, 2 Peers
- // 1 Client connected to 2 AccessorServers. Hence metadata should not be
- // fetched.
+ /**
+ * 2 AccessorServers, 2 Peers
+ * 1 Client connected to 2 AccessorServers. Hence metadata should not be
+ * fetched.
+ */
+ @Test
public void test_ClientConnectedToAccessors() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createAccessorServer());
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createAccessorServer());
@@ -291,8 +318,11 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
verifyEmptyStaticData();
}
- // 1 server 2 accesorservers 2 peers.i client connected to the server
- // Since only 1 server hence Metadata should not be fetched.
+ /**
+ * 1 server 2 accesorservers 2 peers.i client connected to the server
+ * Since only 1 server hence Metadata should not be fetched.
+ */
+ @Test
public void test_ClientConnectedTo1Server() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
@@ -312,10 +342,13 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
verifyEmptyStaticData();
}
- // 4 servers, 1 client connected to all 4 servers.
- // Put data, get data and make the metadata stable.
- // Now verify that metadata has all 8 buckets info.
- // Now update and ensure the fetch service is never called.
+ /**
+ * 4 servers, 1 client connected to all 4 servers.
+ * Put data, get data and make the metadata stable.
+ * Now verify that metadata has all 8 buckets info.
+ * Now update and ensure the fetch service is never called.
+ */
+ @Test
public void test_MetadataContents() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
@@ -336,11 +369,14 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
updateIntoSinglePR();
}
- // 2 servers, 2 clients.One client to one server.
- // Put from c1 to s1. Now put from c2. So since there will be a hop atleast
- // once,
- // fetchservice has to be triggered.
- // Now put again from c2.There should be no hop at all.
+ /**
+ * 2 servers, 2 clients.One client to one server.
+ * Put from c1 to s1. Now put from c2. So since there will be a hop at least
+ * once,
+ * fetchservice has to be triggered.
+ * Now put again from c2.There should be no hop at all.
+ */
+ @Test
public void test_MetadataServiceCallAccuracy() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
@@ -375,6 +411,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.isRefreshMetadataTestOnly() == false);
}
+ @Test
public void test_MetadataServiceCallAccuracy_FromDestroyOp() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
@@ -398,6 +435,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.isRefreshMetadataTestOnly() == true);
}
+ @Test
public void test_MetadataServiceCallAccuracy_FromGetOp() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
@@ -412,8 +450,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
final ClientMetadataService cms = ((GemFireCacheImpl)cache).getClientMetadataService();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
-
-
region.get(new Integer(0));
region.get(new Integer(1));
region.get(new Integer(2));
@@ -429,9 +465,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
region.get(new Integer(3));
Wait.pause(5000);
assertFalse(cms.isRefreshMetadataTestOnly());
-
}
+ @Test
public void test_SingleHopWithHA() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 8 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 8 ));
@@ -462,6 +498,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
}
+ @Test
public void test_SingleHopWithHAWithLocator() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -498,7 +535,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
}
-
+ @Test
public void test_NoMetadataServiceCall_ForGetOp() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
@@ -529,8 +566,8 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
assertFalse(cms.isRefreshMetadataTestOnly());
}
-
- public void test_NoMetadataServiceCall() {
+ @Test
+ public void test_NoMetadataServiceCall() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
@@ -545,7 +582,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.printView());
member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.printView());
-
region.put(new Integer(0), "create0");
final boolean metadataRefreshed_get1 = cms
.isRefreshMetadataTestOnly();
@@ -576,9 +612,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
region.put(new Integer(3), "create3");
Wait.pause(5000);
assertFalse(cms.isRefreshMetadataTestOnly());
-
}
+ @Test
public void test_NoMetadataServiceCall_ForDestroyOp() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 0, 4 ));
@@ -602,6 +638,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
@Category(FlakyTest.class) // GEODE-853: random ports, pause sleeps, time sensitive, 5 second thread sleeps
+ @Test
public void testServerLocationRemovalThroughPing() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
@@ -633,7 +670,8 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
verifyDeadServer(regionMetaData, region, port0, port1);
}
- public void testMetadataFetchOnlyThroughFunctions() {
+ @Test
+ public void testMetadataFetchOnlyThroughFunctions() throws Exception {
//Workaround for 52004
IgnoredException.addIgnoredException("InternalFunctionInvocationTargetException");
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
@@ -659,11 +697,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
do {
if ((prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() !=4)) {
//waiting if there is another thread holding the lock
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- //ignored.
- }
+ Thread.sleep(1000);
cms.getClientPRMetadata((LocalRegion)region);
} else {
break;
@@ -674,6 +708,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
// assertIndexDetailsEquals(4/*numBuckets*/, prMetaData.getBucketServerLocationsMap_TEST_ONLY().size());
}
+ @Test
public void testMetadataFetchOnlyThroughputAll() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
@@ -692,10 +727,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> (prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() == 4));
}
-
-
- @Ignore("Bug 47950")
- public void DISABLED_testMetadataIsSameOnAllServersAndClients() {
+ @Ignore("TODO: test disabled due to Bug 47950")
+ @Test
+ public void testMetadataIsSameOnAllServersAndClients() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
Integer port2 = (Integer)member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 3, 4 ));
@@ -707,7 +741,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.waitForLocalBucketsCreation(4));
member3.invoke(() -> PartitionedRegionSingleHopDUnitTest.waitForLocalBucketsCreation(4));
-
ClientMetadataService cms = ((GemFireCacheImpl)cache).getClientMetadataService();
cms.getClientPRMetadata((LocalRegion)region);
@@ -864,9 +897,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
}, 20000, 2000, true);
-
}
+ @Test
public void testMetadataIsSameOnAllServersAndClientsHA() {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 2, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 2, 4 ));
@@ -948,11 +981,15 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
});
}
- //TODO This is failing in WAN_Dev_Dec11 branch after downmerge from trunk revision 34709
-
- // This test is disabled due to intermittent failures in unit test runs
- // Please see ticket #52203
- public void disabledtestClientMetadataForPersistentPrs() throws Exception {
+ /**
+ * TODO This is failing in WAN_Dev_Dec11 branch after downmerge from trunk revision 34709
+ *
+ * This test is disabled due to intermittent failures in unit test runs
+ * Please see ticket #52203
+ */
+ @Ignore("TODO: test is disabled due to #52203")
+ @Test
+ public void testClientMetadataForPersistentPrs() throws Exception {
Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createPersistentPrsAndServer( 3, 4 ));
Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createPersistentPrsAndServer( 3, 4 ));
Integer port2 = (Integer)member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.createPersistentPrsAndServer( 3, 4 ));
@@ -983,7 +1020,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
fetchAndValidateMetadata();
}
-
private void fetchAndValidateMetadata() {
ClientMetadataService service = ((GemFireCacheImpl)this.cache)
.getClientMetadataService();
@@ -1079,8 +1115,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1101,8 +1136,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
public static int createAccessorServer() {
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
cache = test.getCache();
CacheServer server = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -1171,8 +1205,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
public static int createServer(int redundantCopies, int totalNoofBuckets) {
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
cache = test.getCache();
CacheServer server = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -1245,8 +1278,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
public static int createPersistentPrsAndServer(int redundantCopies, int totalNoofBuckets) {
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
cache = test.getCache();
DiskStore disk = cache.findDiskStore("disk");
if(disk == null) {
@@ -1328,9 +1360,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
return port;
}
+
public static int createPersistentPrsAndServerOnPort(int redundantCopies, int totalNoofBuckets, int port) {
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
cache = test.getCache();
DiskStore disk = cache.findDiskStore("disk");
if(disk == null) {
@@ -1411,9 +1443,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
return port;
}
+
public static void createServerOnPort(int redundantCopies, int totalNoofBuckets, int port) {
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
cache = test.getCache();
CacheServer server = cache.addCacheServer();
server.setPort(port);
@@ -1480,12 +1512,10 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
+ shipmentRegion.toString());
replicatedRegion = cache.createRegion("rr", new AttributesFactory().create());
-
}
public static void startServerOnPort(int port) {
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
cache = test.getCache();
CacheServer server = cache.addCacheServer();
server.setPort(port);
@@ -1498,10 +1528,8 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
}
-
public static void createPeer() {
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
cache = test.getCache();
PartitionAttributesFactory paf = new PartitionAttributesFactory();
@@ -1561,8 +1589,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1587,8 +1614,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1613,8 +1639,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1638,8 +1663,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopDUnitTest(
- "PartitionedRegionSingleHopDUnitTest");
+ PartitionedRegionSingleHopDUnitTest test = new PartitionedRegionSingleHopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1748,10 +1772,12 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
static class MyFunctionAdapter extends FunctionAdapter {
+ @Override
public String getId() {
return "fid";
}
+ @Override
public void execute(FunctionContext context) {
System.out.println("YOGS function called");
RegionFunctionContext rc = (RegionFunctionContext)context;
@@ -1806,7 +1832,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
public static void put() {
-
region.put(new Integer(0), "create0");
region.put(new Integer(1), "create1");
region.put(new Integer(2), "create2");
@@ -1843,7 +1868,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
shipmentRegion.get(shipmentId, shipment);
}
}
-
}
region.get(new Integer(0), "create0");
@@ -1961,13 +1985,12 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
}
-class Customer implements DataSerializable {
+class Customer implements DataSerializable { // TODO: move this to be an inner class and make it static
String name;
String address;
public Customer() {
-
}
public Customer(String name, String address) {
@@ -1975,21 +1998,25 @@ class Customer implements DataSerializable {
this.address = address;
}
+ @Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.name = DataSerializer.readString(in);
this.address = DataSerializer.readString(in);
}
+ @Override
public void toData(DataOutput out) throws IOException {
DataSerializer.writeString(this.name, out);
DataSerializer.writeString(this.address, out);
}
+ @Override
public String toString() {
return "Customer { name=" + this.name + " address=" + this.address + "}";
}
+ @Override
public boolean equals(Object o) {
if (this == o)
return true;
@@ -2006,25 +2033,28 @@ class Order implements DataSerializable {
String orderName;
public Order() {
-
}
public Order(String orderName) {
this.orderName = orderName;
}
+ @Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.orderName = DataSerializer.readString(in);
}
+ @Override
public void toData(DataOutput out) throws IOException {
DataSerializer.writeString(this.orderName, out);
}
+ @Override
public String toString() {
return this.orderName;
}
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -2043,25 +2073,28 @@ class Shipment implements DataSerializable {
String shipmentName;
public Shipment() {
-
}
public Shipment(String shipmentName) {
this.shipmentName = shipmentName;
}
+ @Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.shipmentName = DataSerializer.readString(in);
}
+ @Override
public void toData(DataOutput out) throws IOException {
DataSerializer.writeString(this.shipmentName, out);
}
+ @Override
public String toString() {
return this.shipmentName;
}
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;