virtual const std::string & GetMonitorDir() const = 0;
virtual bool GetMonitoring() const = 0;
virtual const std::vector<std::string> & GetScriptParams() const = 0;
+ virtual bool GetDisableSessionLog() const = 0;
+ virtual const std::vector<std::string> & GetFilterParamsLog() const = 0;
};
//-----------------------------------------------------------------------------
#include "stg/logger.h"
#include "stg/locker.h"
+#include "stg/settings.h"
#include "stg/scriptexecuter.h"
#include "stg/common.h"
bool isPassword,
bool isStat,
STG_LOGGER & logger,
- const std::string & sd,
+ const SETTINGS & s,
REGISTRY & properties);
virtual ~USER_PROPERTY_LOGGED() {}
bool isPassword;
bool isStat;
std::string name;
- const std::string scriptsDir;
+ const SETTINGS& settings;
};
//-----------------------------------------------------------------------------
class USER_PROPERTIES : private NONCOPYABLE {
REGISTRY properties;
public:
- USER_PROPERTIES(const std::string & sd);
+ USER_PROPERTIES(const SETTINGS& s);
USER_STAT & Stat() { return stat; }
USER_CONF & Conf() { return conf; }
bool isPass,
bool isSt,
STG_LOGGER & logger,
- const std::string & sd,
+ const SETTINGS& s,
REGISTRY & properties)
: USER_PROPERTY<varT>(val),
isPassword(isPass),
isStat(isSt),
name(n),
- scriptsDir(sd)
+ settings(s)
{
properties.insert(std::make_pair(ToLower(name), this));
}
newValue.c_str(),
msg.c_str());
-store->WriteUserChgLog(login, admin->GetLogin(), admin->GetIP(), parameter, oldValue, newValue, msg);
+for (size_t i = 0; i < settings.GetFilterParamsLog().size(); ++i)
+ if (settings.GetFilterParamsLog()[i] == "*" || strcasecmp(settings.GetFilterParamsLog()[i].c_str(), parameter.c_str()) == 0)
+ {
+ store->WriteUserChgLog(login, admin->GetLogin(), admin->GetIP(), parameter, oldValue, newValue, msg);
+ return;
+ }
}
//-------------------------------------------------------------------------
template <typename varT>
const std::string & newValue,
const ADMIN * admin)
{
-std::string filePath = scriptsDir + "/OnChange";
+static std::string filePath = settings.GetScriptsDir() + "/OnChange";
if (access(filePath.c_str(), X_OK) == 0)
{
messageTimeout(0),
feeChargeType(0),
reconnectOnTariffChange(false),
+ disableSessionLog(false),
logger(GetStgLogger())
{
+ filterParamsLog.push_back("*");
}
//-----------------------------------------------------------------------------
SETTINGS_IMPL::SETTINGS_IMPL(const SETTINGS_IMPL & rval)
messageTimeout(rval.messageTimeout),
feeChargeType(rval.feeChargeType),
reconnectOnTariffChange(rval.reconnectOnTariffChange),
+ disableSessionLog(rval.disableSessionLog),
+ filterParamsLog(rval.filterParamsLog),
modulesSettings(rval.modulesSettings),
storeModuleSettings(rval.storeModuleSettings),
logger(GetStgLogger())
messageTimeout = rhs.messageTimeout;
feeChargeType = rhs.feeChargeType;
reconnectOnTariffChange = rhs.reconnectOnTariffChange;
+ disableSessionLog = rhs.disableSessionLog;
+ filterParamsLog = rhs.filterParamsLog;
modulesSettings = rhs.modulesSettings;
storeModuleSettings = rhs.storeModuleSettings;
}
}
+ if (strcasecmp(node->getName(), "DisableSessionLog") == 0)
+ {
+ if (ParseYesNo(node->getValue(0), &disableSessionLog) != 0)
+ {
+ strError = "Incorrect DisableSessionLog value: \'" + std::string(node->getValue(0)) + "\'";
+ return -1;
+ }
+ }
+
+ if (strcasecmp(node->getName(), "FilterParamsLog") == 0)
+ {
+ filterParamsLog.clear();
+ for (int i = 0; node->getValue(i) != NULL; ++i)
+ filterParamsLog.push_back(node->getValue(i));
+ }
+
if (strcasecmp(node->getName(), "DirNames") == 0)
{
const DOTCONFDocumentNode * child = node->getChildNode();
if (strcasecmp(node->getName(), "ScriptParams") == 0)
{
for (int i = 0; node->getValue(i) != NULL; ++i)
- {
scriptParams.push_back(node->getValue(i));
- }
}
node = node->getNextNode();
}
unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
unsigned GetFeeChargeType() const { return feeChargeType; }
bool GetReconnectOnTariffChange() const { return reconnectOnTariffChange; }
+ bool GetDisableSessionLog() const { return disableSessionLog; }
+ const std::vector<std::string> & GetFilterParamsLog() const { return filterParamsLog; }
const std::string & GetModulesPath() const { return modulesPath; }
const MODULE_SETTINGS & GetStoreModuleSettings() const
unsigned messageTimeout;
unsigned feeChargeType;
bool reconnectOnTariffChange;
+ bool disableSessionLog;
+ std::vector<std::string> filterParamsLog;
std::vector<MODULE_SETTINGS> modulesSettings;
MODULE_SETTINGS storeModuleSettings;
const USERS * u,
const SERVICES & svcs)
: users(u),
- property(s->GetScriptsDir()),
+ property(*s),
WriteServLog(GetStgLogger()),
lastScanMessages(0),
id(0),
const USERS * u,
const SERVICES & svcs)
: users(u),
- property(s->GetScriptsDir()),
+ property(*s),
WriteServLog(GetStgLogger()),
lastScanMessages(0),
id(0),
USER_IMPL::USER_IMPL(const USER_IMPL & u)
: USER(),
users(u.users),
- property(u.settings->GetScriptsDir()),
+ property(*u.settings),
WriteServLog(GetStgLogger()),
lastScanMessages(0),
login(u.login),
connected = true;
}
-if (store->WriteUserConnect(login, currIP))
+if (!settings->GetDisableSessionLog() && store->WriteUserConnect(login, currIP))
{
WriteServLog("Cannot write connect for user %s.", login.c_str());
WriteServLog("%s", store->GetStrError().c_str());
if (!lastDisconnectReason.empty())
reasonMessage += ": " + lastDisconnectReason;
-if (store->WriteUserDisconnect(login, up, down, sessionUpload, sessionDownload,
- cash, freeMb, reasonMessage))
+if (!settings->GetDisableSessionLog() && store->WriteUserDisconnect(login, up, down, sessionUpload, sessionDownload,
+ cash, freeMb, reasonMessage))
{
WriteServLog("Cannot write disconnect for user %s.", login.c_str());
WriteServLog("%s", store->GetStrError().c_str());
#include "stg/user_property.h"
-USER_PROPERTIES::USER_PROPERTIES(const std::string & sd)
+USER_PROPERTIES::USER_PROPERTIES(const SETTINGS& s)
: stat(),
conf(),
- cash (stat.cash, "cash", false, true, GetStgLogger(), sd, properties),
- up (stat.monthUp, "upload", false, true, GetStgLogger(), sd, properties),
- down (stat.monthDown, "download", false, true, GetStgLogger(), sd, properties),
- lastCashAdd (stat.lastCashAdd, "lastCashAdd", false, true, GetStgLogger(), sd, properties),
- passiveTime (stat.passiveTime, "passiveTime", false, true, GetStgLogger(), sd, properties),
- lastCashAddTime (stat.lastCashAddTime, "lastCashAddTime", false, true, GetStgLogger(), sd, properties),
- freeMb (stat.freeMb, "freeMb", false, true, GetStgLogger(), sd, properties),
- lastActivityTime(stat.lastActivityTime, "lastActivityTime", false, true, GetStgLogger(), sd, properties),
+ cash (stat.cash, "cash", false, true, GetStgLogger(), s, properties),
+ up (stat.monthUp, "upload", false, true, GetStgLogger(), s, properties),
+ down (stat.monthDown, "download", false, true, GetStgLogger(), s, properties),
+ lastCashAdd (stat.lastCashAdd, "lastCashAdd", false, true, GetStgLogger(), s, properties),
+ passiveTime (stat.passiveTime, "passiveTime", false, true, GetStgLogger(), s, properties),
+ lastCashAddTime (stat.lastCashAddTime, "lastCashAddTime", false, true, GetStgLogger(), s, properties),
+ freeMb (stat.freeMb, "freeMb", false, true, GetStgLogger(), s, properties),
+ lastActivityTime(stat.lastActivityTime, "lastActivityTime", false, true, GetStgLogger(), s, properties),
- password (conf.password, "password", true, false, GetStgLogger(), sd, properties),
- passive (conf.passive, "passive", false, false, GetStgLogger(), sd, properties),
- disabled (conf.disabled, "disabled", false, false, GetStgLogger(), sd, properties),
- disabledDetailStat(conf.disabledDetailStat, "DisabledDetailStat", false, false, GetStgLogger(), sd, properties),
- alwaysOnline(conf.alwaysOnline, "alwaysOnline", false, false, GetStgLogger(), sd, properties),
- tariffName (conf.tariffName, "tariffName", false, false, GetStgLogger(), sd, properties),
- nextTariff (conf.nextTariff, "nextTariff", false, false, GetStgLogger(), sd, properties),
- address (conf.address, "address", false, false, GetStgLogger(), sd, properties),
- note (conf.note, "note", false, false, GetStgLogger(), sd, properties),
- group (conf.group, "group", false, false, GetStgLogger(), sd, properties),
- email (conf.email, "email", false, false, GetStgLogger(), sd, properties),
- phone (conf.phone, "phone", false, false, GetStgLogger(), sd, properties),
- realName (conf.realName, "realName", false, false, GetStgLogger(), sd, properties),
- credit (conf.credit, "credit", false, false, GetStgLogger(), sd, properties),
- creditExpire(conf.creditExpire, "creditExpire", false, false, GetStgLogger(), sd, properties),
- ips (conf.ips, "ips", false, false, GetStgLogger(), sd, properties),
- userdata0 (conf.userdata[0], "userdata0", false, false, GetStgLogger(), sd, properties),
- userdata1 (conf.userdata[1], "userdata1", false, false, GetStgLogger(), sd, properties),
- userdata2 (conf.userdata[2], "userdata2", false, false, GetStgLogger(), sd, properties),
- userdata3 (conf.userdata[3], "userdata3", false, false, GetStgLogger(), sd, properties),
- userdata4 (conf.userdata[4], "userdata4", false, false, GetStgLogger(), sd, properties),
- userdata5 (conf.userdata[5], "userdata5", false, false, GetStgLogger(), sd, properties),
- userdata6 (conf.userdata[6], "userdata6", false, false, GetStgLogger(), sd, properties),
- userdata7 (conf.userdata[7], "userdata7", false, false, GetStgLogger(), sd, properties),
- userdata8 (conf.userdata[8], "userdata8", false, false, GetStgLogger(), sd, properties),
- userdata9 (conf.userdata[9], "userdata9", false, false, GetStgLogger(), sd, properties)
+ password (conf.password, "password", true, false, GetStgLogger(), s, properties),
+ passive (conf.passive, "passive", false, false, GetStgLogger(), s, properties),
+ disabled (conf.disabled, "disabled", false, false, GetStgLogger(), s, properties),
+ disabledDetailStat(conf.disabledDetailStat, "DisabledDetailStat", false, false, GetStgLogger(), s, properties),
+ alwaysOnline(conf.alwaysOnline, "alwaysOnline", false, false, GetStgLogger(), s, properties),
+ tariffName (conf.tariffName, "tariffName", false, false, GetStgLogger(), s, properties),
+ nextTariff (conf.nextTariff, "nextTariff", false, false, GetStgLogger(), s, properties),
+ address (conf.address, "address", false, false, GetStgLogger(), s, properties),
+ note (conf.note, "note", false, false, GetStgLogger(), s, properties),
+ group (conf.group, "group", false, false, GetStgLogger(), s, properties),
+ email (conf.email, "email", false, false, GetStgLogger(), s, properties),
+ phone (conf.phone, "phone", false, false, GetStgLogger(), s, properties),
+ realName (conf.realName, "realName", false, false, GetStgLogger(), s, properties),
+ credit (conf.credit, "credit", false, false, GetStgLogger(), s, properties),
+ creditExpire(conf.creditExpire, "creditExpire", false, false, GetStgLogger(), s, properties),
+ ips (conf.ips, "ips", false, false, GetStgLogger(), s, properties),
+ userdata0 (conf.userdata[0], "userdata0", false, false, GetStgLogger(), s, properties),
+ userdata1 (conf.userdata[1], "userdata1", false, false, GetStgLogger(), s, properties),
+ userdata2 (conf.userdata[2], "userdata2", false, false, GetStgLogger(), s, properties),
+ userdata3 (conf.userdata[3], "userdata3", false, false, GetStgLogger(), s, properties),
+ userdata4 (conf.userdata[4], "userdata4", false, false, GetStgLogger(), s, properties),
+ userdata5 (conf.userdata[5], "userdata5", false, false, GetStgLogger(), s, properties),
+ userdata6 (conf.userdata[6], "userdata6", false, false, GetStgLogger(), s, properties),
+ userdata7 (conf.userdata[7], "userdata7", false, false, GetStgLogger(), s, properties),
+ userdata8 (conf.userdata[8], "userdata8", false, false, GetStgLogger(), s, properties),
+ userdata9 (conf.userdata[9], "userdata9", false, false, GetStgLogger(), s, properties)
{}
-I ../projects/stargazer
DEFS = -DLINUX \
-DUSE_ABSTRACT_SETTINGS
-CFLAGS += -g3 -Wall -W -Wextra $(INCS) $(DEFS)
+CFLAGS += -g3 -Wall -W -Wextra -Wno-unused-function $(INCS) $(DEFS)
CXXFLAGS += $(CFLAGS)
LIBS = -lpthread
PROG = tests
test_conffiles.cpp \
test_fee_charge_rules.cpp \
test_reconnect_on_tariff_change.cpp \
+ test_disable_session_log.cpp \
+ test_filter_params_log.cpp \
test_crypto.cpp \
test_bfstream.cpp \
../projects/stargazer/tariff_impl.cpp \
test_conffiles.cpp \
test_fee_charge_rules.cpp \
test_reconnect_on_tariff_change.cpp \
+ test_disable_session_log.cpp \
+ test_filter_params_log.cpp \
test_crypto.cpp \
test_bfstream.cpp \
../projects/stargazer/tariff_impl.cpp \
--- /dev/null
+#include "tut/tut.hpp"
+
+#include "stg/user_property.h"
+#include "user_impl.h"
+
+#include "testsettings.h"
+#include "testtariffs.h"
+#include "testadmin.h"
+#include "teststore.h"
+#include "testauth.h"
+#include "testusers.h"
+#include "testservices.h"
+
+namespace
+{
+
+class TEST_STORE_LOCAL : public TEST_STORE,
+ private NONCOPYABLE {
+public:
+ TEST_STORE_LOCAL()
+ : connects(0),
+ disconnects(0)
+ {}
+ int WriteUserConnect(const std::string & /*login*/, uint32_t /*ip*/) const { ++connects; return 0; }
+
+ int WriteUserDisconnect(const std::string & /*login*/,
+ const DIR_TRAFF & /*up*/,
+ const DIR_TRAFF & /*down*/,
+ const DIR_TRAFF & /*sessionUp*/,
+ const DIR_TRAFF & /*sessionDown*/,
+ double /*cash*/,
+ double /*freeMb*/,
+ const std::string & /*reason*/) const { ++disconnects; return 0; }
+
+ size_t GetConnects() const { return connects; }
+ size_t GetDisconnects() const { return disconnects; }
+
+private:
+ mutable size_t connects;
+ mutable size_t disconnects;
+};
+
+class TEST_SETTINGS_LOCAL : public TEST_SETTINGS {
+ public:
+ TEST_SETTINGS_LOCAL(bool _disableSessionLog)
+ : TEST_SETTINGS(),
+ disableSessionLog(_disableSessionLog)
+ {}
+
+ bool GetDisableSessionLog() const { return disableSessionLog; }
+
+ private:
+ bool disableSessionLog;
+};
+
+}
+
+namespace tut
+{
+ struct disable_session_log_data {
+ };
+
+ typedef test_group<disable_session_log_data> tg;
+ tg disable_session_log_test_group("Disable session log tests group");
+
+ typedef tg::object testobject;
+
+ template<>
+ template<>
+ void testobject::test<1>()
+ {
+ set_test_name("Check normal behaviour");
+
+ TEST_SETTINGS_LOCAL settings(false);
+ TEST_TARIFFS tariffs;
+ TEST_ADMIN admin;
+ TEST_STORE_LOCAL store;
+ TEST_AUTH auth;
+ TEST_USERS users;
+ TEST_SERVICES services;
+ USER_IMPL user(&settings, &store, &tariffs, &admin, &users, services);
+
+ USER_PROPERTY<USER_IPS> & ips(user.GetProperty().ips);
+
+ ips = StrToIPS("*");
+
+ ensure_equals("user.connected = false", user.GetConnected(), false);
+ ensure_equals("connects = 0", store.GetConnects(), static_cast<size_t>(0));
+ ensure_equals("disconnects = 0", store.GetDisconnects(), static_cast<size_t>(0));
+
+ user.Authorize(inet_strington("127.0.0.1"), 0, &auth);
+ user.Run();
+
+ ensure_equals("user.authorised_by = true", user.IsAuthorizedBy(&auth), true);
+
+ ensure_equals("user.connected = true", user.GetConnected(), true);
+ ensure_equals("connects = 1", store.GetConnects(), static_cast<size_t>(1));
+ ensure_equals("disconnects = 0", store.GetDisconnects(), static_cast<size_t>(0));
+
+ user.Unauthorize(&auth);
+ user.Run();
+
+ ensure_equals("user.authorised_by = false", user.IsAuthorizedBy(&auth), false);
+
+ ensure_equals("user.connected = false", user.GetConnected(), false);
+ ensure_equals("connects = 1", store.GetConnects(), static_cast<size_t>(1));
+ ensure_equals("disconnects = 1", store.GetDisconnects(), static_cast<size_t>(1));
+ }
+
+
+ template<>
+ template<>
+ void testobject::test<2>()
+ {
+ set_test_name("Check disabled session log");
+
+ TEST_SETTINGS_LOCAL settings(true);
+ TEST_TARIFFS tariffs;
+ TEST_ADMIN admin;
+ TEST_STORE_LOCAL store;
+ TEST_AUTH auth;
+ TEST_USERS users;
+ TEST_SERVICES services;
+ USER_IMPL user(&settings, &store, &tariffs, &admin, &users, services);
+
+ USER_PROPERTY<USER_IPS> & ips(user.GetProperty().ips);
+
+ ips = StrToIPS("*");
+
+ ensure_equals("user.connected = false", user.GetConnected(), false);
+ ensure_equals("connects = 0", store.GetConnects(), static_cast<size_t>(0));
+ ensure_equals("disconnects = 0", store.GetDisconnects(), static_cast<size_t>(0));
+
+ user.Authorize(inet_strington("127.0.0.1"), 0, &auth);
+ user.Run();
+
+ ensure_equals("user.authorised_by = true", user.IsAuthorizedBy(&auth), true);
+
+ ensure_equals("user.connected = true", user.GetConnected(), true);
+ ensure_equals("connects = 0", store.GetConnects(), static_cast<size_t>(0));
+ ensure_equals("disconnects = 0", store.GetDisconnects(), static_cast<size_t>(0));
+
+ user.Unauthorize(&auth);
+ user.Run();
+
+ ensure_equals("user.authorised_by = false", user.IsAuthorizedBy(&auth), false);
+
+ ensure_equals("user.connected = false", user.GetConnected(), false);
+ ensure_equals("connects = 0", store.GetConnects(), static_cast<size_t>(0));
+ ensure_equals("disconnects = 0", store.GetDisconnects(), static_cast<size_t>(0));
+ }
+}
--- /dev/null
+#include "tut/tut.hpp"
+
+#include "stg/user_property.h"
+#include "user_impl.h"
+
+#include "testsettings.h"
+#include "testtariffs.h"
+#include "testadmin.h"
+#include "teststore.h"
+#include "testauth.h"
+#include "testusers.h"
+#include "testservices.h"
+
+namespace
+{
+
+class TEST_STORE_LOCAL : public TEST_STORE,
+ private NONCOPYABLE {
+public:
+ TEST_STORE_LOCAL()
+ : entries(0)
+ {}
+
+ int WriteUserChgLog(const std::string & /*login*/,
+ const std::string & /*admLogin*/,
+ uint32_t /*admIP*/,
+ const std::string & /*paramName*/,
+ const std::string & /*oldValue*/,
+ const std::string & /*newValue*/,
+ const std::string & /*message*/) const { ++entries; return 0; }
+
+ size_t GetEntries() const { return entries; }
+
+private:
+ mutable size_t entries;
+};
+
+class TEST_SETTINGS_LOCAL : public TEST_SETTINGS {
+ public:
+ void addFilter(const std::string& field) { filter.push_back(field); }
+
+ const std::vector<std::string>& GetFilterParamsLog() const { return filter; }
+
+ private:
+ std::vector<std::string> filter;
+};
+
+}
+
+namespace tut
+{
+ struct filter_params_log_data {
+ };
+
+ typedef test_group<filter_params_log_data> tg;
+ tg filter_params_log_test_group("Filter params log tests group");
+
+ typedef tg::object testobject;
+
+ template<>
+ template<>
+ void testobject::test<1>()
+ {
+ set_test_name("Check normal behaviour");
+
+ TEST_SETTINGS_LOCAL settings;
+ settings.addFilter("*"); // Allow everything by default.
+ TEST_TARIFFS tariffs;
+ TEST_ADMIN admin;
+ TEST_STORE_LOCAL store;
+ TEST_AUTH auth;
+ TEST_USERS users;
+ TEST_SERVICES services;
+ USER_IMPL user(&settings, &store, &tariffs, &admin, &users, services);
+
+ USER_PROPERTY_LOGGED<std::string> & address(user.GetProperty().address);
+ USER_PROPERTY_LOGGED<std::string> & note(user.GetProperty().note);
+ USER_PROPERTY_LOGGED<std::string> & group(user.GetProperty().group);
+
+ address.Set("address", &admin, "", &store, "");
+ note.Set("note", &admin, "", &store, "");
+ group.Set("group", &admin, "", &store, "");
+
+ ensure_equals("entries = 3", store.GetEntries(), 3);
+
+ note.Set("another note", &admin, "", &store, "");
+
+ ensure_equals("entries = 4", store.GetEntries(), 4);
+ }
+
+
+ template<>
+ template<>
+ void testobject::test<2>()
+ {
+ set_test_name("Check single filter entry.");
+
+ TEST_SETTINGS_LOCAL settings;
+ settings.addFilter("address"); // Allow everything by default.
+ TEST_TARIFFS tariffs;
+ TEST_ADMIN admin;
+ TEST_STORE_LOCAL store;
+ TEST_AUTH auth;
+ TEST_USERS users;
+ TEST_SERVICES services;
+ USER_IMPL user(&settings, &store, &tariffs, &admin, &users, services);
+
+ USER_PROPERTY_LOGGED<std::string> & address(user.GetProperty().address);
+ USER_PROPERTY_LOGGED<std::string> & note(user.GetProperty().note);
+ USER_PROPERTY_LOGGED<std::string> & group(user.GetProperty().group);
+
+ address.Set("address", &admin, "", &store, "");
+ note.Set("note", &admin, "", &store, "");
+ group.Set("group", &admin, "", &store, "");
+
+ ensure_equals("entries = 1", store.GetEntries(), 1);
+
+ note.Set("another note", &admin, "", &store, "");
+
+ ensure_equals("entries = 1", store.GetEntries(), 1);
+
+ address.Set("new address", &admin, "", &store, "");
+
+ ensure_equals("entries = 2", store.GetEntries(), 2);
+ }
+
+ template<>
+ template<>
+ void testobject::test<3>()
+ {
+ set_test_name("Check multiple filter entries.");
+
+ TEST_SETTINGS_LOCAL settings;
+ settings.addFilter("address"); // Allow everything by default.
+ settings.addFilter("group"); // Allow everything by default.
+ TEST_TARIFFS tariffs;
+ TEST_ADMIN admin;
+ TEST_STORE_LOCAL store;
+ TEST_AUTH auth;
+ TEST_USERS users;
+ TEST_SERVICES services;
+ USER_IMPL user(&settings, &store, &tariffs, &admin, &users, services);
+
+ USER_PROPERTY_LOGGED<std::string> & address(user.GetProperty().address);
+ USER_PROPERTY_LOGGED<std::string> & note(user.GetProperty().note);
+ USER_PROPERTY_LOGGED<std::string> & group(user.GetProperty().group);
+
+ address.Set("address", &admin, "", &store, "");
+ note.Set("note", &admin, "", &store, "");
+ group.Set("group", &admin, "", &store, "");
+
+ ensure_equals("entries = 2", store.GetEntries(), 2);
+
+ note.Set("another note", &admin, "", &store, "");
+
+ ensure_equals("entries = 2", store.GetEntries(), 2);
+
+ address.Set("new address", &admin, "", &store, "");
+
+ ensure_equals("entries = 3", store.GetEntries(), 3);
+
+ group.Set("administrative group", &admin, "", &store, "");
+
+ ensure_equals("entries = 4", store.GetEntries(), 4);
+ }
+}
#include "testusers.h"
#include "testservices.h"
+namespace
+{
+
class AFTER_CONNECTED_NOTIFIER : public PROPERTY_NOTIFIER_BASE<bool>,
private NONCOPYABLE {
public:
bool reconnectOnTariffChange;
};
+}
+
namespace tut
{
struct reconnect_on_tariff_change_data {
int Start() { return 0; }
int Stop() { return 0; }
- int Reload() { return 0; }
+ int Reload(const MODULE_SETTINGS&) { return 0; }
bool IsRunning() { return true; }
const std::string & GetStrError() const { return strError; }
std::string GetVersion() const { return ""; }
virtual int Add(const SERVICE_CONF & /*service*/, const ADMIN * /*admin*/) { return 0; }
virtual int Del(const std::string & /*name*/, const ADMIN * /*admin*/) { return 0; }
virtual int Change(const SERVICE_CONF & /*service*/, const ADMIN * /*admin*/) { return 0; }
- virtual bool Find(const std::string & name, SERVICE_CONF * service) const { return false; }
- virtual bool Find(const std::string & name, SERVICE_CONF_RES * service) const { return false; }
- virtual bool Exists(const std::string & name) const { return false; }
+ virtual bool Find(const std::string & /*name*/, SERVICE_CONF * /*service*/) const { return false; }
+ virtual bool Find(const std::string & /*name*/, SERVICE_CONF_RES * /*service*/) const { return false; }
+ virtual bool Exists(const std::string & /*name*/) const { return false; }
virtual const std::string & GetStrError() const { return m_errorStr; }
virtual size_t Count() const { return 0; }
class TEST_SETTINGS : public SETTINGS {
public:
- TEST_SETTINGS() {}
+ TEST_SETTINGS() { filterParamsLog.push_back("*"); }
const std::string & GetDirName(size_t) const { return dirName; }
const std::string & GetScriptsDir() const { return scriptsDir; }
const std::string & GetMonitorDir() const { return monitorDir; }
bool GetMonitoring() const { return false; }
const std::vector<std::string> & GetScriptParams() const { return scriptParams; }
+ bool GetDisableSessionLog() const { return false; }
+ const std::vector<std::string>& GetFilterParamsLog() const { return filterParamsLog; }
private:
std::string dirName;
std::string scriptsDir;
std::string monitorDir;
std::vector<std::string> scriptParams;
+ std::vector<std::string> filterParamsLog;
};
#endif