Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cppcache/include/geode/DataInput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace client {

class SerializationRegistry;
class DataInputInternal;
class CacheImpl;

/**
* Provide operations for reading primitive data values, byte arrays,
Expand Down Expand Up @@ -918,7 +919,7 @@ class CPPCACHE_EXPORT DataInput {

protected:
/** constructor given a pre-allocated byte array with size */
DataInput(const uint8_t* m_buffer, int32_t len, const Cache* cache)
DataInput(const uint8_t* m_buffer, int32_t len, const CacheImpl* cache)
: m_buf(m_buffer),
m_bufHead(m_buffer),
m_bufLength(len),
Expand All @@ -932,7 +933,7 @@ class CPPCACHE_EXPORT DataInput {
const uint8_t* m_bufHead;
int32_t m_bufLength;
std::reference_wrapper<const std::string> m_poolName;
const Cache* m_cache;
const CacheImpl* m_cache;

std::shared_ptr<Serializable> readObjectInternal(int8_t typeId = -1);

Expand Down Expand Up @@ -1062,6 +1063,7 @@ class CPPCACHE_EXPORT DataInput {
DataInput& operator=(const DataInput&) = delete;

friend Cache;
friend CacheImpl;
friend DataInputInternal;
};
} // namespace client
Expand Down
6 changes: 4 additions & 2 deletions cppcache/include/geode/DataOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace geode {
namespace client {
class SerializationRegistry;
class DataOutputInternal;
class CacheImpl;

/**
* Provide operations for writing primitive data values, byte arrays,
Expand Down Expand Up @@ -687,7 +688,7 @@ class CPPCACHE_EXPORT DataOutput {
/**
* Construct a new DataOutput.
*/
DataOutput(const Cache* cache);
DataOutput(const CacheImpl* cache);

DataOutput() : DataOutput(nullptr) {}

Expand All @@ -710,7 +711,7 @@ class CPPCACHE_EXPORT DataOutput {
static uint32_t m_highWaterMark;
// flag to indicate we have a big buffer
volatile bool m_haveBigBuffer;
const Cache* m_cache;
const CacheImpl* m_cache;
std::reference_wrapper<const std::string> m_poolName;

inline void writeAscii(const std::string& value) {
Expand Down Expand Up @@ -860,6 +861,7 @@ class CPPCACHE_EXPORT DataOutput {
DataOutput& operator=(const DataOutput&);

friend Cache;
friend CacheImpl;
friend DataOutputInternal;
friend CacheableString;
};
Expand Down
28 changes: 19 additions & 9 deletions cppcache/integration-test/CacheHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ void CacheHelper::cleanupServerInstances() {
void CacheHelper::initServer(int instance, const char* xml,
const char* locHostport, const char* authParam,
bool ssl, bool enableDelta, bool multiDS,
bool testServerGC, bool untrustedCert) {
bool testServerGC, bool untrustedCert, bool useSecurityManager) {
if (!isServerCleanupCallbackRegistered &&
gClientCleanup.registerCallback(&CacheHelper::cleanupServerInstances)) {
isServerCleanupCallbackRegistered = true;
Expand Down Expand Up @@ -1341,17 +1341,18 @@ void CacheHelper::initServer(int instance, const char* xml,

if (locHostport != nullptr) { // check number of locator host port.
std::string geodeProperties =
generateGeodeProperties(currDir, ssl, -1, 0, untrustedCert);
generateGeodeProperties(currDir, ssl, -1, 0, untrustedCert, useSecurityManager);

sprintf(
cmd,
"%s/bin/%s start server --classpath=%s --name=%s "
"--cache-xml-file=%s --dir=%s --server-port=%d --log-level=%s "
"--cache-xml-file=%s %s --dir=%s --server-port=%d --log-level=%s "
"--properties-file=%s %s %s "
"--J=-Dgemfire.tombstone-timeout=%ld "
"--J=-Dgemfire.tombstone-gc-hreshold=%ld "
"--J=-Dgemfire.security-log-level=%s --J=-Xmx1024m --J=-Xms128m 2>&1",
gfjavaenv, GFSH, classpath, sname.c_str(), xmlFile.c_str(),
useSecurityManager ? "--user=root --password=root-password" : "",
currDir.c_str(), portNum, gfLogLevel, geodeProperties.c_str(),
authParam, deltaProperty.c_str(),
testServerGC ? userTombstone_timeout : defaultTombstone_timeout,
Expand All @@ -1362,11 +1363,12 @@ void CacheHelper::initServer(int instance, const char* xml,
sprintf(
cmd,
"%s/bin/%s start server --classpath=%s --name=%s "
"--cache-xml-file=%s --dir=%s --server-port=%d --log-level=%s %s %s "
"--cache-xml-file=%s %s --dir=%s --server-port=%d --log-level=%s %s %s "
"--J=-Dgemfire.tombstone-timeout=%ld "
"--J=-Dgemfire.tombstone-gc-hreshold=%ld "
"--J=-Dgemfire.security-log-level=%s --J=-Xmx1024m --J=-Xms128m 2>&1",
gfjavaenv, GFSH, classpath, sname.c_str(), xmlFile.c_str(),
useSecurityManager ? "--user=root --password=root-password" : "",
currDir.c_str(), portNum, gfLogLevel, authParam, deltaProperty.c_str(),
testServerGC ? userTombstone_timeout : defaultTombstone_timeout,
testServerGC ? userTombstone_gc_threshold
Expand Down Expand Up @@ -1694,7 +1696,7 @@ void CacheHelper::cleanupLocatorInstances() {

// starting locator
void CacheHelper::initLocator(int instance, bool ssl, bool multiDS, int dsId,
int remoteLocator, bool untrustedCert) {
int remoteLocator, bool untrustedCert, bool useSecurityManager) {
if (!isLocatorCleanupCallbackRegistered &&
gClientCleanup.registerCallback(&CacheHelper::cleanupLocatorInstances)) {
isLocatorCleanupCallbackRegistered = true;
Expand Down Expand Up @@ -1749,19 +1751,23 @@ void CacheHelper::initLocator(int instance, bool ssl, bool multiDS, int dsId,
ACE_OS::mkdir(locDirname.c_str());

std::string geodeFile =
generateGeodeProperties(currDir, ssl, dsId, remoteLocator, untrustedCert);
generateGeodeProperties(currDir, ssl, dsId, remoteLocator, untrustedCert, useSecurityManager);

sprintf(cmd, "%s/bin/%s stop locator --dir=%s --properties-file=%s ",
gfjavaenv, GFSH, currDir.c_str(), geodeFile.c_str());

LOG(cmd);
ACE_OS::system(cmd);

static char* classpath = ACE_OS::getenv("GF_CLASSPATH");
std::string propertiesFile = useSecurityManager ?
std::string("--security-properties-file=") + geodeFile :
std::string("--properties-file=") + geodeFile;
sprintf(cmd,
"%s/bin/%s start locator --name=%s --port=%d --dir=%s "
"--properties-file=%s --http-service-port=0",
"%s --http-service-port=0 --classpath=%s",
gfjavaenv, GFSH, locDirname.c_str(), portnum, currDir.c_str(),
geodeFile.c_str());
propertiesFile.c_str(), classpath);

LOG(cmd);
ACE_OS::system(cmd);
Expand Down Expand Up @@ -1872,7 +1878,8 @@ int CacheHelper::getNumLocatorListUpdates(const char* s) {
std::string CacheHelper::generateGeodeProperties(const std::string& path,
const bool ssl, const int dsId,
const int remoteLocator,
const bool untrustedCert) {
const bool untrustedCert,
const bool useSecurityManager) {
char cmd[2048];
std::string keystore = std::string(ACE_OS::getenv("TESTSRC")) + "/keystore";

Expand All @@ -1894,6 +1901,9 @@ std::string CacheHelper::generateGeodeProperties(const std::string& path,
msg += "log-level=config\n";
msg += "mcast-port=0\n";
msg += "enable-network-partition-detection=false\n";
if (useSecurityManager) {
msg += "security-manager=javaobject.SimpleSecurityManager\n";
}

std::string serverKeystore;
std::string serverTruststore;
Expand Down
8 changes: 5 additions & 3 deletions cppcache/integration-test/CacheHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ class CacheHelper {
const char* locHostport = nullptr,
const char* authParam = nullptr, bool ssl = false,
bool enableDelta = true, bool multiDS = false,
bool testServerGC = false, bool untrustedCert = false);
bool testServerGC = false, bool untrustedCert = false,
bool useSecurityManager = false);

static void createDuplicateXMLFile(std::string& originalFile, int hostport1,
int hostport2, int locport1, int locport2);
Expand Down Expand Up @@ -348,7 +349,7 @@ class CacheHelper {
// starting locator
static void initLocator(int instance, bool ssl = false, bool multiDS = false,
int dsId = -1, int remoteLocator = 0,
bool untrustedCert = false);
bool untrustedCert = false, bool useSecurityManager = false);

static void clearSecProp();

Expand All @@ -371,7 +372,8 @@ class CacheHelper {
const bool ssl = false,
const int dsId = -1,
const int remoteLocator = 0,
const bool untrustedCert = false);
const bool untrustedCert = false,
const bool useSecurityManager = false);
};

#ifndef test_cppcache_utils_static
Expand Down
Loading