You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2017/04/21 23:42:10 UTC

[14/51] [abbrv] geode git commit: GEODE-2730: refactor rules - review changes

GEODE-2730: refactor rules - review changes


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/f272762f
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/f272762f
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/f272762f

Branch: refs/heads/feature/GEODE-2097
Commit: f272762f8b061f9380128c83e3aacbf2a97a58f7
Parents: 7e607de
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Apr 13 15:11:27 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri Apr 14 16:35:18 2017 -0700

----------------------------------------------------------------------
 .../internal/web/RestSecurityWithSSLTest.java   | 38 +++++++-------------
 .../test/dunit/rules/EmbeddedPulseRule.java     |  4 ++-
 .../cli/util/LogExporterIntegrationTest.java    |  2 +-
 3 files changed, 16 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/f272762f/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
index 4d142bd..ac50716 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
@@ -15,8 +15,6 @@
 
 package org.apache.geode.rest.internal.web;
 
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
@@ -25,10 +23,8 @@ import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD;
-import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
 import static org.junit.Assert.assertEquals;
 
-import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
@@ -40,36 +36,26 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import java.net.URL;
-import java.util.Properties;
 
 @Category({IntegrationTest.class, SecurityTest.class})
 public class RestSecurityWithSSLTest {
+  private static URL KEYSTORE_URL =
+      RestSecurityWithSSLTest.class.getClassLoader().getResource("ssl/trusted.keystore");
 
-  private static int restPort = AvailablePortHelper.getRandomAvailableTCPPort();
   @Rule
-  public ServerStarterRule serverStarter = new ServerStarterRule();
+  public ServerStarterRule serverStarter = new ServerStarterRule().withRestService()
+      .withProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName())
+      .withProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant())
+      .withProperty(SSL_KEYSTORE, KEYSTORE_URL.getPath())
+      .withProperty(SSL_KEYSTORE_PASSWORD, "password").withProperty(SSL_KEYSTORE_TYPE, "JKS")
+      .withProperty(SSL_TRUSTSTORE, KEYSTORE_URL.getPath())
+      .withProperty(SSL_TRUSTSTORE_PASSWORD, "password")
+      .withProperty(SSL_PROTOCOLS, "TLSv1.2,TLSv1.1").withAutoStart();
 
   @Test
   public void testRestSecurityWithSSL() throws Exception {
-    URL keystoreUrl =
-        RestSecurityWithSSLTest.class.getClassLoader().getResource("ssl/trusted.keystore");
-
-    Properties properties = new Properties();
-    properties.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
-    properties.setProperty(START_DEV_REST_API, "true");
-    properties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-    properties.setProperty(HTTP_SERVICE_PORT, restPort + "");
-    properties.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant());
-    properties.setProperty(SSL_KEYSTORE, keystoreUrl.getPath());
-    properties.setProperty(SSL_KEYSTORE_PASSWORD, "password");
-    properties.setProperty(SSL_KEYSTORE_TYPE, "JKS");
-    properties.setProperty(SSL_TRUSTSTORE, keystoreUrl.getPath());
-    properties.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
-    properties.setProperty(SSL_PROTOCOLS, "TLSv1.2,TLSv1.1");
-
-    serverStarter.withProperties(properties).startServer();
-
-    GeodeRestClient restClient = new GeodeRestClient("localhost", restPort, true);
+    GeodeRestClient restClient =
+        new GeodeRestClient("localhost", serverStarter.getHttpPort(), true);
     HttpResponse response = restClient.doGet("/servers", "cluster", "cluster");
 
     assertEquals(200, GeodeRestClient.getCode(response));

http://git-wip-us.apache.org/repos/asf/geode/blob/f272762f/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
index e41d0fe..0ed5403 100644
--- a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
+++ b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
@@ -48,6 +48,8 @@ public class EmbeddedPulseRule extends ExternalResource {
    * Override to tear down your specific external resource.
    */
   protected void after() {
-    repository.removeAllClusters();
+    if (repository != null) {
+      repository.removeAllClusters();
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/f272762f/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
index dc24a57..c694523 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
@@ -91,7 +91,7 @@ public class LogExporterIntegrationTest {
   }
 
   @Test
-  @Ignore("fix .gz suffix")
+  @Ignore("GEODE-2574: fix .gz suffix")
   public void serverStartedWithGZSuffix() throws Exception {
     properties.setProperty(LOG_FILE, "test.log.gz");
     properties.setProperty(STATISTIC_ARCHIVE_FILE, "archive.gfs.gz");