You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/04/15 05:07:52 UTC
[23/32] incubator-geode git commit: GEODE-1162: convert all CLI
command DUnit tests to JUnit 4
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
index 7151ffd..1b0c9cf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
@@ -16,6 +16,25 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
@@ -55,35 +74,18 @@ import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData.S
import com.gemstone.gemfire.management.internal.cli.result.ResultData;
import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
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 hydra.GsRandom;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Random;
-import java.util.Set;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Dunit class for testing gemfire data commands : get, put, remove, select, rebalance
- *
*/
-
+@Category(DistributedTest.class)
@SuppressWarnings("serial")
public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
@@ -117,16 +119,11 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final static int COUNT = 5;
- public GemfireDataCommandsDUnitTest(String name) {
- super(name);
- }
-
public static String getMemberId() {
- Cache cache = new GemfireDataCommandsDUnitTest("test").getCache();
+ Cache cache = new GemfireDataCommandsDUnitTest().getCache();
return cache.getDistributedSystem().getDistributedMember().getId();
}
-
void setupForGetPutRemoveLocateEntry(String testName) {
final VM vm1 = Host.getHost(0).getVM(1);
final VM vm2 = Host.getHost(0).getVM(2);
@@ -142,29 +139,29 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE);
Region dataRegion = regionFactory.create(DATA_REGION_NAME);
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
dataRegion = dataRegion.createSubregion(DATA_REGION_NAME_CHILD_1, dataRegion.getAttributes());
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
dataRegion = dataRegion.createSubregion(DATA_REGION_NAME_CHILD_1_2, dataRegion.getAttributes());
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
dataRegion = regionFactory.create(DATA_REGION_NAME_VM1);
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
PartitionAttributes partitionAttrs = new PartitionAttributesFactory().setRedundantCopies(2).create();
RegionFactory<Object, Object> partitionRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION);
partitionRegionFactory.setPartitionAttributes(partitionAttrs);
Region dataParRegion = partitionRegionFactory.create(DATA_PAR_REGION_NAME);
assertNotNull(dataParRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataParRegion);
+ getLogWriter().info("Created Region " + dataParRegion);
dataParRegion = partitionRegionFactory.create(DATA_PAR_REGION_NAME_VM1);
assertNotNull(dataParRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataParRegion);
+ getLogWriter().info("Created Region " + dataParRegion);
}
});
@@ -175,19 +172,19 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE);
Region dataRegion = regionFactory.create(DATA_REGION_NAME);
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
dataRegion = dataRegion.createSubregion(DATA_REGION_NAME_CHILD_1, dataRegion.getAttributes());
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
dataRegion = dataRegion.createSubregion(DATA_REGION_NAME_CHILD_1_2, dataRegion.getAttributes());
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
dataRegion = regionFactory.create(DATA_REGION_NAME_VM2);
assertNotNull(dataRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataRegion);
+ getLogWriter().info("Created Region " + dataRegion);
PartitionAttributes partitionAttrs = new PartitionAttributesFactory().setRedundantCopies(2).create();
@@ -195,18 +192,18 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
partitionRegionFactory.setPartitionAttributes(partitionAttrs);
Region dataParRegion = partitionRegionFactory.create(DATA_PAR_REGION_NAME);
assertNotNull(dataParRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataParRegion);
+ getLogWriter().info("Created Region " + dataParRegion);
dataParRegion = partitionRegionFactory.create(DATA_PAR_REGION_NAME_VM2);
assertNotNull(dataParRegion);
- LogWriterUtils.getLogWriter().info("Created Region " + dataParRegion);
+ getLogWriter().info("Created Region " + dataParRegion);
}
});
final String vm1MemberId = (String) vm1.invoke(() -> GemfireDataCommandsDUnitTest.getMemberId());
final String vm2MemberId = (String) vm2.invoke(() -> GemfireDataCommandsDUnitTest.getMemberId());
- LogWriterUtils.getLogWriter().info("Vm1 ID : " + vm1MemberId);
- LogWriterUtils.getLogWriter().info("Vm2 ID : " + vm2MemberId);
+ getLogWriter().info("Vm1 ID : " + vm1MemberId);
+ getLogWriter().info("Vm2 ID : " + vm2MemberId);
final VM manager = Host.getHost(0).getVM(0);
@@ -222,10 +219,10 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
ManagerMXBean bean1 = service.getManagerMXBean();
DistributedRegionMXBean bean2 = service.getDistributedRegionMXBean(DATA_REGION_NAME_PATH);
if (bean1 == null) {
- LogWriterUtils.getLogWriter().info("Still probing for ManagerMBean");
+ getLogWriter().info("Still probing for ManagerMBean");
return false;
} else {
- LogWriterUtils.getLogWriter().info("Still probing for DistributedRegionMXBean=" + bean2);
+ getLogWriter().info("Still probing for DistributedRegionMXBean=" + bean2);
return (bean2 != null);
}
}
@@ -236,7 +233,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 30000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 30000, 2000, true);
assertNotNull(service.getMemberMXBean());
assertNotNull(service.getManagerMXBean());
@@ -266,7 +263,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
if (!flag) {
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
"Still probing for regionMbeans " + DATA_REGION_NAME_PATH + "=" + beans[0] + " " + DATA_REGION_NAME_VM1_PATH + "=" + beans[1] + " " + DATA_REGION_NAME_VM2_PATH + "=" + beans[2] + " " + DATA_PAR_REGION_NAME_PATH + "=" + beans[3] + " " + DATA_PAR_REGION_NAME_VM1_PATH + "=" + beans[4] + " " + DATA_PAR_REGION_NAME_VM2_PATH + "=" + beans[5] + " "
//+ DATA_REGION_NAME_CHILD_1_PATH
// +"="+ beans[6] + " " + DATA_REGION_NAME_CHILD_1_2_PATH
@@ -274,7 +271,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
);
return false;
} else {
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
"Probing complete for regionMbeans " + DATA_REGION_NAME_PATH + "=" + beans[0] + " " + DATA_REGION_NAME_VM1_PATH + "=" + beans[1] + " " + DATA_REGION_NAME_VM2_PATH + "=" + beans[2] + " " + DATA_PAR_REGION_NAME_PATH + "=" + beans[3] + " " + DATA_PAR_REGION_NAME_VM1_PATH + "=" + beans[4] + " " + DATA_PAR_REGION_NAME_VM2_PATH + "=" + beans[5] + " "
//+ DATA_REGION_NAME_CHILD_1_PATH
// +"="+ beans[6] + " " + DATA_REGION_NAME_CHILD_1_2_PATH
@@ -296,7 +293,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
};
- Wait.waitForCriterion(waitForRegionMBeans, 30000, 2000, true);
+ waitForCriterion(waitForRegionMBeans, 30000, 2000, true);
String regions[] = {DATA_REGION_NAME_PATH, DATA_REGION_NAME_VM1_PATH, DATA_REGION_NAME_VM2_PATH, DATA_PAR_REGION_NAME_PATH, DATA_PAR_REGION_NAME_VM1_PATH, DATA_PAR_REGION_NAME_VM2_PATH, /*DATA_REGION_NAME_CHILD_1_PATH, DATA_REGION_NAME_CHILD_1_2_PATH*/};
@@ -304,7 +301,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
bean = service.getDistributedRegionMXBean(region);
assertNotNull(bean);
String[] membersName = bean.getMembers();
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
"Members Array for region " + region + " : " + StringUtils.objectToString(membersName, true, 10));
if (bean.getMemberCount() < 1) fail(
"Even after waiting mbean reports number of member hosting region " + DATA_REGION_NAME_VM1_PATH + " is less than one");
@@ -369,7 +366,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
query = query.replace("?" + i, r);
i++;
}
- LogWriterUtils.getLogWriter().info("Checking members for query : " + query);
+ getLogWriter().info("Checking members for query : " + query);
QCompiler compiler = new QCompiler();
Set<String> regionsInQuery = null;
try {
@@ -377,11 +374,11 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
Set regionSet = new HashSet();
compiledQuery.getRegionsInQuery(regionSet, null);//GFSH ENV VARIBLES
regionsInQuery = Collections.unmodifiableSet(regionSet);
- LogWriterUtils.getLogWriter().info("Region in query : " + regionsInQuery);
+ getLogWriter().info("Region in query : " + regionsInQuery);
if (regionsInQuery.size() > 0) {
Set<DistributedMember> members = DataCommands.getQueryRegionsAssociatedMembers(regionsInQuery, cache,
returnAll);
- LogWriterUtils.getLogWriter().info("Members for Region in query : " + members);
+ getLogWriter().info("Members for Region in query : " + members);
if (expectedMembers != -1) {
assertNotNull(members);
assertEquals(expectedMembers, members.size());
@@ -390,7 +387,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
assertEquals(-1, expectedMembers);//Regions do not exist at all
}
} catch (QueryInvalidException qe) {
- Assert.fail("Invalid Query", qe);
+ fail("Invalid Query", qe);
}
}
@@ -453,7 +450,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
MemberMXBean member = service.getMemberMXBean();
String cmdResult = member.processCommand(query);
assertNotNull(cmdResult);
- LogWriterUtils.getLogWriter().info("Text Command Output : " + cmdResult);
+ getLogWriter().info("Text Command Output : " + cmdResult);
}
});
}
@@ -495,17 +492,17 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
validateSelectResult(cmdResult, true, (randomInteger + 1), expectedCols);
}
- public void doTestSelectWithGfshEnvVariables() {
+ public void doTestSelectWithGfshEnvVariables(boolean statusActive) {
Random random = new Random(System.nanoTime());
int randomInteger = random.nextInt(COUNT);
String query = "query --query=\"select ID , status , createTime , pk, floatMinValue from ${DATA_REGION} where ID <= ${PORTFOLIO_ID}" + " and status='${STATUS}'" + "\" --interactive=false";
executeCommand("set variable --name=DATA_REGION --value=" + DATA_REGION_NAME_PATH);
executeCommand("set variable --name=PORTFOLIO_ID --value=" + randomInteger);
- executeCommand("set variable --name=STATUS --value=" + (new GsRandom().nextBoolean() ? "active" : "inactive"));
+ executeCommand("set variable --name=STATUS --value=" + (statusActive ? "active" : "inactive"));
CommandResult cmdResult = executeCommand(query);
printCommandOutput(cmdResult);
validateSelectResult(cmdResult, true, -1, null);
- IgnoredException ex = IgnoredException.addIgnoredException(QueryInvalidException.class.getSimpleName(), Host.getHost(0).getVM(0));
+ IgnoredException ex = addIgnoredException(QueryInvalidException.class.getSimpleName(), Host.getHost(0).getVM(0));
try {
query = "query --query=\"select ID , status , createTime , pk, floatMinValue from ${DATA_REGION2} where ID <= ${PORTFOLIO_ID2}" + " and status='${STATUS2}'" + "\" --interactive=false";
cmdResult = executeCommand(query);
@@ -523,11 +520,12 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
validateResult(cmdResult, true);
}
-
+ @Test
public void testSelectCommand() {
setupForSelect();
doTestGetRegionAssociatedMembersForSelect();
- doTestSelectWithGfshEnvVariables();
+ doTestSelectWithGfshEnvVariables(true);
+ doTestSelectWithGfshEnvVariables(false);
doTestSelectProjection();
doTestBug48013();
doTestSelectProjectionProcessCommand();
@@ -536,7 +534,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
doTestSelectBeansWithNestedFieldAsResult();
}
-
+ @Test
public void testPrimitivesWithDataCommands() {
setupForGetPutRemoveLocateEntry("testPrimitives");
Byte byteKey = Byte.parseByte("41");
@@ -550,15 +548,15 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
Double doubleKey = Double.valueOf("12432.235425");
Double doubleValue = Double.valueOf("111111.111111");
- LogWriterUtils.getLogWriter().info("Testing Byte Wrappers");
+ getLogWriter().info("Testing Byte Wrappers");
testGetPutLocateEntryFromShellAndGemfire(byteKey, byteValue, Byte.class, true, true);
- LogWriterUtils.getLogWriter().info("Testing Short Wrappers");
+ getLogWriter().info("Testing Short Wrappers");
testGetPutLocateEntryFromShellAndGemfire(shortKey, shortValue, Short.class, true, true);
- LogWriterUtils.getLogWriter().info("Testing Integer Wrappers");
+ getLogWriter().info("Testing Integer Wrappers");
testGetPutLocateEntryFromShellAndGemfire(integerKey, integerValue, Integer.class, true, true);
- LogWriterUtils.getLogWriter().info("Testing Float Wrappers");
+ getLogWriter().info("Testing Float Wrappers");
testGetPutLocateEntryFromShellAndGemfire(floatKey, flaotValue, Float.class, true, true);
- LogWriterUtils.getLogWriter().info("Testing Double Wrappers");
+ getLogWriter().info("Testing Double Wrappers");
testGetPutLocateEntryFromShellAndGemfire(doubleKey, doubleValue, Double.class, true, true);
}
@@ -683,6 +681,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
}
+ @Test
public void testSimplePutCommand() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -760,7 +759,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
try {
for (String col : expectedCols) {
boolean found = false;
- LogWriterUtils.getLogWriter().info("Validating column " + col);
+ getLogWriter().info("Validating column " + col);
for (int i = 0; i < array.size(); i++) {
String header = (String) array.get(i);
if (col.equals(header)) found = true;
@@ -768,7 +767,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
assertEquals(true, found);
}
} catch (GfJsonException e) {
- Assert.fail("Error accessing table data", e);
+ fail("Error accessing table data", e);
}
}
@@ -781,7 +780,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
try {
for (String col : expectedCols) {
boolean found = false;
- LogWriterUtils.getLogWriter().info("Validating column " + col);
+ getLogWriter().info("Validating column " + col);
for (int i = 0; i < array.size(); i++) {
String header = (String) array.get(i);
if (col.equals(header)) found = true;
@@ -795,7 +794,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
} catch (GfJsonException e) {
- Assert.fail("Error accessing table data", e);
+ fail("Error accessing table data", e);
}
}
@@ -815,7 +814,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
assertEquals(cols.length, array.size());
for (String col : cols) {
boolean found = false;
- LogWriterUtils.getLogWriter().info("Validating column " + col);
+ getLogWriter().info("Validating column " + col);
for (int i = 0; i < array.size(); i++) {
String header = (String) array.get(i);
if (col.equals(header)) found = true;
@@ -823,14 +822,14 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
assertEquals(true, found);
}
} catch (GfJsonException e) {
- Assert.fail("Error accessing table data", e);
+ fail("Error accessing table data", e);
}
}
}
} else fail("Expected CompositeResult Returned Result Type " + cmdResult.getType());
}
-
+ @Test
public void testSimplePutIfAbsentCommand() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -892,6 +891,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
+ @Test
public void testSimpleRemoveCommand() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -948,6 +948,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
vm2.invoke(checkRemoveKeys);
}
+ @Test
public void testSimpleGetLocateEntryCommand() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -994,6 +995,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
+ @Test
public void testRecursiveLocateEntryCommand() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -1036,6 +1038,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
+ @Test
public void testGetLocateEntryFromRegionOnDifferentVM() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -1116,6 +1119,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
}
+ @Test
public void testGetLocateEntryLocationsForPR() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -1151,6 +1155,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
}
+ @Test
public void testPutFromRegionOnDifferentVM() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
@@ -1207,6 +1212,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
vm2.invoke(checkPutKeysInVM2);
}
+ @Test
public void testGetLocateEntryJsonKeys() {
final String keyPrefix = "testKey";
@@ -1277,7 +1283,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
String valueJson = valueTemplate.replaceAll("\\?1", population);
valueJson = valueJson.replaceAll("\\?2", area);
valueJson = valueJson.replaceAll("\\?", keyString);
- LogWriterUtils.getLogWriter().info("Getting key with json key : " + keyJson);
+ getLogWriter().info("Getting key with json key : " + keyJson);
command = command + " " + "--key=" + keyJson + " --region=" + DATA_REGION_NAME_PATH + " --key-class=" + Key1.class.getCanonicalName();
command = command + " --value-class=" + Value2.class.getCanonicalName();
CommandResult cmdResult = executeCommand(command);
@@ -1306,7 +1312,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
String valueJson = valueTemplate.replaceAll("\\?1", population);
valueJson = valueJson.replaceAll("\\?2", area);
valueJson = valueJson.replaceAll("\\?", keyString);
- LogWriterUtils.getLogWriter().info("Getting key with json key : " + keyJson);
+ getLogWriter().info("Getting key with json key : " + keyJson);
command = command + " " + "--key=" + keyJson + " --region=" + DATA_REGION_NAME_PATH + " --key-class=" + Key1.class.getCanonicalName();
command = command + " --value-class=" + Value2.class.getCanonicalName();
CommandResult cmdResult = executeCommand(command);
@@ -1326,6 +1332,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
}
+ @Test
public void testPutJsonKeys() {
final String keyPrefix = "testKey";
@@ -1343,8 +1350,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
String valueJson = valueTemplate.replaceAll("\\?1", population);
valueJson = valueJson.replaceAll("\\?2", area);
valueJson = valueJson.replaceAll("\\?", keyString);
- LogWriterUtils.getLogWriter().info("Putting key with json key : " + keyJson);
- LogWriterUtils.getLogWriter().info("Putting key with json valye : " + valueJson);
+ getLogWriter().info("Putting key with json key : " + keyJson);
+ getLogWriter().info("Putting key with json valye : " + valueJson);
command = command + " " + "--key=" + keyJson + " --value=" + valueJson + " --region=" + DATA_REGION_NAME_PATH;
command = command + " --key-class=" + Key1.class.getCanonicalName() + " --value-class=" + Value2.class.getCanonicalName();
;
@@ -1372,8 +1379,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
valueJson = valueJson.replaceAll("\\?set", set);
valueJson = valueJson.replaceAll("\\?map", map);
- LogWriterUtils.getLogWriter().info("Putting key with json key : " + keyJson);
- LogWriterUtils.getLogWriter().info("Putting key with json valye : " + valueJson);
+ getLogWriter().info("Putting key with json key : " + keyJson);
+ getLogWriter().info("Putting key with json valye : " + valueJson);
command = command + " " + "--key=" + keyJson + " --value=" + valueJson + " --region=" + DATA_REGION_NAME_PATH;
command = command + " --key-class=" + Key1.class.getCanonicalName() + " --value-class=" + Car.class.getCanonicalName();
;
@@ -1447,6 +1454,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
validateResult(cmdResult, false);
}
+ @Test
public void testRemoveJsonCommand() {
final String keyPrefix = "testKey";
@@ -1483,7 +1491,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
String command = "remove";
String keyString = keyPrefix + i;
String keyJson = keyTemplate.replaceAll("\\?", keyString);
- LogWriterUtils.getLogWriter().info("Removing key with json key : " + keyJson);
+ getLogWriter().info("Removing key with json key : " + keyJson);
command = command + " " + "--key=" + keyJson + " --region=" + DATA_REGION_NAME_PATH + " --key-class=" + Key1.class.getCanonicalName();
CommandResult cmdResult = executeCommand(command);
printCommandOutput(cmdResult);
@@ -1524,6 +1532,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
return regionFactory.create(regionName);
}
+ @Test
public void testImportExportData() throws InterruptedException, IOException {
final String regionName = "Region1";
final String exportFileName = "export.gfd";
@@ -1564,8 +1573,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
CommandResult cmdResult = executeCommand(commandString);
String resultAsString = commandResultToString(cmdResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
- LogWriterUtils.getLogWriter().info("Command Output");
- LogWriterUtils.getLogWriter().info(resultAsString);
+ getLogWriter().info("Command Output");
+ getLogWriter().info(resultAsString);
vm1.invoke(new SerializableRunnable() {
public void run() {
@@ -1588,8 +1597,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
cmdResult = executeCommand(commandString);
resultAsString = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("Result of import data");
- LogWriterUtils.getLogWriter().info(resultAsString);
+ getLogWriter().info("Result of import data");
+ getLogWriter().info(resultAsString);
assertEquals(Result.Status.OK, cmdResult.getStatus());
/**
@@ -1614,8 +1623,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
cmdResult = executeCommand(commandString);
resultAsString = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("Result of import data with wrong region name");
- LogWriterUtils.getLogWriter().info(resultAsString);
+ getLogWriter().info("Result of import data with wrong region name");
+ getLogWriter().info(resultAsString);
assertEquals(Result.Status.ERROR, cmdResult.getStatus());
csb = new CommandStringBuilder(CliStrings.IMPORT_DATA);
@@ -1626,8 +1635,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
cmdResult = executeCommand(commandString);
resultAsString = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("Result of import data with wrong file");
- LogWriterUtils.getLogWriter().info(resultAsString);
+ getLogWriter().info("Result of import data with wrong file");
+ getLogWriter().info(resultAsString);
assertEquals(Result.Status.ERROR, cmdResult.getStatus());
} finally {
@@ -1687,7 +1696,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final DistributedRegionMXBean bean = service.getDistributedRegionMXBean(
Region.SEPARATOR + REBALANCE_REGION_NAME);
if (bean == null) {
- LogWriterUtils.getLogWriter().info("Still probing for checkRegionMBeans ManagerMBean");
+ getLogWriter().info("Still probing for checkRegionMBeans ManagerMBean");
return false;
} else {
// verify that bean is proper before executing tests
@@ -1704,32 +1713,34 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
return "Probing for testRebalanceCommandForSimulateWithNoMember ManagerMBean";
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
DistributedRegionMXBean bean = ManagementService.getManagementService(getCache()).getDistributedRegionMXBean(
"/" + REBALANCE_REGION_NAME);
assertNotNull(bean);
}
};
+ @Test
public void testRebalanceCommandForTimeOut() {
setupTestRebalanceForEntireDS();
//check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForTimeOut verified Mbean and executin command");
+ getLogWriter().info("testRebalanceCommandForTimeOut verified Mbean and executin command");
String command = "rebalance --time-out=1";
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForTimeOut just after executing " + cmdResult);
+ getLogWriter().info("testRebalanceCommandForTimeOut just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForTimeOut stringResult : " + stringResult);
+ getLogWriter().info("testRebalanceCommandForTimeOut stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceCommandForTimeOut failed as did not get CommandResult");
}
}
+ @Test
public void testRebalanceCommandForTimeOutForRegion() {
setupTestRebalanceForEntireDS();
@@ -1737,22 +1748,23 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForTimeOutForRegion verified Mbean and executin command");
+ getLogWriter().info("testRebalanceCommandForTimeOutForRegion verified Mbean and executin command");
String command = "rebalance --time-out=1 --include-region=" + "/" + REBALANCE_REGION_NAME;
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForTimeOutForRegion just after executing " + cmdResult);
+ getLogWriter().info("testRebalanceCommandForTimeOutForRegion just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForTimeOutForRegion stringResult : " + stringResult);
+ getLogWriter().info("testRebalanceCommandForTimeOutForRegion stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceCommandForTimeOut failed as did not get CommandResult");
}
}
+ @Test
public void testRebalanceCommandForSimulate() {
setupTestRebalanceForEntireDS();
@@ -1760,19 +1772,20 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForSimulate verified Mbean and executin command");
+ getLogWriter().info("testRebalanceCommandForSimulate verified Mbean and executin command");
String command = "rebalance --simulate=true --include-region=" + "/" + REBALANCE_REGION_NAME;
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForSimulate just after executing " + cmdResult);
+ getLogWriter().info("testRebalanceCommandForSimulate just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForSimulate stringResult : " + stringResult);
+ getLogWriter().info("testRebalanceCommandForSimulate stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceCommandForSimulate failed as did not get CommandResult");
}
}
+ @Test
public void testRebalanceCommandForSimulateWithNoMember() {
setupTestRebalanceForEntireDS();
@@ -1780,22 +1793,23 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForSimulateWithNoMember verified Mbean and executin command");
+ getLogWriter().info("testRebalanceCommandForSimulateWithNoMember verified Mbean and executin command");
String command = "rebalance --simulate=true";
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForSimulateWithNoMember just after executing " + cmdResult);
+ getLogWriter().info("testRebalanceCommandForSimulateWithNoMember just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testRebalanceCommandForSimulateWithNoMember stringResult : " + stringResult);
+ getLogWriter().info("testRebalanceCommandForSimulateWithNoMember stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceCommandForSimulateWithNoMember failed as did not get CommandResult");
}
}
+ @Test
public void testRebalanceForIncludeRegionFunction() {
// setup();
setupWith2Regions();
@@ -1803,54 +1817,56 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
//check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testRebalanceForIncludeRegionFunction verified Mbean and executin command");
+ getLogWriter().info("testRebalanceForIncludeRegionFunction verified Mbean and executin command");
String command = "rebalance --include-region=" + "/" + REBALANCE_REGION_NAME + ",/" + REBALANCE_REGION2_NAME;
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testRebalanceForIncludeRegionFunction just after executing " + cmdResult);
+ getLogWriter().info("testRebalanceForIncludeRegionFunction just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testRebalanceForIncludeRegionFunction stringResult : " + stringResult);
+ getLogWriter().info("testRebalanceForIncludeRegionFunction stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
}
}
+ @Test
public void testSimulateForEntireDS() {
setupTestRebalanceForEntireDS();
//check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testSimulateForEntireDS verified Mbean and executin command");
+ getLogWriter().info("testSimulateForEntireDS verified Mbean and executin command");
String command = "rebalance --simulate=true";
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testSimulateForEntireDS just after executing " + cmdResult);
+ getLogWriter().info("testSimulateForEntireDS just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testSimulateForEntireDS stringResult : " + stringResult);
+ getLogWriter().info("testSimulateForEntireDS stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
}
}
+ @Test
public void testRebalanceForEntireDS() {
setupTestRebalanceForEntireDS();
//check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testRebalanceForEntireDS verified Mbean and executin command");
+ getLogWriter().info("testRebalanceForEntireDS verified Mbean and executin command");
String command = "rebalance";
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testRebalanceForEntireDS just after executing " + cmdResult);
+ getLogWriter().info("testRebalanceForEntireDS just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testRebalanceForEntireDS stringResult : " + stringResult);
+ getLogWriter().info("testRebalanceForEntireDS stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
@@ -1901,14 +1917,14 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
private static void printCommandOutput(CommandResult cmdResult) {
assertNotNull(cmdResult);
- LogWriterUtils.getLogWriter().info("Command Output : ");
+ getLogWriter().info("Command Output : ");
StringBuilder sb = new StringBuilder();
cmdResult.resetToFirstLine();
while (cmdResult.hasNextLine()) {
sb.append(cmdResult.nextLine()).append(DataCommandRequest.NEW_LINE);
}
- LogWriterUtils.getLogWriter().info(sb.toString());
- LogWriterUtils.getLogWriter().info("");
+ getLogWriter().info(sb.toString());
+ getLogWriter().info("");
}
public static class Value1WithValue2 extends Value1 {
@@ -1928,6 +1944,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
}
+ @Test
public void testRebalanceForExcludeRegionFunction() {
setupWith2Regions();
@@ -1935,15 +1952,15 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- LogWriterUtils.getLogWriter().info("testRebalanceForExcludeRegionFunction verified Mbean and executing command");
+ getLogWriter().info("testRebalanceForExcludeRegionFunction verified Mbean and executing command");
String command = "rebalance --exclude-region=" + "/" + REBALANCE_REGION2_NAME;
- LogWriterUtils.getLogWriter().info("testRebalanceForExcludeRegionFunction command : " + command);
+ getLogWriter().info("testRebalanceForExcludeRegionFunction command : " + command);
CommandResult cmdResult = executeCommand(command);
- LogWriterUtils.getLogWriter().info("testRebalanceForExcludeRegionFunction just after executing " + cmdResult);
+ getLogWriter().info("testRebalanceForExcludeRegionFunction just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
- LogWriterUtils.getLogWriter().info("testRebalanceForExcludeRegionFunction stringResult : " + stringResult);
+ getLogWriter().info("testRebalanceForExcludeRegionFunction stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
@@ -1966,19 +1983,19 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
ManagerMXBean bean1 = service.getManagerMXBean();
DistributedRegionMXBean bean2 = service.getDistributedRegionMXBean(regionName);
if (bean1 == null) {
- LogWriterUtils.getLogWriter().info("waitForListClientMbean Still probing for ManagerMBean");
+ getLogWriter().info("waitForListClientMbean Still probing for ManagerMBean");
return false;
} else {
- LogWriterUtils.getLogWriter().info("waitForListClientMbean Still probing for DistributedRegionMXBean=" + bean2);
+ getLogWriter().info("waitForListClientMbean Still probing for DistributedRegionMXBean=" + bean2);
if (bean2 == null) {
bean2 = service.getDistributedRegionMXBean(Region.SEPARATOR + regionName);
}
if (bean2 == null) {
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
"waitForListClientMbean Still probing for DistributedRegionMXBean with separator = " + bean2);
return false;
} else {
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
"waitForListClientMbean Still probing for DistributedRegionMXBean with separator Not null " + bean2.getMembers().length);
if (bean2.getMembers().length > 1) {
return true;
@@ -1995,7 +2012,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 30000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 30000, 2000, true);
DistributedRegionMXBean bean = service.getDistributedRegionMXBean(regionName);
if (bean == null) {
bean = service.getDistributedRegionMXBean(Region.SEPARATOR + regionName);
@@ -2006,6 +2023,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
+ @Test
public void testRegionsViaMbeanAndFunctions() {
setupForGetPutRemoveLocateEntry("tesSimplePut");
@@ -2031,7 +2049,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
});
- LogWriterUtils.getLogWriter().info("testRegionsViaMbeanAndFunctions memSizeFromMbean= " + memSizeFromMbean);
+ getLogWriter().info("testRegionsViaMbeanAndFunctions memSizeFromMbean= " + memSizeFromMbean);
String memSizeFromFunctionCall = (String) manager.invoke(new SerializableCallable() {
public Object call() {
@@ -2041,10 +2059,11 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
});
- LogWriterUtils.getLogWriter().info("testRegionsViaMbeanAndFunctions memSizeFromFunctionCall= " + memSizeFromFunctionCall);
+ getLogWriter().info("testRegionsViaMbeanAndFunctions memSizeFromFunctionCall= " + memSizeFromFunctionCall);
assertTrue(memSizeFromFunctionCall.equals(memSizeFromMbean));
}
+ @Test
public void testRegionsViaMbeanAndFunctionsForPartRgn() {
setupWith2Regions();
waitForListClientMbean(REBALANCE_REGION_NAME);
@@ -2070,7 +2089,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
});
- LogWriterUtils.getLogWriter().info("testRegionsViaMbeanAndFunctionsForPartRgn memSizeFromMbean= " + memSizeFromMbean);
+ getLogWriter().info("testRegionsViaMbeanAndFunctionsForPartRgn memSizeFromMbean= " + memSizeFromMbean);
String memSizeFromFunctionCall = (String) manager.invoke(new SerializableCallable() {
public Object call() {
@@ -2079,7 +2098,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
});
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
"testRegionsViaMbeanAndFunctionsForPartRgn memSizeFromFunctionCall= " + memSizeFromFunctionCall);
assertTrue(memSizeFromFunctionCall.equals(memSizeFromMbean));
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
index 6704979..19a354e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.java
@@ -16,11 +16,18 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheLoader;
import com.gemstone.gemfire.cache.CacheLoaderException;
@@ -40,12 +47,11 @@ import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
import com.gemstone.gemfire.management.internal.cli.result.ResultData;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
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.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* The GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest class is test suite of test cases testing the Gfsh
@@ -57,6 +63,7 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
* @since 8.0
*/
@SuppressWarnings("unused")
+@Category(DistributedTest.class)
public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends CliCommandTestBase {
private static final String GEMFIRE_MANAGER_NAME = "GemManagerNode";
@@ -82,10 +89,6 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
return buffer.toString();
}
- public GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest(final String testName) {
- super(testName);
- }
-
@Override
public final void postSetUp() throws Exception {
Properties managerDistributedSystemProperties = createDistributedSystemProperties(GEMFIRE_MANAGER_NAME);
@@ -171,7 +174,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
};
- Wait.waitForCriterion(waitOnManagerCriterion, 30000, 2000, true);
+ waitForCriterion(waitOnManagerCriterion, 30000, 2000, true);
}
});
}
@@ -194,7 +197,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
protected void log(final String tag, final String message) {
//System.out.printf("%1$s (%2$s)%n", tag, message);
- LogWriterUtils.getLogWriter().info(String.format("%1$s (%2$s)%n", tag, message));
+ getLogWriter().info(String.format("%1$s (%2$s)%n", tag, message));
}
protected CommandResult runCommand(final String command) {
@@ -218,6 +221,7 @@ public class GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest extends C
}
}
+ @Test
public void testGetOnCacheMiss() {
doHousekeeping();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HTTPServiceSSLSupportJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HTTPServiceSSLSupportJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HTTPServiceSSLSupportJUnitTest.java
index 49f405c..344d116 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HTTPServiceSSLSupportJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HTTPServiceSSLSupportJUnitTest.java
@@ -16,23 +16,23 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static org.junit.Assert.*;
+
import java.io.File;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
-import com.gemstone.gemfire.util.test.TestUtil;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.util.test.TestUtil;
/**
- *
* @since 8.1
*/
@Category(IntegrationTest.class)
@@ -68,7 +68,9 @@ public class HTTPServiceSSLSupportJUnitTest {
return sb.toString();
}
- public void _testSSLWithClusterSSL() throws Exception {
+ @Ignore("disabled for unknown reason")
+ @Test
+ public void testSSLWithClusterSSL() throws Exception {
Properties localProps = new Properties();
localProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
index 431c6b3..123c3bc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.DiskStoreFactory;
@@ -43,11 +52,10 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
+@Category({ DistributedTest.class, FlakyTest.class }) // see GEODE-689, GEODE-1048
public class IndexCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -57,11 +65,6 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
private static final String parRegPersName = "ParRegPers";
private static final String repRegPersName = "RepRegPer";
- public IndexCommandsDUnitTest(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
-
Region<?, ?> createParReg(String regionName, Cache cache, Class keyConstraint, Class valueConstraint) {
RegionFactory regionFactory = cache.createRegionFactory();
regionFactory.setDataPolicy(DataPolicy.PARTITION);
@@ -130,6 +133,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
return regionFactory.create(regionName);
}
+ @Test
public void testCreateKeyIndexOnRegionWithPersistence() {
setupSystemPersist();
@@ -159,6 +163,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
assertTrue(Status.OK.equals(commandResult.getStatus()));
}
+ @Test
public void testCreateAndDestroyIndex() {
setupSystem();
/***
@@ -200,6 +205,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
assertFalse(resultAsString.contains(indexName));
}
+ @Test
public void testCreateIndexMultipleIterators() {
setupSystem();
@@ -224,6 +230,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
assertTrue(resultAsString.contains(indexName));
}
+ @Test
public void testCreateMultipleIndexes() {
setupSystem();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEFINE_INDEX);
@@ -257,6 +264,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
assertTrue(resultAsString.contains(indexName));
}
+ @Test
public void testClearMultipleIndexes() {
setupSystem();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DEFINE_INDEX);
@@ -290,6 +298,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
assertTrue(!resultAsString.contains(indexName));
}
+ @Test
public void testCreateAndDestroyIndexOnMember() {
setupSystem();
/***
@@ -339,6 +348,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
assertFalse(resultAsString.contains(VM1Name));
}
+ @Test
public void testCreateAndDestroyIndexOnGroup() {
setupSystem();
/***
@@ -406,6 +416,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
}
}
+ @Test
public void testCreateAndDestroyIndexWithIncorrectInput() {
setupSystem();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
@@ -524,6 +535,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
assertTrue(commandResult.getStatus().equals(Status.ERROR));
}
+ @Test
public void testDestroyIndexWithoutIndexName() {
setupSystem();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
@@ -585,6 +597,7 @@ public class IndexCommandsDUnitTest extends CliCommandTestBase {
/**
* Asserts that creating and destroying indexes correctly updates the shared configuration.
*/
+ @Test
public void testCreateDestroyUpdatesSharedConfig() {
disconnectAllFromDS();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsJUnitTest.java
index bf77aba..ce36401 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/IndexCommandsJUnitTest.java
@@ -24,6 +24,15 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.execute.Execution;
import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
@@ -35,15 +44,6 @@ import com.gemstone.gemfire.management.internal.cli.domain.IndexDetails;
import com.gemstone.gemfire.management.internal.cli.functions.ListIndexFunction;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
/**
* The IndexCommandsJUnitTest class is a test suite of test cases testing the contract and functionality of the
* IndexCommands class.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
index 744824f..6466033 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
@@ -16,9 +16,15 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+
import java.io.Serializable;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.DiskStore;
@@ -29,10 +35,10 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.management.cli.Result;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
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.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* The ListAndDescribeDiskStoreCommandsDUnitTest class is a test suite of functional tests cases testing the proper
@@ -42,6 +48,7 @@ import com.gemstone.gemfire.test.dunit.VM;
* @see com.gemstone.gemfire.management.internal.cli.commands.DiskStoreCommands
* @since 7.0
*/
+@Category(DistributedTest.class)
public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBase {
protected static String toString(final Result result) {
@@ -57,10 +64,6 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
return buffer.toString().trim();
}
- public ListAndDescribeDiskStoreCommandsDUnitTest(final String testName) {
- super(testName);
- }
-
@Override
public final void postSetUp() throws Exception {
createDefaultSetup(null);
@@ -89,7 +92,7 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
protected Properties createDistributedSystemProperties(final String gemfireName) {
final Properties distributedSystemProperties = new Properties();
- distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
+ distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
distributedSystemProperties.setProperty(DistributionConfig.NAME_NAME, gemfireName);
return distributedSystemProperties;
@@ -121,23 +124,26 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
});
}
+ @Test
public void testListDiskStore() throws Exception {
final Result result = executeCommand(CliStrings.LIST_DISK_STORE);
assertNotNull(result);
- LogWriterUtils.getLogWriter().info(toString(result));
+ getLogWriter().info(toString(result));
assertEquals(Result.Status.OK, result.getStatus());
}
+ @Test
public void testDescribeDiskStore() throws Exception {
final Result result = executeCommand(
CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=producerData");
assertNotNull(result);
- LogWriterUtils.getLogWriter().info(toString(result));
+ getLogWriter().info(toString(result));
assertEquals(Result.Status.OK, result.getStatus());
}
+ @Test
public void testDescribeDiskStoreWithInvalidMemberName() throws Exception {
final Result commandResult = executeCommand(
CliStrings.DESCRIBE_DISK_STORE + " --member=badMemberName --name=producerData");
@@ -148,6 +154,7 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
toString(commandResult));
}
+ @Test
public void testDescribeDiskStoreWithInvalidDiskStoreName() {
final Result commandResult = executeCommand(
CliStrings.DESCRIBE_DISK_STORE + " --member=producerServer --name=badDiskStoreName");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
index 2d11491..f495944 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
@@ -16,6 +16,14 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.EvictionAction;
import com.gemstone.gemfire.cache.EvictionAttributes;
@@ -35,19 +43,13 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
import com.gemstone.gemfire.management.internal.cli.util.RegionAttributesNames;
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;
-import java.util.Properties;
-
+@Category(DistributedTest.class)
public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
- public ListAndDescribeRegionDUnitTest(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
-
private static final String REGION1 = "region1";
private static final String REGION2 = "region2";
private static final String REGION3 = "region3";
@@ -186,15 +188,15 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
dataRegionFactory.create(REGION3);
}
-
+ @Test
public void testListRegion() {
setupSystem();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_REGION);
String commandString = csb.toString();
CommandResult commandResult = executeCommand(commandString);
String commandResultAsString = commandResultToString(commandResult);
- LogWriterUtils.getLogWriter().info("Command String : " + commandString);
- LogWriterUtils.getLogWriter().info("Output : \n" + commandResultAsString);
+ getLogWriter().info("Command String : " + commandString);
+ getLogWriter().info("Output : \n" + commandResultAsString);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(PR1));
assertTrue(commandResultAsString.contains(LOCALREGIONONMANAGER));
@@ -208,8 +210,8 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
commandString = csb.toString();
commandResult = executeCommand(commandString);
commandResultAsString = commandResultToString(commandResult);
- LogWriterUtils.getLogWriter().info("Command String : " + commandString);
- LogWriterUtils.getLogWriter().info("Output : \n" + commandResultAsString);
+ getLogWriter().info("Command String : " + commandString);
+ getLogWriter().info("Output : \n" + commandResultAsString);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(PR1));
assertTrue(commandResultAsString.contains(LOCALREGIONONMANAGER));
@@ -219,8 +221,8 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
commandString = csb.toString();
commandResult = executeCommand(commandString);
commandResultAsString = commandResultToString(commandResult);
- LogWriterUtils.getLogWriter().info("Command String : " + commandString);
- LogWriterUtils.getLogWriter().info("Output : \n" + commandResultAsString);
+ getLogWriter().info("Command String : " + commandString);
+ getLogWriter().info("Output : \n" + commandResultAsString);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(PR1));
assertTrue(commandResultAsString.contains(REGION1));
@@ -233,8 +235,8 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
commandString = csb.toString();
commandResult = executeCommand(commandString);
commandResultAsString = commandResultToString(commandResult);
- LogWriterUtils.getLogWriter().info("Command String : " + commandString);
- LogWriterUtils.getLogWriter().info("Output : \n" + commandResultAsString);
+ getLogWriter().info("Command String : " + commandString);
+ getLogWriter().info("Output : \n" + commandResultAsString);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(PR1));
assertTrue(commandResultAsString.contains(LOCALREGIONONMANAGER));
@@ -244,8 +246,8 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
commandString = csb.toString();
commandResult = executeCommand(commandString);
commandResultAsString = commandResultToString(commandResult);
- LogWriterUtils.getLogWriter().info("Command String : " + commandString);
- LogWriterUtils.getLogWriter().info("Output : \n" + commandResultAsString);
+ getLogWriter().info("Command String : " + commandString);
+ getLogWriter().info("Output : \n" + commandResultAsString);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(PR1));
assertTrue(commandResultAsString.contains(REGION1));
@@ -254,6 +256,7 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
assertTrue(commandResultAsString.contains(SUBREGION1A));
}
+ @Test
public void testDescribeRegion() {
setupSystem();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESCRIBE_REGION);
@@ -261,8 +264,8 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
String commandString = csb.toString();
CommandResult commandResult = executeCommand(commandString);
String commandResultAsString = commandResultToString(commandResult);
- LogWriterUtils.getLogWriter().info("Command String : " + commandString);
- LogWriterUtils.getLogWriter().info("Output : \n" + commandResultAsString);
+ getLogWriter().info("Command String : " + commandString);
+ getLogWriter().info("Output : \n" + commandResultAsString);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(PR1));
assertTrue(commandResultAsString.contains("Server1"));
@@ -272,8 +275,8 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
commandString = csb.toString();
commandResult = executeCommand(commandString);
commandResultAsString = commandResultToString(commandResult);
- LogWriterUtils.getLogWriter().info("Command String : " + commandString);
- LogWriterUtils.getLogWriter().info("Output : \n" + commandResultAsString);
+ getLogWriter().info("Command String : " + commandString);
+ getLogWriter().info("Output : \n" + commandResultAsString);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(LOCALREGIONONMANAGER));
assertTrue(commandResultAsString.contains("Manager"));
@@ -283,6 +286,7 @@ public class ListAndDescribeRegionDUnitTest extends CliCommandTestBase {
* Asserts that a describe region command issued on a region with compression returns the correct non default region
* attribute for compression and the correct codec value.
*/
+ @Test
public void testDescribeRegionWithCompressionCodec() {
final String regionName = "compressedRegion";
VM vm = Host.getHost(0).getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
index caa33fb..deb8860 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ListIndexCommandDUnitTest.java
@@ -16,6 +16,9 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,6 +31,9 @@ import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.Region;
@@ -45,10 +51,10 @@ import com.gemstone.gemfire.management.cli.Result;
import com.gemstone.gemfire.management.internal.cli.domain.IndexDetails;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
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.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* The ListIndexCommandDUnitTest class is distributed test suite of test cases for testing the index-based GemFire shell
@@ -59,6 +65,7 @@ import com.gemstone.gemfire.test.dunit.VM;
* @since 7.0
*/
@SuppressWarnings("unused")
+@Category(DistributedTest.class)
public class ListIndexCommandDUnitTest extends CliCommandTestBase {
protected static final int DEFAULT_REGION_INITIAL_CAPACITY = 10000;
@@ -78,11 +85,6 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
return buffer.toString();
}
-
- public ListIndexCommandDUnitTest(final String testName) {
- super(testName);
- }
-
@Override
public final void postSetUp() throws Exception {
createDefaultSetup(null);
@@ -136,7 +138,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
protected Properties createDistributedSystemProperties(final String gemfireName) {
final Properties distributedSystemProperties = new Properties();
- distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
+ distributedSystemProperties.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
distributedSystemProperties.setProperty(DistributionConfig.NAME_NAME, gemfireName);
return distributedSystemProperties;
@@ -174,7 +176,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
} catch (Exception e) {
- LogWriterUtils.getLogWriter().error(
+ getLogWriter().error(
String.format("Error occurred creating Index (%1$s) on Region (%2$s) - (%3$s)", indexName,
region.getFullPath(), e.getMessage()));
}
@@ -276,11 +278,11 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
@SuppressWarnings("unchecked")
protected <T extends Comparable<T>, B extends AbstractBean<T>> B query(final Cache cache, final String queryString) {
try {
- LogWriterUtils.getLogWriter().info(String.format("Running Query (%1$s) in GemFire...", queryString));
+ getLogWriter().info(String.format("Running Query (%1$s) in GemFire...", queryString));
final SelectResults<B> results = (SelectResults<B>) cache.getQueryService().newQuery(queryString).execute();
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
String.format("Running Query (%1$s) in GemFire returned (%2$d) result(s).", queryString, results.size()));
return (results.iterator().hasNext() ? results.iterator().next() : null);
@@ -292,12 +294,12 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
protected <T extends Comparable<T>, B extends AbstractBean<T>> B query(final Region<T, B> region,
final String queryPredicate) {
try {
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
String.format("Running Query (%1$s) on Region (%2$s)...", queryPredicate, region.getFullPath()));
final SelectResults<B> results = region.query(queryPredicate);
- LogWriterUtils.getLogWriter().info(
+ getLogWriter().info(
String.format("Running Query (%1$s) on Region (%2$s) returned (%3$d) result(s).", queryPredicate,
region.getFullPath(), results.size()));
@@ -309,11 +311,12 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
}
}
+ @Test
public void testListIndex() throws Exception {
final Result result = executeCommand(CliStrings.LIST_INDEX + " --" + CliStrings.LIST_INDEX__STATS);
assertNotNull(result);
- LogWriterUtils.getLogWriter().info(toString(result));
+ getLogWriter().info(toString(result));
assertEquals(Result.Status.OK, result.getStatus());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MemberCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MemberCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MemberCommandsDUnitTest.java
index 44cead8..d2bdcba 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MemberCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/MemberCommandsDUnitTest.java
@@ -16,6 +16,21 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.EvictionAction;
@@ -26,7 +41,6 @@ import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -39,24 +53,16 @@ import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.remote.CommandProcessor;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-/****
- */
+@Category(DistributedTest.class)
+public class MemberCommandsDUnitTest extends JUnit4CacheTestCase {
-public class MemberCommandsDUnitTest extends CacheTestCase {
private static final long serialVersionUID = 1L;
+
private static final Map<String, String> EMPTY_ENV = Collections.emptyMap();
private static final String REGION1 = "region1";
private static final String REGION2 = "region2";
@@ -67,10 +73,6 @@ public class MemberCommandsDUnitTest extends CacheTestCase {
private static final String PR1 = "PartitionedRegion1";
private static final String PR2 = "ParitionedRegion2";
- public MemberCommandsDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
// This test does not require an actual Gfsh connection to work, however when run as part of a suite, prior tests
@@ -179,7 +181,7 @@ public class MemberCommandsDUnitTest extends CacheTestCase {
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOCATORS_NAME, NetworkUtils.getServerHostName(host) + "[" + locatorPort + "]");
+ props.setProperty(DistributionConfig.LOCATORS_NAME, getServerHostName(host) + "[" + locatorPort + "]");
props.setProperty(DistributionConfig.LOG_LEVEL_NAME, "info");
props.setProperty(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true");
props.setProperty(DistributionConfig.ENABLE_TIME_STATISTICS_NAME, "true");
@@ -196,26 +198,28 @@ public class MemberCommandsDUnitTest extends CacheTestCase {
final Cache cache = getCache();
}
- /***
+ /**
* Tests the execution of "list member" command which should list out all the members in the DS
*
* @throws IOException
* @throws ClassNotFoundException
*/
+ @Test
public void testListMemberAll() throws IOException, ClassNotFoundException {
setupSystem();
CommandProcessor commandProcessor = new CommandProcessor();
Result result = commandProcessor.createCommandStatement(CliStrings.LIST_MEMBER, EMPTY_ENV).process();
- LogWriterUtils.getLogWriter().info("#SB" + getResultAsString(result));
+ getLogWriter().info("#SB" + getResultAsString(result));
assertEquals(true, result.getStatus().equals(Status.OK));
}
- /****
+ /**
* Tests the execution of "list member" command, when no cache is created
*
* @throws IOException
* @throws ClassNotFoundException
*/
+ @Test
public void testListMemberWithNoCache() throws IOException, ClassNotFoundException {
final Host host = Host.getHost(0);
final VM[] servers = {host.getVM(0), host.getVM(1)};
@@ -229,35 +233,37 @@ public class MemberCommandsDUnitTest extends CacheTestCase {
CommandProcessor commandProcessor = new CommandProcessor();
Result result = commandProcessor.createCommandStatement(CliStrings.LIST_MEMBER, EMPTY_ENV).process();
- LogWriterUtils.getLogWriter().info("#SB" + getResultAsString(result));
+ getLogWriter().info("#SB" + getResultAsString(result));
assertEquals(true, result.getStatus().equals(Status.ERROR));
} finally {
locator.stop(); // fix for bug 46562
}
}
- /***
+ /**
* Tests list member --group=G1
*
* @throws IOException
* @throws ClassNotFoundException
*/
+ @Test
public void testListMemberWithGroups() throws IOException, ClassNotFoundException {
setupSystem();
CommandProcessor commandProcessor = new CommandProcessor();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_MEMBER);
csb.addOption(CliStrings.LIST_MEMBER__GROUP, "G1");
Result result = commandProcessor.createCommandStatement(csb.toString(), EMPTY_ENV).process();
- LogWriterUtils.getLogWriter().info("#SB" + getResultAsString(result));
+ getLogWriter().info("#SB" + getResultAsString(result));
assertEquals(true, result.getStatus().equals(Status.OK));
}
- /***
+ /**
* Tests the "describe member" command for all the members in the DS
*
* @throws IOException
* @throws ClassNotFoundException
*/
+ @Test
public void testDescribeMember() throws IOException, ClassNotFoundException {
setupSystem();
CommandProcessor commandProcessor = new CommandProcessor();
@@ -271,7 +277,7 @@ public class MemberCommandsDUnitTest extends CacheTestCase {
Result result = commandProcessor.createCommandStatement("describe member --name=" + member.getId(),
EMPTY_ENV).process();
assertEquals(true, result.getStatus().equals(Status.OK));
- LogWriterUtils.getLogWriter().info("#SB" + getResultAsString(result));
+ getLogWriter().info("#SB" + getResultAsString(result));
//assertEquals(true, result.getStatus().equals(Status.OK));
}
}