You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/04/14 22:47:14 UTC
[2/8] 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-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
index f1afdaf..6fef000 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
@@ -16,16 +16,23 @@
*/
package com.gemstone.gemfire.management.internal.cli.commands;
-import hydra.Log;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.DistributedTestUtils.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import java.util.Map.Entry;
-
+import java.util.Properties;
import javax.management.ObjectName;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -63,23 +70,20 @@ import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData.SectionResultData;
-import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
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.management.internal.cli.result.TabularResultData;
-
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
/**
* Dunit class for testing gemfire Client commands : list client , describe client
* @since 8.0
*/
-
-
+@Category({ DistributedTest.class, FlakyTest.class }) // see GEODE-1034
public class ClientCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -92,15 +96,7 @@ public class ClientCommandsDUnitTest extends CliCommandTestBase {
int port0 = 0;
int port1= 0;
-
-
- public ClientCommandsDUnitTest(String name) {
- super(name);
-
- }
-
-
-public void waitForListClientMbean(){
+ public void waitForListClientMbean(){
final VM manager = Host.getHost(0).getVM(0);
final VM server1 = Host.getHost(0).getVM(1);
@@ -117,7 +113,7 @@ public void waitForListClientMbean(){
public boolean done() {
final SystemManagementService service = (SystemManagementService) ManagementService.getManagementService(getCache());
if (service == null) {
- Log.getLogWriter().info("waitForListClientMbean Still probing for service");
+ getLogWriter().info("waitForListClientMbean Still probing for service");
return false;
} else {
final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port0,serverMember);
@@ -142,7 +138,7 @@ public void waitForListClientMbean(){
return "waitForListClientMbean Probing ...";
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
}
});
@@ -166,7 +162,7 @@ public void waitForListClientMbean2(){
public boolean done() {
final SystemManagementService service = (SystemManagementService) ManagementService.getManagementService(getCache());
if (service == null) {
- Log.getLogWriter().info("waitForListClientMbean2 Still probing for service");
+ getLogWriter().info("waitForListClientMbean2 Still probing for service");
return false;
} else {
final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port0,serverMember);
@@ -191,7 +187,7 @@ public void waitForListClientMbean2(){
return "waitForListClientMbean2 Probing ...";
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
}
});
@@ -216,7 +212,7 @@ public void waitForListClientMbean2(){
public boolean done() {
final SystemManagementService service = (SystemManagementService) ManagementService.getManagementService(getCache());
if (service == null) {
- Log.getLogWriter().info("waitForMbean Still probing for service");
+ getLogWriter().info("waitForMbean Still probing for service");
return false;
} else {
final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port0,serverMember);
@@ -251,7 +247,7 @@ public void waitForListClientMbean2(){
return "waitForMbean Probing for ";
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
}
});
@@ -276,7 +272,7 @@ public void waitForListClientMbean2(){
public boolean done() {
final SystemManagementService service = (SystemManagementService) ManagementService.getManagementService(getCache());
if (service == null) {
- Log.getLogWriter().info("waitForListClientMbean3 Still probing for service");
+ getLogWriter().info("waitForListClientMbean3 Still probing for service");
return false;
} else {
final ObjectName cacheServerMBeanName1 = service.getCacheServerMBeanName(port0,serverMember1);
@@ -303,13 +299,15 @@ public void waitForListClientMbean2(){
return "waitForListClientMbean3 Probing ...";
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 2 * 60 * 1000, 2000, true);
}
});
}
-
- /*public void testDescribeClientWithServers3() throws Exception {
+
+ @Ignore("disabled for unknown reason")
+ @Test
+ public void testDescribeClientWithServers3() throws Exception {
setupSystem3();
String commandString = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientId + "\"" ;
final VM server1 = Host.getHost(0).getVM(1);
@@ -350,7 +348,7 @@ public void waitForListClientMbean2(){
for(String str : clientIds){
clientId1 = str;
- Log.getLogWriter().info("testDescribeClientWithServers clientIds for server1 ="+str);
+ getLogWriter().info("testDescribeClientWithServers clientIds for server1 ="+str);
}
final DistributedMember serverMember2 = getMember(server2);
@@ -373,21 +371,21 @@ public void waitForListClientMbean2(){
for(String str : clientIds2){
clientId2 = str;
- Log.getLogWriter().info("testDescribeClientWithServers clientIds for server2 ="+str);
+ getLogWriter().info("testDescribeClientWithServers clientIds for server2 ="+str);
}
commandString = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientId1 + "\"" ;
- Log.getLogWriter().info("testDescribeClientWithServers commandStr clientId1 ="+commandString);
+ getLogWriter().info("testDescribeClientWithServers commandStr clientId1 ="+commandString);
CommandResult commandResultForClient1 = executeCommand(commandString);
- Log.getLogWriter().info("testDescribeClientWithServers commandStr clientId1="+commandResultForClient1);
+ getLogWriter().info("testDescribeClientWithServers commandStr clientId1="+commandResultForClient1);
String resultAsString = commandResultToString(commandResultForClient1);
- Log.getLogWriter().info("testDescribeClientWithServers commandStr clientId1 ="+resultAsString);
+ getLogWriter().info("testDescribeClientWithServers commandStr clientId1 ="+resultAsString);
assertTrue(Status.OK.equals(commandResultForClient1.getStatus()));
verifyClientStats(commandResultForClient1, serverName1);
@@ -396,15 +394,15 @@ public void waitForListClientMbean2(){
commandString = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientId2 + "\"" ;
- Log.getLogWriter().info("testDescribeClientWithServers commandStr1="+commandString);
+ getLogWriter().info("testDescribeClientWithServers commandStr1="+commandString);
CommandResult commandResultForClient2 = executeCommand(commandString);
- Log.getLogWriter().info("testDescribeClientWithServers commandResult1="+commandResultForClient2);
+ getLogWriter().info("testDescribeClientWithServers commandResult1="+commandResultForClient2);
resultAsString = commandResultToString(commandResultForClient2);
- Log.getLogWriter().info("testDescribeClientWithServers resultAsString1="+resultAsString);
+ getLogWriter().info("testDescribeClientWithServers resultAsString1="+resultAsString);
assertTrue(Status.OK.equals(commandResultForClient2.getStatus()));
verifyClientStats(commandResultForClient2, serverName2);
@@ -414,15 +412,15 @@ public void waitForListClientMbean2(){
closeCacheServer(Host.getHost(0).getVM(3));
closeCacheServer(Host.getHost(0).getVM(1));
- } */
+ }
-public void verifyClientStats(CommandResult commandResultForClient, String serverName){
+ public void verifyClientStats(CommandResult commandResultForClient, String serverName){
CompositeResultData resultData = (CompositeResultData) commandResultForClient.getResultData();
SectionResultData section =resultData.retrieveSection("InfoSection");
assertNotNull(section);
for(int i = 0 ; i < 1 ; i++){
TabularResultData tableRsultData = section.retrieveTableByIndex(i);
- Log.getLogWriter().info("testDescribeClientWithServers getHeader="+tableRsultData.getHeader());
+ getLogWriter().info("testDescribeClientWithServers getHeader="+tableRsultData.getHeader());
assertNotNull(tableRsultData);
List<String> minConn = tableRsultData.retrieveAllValues(CliStrings.DESCRIBE_CLIENT_MIN_CONN);
@@ -431,7 +429,7 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
List<String> numCqs = tableRsultData.retrieveAllValues(CliStrings.DESCRIBE_CLIENT_CQs);
- Log.getLogWriter().info("testDescribeClientWithServers getHeader numCqs ="+ numCqs);
+ getLogWriter().info("testDescribeClientWithServers getHeader numCqs ="+ numCqs);
assertTrue(minConn.contains("1"));
assertTrue(maxConn.contains("-1"));
@@ -458,15 +456,17 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
}
}
-
- public void disabled_testDescribeClient() throws Exception {
+
+ @Ignore("disabled for unknown reason")
+ @Test
+ public void testDescribeClient() throws Exception {
setupSystem();
- Log.getLogWriter().info("testDescribeClient clientId="+clientId);
+ getLogWriter().info("testDescribeClient clientId="+clientId);
assertNotNull(clientId);
String commandString = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientId + "\"" ;
- Log.getLogWriter().info("testDescribeClient commandStr="+commandString);
+ getLogWriter().info("testDescribeClient commandStr="+commandString);
final VM server1 = Host.getHost(0).getVM(1);
String serverName = (String) server1.invoke(new SerializableCallable(){
@@ -480,11 +480,11 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
CommandResult commandResult = executeCommand(commandString);
- Log.getLogWriter().info("testDescribeClient commandResult="+commandResult);
+ getLogWriter().info("testDescribeClient commandResult="+commandResult);
String resultAsString = commandResultToString(commandResult);
- Log.getLogWriter().info("testDescribeClient resultAsString="+resultAsString);
+ getLogWriter().info("testDescribeClient resultAsString="+resultAsString);
assertTrue(Status.OK.equals(commandResult.getStatus()));
CompositeResultData resultData = (CompositeResultData) commandResult.getResultData();
@@ -527,13 +527,14 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
closeCacheServer(Host.getHost(0).getVM(3));
- }
-
+ }
+
+ @Test
public void testDescribeClientWithServers() throws Exception {
setupSystem2();
String commandString = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientId + "\"" ;
- Log.getLogWriter().info("testDescribeClientWithServers commandStr="+commandString);
+ getLogWriter().info("testDescribeClientWithServers commandStr="+commandString);
final VM server1 = Host.getHost(0).getVM(1);
@@ -547,11 +548,11 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
CommandResult commandResult = executeCommand(commandString);
- Log.getLogWriter().info("testDescribeClientWithServers commandResult="+commandResult);
+ getLogWriter().info("testDescribeClientWithServers commandResult="+commandResult);
String resultAsString = commandResultToString(commandResult);
- Log.getLogWriter().info("testDescribeClientWithServers resultAsString="+resultAsString);
+ getLogWriter().info("testDescribeClientWithServers resultAsString="+resultAsString);
assertTrue(Status.OK.equals(commandResult.getStatus()));
CompositeResultData resultData = (CompositeResultData) commandResult.getResultData();
@@ -592,9 +593,9 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
closeNonDurableClient(Host.getHost(0).getVM(3));
closeCacheServer(Host.getHost(0).getVM(1));
- }
-
-
+ }
+
+ @Test
public void testListClient() throws Exception {
setupSystemForListClient();
@@ -602,7 +603,7 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
final VM manager = Host.getHost(0).getVM(0);
String commandString = CliStrings.LIST_CLIENTS ;
- Log.getLogWriter().info("testListClient commandStr="+commandString);
+ getLogWriter().info("testListClient commandStr="+commandString);
waitForListClientMbean();
@@ -632,11 +633,11 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
});
CommandResult commandResult = executeCommand(commandString);
- Log.getLogWriter().info("testListClient commandResult="+commandResult);
+ getLogWriter().info("testListClient commandResult="+commandResult);
String resultAsString = commandResultToString(commandResult);
- Log.getLogWriter().info("testListClient resultAsString="+resultAsString);
+ getLogWriter().info("testListClient resultAsString="+resultAsString);
assertTrue(Status.OK.equals(commandResult.getStatus()));
@@ -650,14 +651,14 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
List<String> clientNames = tableRsultData.retrieveAllValues(CliStrings.LIST_CLIENT_COLUMN_Clients);
- Log.getLogWriter().info("testListClients serverNames : " + serverNames);
- Log.getLogWriter().info("testListClients clientNames : " + clientNames);
+ getLogWriter().info("testListClients serverNames : " + serverNames);
+ getLogWriter().info("testListClients clientNames : " + clientNames);
assertEquals(2, serverNames.size());
assertEquals(2, clientNames.size());
assertTrue(clientNames.contains(clientIds[0]));
assertTrue(clientNames.contains(clientIds[1]));
serverName = serverName.replace(":", "-");
- Log.getLogWriter().info("testListClients serverName : " + serverName);
+ getLogWriter().info("testListClients serverName : " + serverName);
for(String str : serverNames){
assertTrue(str.contains(serverName));
}
@@ -666,17 +667,17 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
closeCacheServer(Host.getHost(0).getVM(3));
- }
-
-
- public void testListClientForServers() throws Exception {
+ }
+
+ @Test
+ public void testListClientForServers() throws Exception {
setupSystem3();
final VM manager = Host.getHost(0).getVM(0);
String commandString = CliStrings.LIST_CLIENTS ;
- Log.getLogWriter().info("testListClientForServers commandStr="+commandString);
+ getLogWriter().info("testListClientForServers commandStr="+commandString);
@@ -716,11 +717,11 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
});
CommandResult commandResult = executeCommand(commandString);
- Log.getLogWriter().info("testListClientForServers commandResult="+commandResult);
+ getLogWriter().info("testListClientForServers commandResult="+commandResult);
String resultAsString = commandResultToString(commandResult);
- Log.getLogWriter().info("testListClientForServers resultAsString="+resultAsString);
+ getLogWriter().info("testListClientForServers resultAsString="+resultAsString);
assertTrue(Status.OK.equals(commandResult.getStatus()));
@@ -737,10 +738,10 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
serverName2 = serverName2.replace(":", "-");
- Log.getLogWriter().info("testListClientForServers serverNames : " + serverNames);
- Log.getLogWriter().info("testListClientForServers serverName1 : " + serverName1);
- Log.getLogWriter().info("testListClientForServers serverName2 : " + serverName2);
- Log.getLogWriter().info("testListClientForServers clientNames : " + clientNames);
+ getLogWriter().info("testListClientForServers serverNames : " + serverNames);
+ getLogWriter().info("testListClientForServers serverName1 : " + serverName1);
+ getLogWriter().info("testListClientForServers serverName2 : " + serverName2);
+ getLogWriter().info("testListClientForServers clientNames : " + clientNames);
for(String client : clientIds){
assertTrue(clientNames.contains(client));
@@ -983,7 +984,7 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
getSystem(props);
final ClientCacheFactory ccf = new ClientCacheFactory(props);
- ccf.addPoolServer(NetworkUtils.getServerHostName(server.getHost()), port);
+ ccf.addPoolServer(getServerHostName(server.getHost()), port);
ccf.setPoolSubscriptionEnabled(true);
ccf.setPoolPingInterval(1);
ccf.setPoolStatisticInterval(1);
@@ -1003,7 +1004,7 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
}else{
String poolName = "new_pool_" + System.currentTimeMillis();
try{
- PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(NetworkUtils.getServerHostName(server.getHost()), port)
+ PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(getServerHostName(server.getHost()), port)
.setThreadLocalConnections(true)
.setMinConnections(1)
.setSubscriptionEnabled(true)
@@ -1056,7 +1057,7 @@ public void verifyClientStats(CommandResult commandResultForClient, String serve
protected Properties getServerProperties() {
Properties p = new Properties();
- p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
+ p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+getDUnitLocatorPort()+"]");
return p;
}
@@ -1077,14 +1078,14 @@ public void waitForNonSubCliMBean(){
try {
final SystemManagementService service = (SystemManagementService) ManagementService.getManagementService(getCache());
if (service == null) {
- Log.getLogWriter().info("waitForNonSubScribedClientMBean Still probing for service");
+ getLogWriter().info("waitForNonSubScribedClientMBean Still probing for service");
return false;
} else {
- Log.getLogWriter().info("waitForNonSubScribedClientMBean 1");
+ getLogWriter().info("waitForNonSubScribedClientMBean 1");
final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port0,serverMember);
- Log.getLogWriter().info("waitForNonSubScribedClientMBean 2 cacheServerMBeanName " + cacheServerMBeanName);
+ getLogWriter().info("waitForNonSubScribedClientMBean 2 cacheServerMBeanName " + cacheServerMBeanName);
CacheServerMXBean bean = service.getMBeanProxy(cacheServerMBeanName, CacheServerMXBean.class);
- Log.getLogWriter().info("waitForNonSubScribedClientMBean 2 bean " + bean);
+ getLogWriter().info("waitForNonSubScribedClientMBean 2 bean " + bean);
if(bean.getClientIds().length > 0){
return true;
}
@@ -1100,7 +1101,7 @@ public void waitForNonSubCliMBean(){
return "waitForNonSubScribedClientMBean Probing for ";
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 5* 60 * 1000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 5* 60 * 1000, 2000, true);
}
});
@@ -1125,14 +1126,14 @@ public void waitForMixedClients(){
try {
final SystemManagementService service = (SystemManagementService) ManagementService.getManagementService(getCache());
if (service == null) {
- Log.getLogWriter().info("waitForMixedClients Still probing for service");
+ getLogWriter().info("waitForMixedClients Still probing for service");
return false;
} else {
- Log.getLogWriter().info("waitForMixedClients 1");
+ getLogWriter().info("waitForMixedClients 1");
final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port0,serverMember);
- Log.getLogWriter().info("waitForMixedClients 2 cacheServerMBeanName " + cacheServerMBeanName);
+ getLogWriter().info("waitForMixedClients 2 cacheServerMBeanName " + cacheServerMBeanName);
CacheServerMXBean bean = service.getMBeanProxy(cacheServerMBeanName, CacheServerMXBean.class);
- Log.getLogWriter().info("waitForMixedClients 2 bean " + bean);
+ getLogWriter().info("waitForMixedClients 2 bean " + bean);
if(bean.getClientIds().length > 1){
return true;
}
@@ -1148,22 +1149,21 @@ public void waitForMixedClients(){
return "waitForMixedClients Probing for ";
}
};
- Wait.waitForCriterion(waitForMaangerMBean, 5* 60 * 1000, 2000, true);
+ waitForCriterion(waitForMaangerMBean, 5* 60 * 1000, 2000, true);
}
});
}
-
-
+ @Test
public void testDescribeClientForNonSubscribedClient() throws Exception {
setUpNonSubscribedClient();
- Log.getLogWriter().info("testDescribeClientForNonSubscribedClient clientId="+clientId);
+ getLogWriter().info("testDescribeClientForNonSubscribedClient clientId="+clientId);
assertNotNull(clientId);
String commandString = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientId + "\"" ;
- Log.getLogWriter().info("testDescribeClientForNonSubscribedClient commandStr="+commandString);
+ getLogWriter().info("testDescribeClientForNonSubscribedClient commandStr="+commandString);
final VM server1 = Host.getHost(0).getVM(1);
String serverName = (String) server1.invoke(new SerializableCallable(){
@@ -1176,11 +1176,11 @@ public void waitForMixedClients(){
CommandResult commandResult = executeCommand(commandString);
- Log.getLogWriter().info("testDescribeClientForNonSubscribedClient commandResult="+commandResult);
+ getLogWriter().info("testDescribeClientForNonSubscribedClient commandResult="+commandResult);
String resultAsString = commandResultToString(commandResult);
- Log.getLogWriter().info("testDescribeClientForNonSubscribedClient resultAsString="+resultAsString);
+ getLogWriter().info("testDescribeClientForNonSubscribedClient resultAsString="+resultAsString);
assertTrue(Status.OK.equals(commandResult.getStatus()));
CompositeResultData resultData = (CompositeResultData) commandResult.getResultData();
@@ -1228,8 +1228,9 @@ public void waitForMixedClients(){
closeCacheServer(Host.getHost(0).getVM(3));
- }
-
+ }
+
+ @Test
public void testDescribeMixClientWithServers() throws Exception {
String[] clientIds = setupSystemWithSubAndNonSubClient();
@@ -1243,13 +1244,13 @@ public void waitForMixedClients(){
});
String commandString = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientIds[0] + "\"" ;
- Log.getLogWriter().info("testDescribeMixClientWithServers commandStr="+commandString);
+ getLogWriter().info("testDescribeMixClientWithServers commandStr="+commandString);
executeAndVerifyResultsForMixedClients(commandString, serverName );
String commandString2 = CliStrings.DESCRIBE_CLIENT + " --" + CliStrings.DESCRIBE_CLIENT__ID + "=\""+ clientIds[1] + "\"" ;
- Log.getLogWriter().info("testDescribeMixClientWithServers commandString2="+commandString2);
+ getLogWriter().info("testDescribeMixClientWithServers commandString2="+commandString2);
executeAndVerifyResultsForMixedClients(commandString2,serverName );
@@ -1262,11 +1263,11 @@ public void waitForMixedClients(){
void executeAndVerifyResultsForMixedClients(String commandString, String serverName){
CommandResult commandResult = executeCommand(commandString);
- Log.getLogWriter().info("testDescribeMixClientWithServers commandResult="+commandResult);
+ getLogWriter().info("testDescribeMixClientWithServers commandResult="+commandResult);
String resultAsString = commandResultToString(commandResult);
- Log.getLogWriter().info("testDescribeMixClientWithServers resultAsString="+resultAsString);
+ getLogWriter().info("testDescribeMixClientWithServers resultAsString="+resultAsString);
assertTrue(Status.OK.equals(commandResult.getStatus()));
@@ -1396,7 +1397,7 @@ private void setUpNonSubscribedClient() throws Exception {
getSystem(props);
final ClientCacheFactory ccf = new ClientCacheFactory(props);
- ccf.addPoolServer(NetworkUtils.getServerHostName(server.getHost()), port);
+ ccf.addPoolServer(getServerHostName(server.getHost()), port);
ccf.setPoolSubscriptionEnabled(false);
ccf.setPoolPingInterval(1);
ccf.setPoolStatisticInterval(1);
@@ -1416,7 +1417,7 @@ private void setUpNonSubscribedClient() throws Exception {
}else{
String poolName = "new_pool_" + System.currentTimeMillis();
try{
- PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(NetworkUtils.getServerHostName(server.getHost()), port)
+ PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(getServerHostName(server.getHost()), port)
.setThreadLocalConnections(true)
.setMinConnections(1)
.setSubscriptionEnabled(false)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
index 0a1f433..b35538d 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
@@ -16,13 +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.DistributedTestUtils.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
+
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.CacheException;
import com.gemstone.gemfire.cache.DataPolicy;
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.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
@@ -44,15 +52,12 @@ import com.gemstone.gemfire.management.cli.Result.Status;
import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
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.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-
+@Category(DistributedTest.class)
public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
private static final long serialVersionUID = 1L;
@@ -61,11 +66,8 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
final String cq2 = "cq2";
final String cq3 = "cq3";
final String clientName = "dc1";
-
- public DurableClientCommandsDUnitTest(String name) {
- super(name);
- }
-
+
+ @Test
public void testListDurableClientCqs() throws Exception {
setupSystem();
setupCqs();
@@ -98,6 +100,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
assertTrue(resultAsString.contains(errorMessage));
}
+ @Test
public void testCloseDurableClients() throws Exception {
setupSystem();
setupCqs();
@@ -127,8 +130,8 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
String errorMessage = CliStrings.format(CliStrings.NO_CLIENT_FOUND_WITH_CLIENT_ID, clientName);
assertTrue(resultAsString.contains(errorMessage));
}
-
-
+
+ @Test
public void testCloseDurableCQ() throws Exception{
setupSystem();
setupCqs();
@@ -156,17 +159,8 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
assertTrue(Status.ERROR.equals(commandResult.getStatus()));
}
-
-// public void testRepeat() throws Exception {
-// long endTime = System.currentTimeMillis() + (75 * 60000);
-// while (endTime > System.currentTimeMillis()) {
-// testCountSubscriptionQueueSize();
-// tearDown();
-// setUp();
-// }
-// testCountSubscriptionQueueSize();
-// }
-//
+
+ @Test
public void testCountSubscriptionQueueSize() throws Exception {
setupSystem();
setupCqs();
@@ -250,7 +244,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
}
private void writeToLog(String text, String resultAsString) {
- LogWriterUtils.getLogWriter().info(getUniqueName() + ": " + text + "\n" + resultAsString);
+ getLogWriter().info(getUniqueName() + ": " + text + "\n" + resultAsString);
}
private void setupSystem() throws Exception {
@@ -360,7 +354,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
getSystem(props);
final ClientCacheFactory ccf = new ClientCacheFactory(props);
- ccf.addPoolServer(NetworkUtils.getServerHostName(server.getHost()), port);
+ ccf.addPoolServer(getServerHostName(server.getHost()), port);
ccf.setPoolSubscriptionEnabled(true);
ClientCache cache = (ClientCache)getClientCache(ccf);
@@ -368,10 +362,9 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
});
}
- /* Does few puts on the region on the server
- *
+ /**
+ * Does few puts on the region on the server
*/
-
private void doPuts(final String regionName, VM server) {
server.invoke(new SerializableCallable() {
public Object call() throws Exception {
@@ -423,7 +416,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase {
protected Properties getServerProperties() {
Properties p = new Properties();
- p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
+ p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+getDUnitLocatorPort()+"]");
return p;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
index e2950c2..f268c8f 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java
@@ -19,11 +19,13 @@ package com.gemstone.gemfire.security;
import static com.gemstone.gemfire.security.SecurityTestUtils.*;
import static com.gemstone.gemfire.test.dunit.IgnoredException.*;
-import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
/**
* Tests for authorization from client to server. This tests for authorization
* of all operations with both valid and invalid credentials/modules with
@@ -35,7 +37,7 @@ import org.junit.experimental.categories.Category;
*
* @since 5.5
*/
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
public class ClientAuthorizationTwoDUnitTest extends ClientAuthorizationTestCase {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
index 0e8e57f..fe0e4c3 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
@@ -26,6 +26,9 @@ import java.util.List;
import java.util.Properties;
import java.util.Random;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.Instantiator;
import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
@@ -38,8 +41,7 @@ import com.gemstone.gemfire.security.generator.DummyCredentialGenerator;
import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
/**
* Tests for authorization callback that modify objects and callbacks from
@@ -57,7 +59,7 @@ import org.junit.experimental.categories.Category;
*
* @since 5.5
*/
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
public class ClientAuthzObjectModDUnitTest extends ClientAuthorizationTestCase {
private static final String preAccessor = FilterPreAuthorization.class.getName() + ".create";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java
index dfa89f9..e3e7886 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java
@@ -29,6 +29,9 @@ import java.util.Map;
import java.util.Properties;
import java.util.Random;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
import com.gemstone.gemfire.cache.query.CqAttributes;
@@ -50,13 +53,12 @@ import com.gemstone.gemfire.security.generator.CredentialGenerator;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
/**
* This is for multiuser-authentication
*/
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
public class ClientCQPostAuthorizationDUnitTest extends ClientAuthorizationTestCase {
private Map<String, String> cqNameToQueryStrings = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java
index ce03ac6..5db15f0 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java
@@ -26,15 +26,18 @@ import java.util.List;
import java.util.Properties;
import java.util.Random;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
import com.gemstone.gemfire.security.generator.AuthzCredentialGenerator;
import com.gemstone.gemfire.security.generator.CredentialGenerator;
import com.gemstone.gemfire.test.junit.Retry;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
import com.gemstone.gemfire.test.junit.rules.RetryRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
/**
* Tests for authorization from client to server. This tests for authorization
@@ -43,14 +46,14 @@ import org.junit.experimental.categories.Category;
*
* @since 5.5
*/
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class, FlakyTest.class}) // GEODE-693, GEODE-1009: getRandomAvailablePort
public class ClientPostAuthorizationDUnitTest extends ClientAuthorizationTestCase {
@Rule
public RetryRule retryRule = new RetryRule();
@Test
- @Retry(2)
+ @Retry(2) // GEODE-693: getRandomAvailablePort
public void testAllPostOps() throws Exception {
OperationWithAction[] allOps = allOpsForTestAllPostOps();
@@ -112,6 +115,7 @@ public class ClientPostAuthorizationDUnitTest extends ClientAuthorizationTestCas
}
@Test
+ @Retry(2) // GEODE-1009: getRandomAvailablePort
public void testAllOpsNotifications() throws Exception {
OperationWithAction[] allOps = allOpsForTestAllOpsNotifications();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserAPIDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserAPIDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserAPIDUnitTest.java
index 9e04f5f..9bbceff 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserAPIDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserAPIDUnitTest.java
@@ -26,6 +26,9 @@ import java.util.Properties;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.execute.FunctionService;
@@ -38,10 +41,9 @@ import com.gemstone.gemfire.internal.cache.PoolManagerImpl;
import com.gemstone.gemfire.security.generator.CredentialGenerator;
import com.gemstone.gemfire.security.generator.DummyCredentialGenerator;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
public class MultiUserAPIDUnitTest extends ClientAuthorizationTestCase {
private static final String[] serverIgnoredExceptions = {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserDurableCQAuthzDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserDurableCQAuthzDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserDurableCQAuthzDUnitTest.java
index 632a997..3a97b7c 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserDurableCQAuthzDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/MultiUserDurableCQAuthzDUnitTest.java
@@ -27,6 +27,9 @@ import java.util.Map;
import java.util.Properties;
import java.util.Random;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
import com.gemstone.gemfire.cache.query.CqAttributes;
@@ -45,10 +48,9 @@ import com.gemstone.gemfire.security.generator.AuthzCredentialGenerator;
import com.gemstone.gemfire.security.generator.CredentialGenerator;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
public class MultiUserDurableCQAuthzDUnitTest extends ClientAuthorizationTestCase {
private final Map<String, String> cqNameToQueryStrings = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/FlakyTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/FlakyTest.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/FlakyTest.java
new file mode 100644
index 0000000..b1e9b18
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/FlakyTest.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.categories;
+
+/**
+ * JUnit Test Category that specifies a flickering test that fails
+ * intermittently.
+ */
+public interface FlakyTest {
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/SecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/SecurityTest.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/SecurityTest.java
new file mode 100644
index 0000000..3af739e
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/categories/SecurityTest.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.categories;
+
+/**
+ * JUnit Test Category that specifies a test involving security.
+ */
+public class SecurityTest {
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RetryRule.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RetryRule.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RetryRule.java
index 8535fa5..7955d97 100755
--- a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RetryRule.java
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/RetryRule.java
@@ -79,7 +79,7 @@ public class RetryRule implements TestRule, Serializable {
return this.implementation.apply(base, description);
}
- protected abstract class AbstractRetryRule implements TestRule {
+ protected abstract class AbstractRetryRule implements TestRule, Serializable {
protected AbstractRetryRule() {
}
protected void evaluate(final Statement base, final Description description, final int retryCount) throws Throwable {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryOne.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryOne.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryOne.java
new file mode 100644
index 0000000..8d3549b
--- /dev/null
+++ b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryOne.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.categories;
+
+public interface CategoryOne {
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTest.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTest.java
new file mode 100644
index 0000000..be342c1
--- /dev/null
+++ b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTest.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.categories;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Categories;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Result;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.gemstone.gemfire.test.junit.rules.TestRunner;
+
+@Category(UnitTest.class)
+public class CategoryTest {
+
+ private static boolean executedClassOneMethodNone; // 1
+ private static boolean executedClassOneMethodTwo; // 2
+ private static boolean executedClassTwoMethodTwo; // 3
+ private static boolean executedClassNoneMethodOne; // 4
+ private static boolean executedClassNoneMethodTwo; // 5
+ private static boolean executedClassTwoMethodOne; // 6
+ private static boolean executedClassOneMethodOne; // 7
+ private static boolean executedClassOneAndTwoMethodNone; // 8
+ private static boolean executedClassNoneMethodOneAndTwo; // 9
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ executedClassOneMethodNone = false;
+ executedClassOneMethodTwo = false;
+ executedClassTwoMethodTwo = false;
+ executedClassNoneMethodOne = false;
+ executedClassNoneMethodTwo = false;
+ executedClassTwoMethodOne = false;
+ executedClassOneMethodOne = false;
+ executedClassOneAndTwoMethodNone = false;
+ executedClassNoneMethodOneAndTwo = false;
+ }
+
+ @AfterClass
+ public static void afterClass() throws Exception {
+ }
+
+ @Test
+ public void allTestsWithCategoryOneShouldBeExecuted() {
+ Result result = TestRunner.runTest(CategoryTestSuite.class);
+
+ assertThat(result.wasSuccessful()).isTrue();
+ assertThat(executedClassOneMethodNone).isTrue();
+ assertThat(executedClassOneMethodTwo).isTrue();
+ assertThat(executedClassTwoMethodTwo).isFalse();
+ assertThat(executedClassNoneMethodOne).isTrue();
+ assertThat(executedClassNoneMethodTwo).isFalse();
+ assertThat(executedClassTwoMethodOne).isTrue();
+ assertThat(executedClassOneMethodOne).isTrue();
+ assertThat(executedClassOneAndTwoMethodNone).isTrue();
+ assertThat(executedClassNoneMethodOneAndTwo).isTrue();
+ }
+
+ @Category(CategoryOne.class)
+ public static class ClassOneMethodNone { // 1
+ @Test
+ public void test() {
+ executedClassOneMethodNone = true;
+ }
+ }
+
+ @Category(CategoryOne.class)
+ public static class ClassOneMethodTwo { // 2
+ @Category(CategoryTwo.class)
+ @Test
+ public void test() {
+ executedClassOneMethodTwo = true;
+ }
+ }
+
+ @Category(CategoryTwo.class)
+ public static class ClassTwoMethodTwo { // 3
+ @Category(CategoryTwo.class)
+ @Test
+ public void test() {
+ executedClassTwoMethodTwo = true;
+ }
+ }
+
+ public static class ClassNoneMethodOne { // 4
+ @Category(CategoryOne.class)
+ @Test
+ public void test() {
+ executedClassNoneMethodOne = true;
+ }
+ }
+
+ public static class ClassNoneMethodTwo { // 5
+ @Category(CategoryTwo.class)
+ @Test
+ public void test() {
+ executedClassNoneMethodTwo = true;
+ }
+ }
+
+ @Category(CategoryTwo.class)
+ public static class ClassTwoMethodOne { // 6
+ @Category(CategoryOne.class)
+ @Test
+ public void test() {
+ executedClassTwoMethodOne = true;
+ }
+ }
+
+ @Category(CategoryOne.class)
+ public static class ClassOneMethodOne { // 7
+ @Category(CategoryOne.class)
+ @Test
+ public void test() {
+ executedClassOneMethodOne = true;
+ }
+ }
+
+ @Category({ CategoryOne.class, CategoryTwo.class })
+ public static class ClassOneAndTwoMethodNone { // 8
+ @Test
+ public void test() {
+ executedClassOneAndTwoMethodNone = true;
+ }
+ }
+
+ public static class ClassNoneMethodOneAndTwo { // 9
+ @Category({ CategoryOne.class, CategoryTwo.class })
+ @Test
+ public void test() {
+ executedClassNoneMethodOneAndTwo = true;
+ }
+ }
+
+ @RunWith(Categories.class)
+ @Categories.IncludeCategory(CategoryOne.class)
+ @Suite.SuiteClasses({
+ ClassOneMethodNone.class, // 1
+ ClassOneMethodTwo.class, // 2
+ ClassTwoMethodTwo.class, // 3
+ ClassNoneMethodOne.class, // 4
+ ClassNoneMethodTwo.class, // 5
+ ClassTwoMethodOne.class, // 6
+ ClassOneMethodOne.class, // 7
+ ClassOneAndTwoMethodNone.class, // 8
+ ClassNoneMethodOneAndTwo.class // 9
+ })
+ public static class CategoryTestSuite {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTwo.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTwo.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTwo.java
new file mode 100644
index 0000000..4a88339
--- /dev/null
+++ b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/categories/CategoryTwo.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.categories;
+
+public interface CategoryTwo {
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
index 9bfce05..719fd92 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WANCommandTestBase.java
@@ -16,13 +16,14 @@
*/
package com.gemstone.gemfire.internal.cache.wan.wancommand;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
-
import javax.management.remote.JMXConnectorServer;
import com.gemstone.gemfire.cache.Cache;
@@ -44,13 +45,13 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
import com.gemstone.gemfire.management.ManagementService;
import com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase;
+import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.Invoke;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
-public class WANCommandTestBase extends CliCommandTestBase{
+public class WANCommandTestBase extends CliCommandTestBase {
static Cache cache;
private JMXConnectorServer jmxConnectorServer;
@@ -67,10 +68,6 @@ public class WANCommandTestBase extends CliCommandTestBase{
static VM vm6;
static VM vm7;
- public WANCommandTestBase(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
final Host host = Host.getHost(0);
@@ -86,7 +83,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static Integer createFirstLocatorWithDSId(int dsId) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -99,7 +96,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -112,7 +109,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static void createCache(Integer locPort){
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort + "]");
@@ -121,7 +118,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static void createCacheWithGroups(Integer locPort, String groups){
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort + "]");
@@ -214,7 +211,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static int createAndStartReceiver(int locPort) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
@@ -238,7 +235,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static int createReceiver(int locPort) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
@@ -256,7 +253,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static int createReceiverWithGroup(int locPort, String groups) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
@@ -275,7 +272,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static void startReceiver() {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
try {
Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
for (GatewayReceiver receiver : receivers) {
@@ -288,7 +285,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static void stopReceiver() {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
for (GatewayReceiver receiver : receivers) {
receiver.stop();
@@ -296,7 +293,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static int createAndStartReceiverWithGroup(int locPort, String groups) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
@@ -444,7 +441,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
}
public static void verifyReceiverState(boolean isRunning) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
for (GatewayReceiver receiver : receivers) {
assertEquals(isRunning, receiver.isRunning());
@@ -455,7 +452,7 @@ public class WANCommandTestBase extends CliCommandTestBase{
int startPort, int endPort, String bindAddress, int maxTimeBetweenPings,
int socketBufferSize, List<String> expectedGatewayTransportFilters) {
- WANCommandTestBase test = new WANCommandTestBase(getTestMethodName());
+ WANCommandTestBase test = new WANCommandTestBase();
Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
assertEquals("Number of receivers is incorrect", 1, receivers.size());
for (GatewayReceiver receiver : receivers) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
index 1122059..d9a551b 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewayReceiverDUnitTest.java
@@ -16,12 +16,16 @@
*/
package com.gemstone.gemfire.internal.cache.wan.wancommand;
-import hydra.Log;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.wan.GatewayReceiver;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -31,22 +35,20 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* DUnit tests for 'create gateway-receiver' command.
*/
-public class WanCommandCreateGatewayReceiverDUnitTest extends
- WANCommandTestBase {
+@Category(DistributedTest.class)
+public class WanCommandCreateGatewayReceiverDUnitTest extends WANCommandTestBase {
private static final long serialVersionUID = 1L;
- public WanCommandCreateGatewayReceiverDUnitTest(String name) {
- super(name);
- }
-
/**
* GatewayReceiver with all default attributes
*/
+ @Test
public void testCreateGatewayReceiverWithDefault() {
VM puneLocator = Host.getLocator();
@@ -68,7 +70,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -109,6 +111,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
/**
* GatewayReceiver with given attributes
*/
+ @Test
public void testCreateGatewayReceiver() {
VM puneLocator = Host.getLocator();
@@ -136,7 +139,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -165,6 +168,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
/**
* GatewayReceiver with given attributes and a single GatewayTransportFilter.
*/
+ @Test
public void testCreateGatewayReceiverWithGatewayTransportFilter() {
VM puneLocator = Host.getLocator();
@@ -193,7 +197,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -225,6 +229,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
/**
* GatewayReceiver with given attributes and multiple GatewayTransportFilters.
*/
+ @Test
public void testCreateGatewayReceiverWithMultipleGatewayTransportFilters() {
VM puneLocator = Host.getLocator();
@@ -254,7 +259,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -288,6 +293,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
* GatewayReceiver with given attributes.
* Error scenario where startPort is greater than endPort.
*/
+ @Test
public void testCreateGatewayReceiver_Error() {
VM puneLocator = Host.getLocator();
@@ -314,7 +320,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -336,6 +342,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
/**
* GatewayReceiver with given attributes on the given member.
*/
+ @Test
public void testCreateGatewayReceiver_onMember() {
VM puneLocator = Host.getLocator();
@@ -366,7 +373,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -391,6 +398,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
/**
* GatewayReceiver with given attributes on multiple members.
*/
+ @Test
public void testCreateGatewayReceiver_onMultipleMembers() {
VM puneLocator = Host.getLocator();
@@ -422,7 +430,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -449,6 +457,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
/**
* GatewayReceiver with given attributes on the given group.
*/
+ @Test
public void testCreateGatewayReceiver_onGroup() {
VM puneLocator = Host.getLocator();
@@ -477,7 +486,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -507,6 +516,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
* GatewayReceiver with given attributes on the given group.
* Only 2 of 3 members are part of the group.
*/
+ @Test
public void testCreateGatewayReceiver_onGroup_Scenario2() {
VM puneLocator = Host.getLocator();
@@ -535,7 +545,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -562,6 +572,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
/**
* GatewayReceiver with given attributes on multiple groups.
*/
+ @Test
public void testCreateGatewayReceiver_onMultipleGroups() {
VM puneLocator = Host.getLocator();
@@ -590,7 +601,7 @@ public class WanCommandCreateGatewayReceiverDUnitTest extends
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
index 2c99ad3..d5c4b75 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandCreateGatewaySenderDUnitTest.java
@@ -16,14 +16,18 @@
*/
package com.gemstone.gemfire.internal.cache.wan.wancommand;
-import hydra.Log;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
@@ -32,15 +36,13 @@ import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+@Category(DistributedTest.class)
public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
private static final long serialVersionUID = 1L;
- public WanCommandCreateGatewaySenderDUnitTest(String name) {
- super(name);
- }
-
private CommandResult executeCommandWithIgnoredExceptions(String command) {
final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
try {
@@ -55,6 +57,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
/**
* GatewaySender with all default attributes
*/
+ @Test
public void testCreateGatewaySenderWithDefault() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -77,7 +80,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -103,6 +106,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
/**
* GatewaySender with given attribute values
*/
+ @Test
public void testCreateGatewaySender() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -139,7 +143,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -174,6 +178,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
* Error scenario where dispatcher threads is set to more than 1 and
* no order policy provided.
*/
+ @Test
public void testCreateGatewaySender_Error() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -209,7 +214,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -226,10 +231,10 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
}
-
/**
* GatewaySender with given attribute values and event filters.
*/
+ @Test
public void testCreateGatewaySenderWithGatewayEventFilters() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -268,7 +273,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -304,6 +309,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
/**
* GatewaySender with given attribute values and transport filters.
*/
+ @Test
public void testCreateGatewaySenderWithGatewayTransportFilters() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -341,7 +347,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -376,6 +382,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
/**
* GatewaySender with given attribute values on given member.
*/
+ @Test
public void testCreateGatewaySender_OnMember() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -415,7 +422,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -440,6 +447,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
/**
* GatewaySender with given attribute values on given group
*/
+ @Test
public void testCreateGatewaySender_Group() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -477,7 +485,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -504,6 +512,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
* GatewaySender with given attribute values on given group.
* Only 2 of 3 members are part of the group.
*/
+ @Test
public void testCreateGatewaySender_Group_Scenario2() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -541,7 +550,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -565,6 +574,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
/**
* Parallel GatewaySender with given attribute values
*/
+ @Test
public void testCreateParallelGatewaySender() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -599,7 +609,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
@@ -633,6 +643,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
* Parallel GatewaySender with given attribute values.
* Provide dispatcherThreads as 2 which is not valid for Parallel sender.
*/
+ @Test
public void testCreateParallelGatewaySender_Error() {
Integer punePort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId( 1 ));
@@ -673,7 +684,7 @@ public class WanCommandCreateGatewaySenderDUnitTest extends WANCommandTestBase {
CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
- Log.getLogWriter().info(
+ getLogWriter().info(
"testCreateGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());