You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by js...@apache.org on 2017/08/29 22:06:30 UTC
geode git commit: GEODE-3445: Convert connect acceptance test to
DUnit test
Repository: geode
Updated Branches:
refs/heads/develop dd7c45b43 -> 76b4ef57b
GEODE-3445: Convert connect acceptance test to DUnit test
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/76b4ef57
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/76b4ef57
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/76b4ef57
Branch: refs/heads/develop
Commit: 76b4ef57b30957ebe45a84f5b93cf09fb0734920
Parents: dd7c45b
Author: Jared Stewart <js...@pivotal.io>
Authored: Mon Aug 28 11:12:00 2017 -0700
Committer: Jared Stewart <js...@pivotal.io>
Committed: Tue Aug 29 15:05:40 2017 -0700
----------------------------------------------------------------------
...shConnectToLocatorWithSSLAcceptanceTest.java | 110 -------------------
.../cli/commands/ConnectCommandWithSSLTest.java | 13 +--
2 files changed, 5 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/76b4ef57/geode-assembly/src/test/java/org/apache/geode/management/GfshConnectToLocatorWithSSLAcceptanceTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/GfshConnectToLocatorWithSSLAcceptanceTest.java b/geode-assembly/src/test/java/org/apache/geode/management/GfshConnectToLocatorWithSSLAcceptanceTest.java
deleted file mode 100644
index 75d60a3..0000000
--- a/geode-assembly/src/test/java/org/apache/geode/management/GfshConnectToLocatorWithSSLAcceptanceTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management;
-
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_CIPHERS;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_TYPE;
-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.SSL_TRUSTSTORE_TYPE;
-import static org.apache.geode.util.test.TestUtil.getResourcePath;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
-
-import org.apache.geode.security.SecurableCommunicationChannels;
-import org.apache.geode.test.dunit.rules.gfsh.GfshRule;
-import org.apache.geode.test.dunit.rules.gfsh.GfshScript;
-import org.apache.geode.test.junit.categories.AcceptanceTest;
-
-@Category(AcceptanceTest.class)
-public class GfshConnectToLocatorWithSSLAcceptanceTest {
- @Rule
- public GfshRule gfshRule = new GfshRule();
-
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private File sslPropertiesFile;
-
- @Before
- public void setup() throws IOException {
- File jks = new File(getResourcePath(getClass(), "/ssl/trusted.keystore"));
- assertThat(jks).exists();
-
- Properties serverProps = new Properties();
- serverProps.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannels.ALL);
- serverProps.setProperty(SSL_KEYSTORE, jks.getAbsolutePath());
- serverProps.setProperty(SSL_KEYSTORE_PASSWORD, "password");
- serverProps.setProperty(SSL_KEYSTORE_TYPE, "JKS");
- serverProps.setProperty(SSL_TRUSTSTORE, jks.getAbsolutePath());
- serverProps.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
- serverProps.setProperty(SSL_TRUSTSTORE_TYPE, "JKS");
- serverProps.setProperty(SSL_CIPHERS, "any");
- serverProps.setProperty(SSL_PROTOCOLS, "any");
-
- sslPropertiesFile = temporaryFolder.newFile("ssl.properties");
- serverProps.store(new FileOutputStream(sslPropertiesFile), null);
-
- GfshScript startLocator =
- GfshScript.of("start locator --name=locator --security-properties-file="
- + sslPropertiesFile.getAbsolutePath());
- gfshRule.execute(startLocator);
- }
-
- @Test
- public void canConnectOverHttpWithUnsignedSSLCertificateIfSkipSslValidationIsSet()
- throws Exception {
- GfshScript connect =
- GfshScript.of("connect --use-http --skip-ssl-validation --security-properties-file="
- + sslPropertiesFile.getAbsolutePath());
- gfshRule.execute(connect);
- }
-
- @Test
- public void cannotConnectOverHttpWithUnsignedSSLCertificateIfSkipSslValidationIsNotSet()
- throws Exception {
- GfshScript connect = GfshScript
- .of("connect --use-http --security-properties-file=" + sslPropertiesFile.getAbsolutePath())
- .expectFailure();
- gfshRule.execute(connect);
- }
-
- @Test
- public void cannotConnectOverHttpWithoutSSL() throws Exception {
- GfshScript connect = GfshScript.of("connect --use-http").expectFailure();
- gfshRule.execute(connect);
- }
-
- @Test
- public void canConnectOverJmxWithSSL() throws Exception {
- GfshScript connect = GfshScript.of("connect --use-http=false --security-properties-file="
- + sslPropertiesFile.getAbsolutePath());
- gfshRule.execute(connect);
- }
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/76b4ef57/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java
index 7c4fb44..39c1ba1 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java
@@ -56,8 +56,6 @@ import java.io.OutputStream;
import java.net.URISyntaxException;
import java.util.Properties;
-import javax.net.ssl.HttpsURLConnection;
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -155,7 +153,6 @@ public class ConnectCommandWithSSLTest {
@Before
public void before() throws Exception {
locator = lsRule.startLocatorVM(0, sslProperties);
- HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);
IgnoredException.addIgnoredException("javax.net.ssl.SSLException: Unrecognized SSL message");
sslConfigFile = temporaryFolder.newFile("ssl.properties");
out = new FileOutputStream(sslConfigFile);
@@ -197,7 +194,7 @@ public class ConnectCommandWithSSLTest {
gfsh.disconnect();
gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
- "security-properties-file", sslConfigFile.getAbsolutePath());
+ "security-properties-file", sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
assertThat(gfsh.isConnected()).isTrue();
}
@@ -245,9 +242,9 @@ public class ConnectCommandWithSSLTest {
assertThat(gfsh.isConnected()).isTrue();
gfsh.disconnect();
- // can conect to http
+ // can connect to http
gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
- "security-properties-file", sslConfigFile.getAbsolutePath());
+ "security-properties-file", sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
assertThat(gfsh.isConnected()).isTrue();
}
@@ -264,9 +261,9 @@ public class ConnectCommandWithSSLTest {
"security-properties-file", sslConfigFile.getAbsolutePath());
assertThat(gfsh.isConnected()).isFalse();
- // cannot conect to http
+ // can conect to http
gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
- "security-properties-file", sslConfigFile.getAbsolutePath());
+ "security-properties-file", sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
assertThat(gfsh.isConnected()).isTrue();
}