[
https://issues.apache.org/jira/browse/GEODE-2687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15939144#comment-15939144
]
ASF GitHub Bot commented on GEODE-2687:
---------------------------------------
Github user echobravopapa commented on a diff in the pull request:
https://github.com/apache/geode-native/pull/71#discussion_r107770677
--- Diff: src/cppcache/integration-test/testThinClientSSLAuthFail.cpp ---
@@ -15,8 +15,180 @@
* limitations under the License.
*/
-#include "ThinClientSSLAuthFail.hpp"
+#include "fw_dunit.hpp"
+#include <geode/GeodeCppCache.hpp>
+#include <ace/OS.h>
+#include <ace/High_Res_Timer.h>
+#include <string>
+
+#define ROOT_NAME "ThinClientSSLAuthFail"
+#define ROOT_SCOPE DISTRIBUTED_ACK
+
+#include "CacheHelper.hpp"
+
+using namespace apache::geode::client;
+using namespace test;
+
+CacheHelper* cacheHelper = NULL;
+bool isLocalServer = false;
+
+static bool isLocator = false;
+const char* locatorsG =
+ CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1);
+
+#define CLIENT1 s1p1
+#define SERVER1 s2p1
+
+void initClient(const bool isthinClient) {
+ if (cacheHelper == NULL) {
+ PropertiesPtr props = Properties::create();
+ props->insert("ssl-enabled", "true");
+ std::string keystore = std::string(ACE_OS::getenv("TESTSRC")) +
"/keystore";
+ std::string pubkey = keystore + "/client_truststore.pem";
+ std::string privkey = keystore + "/client_keystore.pem";
+ props->insert("ssl-keystore", privkey.c_str());
+ props->insert("ssl-truststore", pubkey.c_str());
+ cacheHelper = new CacheHelper(isthinClient, props);
+ }
+ ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
+}
+void cleanProc() {
+ if (cacheHelper != NULL) {
+ delete cacheHelper;
+ cacheHelper = NULL;
+ }
+}
+
+CacheHelper* getHelper() {
+ ASSERT(cacheHelper != NULL, "No cacheHelper initialized.");
+ return cacheHelper;
+}
+
+
+void createPooledRegion(const char* name, bool ackMode, const char*
locators,
+ const char* poolname,
+ bool clientNotificationEnabled = false,
+ bool cachingEnable = true) {
+ LOG("createRegion_Pool() entered.");
+ fprintf(stdout, "Creating region -- %s ackMode is %d\n", name,
ackMode);
+ fflush(stdout);
+ RegionPtr regPtr =
+ getHelper()->createPooledRegion(name, ackMode, locators, poolname,
+ cachingEnable,
clientNotificationEnabled);
+ ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ LOG("Pooled Region created.");
+}
+
+void createEntry(const char* name, const char* key, const char* value) {
+ LOG("createEntry() entered.");
+ fprintf(stdout, "Creating entry -- key: %s value: %s in region %s\n",
key,
+ value, name);
+ fflush(stdout);
+ // Create entry, verify entry is correct
+ CacheableKeyPtr keyPtr = createKey(key);
+ CacheableStringPtr valPtr = CacheableString::create(value);
+
+ RegionPtr regPtr = getHelper()->getRegion(name);
+ ASSERT(regPtr != NULLPTR, "Region not found.");
+
+ ASSERT(!regPtr->containsKey(keyPtr),
+ "Key should not have been found in region.");
+ ASSERT(!regPtr->containsValueForKey(keyPtr),
+ "Value should not have been found in region.");
+
+ // regPtr->create( keyPtr, valPtr );
+ regPtr->put(keyPtr, valPtr);
+ LOG("Created entry.");
+
+ //verifyEntry(name, key, value);
+ LOG("Entry created.");
+}
+
+
+
+const char* keys[] = {"Key-1", "Key-2", "Key-3", "Key-4"};
+const char* vals[] = {"Value-1", "Value-2", "Value-3", "Value-4"};
+const char* nvals[] = {"New Value-1", "New Value-2", "New Value-3",
+ "New Value-4"};
+
+const char* regionNames[] = {"DistRegionAck", "DistRegionNoAck"};
+
+const bool USE_ACK = true;
+const bool NO_ACK = false;
+
+DUNIT_TASK_DEFINITION(SERVER1, CreateLocator1_With_SSL_untrustedCert)
+ {
+ // starting locator
+ if (isLocator) CacheHelper::initLocator(1, true, false, -1, 0, true);
+ LOG("Locator1 started with SSL");
+ }
+END_TASK_DEFINITION
+
+
+
+DUNIT_TASK_DEFINITION(SERVER1,
CreateServer1_With_Locator_And_SSL_untrustedCert)
+ {
+ // starting servers
+ if (isLocalServer) CacheHelper::initServer(1, NULL, locatorsG, NULL,
true, true, false, false, true);
+ }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1)
+ { initClient(true); }
+END_TASK_DEFINITION
+
+DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators)
+ {
+ createPooledRegion(regionNames[0], USE_ACK, locatorsG, "__TESTPOOL1_",
+ true);
+ createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_",
true);
+ RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
+ try {
+ regPtr->registerAllKeys(false, NULLPTR, false, false);
+ FAIL("Should have got NotConnectedException during registerAllKeys");
--- End diff --
Good change here, we missed that first go around...
> create a test for failed SSL auth
> ---------------------------------
>
> Key: GEODE-2687
> URL: https://issues.apache.org/jira/browse/GEODE-2687
> Project: Geode
> Issue Type: Test
> Components: native client
> Reporter: Ernest Burghardt
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)