TEST(SpecializedServerParameter, withOptions) { auto* swo = getServerParameter("specializedWithOptions"); ASSERT_APPENDED_STRING(swo, "###"); ASSERT_OK(swo->setFromString("second value")); ASSERT_EQ(gSWO, "second value"); ASSERT_APPENDED_STRING(swo, "###"); auto* dswo = getServerParameter("deprecatedWithOptions"); ASSERT_APPENDED_STRING(dswo, "###"); ASSERT_OK(dswo->setFromString("third value")); ASSERT_EQ(gSWO, "third value"); ASSERT_APPENDED_STRING(dswo, "###"); }
bool CServer::LoadDLL(const std::string &name) { int mode=RTLD_NOW | RTLD_GLOBAL; if(getServerParameter("leak_check")=="true") { mode|=RTLD_NODELETE; } HMODULE dll = dlopen( name.c_str(), mode); if(dll==NULL) { Server->Log("DLL not found: "+(std::string)dlerror(), LL_ERROR); return false; } unload_handles.push_back( dll ); LOADACTIONS load_func=NULL; load_func=(LOADACTIONS)dlsym(dll,"LoadActions"); unload_functs.insert(std::pair<std::string, UNLOADACTIONS>(name, (UNLOADACTIONS) dlsym(dll,"UnloadActions") ) ); if(load_func==NULL) { Server->Log("Loading function in DLL not found", LL_ERROR); return false; } load_func(this); return true; }
TEST(SpecializedServerParameter, withCtor) { auto* csp = getServerParameter("specializedWithCtor"); ASSERT_APPENDED_STRING(csp, "Value from ctor"); ASSERT_OK(csp->setFromString("Updated Value")); ASSERT_EQ(gSCSP, "Updated Value"); ASSERT_APPENDED_STRING(csp, "Updated Value"); }
TEST(SpecializedServerParameter, dummy) { auto* dsp = getServerParameter("specializedDummy"); ASSERT_APPENDED_STRING(dsp, "Dummy Value"); ASSERT_OK(dsp->setFromString("new value")); ASSERT_NOT_OK(dsp->set(BSON("" << BSON_ARRAY("bar")).firstElement())); ASSERT_OK(dsp->set(BSON("" << "bar") .firstElement())); }
TEST(SpecializedServerParameter, multiValue) { auto* edsp = getServerParameter("specializedWithMultiValue"); ASSERT_APPENDED_OBJECT(edsp, BSON("value" << "start value" << "flag" << true)); ASSERT_OK(edsp->setFromString("second value")); ASSERT_APPENDED_OBJECT(edsp, BSON("value" << "second value" << "flag" << false)); ASSERT_OK(edsp->set(BSON("" << BSON("value" << "third value" << "flag" << true)) .firstElement())); ASSERT_APPENDED_OBJECT(edsp, BSON("value" << "third value" << "flag" << true)); }