You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2016/05/23 22:01:10 UTC
[08/11] incubator-geode git commit: GEODE-1367: Cleaned up some more
code.
GEODE-1367: Cleaned up some more code.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/0ff390a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/0ff390a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/0ff390a0
Branch: refs/heads/feature/GEODE-837
Commit: 0ff390a0f609f6b24858ac8142532dfcdd55c3e3
Parents: 8c23fab
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Thu May 19 07:34:15 2016 +1000
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Tue May 24 03:37:40 2016 +1000
----------------------------------------------------------------------
.../controllers/RestAPIsWithSSLDUnitTest.java | 37 +++++++++++---------
1 file changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0ff390a0/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
----------------------------------------------------------------------
diff --git 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
index 9578d35..50fb0df 100644
--- 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
@@ -61,15 +61,12 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
private static final long serialVersionUID = -254776154266339226L;
- private ManagementTestBase helper;
-
private final String PEOPLE_REGION_NAME = "People";
private File jks;
public RestAPIsWithSSLDUnitTest(String name) {
super(name);
- this.helper = new ManagementTestBase(name);
this.jks = findTrustedJKS();
}
@@ -173,9 +170,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String locatorHostName = NetworkUtils.getServerHostName(locator.getHost());
- locator.invoke("Start Locator", () -> {
- startLocator(locatorHostName, locatorPort, "");
- });
+ locator.invoke("Start Locator", () -> startLocator(locatorHostName, locatorPort, ""));
// find locators
String locators = locatorHostName + "[" + locatorPort + "]";
@@ -221,16 +216,24 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
// stop the client and make sure the bridge server notifies
// stopBridgeMemberVM(client);
- locator.invoke(()-> helper.closeCache());
- manager.invoke(()-> helper.closeCache());
- server.invoke(()-> helper.closeCache());
- client.invoke(()-> helper.closeCache());
+ locator.invoke(()-> closeCache());
+ manager.invoke(()-> closeCache());
+ server.invoke(()-> closeCache());
+ client.invoke(()-> closeCache());
+ }
+
+ private void closeCache() {
+ Cache cache = CacheFactory.getAnyInstance();
+ if (cache != null && !cache.isClosed()) {
+ cache.close();
+ cache.getDistributedSystem().disconnect();
+ }
}
- private void sslPropertyConverter(Properties properties, Properties newProperties, String propertyName, String newPropertyName) {
- String property = properties.getProperty(propertyName);
- if (property != null) {
- newProperties.setProperty((newPropertyName != null ? newPropertyName : propertyName), property);
+ private void sslPropertyConverter(Properties oldProperties, Properties newProperties, String oldPropertyName, String newPropertyName) {
+ String oldProperty = oldProperties.getProperty(oldPropertyName);
+ if (oldProperty != null) {
+ newProperties.setProperty((newPropertyName != null ? newPropertyName : oldPropertyName), oldProperty);
}
}
@@ -271,14 +274,16 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
props.setProperty("jmx-manager", "true");
props.setProperty("jmx-manager-start", "true");
+ props.setProperty("http-service-port", "7070");
+ props.setProperty("jmx-manager-port", "1099");
Cache cache = null;
configureSSL(props, sslProperties, false);
while (true) {
try {
DistributedSystem ds = getSystem(props);
- System.out.println("Creating cache with http-service-port " + props.getProperty("http-service-port", "7070")
- + " and jmx-manager-port " + props.getProperty("jmx-manager-port", "1099"));
+ System.out.println("Creating cache with http-service-port " + props.getProperty("http-service-port")
+ + " and jmx-manager-port " + props.getProperty("jmx-manager-port"));
cache = CacheFactory.create(ds);
System.out.println("Successfully created cache.");
break;