[ https://issues.apache.org/jira/browse/GEODE-2470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15937155#comment-15937155 ]
ASF GitHub Bot commented on GEODE-2470: --------------------------------------- Github user echobravopapa commented on a diff in the pull request: https://github.com/apache/geode-native/pull/70#discussion_r107535535 --- Diff: src/cppcache/integration-test/CacheHelper.cpp --- @@ -1376,6 +1376,41 @@ void CacheHelper::createDuplicateXMLFile(std::string& originalFile, CacheHelper::staticConfigFileList.size()); } +// Need to avoid regex usage in Solaris Studio 12.4. +#ifdef _SOLARIS +// @Solaris 12.4 compiler is missing support for C++11 regex +void CacheHelper::replacePortsInFile(int hostPort1, int hostPort2, + int hostPort3, int hostPort4, int locPort1, + int locPort2, const std::string& inFile, + const std::string& outFile) { + std::ifstream in(inFile, std::ios::in | std::ios::binary); + if (in) { + std::string contents; + contents.assign(std::istreambuf_iterator<char>(in), std::istreambuf_iterator<char>()); + in.close(); + + replaceInPlace(contents, "HOST_PORT1", std::to_string(hostPort1)); + replaceInPlace(contents, "HOST_PORT2", std::to_string(hostPort2)); + replaceInPlace(contents, "HOST_PORT3", std::to_string(hostPort3)); + replaceInPlace(contents, "HOST_PORT4", std::to_string(hostPort4)); + replaceInPlace(contents, "LOC_PORT1", std::to_string(locPort1)); + replaceInPlace(contents, "LOC_PORT2", std::to_string(locPort2)); + + std::ofstream out(outFile, std::ios::out); + out << contents; + out.close(); + } +} + +void CacheHelper::replaceInPlace(std::string& searchStr, const std::string& matchStr, + const std::string& replaceStr) { + size_t pos = 0; + while ((pos = searchStr.find(matchStr, pos)) != std::string::npos) { --- End diff -- @mmartell I think there is an issue with this replacement code... I'm not convinced we need the loop and my experiments are showing that a searchStr like so: "look do leap be sheep" where the matchStr is "leap" and replaceStr is "lose" you will end up with "look do lose" > Remove Dependency on sed tool > ----------------------------- > > Key: GEODE-2470 > URL: https://issues.apache.org/jira/browse/GEODE-2470 > Project: Geode > Issue Type: Improvement > Components: native client > Reporter: Michael Martell > > The integration tests currently rely on sed to replace strings inside config > xml files. This task replaces that dependency with standard C++ code. -- This message was sent by Atlassian JIRA (v6.3.15#6346)