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/06/07 20:55:15 UTC
[60/62] [abbrv] incubator-geode git commit: Merge remote-tracking
branch 'origin/develop' into feature/GEODE-837
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/extensions/geode-modules-hibernate/src/test/java/com/gemstone/gemfire/modules/SecondVMTest.java
----------------------------------------------------------------------
diff --cc extensions/geode-modules-hibernate/src/test/java/com/gemstone/gemfire/modules/SecondVMTest.java
index 7c64c3c,f2fb584..d4df02c
--- a/extensions/geode-modules-hibernate/src/test/java/com/gemstone/gemfire/modules/SecondVMTest.java
+++ b/extensions/geode-modules-hibernate/src/test/java/com/gemstone/gemfire/modules/SecondVMTest.java
@@@ -16,18 -16,6 +16,20 @@@
*/
package com.gemstone.gemfire.modules;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
++
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+
+import org.hibernate.Session;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.GemFireCache;
@@@ -35,19 -23,33 +37,19 @@@ import com.gemstone.gemfire.cache.Regio
import com.gemstone.gemfire.cache.Region.Entry;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import junit.framework.TestCase;
-import org.hibernate.Session;
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.logging.Level;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-@Ignore("Can this test be deleted?")
@Category(IntegrationTest.class)
-public class SecondVMTest extends TestCase {
+@Ignore("Can this test be deleted?")
+public class SecondVMTest {
private Logger log = LoggerFactory.getLogger(getClass());
-
- public void testNoop() {
-
- }
- public void _testStartEmptyVM() throws IOException {
+
+ @Ignore
+ @Test
+ public void testStartEmptyVM() throws IOException {
Properties gemfireProperties = new Properties();
- gemfireProperties.setProperty("mcast-port", "5555");
- gemfireProperties.setProperty("log-level", "fine");
+ gemfireProperties.setProperty(MCAST_PORT, "5555");
+ gemfireProperties.setProperty(LOG_LEVEL, "fine");
Cache cache = new CacheFactory(gemfireProperties).create();
System.in.read();
Iterator it = cache.rootRegions().iterator();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/extensions/geode-modules/src/test/java/com/gemstone/gemfire/modules/session/TestSessionsBase.java
----------------------------------------------------------------------
diff --cc extensions/geode-modules/src/test/java/com/gemstone/gemfire/modules/session/TestSessionsBase.java
index 1d4d643,292f5ca..f2ef993
--- a/extensions/geode-modules/src/test/java/com/gemstone/gemfire/modules/session/TestSessionsBase.java
+++ b/extensions/geode-modules/src/test/java/com/gemstone/gemfire/modules/session/TestSessionsBase.java
@@@ -16,15 -16,10 +16,16 @@@
*/
package com.gemstone.gemfire.modules.session;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.modules.session.catalina.DeltaSessionManager;
-import com.gemstone.gemfire.modules.session.catalina.PeerToPeerCacheLifecycleListener;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.beans.PropertyChangeEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
@@@ -185,36 -185,36 +186,6 @@@ public abstract class TestSessionsBase
}
/**
-- * Check that our session persists beyond the container restarting.
-- */
--// public void testSessionPersists2() throws Exception {
--// String key = "value_testSessionPersists2";
--// String value = "Foo";
--//
--// WebConversation wc = new WebConversation();
--// WebRequest req = new GetMethodWebRequest("http://localhost:7890/test");
--// req.setParameter("cmd", QueryCommand.SET.name());
--// req.setParameter("param", key);
--// req.setParameter("value", value);
--// WebResponse response = wc.getResponse(req);
--// String sessionId = response.getNewCookieValue("JSESSIONID");
--//
--// assertNotNull("No apparent session cookie", sessionId);
--//
--// // Restart the container
--// AllTests.teardownClass();
--// AllTests.setupClass();
--//
--// // The request retains the cookie from the prior response...
--// req.setParameter("cmd", QueryCommand.GET.name());
--// req.setParameter("param", key);
--// req.removeParameter("value");
--// response = wc.getResponse(req);
--//
--// assertIndexDetailsEquals(value, response.getText());
--// }
--
-- /**
* Test that invalidating a session makes it's attributes inaccessible.
*/
@Test
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
index 5d224e7,5c10342..d384fef
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
@@@ -46,10 -37,9 +46,10 @@@ import java.util.*
/**
* Dunit Test to validate OnRegion function execution with REST APIs
*
- * @since 8.0
+ * @since GemFire 8.0
*/
+@Category(DistributedTest.class)
public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
private final String REPLICATE_REGION_NAME = "sampleRRegion";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --cc geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
index db5393e,eca5656..e61d984
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
@@@ -17,27 -17,16 +17,18 @@@
*/
package com.gemstone.gemfire.rest.internal.web.controllers;
- import org.junit.experimental.categories.Category;
- import org.junit.Test;
-
- import static org.junit.Assert.*;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.management.internal.AgentUtil;
-import com.gemstone.gemfire.rest.internal.web.RestFunctionTemplate;
-import com.gemstone.gemfire.test.dunit.*;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
++import static com.gemstone.gemfire.test.dunit.Assert.*;
+
- import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
- import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
- import com.gemstone.gemfire.test.junit.categories.DistributedTest;
++import java.io.BufferedReader;
++import java.io.IOException;
++import java.io.InputStream;
++import java.io.InputStreamReader;
++import java.util.ArrayList;
++import java.util.List;
++import java.util.Properties;
++import java.util.Random;
+
- import com.gemstone.gemfire.cache.Cache;
- import com.gemstone.gemfire.cache.CacheFactory;
- import com.gemstone.gemfire.cache.execute.Function;
- import com.gemstone.gemfire.cache.execute.FunctionService;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
- import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
- import com.gemstone.gemfire.internal.AvailablePortHelper;
- import com.gemstone.gemfire.internal.GemFireVersion;
- import com.gemstone.gemfire.internal.lang.StringUtils;
- import com.gemstone.gemfire.management.internal.AgentUtil;
- import com.gemstone.gemfire.rest.internal.web.RestFunctionTemplate;
- import com.gemstone.gemfire.test.dunit.*;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.CloseableHttpResponse;
@@@ -47,18 -36,19 +38,26 @@@ import org.apache.http.entity.StringEnt
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.json.JSONArray;
++import org.junit.experimental.categories.Category;
--import java.io.BufferedReader;
--import java.io.IOException;
--import java.io.InputStream;
--import java.io.InputStreamReader;
--import java.util.ArrayList;
--import java.util.List;
--import java.util.Properties;
--import java.util.Random;
++import com.gemstone.gemfire.cache.Cache;
++import com.gemstone.gemfire.cache.CacheFactory;
++import com.gemstone.gemfire.cache.execute.FunctionService;
++import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
++import com.gemstone.gemfire.internal.AvailablePortHelper;
++import com.gemstone.gemfire.internal.GemFireVersion;
++import com.gemstone.gemfire.internal.lang.StringUtils;
++import com.gemstone.gemfire.management.internal.AgentUtil;
++import com.gemstone.gemfire.rest.internal.web.RestFunctionTemplate;
++import com.gemstone.gemfire.test.dunit.Host;
++import com.gemstone.gemfire.test.dunit.Invoke;
++import com.gemstone.gemfire.test.dunit.VM;
++import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
++import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+@Category(DistributedTest.class)
+public class RestAPITestBase extends JUnit4DistributedTestCase {
+
-public class RestAPITestBase extends DistributedTestCase {
protected Cache cache = null;
protected List<String> restURLs = new ArrayList();
protected VM vm0 = null;
@@@ -66,10 -56,10 +65,6 @@@
protected VM vm2 = null;
protected VM vm3 = null;
- public RestAPITestBase() {
- super();
- public RestAPITestBase(String name) {
- super(name);
-- }
--
@Override
public final void postSetUp() throws Exception {
disconnectAllFromDS();
@@@ -142,6 -132,6 +137,7 @@@
protected CloseableHttpResponse executeFunctionThroughRestCall(String function, String regionName, String filter, String jsonBody, String groups,
String members) {
System.out.println("Entering executeFunctionThroughRestCall");
++ CloseableHttpResponse value = null;
try {
CloseableHttpClient httpclient = HttpClients.createDefault();
Random randomGenerator = new Random();
@@@ -150,10 -140,10 +146,11 @@@
HttpPost post = createHTTPPost(function, regionName, filter, restURLIndex, groups, members, jsonBody);
System.out.println("Request: POST " + post.toString());
-- return httpclient.execute(post);
++ value = httpclient.execute(post);
} catch (Exception e) {
-- throw new RuntimeException("unexpected exception", e);
++ fail("unexpected exception", e);
}
++ return value;
}
private HttpPost createHTTPPost(String function, String regionName, String filter, int restUrlIndex, String groups, String members, String jsonBody) {
@@@ -199,7 -189,7 +196,7 @@@
JSONArray resultArray = new JSONArray(httpResponseString);
assertEquals(resultArray.length(), expectedServerResponses);
} catch (Exception e) {
-- e.printStackTrace();
++ fail("exception", e);
}
}
@@@ -216,7 -206,7 +213,7 @@@
}
return sb.toString();
} catch (IOException e) {
-- LogWriterUtils.getLogWriter().error("Error in processing Http Response", e);
++ fail("exception", e);
}
return "";
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
index 7718cbd,c0b5c79..b601b3a
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
@@@ -62,10 -54,9 +63,10 @@@ import static com.gemstone.gemfire.dist
/**
* Dunit Test containing inter - operations between REST Client and Gemfire cache client
*
- * @since 8.0
+ * @since GemFire 8.0
*/
+@Category(DistributedTest.class)
public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
private static final long serialVersionUID = -254776154266339226L;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
index 00b08ad,901f15f..b2b31e4
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
@@@ -36,10 -26,8 +35,9 @@@ import com.gemstone.gemfire.rest.intern
import org.apache.http.client.methods.CloseableHttpResponse;
import java.util.Properties;
+ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+@Category(DistributedTest.class)
public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
----------------------------------------------------------------------
diff --cc geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
index 7003b50,f10d96b..b63b6ec
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
@@@ -16,61 -16,33 +16,62 @@@
*/
package com.gemstone.gemfire.rest.internal.web.controllers;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.distributed.ServerLauncher;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.management.internal.AgentUtil;
-import com.gemstone.gemfire.management.internal.ManagementConstants;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import junit.framework.TestCase;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+ import org.json.JSONArray;
+ import org.json.JSONException;
+ import org.json.JSONObject;
++import org.junit.After;
++import org.junit.Before;
++import org.junit.Test;
+ import org.junit.experimental.categories.Category;
-import org.springframework.http.*;
++import org.springframework.http.HttpEntity;
++import org.springframework.http.HttpHeaders;
++import org.springframework.http.HttpMethod;
++import org.springframework.http.HttpStatus;
++import org.springframework.http.MediaType;
++import org.springframework.http.ResponseEntity;
+ import org.springframework.util.StringUtils;
+ import org.springframework.web.client.HttpClientErrorException;
+ import org.springframework.web.client.HttpServerErrorException;
+
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheWriter;
+import com.gemstone.gemfire.cache.CacheWriterException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.TimeoutException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.distributed.ServerLauncher;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.management.internal.AgentUtil;
+import com.gemstone.gemfire.management.internal.ManagementConstants;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
- import org.json.JSONArray;
- import org.json.JSONException;
- import org.json.JSONObject;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- import org.junit.experimental.categories.Category;
- import org.springframework.http.HttpEntity;
- import org.springframework.http.HttpHeaders;
- import org.springframework.http.HttpMethod;
- import org.springframework.http.HttpStatus;
- import org.springframework.http.MediaType;
- import org.springframework.http.ResponseEntity;
- import org.springframework.util.StringUtils;
- import org.springframework.web.client.HttpClientErrorException;
- import org.springframework.web.client.HttpServerErrorException;
-
@Category(IntegrationTest.class)
-public class RestAPIsQueryAndFEJUnitTest extends TestCase {
+public class RestAPIsQueryAndFEJUnitTest {
private Cache c;
@@@ -82,9 -54,9 +83,6 @@@
private final String CUSTOMER_REGION = "customers";
-- //DEBUG code
-- //private final String PEOPLE_REGION = "People";
--
private final String ITEM_REGION = "items";
private final String ORDER_REGION = "orders";
private final String PRIMITIVE_KV_STORE_REGION = "primitiveKVStore";
@@@ -1280,9 -1252,9 +1278,9 @@@
return baseURL + RestTestUtils.GEMFIRE_REST_API_CONTEXT + RestTestUtils.GEMFIRE_REST_API_VERSION + requestPart;
}
}
++
public void initializeQueryTestData() {
--
-- //LIST_ALL_NAMED_QUERY
++ //LIST_ALL_NAMED_QUERY
int size = PARAMETERIZED_QUERIES.length;
List<String> queryIds = new ArrayList<>();
for (int i=0; i < size; i++ ){
@@@ -1321,9 -1293,10 +1319,8 @@@
queryResultByIndex.put(48, qIndex48_resultData);
}
- @Override
- @SuppressWarnings("deprecation")
+ @Before
public void setUp() throws Exception {
--
AgentUtil agentUtil = new AgentUtil(GemFireVersion.getGemFireVersion());
if (agentUtil.findWarLocation("geode-web-api") == null) {
fail("unable to locate geode-web-api WAR file");
@@@ -1356,33 -1329,33 +1353,6 @@@
this.baseURL = "http://" + this.hostName + ":" + this.restServicePort;
this.c = CacheFactory.getAnyInstance();
-- /*
-- //Debug code
-- this.baseURL = "http://" + "localhost" + ":" + "8080";
--
-- this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0")
-- .set("rest-service-http-port", String.valueOf(this.restServicePort))
-- .set("rest-service-bind-address", this.hostName)
-- //.set("log-file", "./restJunitLogs/my.log")
-- .setPdxReadSerialized(true).create();
-- */
--
-- /*
-- this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0")
-- .set("rest-service-http-port", "8080")
-- .set("rest-service-bind-address", "localhost")
-- //.set("log-file", "./restJunitLogs/my.log")
-- .setPdxReadSerialized(true).create();
-- */
--
-- //start cache-server, Gemfire cache clients will connect it
-- /*
-- BridgeServer server = c.addCacheServer();
-- final int serverPort = 40405;
-- server.setPort(serverPort);
-- server.start();
-- */
--
final AttributesFactory<String, String> attributesFactory = new AttributesFactory<>();
attributesFactory.setDataPolicy(DataPolicy.REPLICATE);
@@@ -1391,9 -1364,9 +1361,6 @@@
.create();
c.createRegion(CUSTOMER_REGION, regionAttributes);
-- //Debug code
-- //c.createRegion(PEOPLE_REGION, regionAttributes);
--
// Create region, items
attributesFactory.setDataPolicy(DataPolicy.PARTITION);
c.createRegion(ITEM_REGION, regionAttributes);
@@@ -1426,10 -1399,10 +1393,9 @@@
FunctionService.registerFunction(new AddFreeItemToOrders());
}
- @Override
+ @After
public void tearDown() {
// shutdown and clean up the manager node.
-- //this.c.close();
ServerLauncher.getInstance().stop();
}
@@@ -1447,20 -1420,20 +1413,23 @@@
public void testCreateAsJson() {
executeQueryTestCases();
}
--
++
++ private void caught(String message, Throwable cause) {
++ throw new AssertionError(message, cause);
++ }
++
private void validateGetAllResult(int index, ResponseEntity<String> result){
-- if(index == 27 || index == 29 || index == 30) {
++ if (index == 27 || index == 29 || index == 30) {
try {
new JSONObject(result.getBody()).getJSONArray("customers");
} catch (JSONException e) {
-- fail("Caught JSONException in validateGetAllResult :: " + e.getMessage());
++ caught("Caught JSONException in validateGetAllResult :: " + e.getMessage(), e);
}
}
}
private void verifyRegionSize(int index, ResponseEntity<String> result) {
--
-- if(index == 59 ) {
++ if (index == 59 ) {
HttpHeaders headers = result.getHeaders();
String value = headers.getFirst("Resource-Count");
assertEquals(Integer.parseInt(value), 55);
@@@ -1468,8 -1441,8 +1437,7 @@@
}
private void validateQueryResult(int index, ResponseEntity<String> result){
--
-- if(Query_URL_INDEXS.contains(index)) {
++ if (Query_URL_INDEXS.contains(index)) {
queryResultByIndex = new HashMap<>();
initializeQueryTestData();
QueryResultData queryResult = queryResultByIndex.get(index);
@@@ -1485,7 -1458,7 +1453,7 @@@
assertTrue("PREPARE_PARAMETERIZED_QUERY: function IDs are not matched", queryResult.getResult().contains(jsonArray.getJSONObject(i).getString("id")));
}
} catch (JSONException e) {
-- fail("Caught JSONException in validateQueryResult :: " + e.getMessage());
++ caught("Caught JSONException in validateQueryResult :: " + e.getMessage(), e);
}
}
else if (index == 46 || index == 47 || index == 48) {
@@@ -1496,16 -1469,16 +1464,13 @@@
//verify query result size
assertEquals(queryResult.getResultSize(), jsonArray.length());
} catch (JSONException e) {
-- fail("Caught JSONException in validateQueryResult :: " + e.getMessage());
++ caught("Caught JSONException in validateQueryResult :: " + e.getMessage(), e);
}
--
}
--
}
}
private String addExpectedException (int index) {
--
String expectedEx = "appears to have started a thread named";
if (index == 4 || index == 5 || index == 24) {
expectedEx = "java.lang.UnsupportedOperationException";
@@@ -1519,118 -1492,118 +1484,110 @@@
expectedEx = "com.gemstone.gemfire.cache.CacheWriterException";
c.getLogger().info("<ExpectedException action=add>" + expectedEx + "</ExpectedException>");
return expectedEx;
-- }else if (index == 19) {
++ } else if (index == 19) {
expectedEx = "java.lang.IllegalArgumentException";
c.getLogger().info("<ExpectedException action=add>" + expectedEx + "</ExpectedException>");
return expectedEx;
-- }else if (index == 38 || index == 41 ) {
++ } else if (index == 38 || index == 41 ) {
expectedEx = "com.gemstone.gemfire.cache.RegionDestroyedException";
c.getLogger().info("<ExpectedException action=add>" + expectedEx + "</ExpectedException>");
return expectedEx;
}
return expectedEx;
--
}
-- private void executeQueryTestCases() {
++ private void executeQueryTestCases() {
HttpHeaders headers = setAcceptAndContentTypeHeaders();
HttpEntity<Object> entity;
int totalRequests = TEST_DATA.length;
String expectedEx = null;
-- for (int index=0; index < totalRequests; index++) {
-- //Debug code
-- /*
-- c.getLogger().info("-------------------------------");
-- c.getLogger().info("Index:" + index+ " " + TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX]);
--
-- if(index == 50){
-- System.out.println("Debug Here...!!");
-- }
-- */
-- try {
-- expectedEx = addExpectedException(index);
-- final String restRequestUrl = createRestURL(this.baseURL, TEST_DATA[index][URL_INDEX]);
--
-- entity = new HttpEntity<>(TEST_DATA[index][REQUEST_BODY_INDEX], headers);
-- ResponseEntity<String> result = RestTestUtils.getRestTemplate().exchange(
-- restRequestUrl,
-- (HttpMethod)TEST_DATA[index][METHOD_INDEX], entity, String.class);
--
-- validateGetAllResult(index, result);
-- validateQueryResult(index, result);
--
-- assertEquals(result.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-- assertEquals(result.hasBody(), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
--
-- verifyRegionSize(index, result);
-- //TODO:
-- //verify location header
--
-- } catch (HttpClientErrorException e) {
--
-- if( VALID_409_URL_INDEXS.contains(index)) {
-- //create-409, conflict testcase. [create on already existing key]
--
-- assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-- assertEquals(StringUtils.hasText(e.getResponseBodyAsString()),((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
--
-- }else if (VALID_400_URL_INDEXS.contains(index)) {
-- // 400, Bad Request testcases. [create with malformed Json]
--
-- assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-- assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
--
-- }
-- else if(VALID_404_URL_INDEXS.contains(index) ) {
-- // create-404, Not Found testcase. [create on not-existing region]
--
-- assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-- assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
--
-- }
-- else if(VALID_405_URL_INDEXS.contains(index) ) {
-- // create-404, Not Found testcase. [create on not-existing region]
--
-- assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-- assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
-- }
-- else {
-- fail( "Index:" + index+ " " + TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " should not have thrown exception ");
-- }
--
-- }catch (HttpServerErrorException se) {
-- //index=4, create- 500, INTERNAL_SERVER_ERROR testcase. [create on Region with DataPolicy=Empty set]
-- //index=7, create- 500, INTERNAL_SERVER_ERROR testcase. [Get, attached cache loader throws Timeout exception]
-- //index=11, put- 500, [While doing R.put, CacheWriter.beforeCreate() has thrown CacheWriterException]
-- //.... and more test cases
-- assertEquals(se.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-- assertEquals(StringUtils.hasText(se.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
--
++ for (int index=0; index < totalRequests; index++) {
++ try {
++ expectedEx = addExpectedException(index);
++ final String restRequestUrl = createRestURL(this.baseURL, TEST_DATA[index][URL_INDEX]);
++
++ entity = new HttpEntity<>(TEST_DATA[index][REQUEST_BODY_INDEX], headers);
++ ResponseEntity<String> result = RestTestUtils.getRestTemplate().exchange(
++ restRequestUrl,
++ (HttpMethod)TEST_DATA[index][METHOD_INDEX], entity, String.class);
++
++ validateGetAllResult(index, result);
++ validateQueryResult(index, result);
++
++ assertEquals(result.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
++ assertEquals(result.hasBody(), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
++
++ verifyRegionSize(index, result);
++ //TODO:
++ //verify location header
++
++ } catch (HttpClientErrorException e) {
++
++ if( VALID_409_URL_INDEXS.contains(index)) {
++ //create-409, conflict testcase. [create on already existing key]
++
++ assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
++ assertEquals(StringUtils.hasText(e.getResponseBodyAsString()),((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
++
++ }else if (VALID_400_URL_INDEXS.contains(index)) {
++ // 400, Bad Request testcases. [create with malformed Json]
++
++ assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
++ assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
++
}
-- catch (Exception e) {
-- throw new RuntimeException("caught Exception in executeQueryTestCases " + "Index:" + index+ " " + TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " :: Unexpected ERROR...!!", e);
-- }finally {
-- c.getLogger().info("<ExpectedException action=remove>" + expectedEx + "</ExpectedException>");
++ else if (VALID_404_URL_INDEXS.contains(index) ) {
++ // create-404, Not Found testcase. [create on not-existing region]
++
++ assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
++ assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
++
}
--
-- }
--
++ else if (VALID_405_URL_INDEXS.contains(index) ) {
++ // create-404, Not Found testcase. [create on not-existing region]
++
++ assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
++ assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
++ }
++ else {
++ fail( "Index:" + index+ " " + TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " should not have thrown exception ");
++ }
++
++ } catch (HttpServerErrorException se) {
++ //index=4, create- 500, INTERNAL_SERVER_ERROR testcase. [create on Region with DataPolicy=Empty set]
++ //index=7, create- 500, INTERNAL_SERVER_ERROR testcase. [Get, attached cache loader throws Timeout exception]
++ //index=11, put- 500, [While doing R.put, CacheWriter.beforeCreate() has thrown CacheWriterException]
++ //.... and more test cases
++ assertEquals(se.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
++ assertEquals(StringUtils.hasText(se.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
++
++ }
++ catch (Exception e) {
++ caught("caught Exception in executeQueryTestCases " + "Index:" + index+ " " + TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " :: Unexpected ERROR...!!", e);
++ } finally {
++ c.getLogger().info("<ExpectedException action=remove>" + expectedEx + "</ExpectedException>");
++ }
++ }
}
--
}
++// TODO: move following classes to be inner classes
++
class SimpleCacheLoader implements CacheLoader<String, Object>, Declarable {
++ @Override
public Object load(LoaderHelper helper) {
//throws TimeoutException
throw new TimeoutException("Could not load, Request Timedout...!!");
}
-- public void close() {
--
++
++ @Override
++ public void close() {
}
++
@Override
public void init(Properties props) {
@@@ -1640,10 -1613,10 +1597,12 @@@
class SampleCacheWriter implements CacheWriter<String, Object> {
@Override
-- public void close() { }
++ public void close() {
++ }
@Override
-- public void beforeUpdate(EntryEvent event) throws CacheWriterException { }
++ public void beforeUpdate(EntryEvent event) throws CacheWriterException {
++ }
@Override
public void beforeCreate(EntryEvent event) throws CacheWriterException {
@@@ -1656,16 -1629,16 +1615,18 @@@
}
@Override
-- public void beforeRegionDestroy(RegionEvent event) throws CacheWriterException { }
++ public void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
++ }
@Override
-- public void beforeRegionClear(RegionEvent event) throws CacheWriterException { }
++ public void beforeRegionClear(RegionEvent event) throws CacheWriterException {
++ }
}
enum QueryType {LIST_ALL_NAMED_QUERY, EXECUTE_NAMED_QUERY, EXECUTE_ADHOC_QUERY }
--class QueryResultData
--{
++class QueryResultData {
++
private int queryIndex;
private QueryType type;
private int resultSize;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
index 9681dad,e82d198..e6b16d0
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
@@@ -63,10 -52,12 +61,13 @@@ import java.util.HashMap
import java.util.Map;
import java.util.Properties;
+ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
/**
- * @since 8.0
+ *
+ * @since GemFire 8.0
*/
+@Category(DistributedTest.class)
public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
private static final long serialVersionUID = -254776154266339226L;
@@@ -422,72 -412,66 +423,72 @@@
validateConnection(restEndpoint, "SSL");
}
+ @Test
public void testSSLWithoutKeyStoreType() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
String restEndpoint = startInfraWithSSL(props, false);
validateConnection(restEndpoint, "SSL");
}
+ @Test
public void testSSLWithSSLProtocol() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+ props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL");
String restEndpoint = startInfraWithSSL(props, false);
validateConnection(restEndpoint, "SSL");
}
+ @Test
public void testSSLWithTLSProtocol() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLS");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+ props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLS");
String restEndpoint = startInfraWithSSL(props, false);
validateConnection(restEndpoint, "TLS");
}
+ @Test
public void testSSLWithTLSv11Protocol() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.1");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+ props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.1");
String restEndpoint = startInfraWithSSL(props, false);
validateConnection(restEndpoint, "TLSv1.1");
}
+ @Test
public void testSSLWithTLSv12Protocol() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+ props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
String restEndpoint = startInfraWithSSL(props, false);
validateConnection(restEndpoint, "TLSv1.2");
}
+ @Test
public void testWithMultipleProtocol() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL,TLSv1.2");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+ props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL,TLSv1.2");
String restEndpoint = startInfraWithSSL(props, false);
validateConnection(restEndpoint, "TLSv1.2");
@@@ -513,13 -496,12 +514,13 @@@
validateConnection(restEndpoint, "TLSv1.2");
}
+ @Test
public void testSSLWithMultipleCipherSuite() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+ props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "TLSv1.2");
SSLContext ssl = SSLContext.getInstance("TLSv1.2");
@@@ -532,18 -514,17 +533,18 @@@
validateConnection(restEndpoint, "TLSv1.2");
}
+ @Test
public void testMutualAuthentication() throws Exception {
Properties props = new Properties();
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, "true");
+ props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD, "password");
+ props.setProperty(HTTP_SERVICE_SSL_PROTOCOLS, "SSL");
+ props.setProperty(HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION, "true");
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, jks.getCanonicalPath());
+ props.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE, jks.getCanonicalPath());
- props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, "password");
+ props.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD, "password");
String restEndpoint = startInfraWithSSL(props, false);
validateConnection(restEndpoint, "SSL");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
index ff98394,34f6bbb..ce43f70
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
@@@ -16,33 -16,23 +16,33 @@@
*/
package com.gemstone.gemfire.cache;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.distributed.DistributedSystem;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Properties;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
/**
* verifies the count of clear operation
- *
*/
-public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class CacheRegionClearStatsDUnitTest extends JUnit4DistributedTestCase {
+
/** the cache */
private static GemFireCacheImpl cache = null;
@@@ -81,11 -76,11 +81,11 @@@
public static void createClientCache(String host, Integer port1)
throws Exception {
- new CacheRegionClearStatsDUnitTest("temp");
+ new CacheRegionClearStatsDUnitTest();
Properties props = new Properties();
- props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOCATORS_NAME, "");
+ props.setProperty(MCAST_PORT, "0");
+ props.setProperty(LOCATORS, "");
- new CacheRegionClearStatsDUnitTest("temp").createCache(props);
+ new CacheRegionClearStatsDUnitTest().createCache(props);
PoolImpl p = (PoolImpl)PoolManager.createFactory().addServer(host,
port1.intValue()).setSubscriptionEnabled(false)
.setThreadLocalConnections(true).setMinConnections(1).setReadTimeout(
@@@ -126,11 -121,11 +126,11 @@@
public static void createClientCacheDisk(String host, Integer port1)
throws Exception {
- new CacheRegionClearStatsDUnitTest("temp");
+ new CacheRegionClearStatsDUnitTest();
Properties props = new Properties();
- props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOCATORS_NAME, "");
+ props.setProperty(MCAST_PORT, "0");
+ props.setProperty(LOCATORS, "");
- new CacheRegionClearStatsDUnitTest("temp").createCache(props);
+ new CacheRegionClearStatsDUnitTest().createCache(props);
PoolImpl p = (PoolImpl)PoolManager.createFactory().addServer(host,
port1.intValue()).setSubscriptionEnabled(false)
.setThreadLocalConnections(true).setMinConnections(1).setReadTimeout(
@@@ -145,6 -140,6 +145,7 @@@
Region region = cache.createRegion(REGION_NAME, attrs);
//region.registerInterest("ALL_KEYS");
}
++
/**
* This test does the following (<b> clear stats counter </b>):<br>
* 1)Verifies that clear operation count matches with stats count<br>
@@@ -167,6 -161,6 +168,7 @@@
server1.invoke(() -> CacheRegionClearStatsDUnitTest.validationClearStat());
}
++
/**
* This test does the following (<b> clear stats counter when disk involved </b>):<br>
* 1)Verifies that clear operation count matches with stats count <br>
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
index 0966f8d,0932ff1..bbde730
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
@@@ -15,21 -15,7 +15,16 @@@
* limitations under the License.
*/
package com.gemstone.gemfire.cache;
+
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
- import java.io.IOException;
- import java.util.Properties;
-
- import org.junit.Ignore;
-
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
@@@ -38,20 -24,18 +33,19 @@@ import com.gemstone.gemfire.cache30.Cac
import com.gemstone.gemfire.distributed.internal.DSClock;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
- import com.gemstone.gemfire.test.dunit.Assert;
- import com.gemstone.gemfire.test.dunit.Host;
- import com.gemstone.gemfire.test.dunit.LogWriterUtils;
- import com.gemstone.gemfire.test.dunit.NetworkUtils;
- import com.gemstone.gemfire.test.dunit.SerializableCallable;
- import com.gemstone.gemfire.test.dunit.VM;
- import com.gemstone.gemfire.test.dunit.Wait;
- import com.gemstone.gemfire.test.dunit.WaitCriterion;
+ import com.gemstone.gemfire.test.dunit.*;
+ import org.junit.Ignore;
+
+ import java.io.IOException;
+ import java.util.Properties;
+
+ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-public class ClientServerTimeSyncDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ClientServerTimeSyncDUnitTest extends JUnit4CacheTestCase {
- public ClientServerTimeSyncDUnitTest(String name) {
- super(name);
+ public ClientServerTimeSyncDUnitTest() {
+ super();
}
@Ignore("Bug 52327")
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
index 90dfd39,412d3ed..f414621
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
@@@ -16,14 -16,6 +16,15 @@@
*/
package com.gemstone.gemfire.cache;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.server.CacheServer;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
index 545cf4c,b72734b..3ae6cf6
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
@@@ -866,9 -871,9 +866,9 @@@ public class ConnectionPoolDUnitTest ex
/**
* Tests the basic operations of the {@link Pool}
*
- * @since 3.5
+ * @since GemFire 3.5
*/
+ @Test
public void test006Pool() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -1465,9 -1471,8 +1465,9 @@@
/**
* Tests the create operation of the {@link Pool}
*
- * @since 3.5
+ * @since GemFire 3.5
*/
+ @Test
public void test011PoolCreate() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -1548,9 -1553,8 +1548,9 @@@
/**
* Tests the put operation of the {@link Pool}
*
- * @since 3.5
+ * @since GemFire 3.5
*/
+ @Test
public void test012PoolPut() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -1665,13 -1669,11 +1665,13 @@@
}
});
}
- /**
+
+ /**
* Tests the put operation of the {@link Pool}
*
- * @since 3.5
+ * @since GemFire 3.5
*/
+ @Test
public void test013PoolPutNoDeserialize() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -1790,9 -1792,8 +1790,9 @@@
/**
* Tests that invalidates and destroys are propagated to {@link Pool}s.
*
- * @since 3.5
+ * @since GemFire 3.5
*/
+ @Test
public void test014InvalidateAndDestroyPropagation() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -1989,9 -1990,8 +1989,9 @@@
* Tests that invalidates and destroys are propagated to {@link Pool}s
* correctly to DataPolicy.EMPTY + InterestPolicy.ALL
*
- * @since 5.0
+ * @since GemFire 5.0
*/
+ @Test
public void test015InvalidateAndDestroyToEmptyAllPropagation() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -2219,9 -2220,8 +2219,9 @@@
* Tests that invalidates and destroys are propagated to {@link Pool}s
* correctly to DataPolicy.EMPTY + InterestPolicy.CACHE_CONTENT
*
- * @since 5.0
+ * @since GemFire 5.0
*/
+ @Test
public void test016InvalidateAndDestroyToEmptyCCPropagation() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -3510,9 -3507,8 +3510,9 @@@
/**
* Tests the containsKeyOnServer operation of the {@link Pool}
*
- * @since 5.0.2
+ * @since GemFire 5.0.2
*/
+ @Test
public void test023ContainsKeyOnServer() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -3607,9 -3604,8 +3607,9 @@@
* <code>null</code> value does the right thing with the {@link
* Pool}.
*
- * @since 3.5
+ * @since GemFire 3.5
*/
+ @Test
public void test024CreateNullValue() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
@@@ -4911,9 -4902,9 +4911,9 @@@
/**
* Tests the keySetOnServer operation of the {@link Pool}
*
- * @since 5.0.2
+ * @since GemFire 5.0.2
*/
+ @Test
public void test031KeySetOnServer() throws CacheException {
final String name = this.getName();
final Host host = Host.getHost(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
index c272f29,8f82edd..fdefbfe
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
@@@ -16,7 -16,12 +16,8 @@@
*/
package com.gemstone.gemfire.cache.client;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
-import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.*;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.io.IOException;
import java.net.UnknownHostException;
@@@ -50,10 -35,10 +51,10 @@@ import com.gemstone.gemfire.test.junit.
* The ClientServerRegisterInterestsDUnitTest class is a test suite of test cases testing the interaction between a
* client and a server in a Register Interests scenario.
*
- * @since 8.0
- * @see com.gemstone.gemfire.test.dunit.DistributedTestCase
+ * @since GemFire 8.0
*/
-public class ClientServerRegisterInterestsDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class ClientServerRegisterInterestsDUnitTest extends JUnit4DistributedTestCase {
protected static final long WAIT_TIME_MILLISECONDS = TimeUnit.SECONDS.toMillis(5);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
index 4a501f9,3c675b8..6c2f3ec
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
@@@ -16,29 -16,14 +16,28 @@@
*/
package com.gemstone.gemfire.cache.client.internal;
-import com.gemstone.gemfire.cache.*;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+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.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.server.CacheServer;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
- import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.security.AuthenticationRequiredException;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.VM;
@@@ -58,7 -49,7 +57,7 @@@ public class CacheServerSSLConnectionDU
private static final String SERVER_KEY_STORE = "cacheserver.keystore";
private static final String SERVER_TRUST_STORE = "cacheserver.truststore";
- private static CacheServerSSLConnectionDUnitTest instance = new CacheServerSSLConnectionDUnitTest();
- private static CacheServerSSLConnectionDUnitTest instance = new CacheServerSSLConnectionDUnitTest("CacheServerSSLConnectionDUnit");
++ private static CacheServerSSLConnectionDUnitTest instance = new CacheServerSSLConnectionDUnitTest(); // TODO: memory leak
private Cache cache;
private CacheServer cacheServer;
@@@ -71,10 -62,14 +70,10 @@@
disconnectAllFromDS();
}
- public CacheServerSSLConnectionDUnitTest(String name) {
- super(name);
- }
-
public Cache createCache(Properties props) throws Exception
{
- props.setProperty("mcast-port", "0");
- props.setProperty("locators", "");
+ props.setProperty(MCAST_PORT, "0");
+ props.setProperty(LOCATORS, "");
cache = new CacheFactory(props).create();
if (cache == null) {
throw new Exception("CacheFactory.create() returned null ");
@@@ -102,7 -98,7 +102,6 @@@
this.cacheServer.stop();
}
--
@SuppressWarnings("rawtypes")
public void setUpServerVM(boolean cacheServerSslenabled) throws Exception {
Properties gemFireProps = new Properties();
@@@ -263,11 -246,10 +250,9 @@@
clientVM.invoke(() -> setUpClientVMTask(hostName, port, cacheClientSslenabled, cacheClientSslRequireAuth, CLIENT_KEY_STORE, CLIENT_TRUST_STORE));
clientVM.invoke(() -> doClientRegionTestTask());
serverVM.invoke(() -> doServerRegionTestTask());
--
}
--
+ @Test
public void testNonSSLClient() throws Exception {
final Host host = Host.getHost(0);
VM serverVM = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
index 3c0faf1,e143462..c372374
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
@@@ -16,34 -16,25 +16,34 @@@
*/
package com.gemstone.gemfire.cache.client.internal;
-import com.gemstone.gemfire.cache.*;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+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.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.server.CacheServer;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.util.test.TestUtil;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
/**
* Test for GEODE-396
*/
@@@ -65,10 -56,14 +65,10 @@@ public class SSLNoClientAuthDUnitTest e
disconnectAllFromDS();
}
- public SSLNoClientAuthDUnitTest(String name) {
- super(name);
- }
-
public Cache createCache(Properties props) throws Exception
{
- props.setProperty("mcast-port", "0");
- props.setProperty("locators", "");
+ props.setProperty(MCAST_PORT, "0");
+ props.setProperty(LOCATORS, "");
cache = new CacheFactory(props).create();
if (cache == null) {
throw new Exception("CacheFactory.create() returned null ");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
index ce05e05,68dfedc..412713f
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
@@@ -16,38 -16,7 +16,39 @@@
*/
package com.gemstone.gemfire.cache.management;
-import com.gemstone.gemfire.cache.*;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+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.AttributesMutator;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.LowMemoryException;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
@@@ -101,9 -46,19 +101,9 @@@ import com.gemstone.gemfire.test.junit.
/**
* Tests the Heap Memory thresholds of {@link ResourceManager}
- * @since 6.0
+ * @since GemFire 6.0
*/
+@Category(DistributedTest.class)
public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
public static class Range implements Serializable {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
index 266e6ea,3cd1d98..d89641c
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
@@@ -16,33 -16,7 +16,34 @@@
*/
package com.gemstone.gemfire.cache.management;
-import com.gemstone.gemfire.cache.*;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.LowMemoryException;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.ServerOperationException;
@@@ -52,49 -26,31 +53,48 @@@ import com.gemstone.gemfire.cache.serve
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.distributed.DistributedMember;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
-import com.gemstone.gemfire.internal.cache.*;
-import com.gemstone.gemfire.internal.cache.control.*;
+import com.gemstone.gemfire.internal.cache.DistributedRegion;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper;
+import com.gemstone.gemfire.internal.cache.ProxyBucketRegion;
+import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
+import com.gemstone.gemfire.internal.cache.control.MemoryEvent;
import com.gemstone.gemfire.internal.cache.control.MemoryThresholds.MemoryState;
+import com.gemstone.gemfire.internal.cache.control.OffHeapMemoryMonitor;
import com.gemstone.gemfire.internal.cache.control.OffHeapMemoryMonitor.OffHeapMemoryMonitorObserver;
+import com.gemstone.gemfire.internal.cache.control.ResourceAdvisor;
+import com.gemstone.gemfire.internal.cache.control.ResourceListener;
+import com.gemstone.gemfire.internal.cache.control.TestMemoryThresholdListener;
import com.gemstone.gemfire.internal.cache.partitioned.RegionAdvisor;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+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.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 org.junit.experimental.categories.Category;
-
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
/**
* Tests the Off-Heap Memory thresholds of {@link ResourceManager}
*
- * @since 9.0
+ * @since Geode 1.0
*/
+@Category(DistributedTest.class)
public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
- private static final long serialVersionUID = -684231183212051910L;
final String expectedEx = LocalizedStrings.MemoryMonitor_MEMBER_ABOVE_CRITICAL_THRESHOLD.getRawText().replaceAll("\\{[0-9]+\\}",
".*?");
@@@ -133,9 -93,9 +133,8 @@@
/**
* Make sure appropriate events are delivered when moving between states.
-- *
-- * @throws Exception
*/
++ @Test
public void testEventDelivery() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@@ -231,8 -191,8 +230,8 @@@
/**
* test that disabling threshold does not cause remote event and
* remote DISABLED events are delivered
-- * @throws Exception
*/
++ @Test
public void testDisabledThresholds() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@@ -344,8 -304,8 +343,8 @@@
/**
* test that puts in a client are rejected when a remote VM crosses
* critical threshold
-- * @throws Exception
*/
++ @Test
public void testDistributedRegionRemoteClientPutRejection() throws Exception {
final Host host = Host.getHost(0);
final VM server1 = host.getVM(0);
@@@ -384,18 -344,18 +383,22 @@@
setUsageBelowEviction(server2, regionName);
}
++ @Test
public void testDistributedRegionRemotePutRejectionLocalDestroy() throws Exception {
doDistributedRegionRemotePutRejection(true, false);
}
--
++
++ @Test
public void testDistributedRegionRemotePutRejectionCacheClose() throws Exception {
doDistributedRegionRemotePutRejection(false, true);
}
--
++
++ @Test
public void testDistributedRegionRemotePutRejectionBelowThreshold() throws Exception {
doDistributedRegionRemotePutRejection(false, false);
}
--
++
++ @Test
public void testGettersAndSetters() {
getSystem(getOffHeapProperties());
ResourceManager rm = getCache().getResourceManager();
@@@ -504,9 -464,9 +507,9 @@@
* Test that DistributedRegion cacheLoade and netLoad are passed through to the
* calling thread if the local VM is in a critical state. Once the VM has moved
* to a safe state then test that they are allowed.
-- * @throws Exception
*/
@Category(FlakyTest.class) // GEODE-438: test pollution, async actions, time sensitive, waitForCriterion, TODO: consider disconnect DS in setup
++ @Test
public void testDRLoadRejection() throws Exception {
final Host host = Host.getHost(0);
final VM replicate1 = host.getVM(1);
@@@ -715,28 -675,28 +718,34 @@@
getCache().getLoggerI18n().fine(removeExpectedBelow);
};
};
--
++
++ @Test
public void testPR_RemotePutRejectionLocalDestroy() throws Exception {
prRemotePutRejection(false, true, false);
}
++ @Test
public void testPR_RemotePutRejectionCacheClose() throws Exception {
prRemotePutRejection(true, false, false);
}
++ @Test
public void testPR_RemotePutRejection() throws Exception {
prRemotePutRejection(false, false, false);
}
++ @Test
public void testPR_RemotePutRejectionLocalDestroyWithTx() throws Exception {
prRemotePutRejection(false, true, true);
}
++ @Test
public void testPR_RemotePutRejectionCacheCloseWithTx() throws Exception {
prRemotePutRejection(true, false, true);
}
@Category(FlakyTest.class) // GEODE-500: time sensitive, memory sensitive and GC dependent, waitForCriterions
++ @Test
public void testPR_RemotePutRejectionWithTx() throws Exception {
prRemotePutRejection(false, false, true);
}
@@@ -909,9 -869,9 +918,9 @@@
/**
* Test that a Partitioned Region loader invocation is rejected
* if the VM with the bucket is in a critical state.
-- * @throws Exception
*/
@Category(FlakyTest.class) // GEODE-551: waitForCriterion, memory sensitive
++ @Test
public void testPRLoadRejection() throws Exception {
final Host host = Host.getHost(0);
final VM accessor = host.getVM(1);
@@@ -1136,8 -1096,8 +1145,8 @@@
* Test that LocalRegion cache Loads are not stored in the Region
* if the VM is in a critical state, then test that they are allowed
* once the VM is no longer critical
-- * @throws Exception
*/
++ @Test
public void testLRLoadRejection() throws Exception {
final Host host = Host.getHost(0);
final VM vm = host.getVM(2);
@@@ -1287,11 -1246,11 +1296,13 @@@
verifyProfiles(server1, 2);
verifyProfiles(server3, 2);
}
--
++
++ @Test
public void testPRClientPutRejection() throws Exception {
doClientServerTest("parRegReject", true/*createPR*/);
}
++ @Test
public void testDistributedRegionClientPutRejection() throws Exception {
doClientServerTest("distrReject", false/*createPR*/);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
index 8f6ef81,0e9256c..1e018f6
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
@@@ -16,7 -16,14 +16,8 @@@
*/
package com.gemstone.gemfire.cache.mapInterface;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.dunit.ThreadUtils;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.util.Properties;
import java.util.TreeMap;
@@@ -45,9 -41,9 +46,6 @@@ public class PutAllGlobalLockJUnitTest
boolean testOK = false;
Thread thread;
-- public PutAllGlobalLockJUnitTest() {
-- }
--
@Before
public void setUp() throws Exception {
try {
@@@ -63,8 -59,8 +61,7 @@@
RegionAttributes regionAttributes = factory.create();
testRegion = cache.createRegion("TestRegion", regionAttributes);
} catch (Exception e) {
-- e.printStackTrace();
-- fail("test failed to create a distributed system/cache");
++ throw new AssertionError("test failed to create a distributed system/cache", e);
}
}
@@@ -80,7 -76,7 +77,7 @@@
ThreadUtils.join(this.thread, 30 * 1000);
assertTrue(this.testOK);
} catch (Exception e) {
-- fail("Test has failed due to "+e);
++ throw new AssertionError("Test has failed due to ", e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
index 934b121,16784c4..fa8980c
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
@@@ -16,6 -16,12 +16,8 @@@
*/
package com.gemstone.gemfire.cache.query;
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
index 70d7e5d,dfde1a6..fdd5b50
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HelperTestCase.java
@@@ -16,24 -16,7 +16,19 @@@
*/
package com.gemstone.gemfire.cache.query.dunit;
- import org.junit.experimental.categories.Category;
- import org.junit.Test;
-
-import com.gemstone.gemfire.cache.*;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
- import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
- import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
- import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
+import java.util.Iterator;
+import java.util.Properties;
+
- import com.gemstone.gemfire.cache.Cache;
++import org.junit.experimental.categories.Category;
++
+import com.gemstone.gemfire.cache.CacheException;
+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.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
@@@ -51,22 -25,22 +46,18 @@@ import com.gemstone.gemfire.cache.query
import com.gemstone.gemfire.cache.query.internal.index.CompactRangeIndex;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
--import com.gemstone.gemfire.cache30.CacheTestCase;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+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.cache.internal.JUnit4CacheTestCase;
++import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.Iterator;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-
-public class HelperTestCase extends CacheTestCase {
+@Category(DistributedTest.class)
+public class HelperTestCase extends JUnit4CacheTestCase {
- public HelperTestCase() {
- super();
- public HelperTestCase(String name) {
- super(name);
-- }
--
protected void createPartitionRegion(VM vm, final String regionName, final Class valueConstraint) {
vm.invoke(new SerializableCallable() {
public Object call() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
index c778721,6421439..e1d698a
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/PartitionedRegionCompactRangeIndexDUnitTest.java
@@@ -16,7 -16,16 +16,8 @@@
*/
package com.gemstone.gemfire.cache.query.dunit;
-import com.gemstone.gemfire.cache.query.Query;
-import com.gemstone.gemfire.cache.query.QueryService;
-import com.gemstone.gemfire.cache.query.QueryTestUtils;
-import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.cache.query.data.Portfolio;
-import com.gemstone.gemfire.test.dunit.*;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.util.test.TestUtil;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.io.File;
import java.util.HashMap;
@@@ -24,26 -33,14 +25,25 @@@ import java.util.Map
import java.util.Properties;
import java.util.stream.IntStream;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
-@Category(DistributedTest.class)
-public class PartitionedRegionCompactRangeIndexDUnitTest extends DistributedTestCase {
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.QueryTestUtils;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.data.Portfolio;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.util.test.TestUtil;
- public PartitionedRegionCompactRangeIndexDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class PartitionedRegionCompactRangeIndexDUnitTest extends JUnit4DistributedTestCase {
private Properties getSystemProperties(String cacheXML) {
Properties props = new Properties();