summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-10 20:55:15 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-10 20:55:15 +0100
commit27e6fbe0e374cd593bb5fca09bf45d80481ea8e8 (patch)
treedda6086937761a1b5778a4bf675c5e97277395c0
parentUpdated compile flags (diff)
downloadicetray-27e6fbe0e374cd593bb5fca09bf45d80481ea8e8.tar.bz2
icetray-27e6fbe0e374cd593bb5fca09bf45d80481ea8e8.tar.xz
icetray-27e6fbe0e374cd593bb5fca09bf45d80481ea8e8.zip
C++17 and ICE 3.7
Updates all code to be C++17 and ICE 3.7 compatible.
-rw-r--r--Jamroot.jam15
-rw-r--r--icetray/Jamfile.jam5
-rw-r--r--icetray/dryice/Jamfile.jam5
-rw-r--r--icetray/dryice/dryice.cpp6
-rw-r--r--icetray/dryice/dryice.h6
-rw-r--r--icetray/dryice/mockPool.cpp4
-rw-r--r--icetray/dryice/mockPool.h4
-rw-r--r--icetray/icetray/Jamfile.jam5
-rw-r--r--icetray/icetray/abstractCachingDatabaseClient.cpp2
-rw-r--r--icetray/icetray/abstractCachingDatabaseClient.h2
-rw-r--r--icetray/icetray/abstractDatabaseClient.cpp2
-rw-r--r--icetray/icetray/abstractDatabaseClient.h8
-rw-r--r--icetray/icetray/database.h4
-rw-r--r--icetray/icetray/defaultPool.cpp2
-rw-r--r--icetray/icetray/defaultPool.h2
-rw-r--r--icetray/icetray/icetrayService.cpp17
-rw-r--r--icetray/icetray/icetrayService.h27
-rw-r--r--icetray/icetray/logWriterConsole.cpp8
-rw-r--r--icetray/icetray/logWriterConsole.h4
-rw-r--r--icetray/icetray/logger.cpp22
-rw-r--r--icetray/icetray/logger.h18
-rw-r--r--icetray/icetray/options.cpp2
-rw-r--r--icetray/icetray/options.h3
-rw-r--r--icetray/icetray/sqlSource.h2
-rw-r--r--icetray/icetray/staticSqlSource.cpp7
-rw-r--r--icetray/icetray/staticSqlSource.h5
-rw-r--r--icetray/tool/Jamfile.jam1
-rw-r--r--icetray/unittests/Jamfile.jam5
-rw-r--r--icetray/unittests/testDefaultPool.cpp1
-rw-r--r--icetray/unittests/testIceBoxInterface.cpp1
-rw-r--r--icetray/unittests/testIceTray.cpp9
-rw-r--r--icetray/unittests/testIceTrayLogger.cpp128
-rw-r--r--icetray/unittests/testIceTrayReplace.cpp6
-rw-r--r--icetray/unittests/testIceTrayServiceI.cpp13
-rw-r--r--icetray/unittests/testIceTrayServiceI.h4
35 files changed, 184 insertions, 171 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index f311633..4b082a5 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -7,13 +7,14 @@ variant coverage : debug ;
project
: requirements
- <cxxflags>"-std=c++17 -fvisibility=hidden"
- <linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
- <variant>release:<cxxflags>"-flto=2"
- <variant>release:<linkflags>"-flto=2"
- <variant>debug:<cxxflags>"-W -Wall -Werror -Wextra"
- <variant>coverage:<cxxflags>"--coverage"
- <variant>coverage:<linkflags>"--coverage"
+ <define>ICE_CPP11_MAPPING
+ <cxxflags>"-std=c++17 -fvisibility=hidden"
+ <linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
+ <variant>release:<cxxflags>"-flto=2"
+ <variant>release:<linkflags>"-flto=2"
+ <variant>debug:<cxxflags>"-W -Wall -Werror -Wextra"
+ <variant>coverage:<cxxflags>"--coverage"
+ <variant>coverage:<linkflags>"--coverage"
;
build-project icetray ;
diff --git a/icetray/Jamfile.jam b/icetray/Jamfile.jam
index f499586..83ad692 100644
--- a/icetray/Jamfile.jam
+++ b/icetray/Jamfile.jam
@@ -3,11 +3,10 @@ import package ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib slicer : : : : <include>/usr/include/slicer ;
lib slicer-db : : : : <include>/usr/include/slicer ;
-lib Ice ;
-lib IceUtil ;
+lib Ice++11 ;
lib pthread ;
lib dl ;
-lib IceBox ;
+lib IceBox++11 ;
lib dbppcore : : : : <include>/usr/include/dbpp ;
lib boost_system ;
lib boost_thread ;
diff --git a/icetray/dryice/Jamfile.jam b/icetray/dryice/Jamfile.jam
index 0be9092..abf23d4 100644
--- a/icetray/dryice/Jamfile.jam
+++ b/icetray/dryice/Jamfile.jam
@@ -6,9 +6,8 @@ lib dryice :
:
<library>..//adhocutil
<library>../icetray//icetray
- <library>..//Ice
- <library>..//IceUtil
- <library>..//IceBox
+ <library>..//Ice++11
+ <library>..//IceBox++11
<library>..//pthread
<library>..//boost_system
<library>..//boost_thread
diff --git a/icetray/dryice/dryice.cpp b/icetray/dryice/dryice.cpp
index b6f9d59..7cf5c35 100644
--- a/icetray/dryice/dryice.cpp
+++ b/icetray/dryice/dryice.cpp
@@ -18,7 +18,7 @@ namespace IceTray {
id.properties->setProperty("DryIce.PoolProvider", "MockPool");
id.properties->parseCommandLineOptions("", cmdline);
ic = Ice::initialize(args, id);
- s = Service::create(ic);
+ s = IceTray::ServicePtr(Service::create(ic));
s->start("DryIce", ic, {});
currentDryIce = this;
}
@@ -37,9 +37,9 @@ namespace IceTray {
}
void
- DryIce::replace(const std::string & name, Ice::ObjectPtr replacement)
+ DryIce::replace(const std::string & name, const Ice::ObjectPtr & replacement)
{
- auto id = ic->stringToIdentity(name);
+ auto id = Ice::stringToIdentity(name);
s->adp->remove(id);
s->adp->add(replacement, id);
}
diff --git a/icetray/dryice/dryice.h b/icetray/dryice/dryice.h
index 363956b..a934efa 100644
--- a/icetray/dryice/dryice.h
+++ b/icetray/dryice/dryice.h
@@ -20,7 +20,7 @@ namespace IceTray {
friend class DryIceClient;
static DryIce * currentDryIce;
- void replace(const std::string &, Ice::ObjectPtr);
+ void replace(const std::string &, const Ice::ObjectPtr &);
Ice::CommunicatorPtr ic;
IceTray::ServicePtr s;
@@ -32,9 +32,9 @@ namespace IceTray {
virtual ~DryIceClient();
template<typename Prx>
- Prx getProxy(const std::string & objectName) const
+ std::shared_ptr<Prx> getProxy(const std::string & objectName) const
{
- return Prx::checkedCast(DryIce::currentDryIce->ic->stringToProxy(objectName));
+ return Ice::checkedCast<Prx>(DryIce::currentDryIce->ic->stringToProxy(objectName));
}
ServicePtr getService() const;
diff --git a/icetray/dryice/mockPool.cpp b/icetray/dryice/mockPool.cpp
index 43e7c0c..4919cfb 100644
--- a/icetray/dryice/mockPool.cpp
+++ b/icetray/dryice/mockPool.cpp
@@ -3,7 +3,7 @@
#include <factory.impl.h>
namespace IceTray {
- MockPool::MockPool(const std::string & name, const std::string &, Ice::PropertiesPtr p) :
+ MockPool::MockPool(const std::string & name, const std::string &, const Ice::PropertiesPtr & p) :
DatabasePool(
p->getPropertyAsIntWithDefault(name + ".Database.PoolMax", 10),
p->getPropertyAsIntWithDefault(name + ".Database.PoolKeep", 2)),
@@ -11,7 +11,7 @@ namespace IceTray {
{
}
- DB::Connection * MockPool::createResource() const
+ DB::ConnectionPtr MockPool::createResource() const
{
return DB::MockDatabase::openConnectionTo(name);
}
diff --git a/icetray/dryice/mockPool.h b/icetray/dryice/mockPool.h
index 8936cb2..fba168a 100644
--- a/icetray/dryice/mockPool.h
+++ b/icetray/dryice/mockPool.h
@@ -8,9 +8,9 @@
namespace IceTray {
class MockPool : public DatabasePool {
public:
- MockPool(const std::string & name, const std::string &, Ice::PropertiesPtr p);
+ MockPool(const std::string & name, const std::string &, const Ice::PropertiesPtr & p);
- DB::Connection * createResource() const override;
+ DB::ConnectionPtr createResource() const override;
const std::string name;
};
diff --git a/icetray/icetray/Jamfile.jam b/icetray/icetray/Jamfile.jam
index 6398f6a..1887b20 100644
--- a/icetray/icetray/Jamfile.jam
+++ b/icetray/icetray/Jamfile.jam
@@ -7,9 +7,8 @@ lib icetray :
:
<library>..//adhocutil
<library>..//dbppcore
- <library>..//Ice
- <library>..//IceUtil
- <library>..//IceBox
+ <library>..//Ice++11
+ <library>..//IceBox++11
<library>..//pthread
<library>..//slicer
<library>..//slicer-db
diff --git a/icetray/icetray/abstractCachingDatabaseClient.cpp b/icetray/icetray/abstractCachingDatabaseClient.cpp
index c05b700..0a886db 100644
--- a/icetray/icetray/abstractCachingDatabaseClient.cpp
+++ b/icetray/icetray/abstractCachingDatabaseClient.cpp
@@ -5,7 +5,7 @@ template DLL_PUBLIC void AdHoc::Cache<IceTray::AbstractCachingDatabaseClient::Ca
template DLL_PUBLIC IceTray::AbstractCachingDatabaseClient::Cache::Value AdHoc::Cache<IceTray::AbstractCachingDatabaseClient::CacheItem, IceTray::AbstractCachingDatabaseClient::CacheKey>::get(const IceTray::AbstractCachingDatabaseClient::CacheKey &) const;
namespace IceTray {
- AbstractCachingDatabaseClient::AbstractCachingDatabaseClient(DatabasePoolPtr d) :
+ AbstractCachingDatabaseClient::AbstractCachingDatabaseClient(const DatabasePoolPtr & d) :
AbstractDatabaseClient(d)
{
}
diff --git a/icetray/icetray/abstractCachingDatabaseClient.h b/icetray/icetray/abstractCachingDatabaseClient.h
index f910626..7858784 100644
--- a/icetray/icetray/abstractCachingDatabaseClient.h
+++ b/icetray/icetray/abstractCachingDatabaseClient.h
@@ -13,7 +13,7 @@ namespace IceTray {
typedef boost::any CacheItem;
protected:
- AbstractCachingDatabaseClient(DatabasePoolPtr d);
+ AbstractCachingDatabaseClient(const DatabasePoolPtr & d);
template<typename Domain, typename ... Params>
inline
diff --git a/icetray/icetray/abstractDatabaseClient.cpp b/icetray/icetray/abstractDatabaseClient.cpp
index 064e0e2..5e4f566 100644
--- a/icetray/icetray/abstractDatabaseClient.cpp
+++ b/icetray/icetray/abstractDatabaseClient.cpp
@@ -4,7 +4,7 @@
#include <Ice/BuiltinSequences.h>
namespace IceTray {
- AbstractDatabaseClient::AbstractDatabaseClient(DatabasePoolPtr d) :
+ AbstractDatabaseClient::AbstractDatabaseClient(const DatabasePoolPtr & d) :
db(d)
{
}
diff --git a/icetray/icetray/abstractDatabaseClient.h b/icetray/icetray/abstractDatabaseClient.h
index 80bd4c9..80ccbcd 100644
--- a/icetray/icetray/abstractDatabaseClient.h
+++ b/icetray/icetray/abstractDatabaseClient.h
@@ -10,7 +10,7 @@
namespace IceTray {
class DLL_PUBLIC AbstractDatabaseClient {
protected:
- AbstractDatabaseClient(DatabasePoolPtr d);
+ AbstractDatabaseClient(const DatabasePoolPtr & d);
template<typename Domain, typename ... Params>
inline
@@ -44,7 +44,7 @@ namespace IceTray {
{
auto s = sql.select(c);
bind(0, s.get(), params...);
- return Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, Domain>(*s, typeIdCol);
+ return Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, Domain>(s, typeIdCol);
}
template<typename Param, typename ... Params>
@@ -71,8 +71,8 @@ namespace IceTray {
} \
}
- BIND1OPTIONAL(IceUtil::Optional);
- BIND1OPTIONAL(boost::optional);
+ BIND1OPTIONAL(Ice::optional);
+ BIND1OPTIONAL(std::optional);
#undef BIND1OPTIONAL
DatabasePoolPtr db;
diff --git a/icetray/icetray/database.h b/icetray/icetray/database.h
index 23ad7fe..46c5279 100644
--- a/icetray/icetray/database.h
+++ b/icetray/icetray/database.h
@@ -2,11 +2,11 @@
#define ICETRAY_DATABASE_H
#include <connectionPool.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace IceTray {
typedef AdHoc::ResourcePool<DB::Connection> DatabasePool;
- typedef boost::shared_ptr<DatabasePool> DatabasePoolPtr;
+ typedef std::shared_ptr<DatabasePool> DatabasePoolPtr;
}
#endif
diff --git a/icetray/icetray/defaultPool.cpp b/icetray/icetray/defaultPool.cpp
index c3f7e50..608734f 100644
--- a/icetray/icetray/defaultPool.cpp
+++ b/icetray/icetray/defaultPool.cpp
@@ -2,7 +2,7 @@
#include "icetrayService.h"
namespace IceTray {
- DefaultPool::DefaultPool(const std::string & name, const std::string & type, Ice::PropertiesPtr p) :
+ DefaultPool::DefaultPool(const std::string & name, const std::string & type, const Ice::PropertiesPtr & p) :
DB::ConnectionPool(
p->getPropertyAsIntWithDefault(name + ".Database.PoolMax", 10),
p->getPropertyAsIntWithDefault(name + ".Database.PoolKeep", 2),
diff --git a/icetray/icetray/defaultPool.h b/icetray/icetray/defaultPool.h
index 5b06ea2..4295536 100644
--- a/icetray/icetray/defaultPool.h
+++ b/icetray/icetray/defaultPool.h
@@ -7,7 +7,7 @@
namespace IceTray {
class DefaultPool : public DB::ConnectionPool {
public:
- DefaultPool(const std::string & name, const std::string & type, Ice::PropertiesPtr p);
+ DefaultPool(const std::string & name, const std::string & type, const Ice::PropertiesPtr & p);
};
}
diff --git a/icetray/icetray/icetrayService.cpp b/icetray/icetray/icetrayService.cpp
index 518eeaa..fc25144 100644
--- a/icetray/icetray/icetrayService.cpp
+++ b/icetray/icetray/icetrayService.cpp
@@ -48,15 +48,12 @@ namespace IceTray {
{
auto logManager = LOGMANAGER();
for (auto logWriterFactory : AdHoc::PluginManager::getDefault()->getAll<Logging::LogWriterFactory>()) {
- auto logWriter = logWriterFactory->implementation()->create(p.get());
- if (logWriter->lowestLevel()) {
- auto prx = Logging::LogWriterPrx::uncheckedCast(adp->addWithUUID(logWriter));
+ auto logWriter = logWriterFactory->implementation()->create(p);
+ if (logWriter->lowestLevel({})) {
+ auto prx = Ice::uncheckedCast<Logging::LogWriterPrx>(adp->addWithUUID(logWriter));
logWriters.insert(prx);
logManager->addWriter(prx);
}
- else {
- delete logWriter;
- }
}
}
@@ -79,9 +76,9 @@ namespace IceTray {
DatabasePoolPtr Service::getConnectionPool(const Ice::CommunicatorPtr & ic, const std::string & type, const std::string & name)
{
auto p = ic->getProperties();
- return DatabasePoolPtr(PoolProvider::createNew(
+ return PoolProvider::createNew(
p->getPropertyWithDefault("DryIce.PoolProvider", "DefaultPool"),
- name, type, p));
+ name, type, p);
}
}
@@ -94,6 +91,6 @@ extern "C" {
}
}
-INSTANTIATEVOIDFACTORY(IceTray::Service);
-INSTANTIATEFACTORY(IceTray::DatabasePool, const std::string &, const std::string &, Ice::PropertiesPtr);
+INSTANTIATEPLUGINOF(IceTray::ServiceFactory);
+INSTANTIATEFACTORY(IceTray::DatabasePool, const std::string &, const std::string &, const Ice::PropertiesPtr &);
diff --git a/icetray/icetray/icetrayService.h b/icetray/icetray/icetrayService.h
index 228d198..8973580 100644
--- a/icetray/icetray/icetrayService.h
+++ b/icetray/icetray/icetrayService.h
@@ -32,13 +32,32 @@ namespace IceTray {
friend class DryIce;
Ice::ObjectAdapterPtr adp;
static Service * current;
- std::set<Logging::LogWriterPrx> logWriters;
+ std::set<Logging::LogWriterPrxPtr> logWriters;
OptionsCollation optionsCollation;
};
- typedef IceInternal::Handle<Service> ServicePtr;
- typedef AdHoc::Factory<Service> ServiceFactory;
- typedef AdHoc::Factory<DatabasePool, const std::string &, const std::string &, Ice::PropertiesPtr> PoolProvider;
+ typedef std::shared_ptr<Service> ServicePtr;
+
+ // Custom factory required because IceBox interface requires a naked pointer.
+ // See: https://doc.zeroc.com/display/Ice37/Developing+IceBox+Services#DevelopingIceBoxServices-C++ServiceEntryPoint
+ class ServiceFactory : public AdHoc::AbstractPluginImplementation {
+ public:
+ virtual Service * create() const = 0;
+
+ template<typename Impl>
+ class For;
+ };
+
+ template<typename Impl>
+ class ServiceFactory::For : public ServiceFactory {
+ public:
+ Service * create() const
+ {
+ return new Impl();
+ }
+ };
+
+ typedef AdHoc::Factory<DatabasePool, const std::string &, const std::string &, const Ice::PropertiesPtr &> PoolProvider;
}
#endif
diff --git a/icetray/icetray/logWriterConsole.cpp b/icetray/icetray/logWriterConsole.cpp
index e06ecb9..feb8789 100644
--- a/icetray/icetray/logWriterConsole.cpp
+++ b/icetray/icetray/logWriterConsole.cpp
@@ -58,18 +58,18 @@ namespace AdHoc {
namespace IceTray {
namespace Logging {
AdHocFormatter(LogMsg, "%?: %d: %?\n");
- ConsoleLogWriter::ConsoleLogWriter(Ice::Properties * p) :
+ ConsoleLogWriter::ConsoleLogWriter(const Ice::PropertiesPtr & p) :
AbstractLogWriter("logging.console", p),
width(p ? p->getPropertyAsIntWithDefault("logging.console.width", -1) : -1)
{
}
void
- ConsoleLogWriter::message(LogLevel priority, const Domain & domain, const std::string & message, const Ice::Current &)
+ ConsoleLogWriter::message(LogLevel priority, Domain domain, std::string message, const Ice::Current &)
{
- writeStream(priority < WARNING ? std::cerr : std::cout,
+ writeStream(priority < LogLevel::WARNING ? std::cerr : std::cout,
width, priority, domain, message);
- (priority < WARNING ? std::cerr : std::cout).flush();
+ (priority < LogLevel::WARNING ? std::cerr : std::cout).flush();
}
std::ostream &
diff --git a/icetray/icetray/logWriterConsole.h b/icetray/icetray/logWriterConsole.h
index 1c5cf3b..a841f6b 100644
--- a/icetray/icetray/logWriterConsole.h
+++ b/icetray/icetray/logWriterConsole.h
@@ -7,9 +7,9 @@ namespace IceTray {
namespace Logging {
class ConsoleLogWriter : public AbstractLogWriter {
public:
- ConsoleLogWriter(Ice::Properties * p);
+ ConsoleLogWriter(const Ice::PropertiesPtr & p);
- void message(LogLevel priority, const Domain & domain, const std::string & message, const Ice::Current &) override;
+ void message(LogLevel priority, Domain domain, std::string message, const Ice::Current &) override;
static DLL_PUBLIC std::ostream & writeStream(std::ostream &, int width, LogLevel priority, const Domain & domain, const std::string & message);
diff --git a/icetray/icetray/logger.cpp b/icetray/icetray/logger.cpp
index 8c5c36b..5143ea0 100644
--- a/icetray/icetray/logger.cpp
+++ b/icetray/icetray/logger.cpp
@@ -8,7 +8,7 @@
#include <slicer/modelPartsTypes.h>
#include <globalStatic.impl.h>
-INSTANTIATEFACTORY(IceTray::Logging::LogWriter, Ice::Properties *);
+INSTANTIATEFACTORY(IceTray::Logging::LogWriter, const Ice::PropertiesPtr &);
template class ::AdHoc::GlobalStatic<::IceTray::Logging::LogManager>;
@@ -86,7 +86,7 @@ namespace IceTray {
{
SharedLock(_lock);
auto i = logs.begin();
- i += priority;
+ i += (int)priority;
while (i != logs.end()) {
if (!i->empty()) {
return i;
@@ -123,7 +123,7 @@ namespace IceTray {
for (const auto & log : logWriters) {
auto level = log->level(domain);
if (level) {
- logs[*level].insert(log);
+ logs[(int)*level].insert(log);
}
}
return logs;
@@ -139,22 +139,22 @@ namespace IceTray {
}
void
- LogManager::addWriter(LogWriterPrx writer)
+ LogManager::addWriter(LogWriterPrxPtr writer)
{
- UpgradableLock(_lock, l);
- UpgradeScopeLock(l) {
+ ScopeLock(_lock) {
logWriters.insert(writer);
}
+ SharedLock(_lock);
updateLoggerWriters();
}
void
- LogManager::removeWriter(LogWriterPrx writer)
+ LogManager::removeWriter(LogWriterPrxPtr writer)
{
- UpgradableLock(_lock, l);
- UpgradeScopeLock(l) {
+ ScopeLock(_lock) {
logWriters.erase(writer);
}
+ SharedLock(_lock);
updateLoggerWriters();
}
@@ -176,7 +176,7 @@ namespace IceTray {
AbstractLogWriter::AbstractLogWriter(const std::string & prefix, Ice::PropertiesPtr p)
{
if (!p || prefix.empty()) {
- logDomains.insert({ { }, WARNING });
+ logDomains.insert({ { }, LogLevel::WARNING });
return;
}
auto domainsPrefix = prefix + ".domains.";
@@ -207,7 +207,7 @@ namespace IceTray {
}
IceUtil::Optional<LogLevel>
- AbstractLogWriter::level(const Domain & domain, const Ice::Current &)
+ AbstractLogWriter::level(Domain domain, const Ice::Current &)
{
for (auto d = logDomains.rbegin(); d != logDomains.rend(); d++) {
if (boost::algorithm::starts_with(domain, d->first)) {
diff --git a/icetray/icetray/logger.h b/icetray/icetray/logger.h
index 0420415..32b57db 100644
--- a/icetray/icetray/logger.h
+++ b/icetray/icetray/logger.h
@@ -7,7 +7,7 @@
#include <boost/format/format_fwd.hpp>
#include <map>
#include <buffer.h>
-#include <boost/thread/shared_mutex.hpp>
+#include <shared_mutex>
#include <Ice/Properties.h>
#include <globalStatic.h>
@@ -16,7 +16,7 @@ namespace IceTray {
class LogManager;
class LoggerBase;
- typedef std::set<LogWriterPrx> LogWriters;
+ typedef std::set<LogWriterPrxPtr> LogWriters;
typedef std::array<LogWriters, 8> LogLevelWriters;
typedef std::set<LoggerBase *> Loggers;
@@ -29,7 +29,7 @@ namespace IceTray {
protected:
friend class LogManager;
- mutable boost::shared_mutex _lock;
+ mutable std::shared_mutex _lock;
LogLevelWriters logs;
const Domain domain;
};
@@ -52,7 +52,7 @@ namespace IceTray {
const auto fl = firstFor(priority);
if (fl != logs.end()) {
auto fmt = AdHoc::Buffer::getFormat(msgfmt);
- messagebf(fl, priority, *fmt, args...);
+ messagebf(fl, priority, fmt, args...);
}
}
@@ -79,14 +79,14 @@ namespace IceTray {
LoggerPtr getLogger(const std::type_info &);
LoggerPtr getLogger(const std::string &);
LogLevelWriters getLogsForDomain(const Domain &) const;
- void addWriter(LogWriterPrx writer);
- void removeWriter(LogWriterPrx writer);
+ void addWriter(LogWriterPrxPtr writer);
+ void removeWriter(LogWriterPrxPtr writer);
static LogManager * getDefault();
private:
void updateLoggerWriters() const;
- mutable boost::shared_mutex _lock;
+ mutable std::shared_mutex _lock;
Loggers loggers;
LogWriters logWriters;
};
@@ -94,7 +94,7 @@ namespace IceTray {
class DLL_PUBLIC AbstractLogWriter : public LogWriter {
public:
IceUtil::Optional<LogLevel> lowestLevel(const Ice::Current &) override;
- IceUtil::Optional<LogLevel> level(const Domain &, const Ice::Current &) override;
+ IceUtil::Optional<LogLevel> level(Domain, const Ice::Current &) override;
protected:
AbstractLogWriter();
@@ -108,7 +108,7 @@ namespace IceTray {
static Domain splitDomain(const std::string &);
};
- typedef AdHoc::Factory<LogWriter, Ice::Properties *> LogWriterFactory;
+ typedef AdHoc::Factory<LogWriter, const Ice::PropertiesPtr &> LogWriterFactory;
}
}
diff --git a/icetray/icetray/options.cpp b/icetray/icetray/options.cpp
index dcc6bb0..821824a 100644
--- a/icetray/icetray/options.cpp
+++ b/icetray/icetray/options.cpp
@@ -15,7 +15,7 @@ namespace IceTray {
OptionsDescPtr
Options::getOptions()
{
- auto opts = OptionsDescPtr(new boost::program_options::options_description(optionsName));
+ auto opts = std::make_shared<boost::program_options::options_description>(optionsName);
options(opts->add_options());
return opts;
}
diff --git a/icetray/icetray/options.h b/icetray/icetray/options.h
index 349959c..d346904 100644
--- a/icetray/icetray/options.h
+++ b/icetray/icetray/options.h
@@ -7,12 +7,11 @@
#include <Ice/Properties.h>
namespace IceTray {
- typedef boost::shared_ptr<boost::program_options::options_description> OptionsDescPtr;
+ typedef std::shared_ptr<boost::program_options::options_description> OptionsDescPtr;
class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
public:
Options(const std::string & name);
-
private:
friend class OptionsCollation;
virtual void options(boost::program_options::options_description_easy_init && optDesc) = 0;
diff --git a/icetray/icetray/sqlSource.h b/icetray/icetray/sqlSource.h
index 2bfe19d..0f21dcf 100644
--- a/icetray/icetray/sqlSource.h
+++ b/icetray/icetray/sqlSource.h
@@ -12,7 +12,7 @@ namespace IceTray {
virtual ~SqlSource() = default;
virtual const std::string & getSql() const = 0;
- virtual const DB::CommandOptions * getCommandOptions() const = 0;
+ virtual DB::CommandOptionsCPtr getCommandOptions() const = 0;
DB::ModifyCommandPtr modify(DB::Connection * db) const;
DB::SelectCommandPtr select(DB::Connection * db) const;
diff --git a/icetray/icetray/staticSqlSource.cpp b/icetray/icetray/staticSqlSource.cpp
index e8d3b78..9be8148 100644
--- a/icetray/icetray/staticSqlSource.cpp
+++ b/icetray/icetray/staticSqlSource.cpp
@@ -15,18 +15,13 @@ namespace IceTray {
}
- StaticSqlSource::~StaticSqlSource()
- {
- delete opts;
- }
-
const std::string &
StaticSqlSource::getSql() const
{
return sql;
}
- const DB::CommandOptions *
+ DB::CommandOptionsCPtr
StaticSqlSource::getCommandOptions() const
{
return opts;
diff --git a/icetray/icetray/staticSqlSource.h b/icetray/icetray/staticSqlSource.h
index a2ab0c6..3dc32a0 100644
--- a/icetray/icetray/staticSqlSource.h
+++ b/icetray/icetray/staticSqlSource.h
@@ -8,14 +8,13 @@ namespace IceTray {
public:
StaticSqlSource(const std::string & sql);
StaticSqlSource(const std::string & sql, const std::string & optsName, const DB::CommandOptionsMap &);
- virtual ~StaticSqlSource();
const std::string & getSql() const override;
- const DB::CommandOptions * getCommandOptions() const override;
+ DB::CommandOptionsCPtr getCommandOptions() const override;
protected:
const std::string sql;
- const DB::CommandOptions * opts;
+ const DB::CommandOptionsCPtr opts;
};
}
diff --git a/icetray/tool/Jamfile.jam b/icetray/tool/Jamfile.jam
index f39377d..9f6caff 100644
--- a/icetray/tool/Jamfile.jam
+++ b/icetray/tool/Jamfile.jam
@@ -19,6 +19,7 @@ exe icetray-doc :
:
<library>boost_program_options
<library>../icetray//icetray
+ <library>..//Ice++11
<library>dl
;
diff --git a/icetray/unittests/Jamfile.jam b/icetray/unittests/Jamfile.jam
index 9883445..f5223d3 100644
--- a/icetray/unittests/Jamfile.jam
+++ b/icetray/unittests/Jamfile.jam
@@ -15,9 +15,8 @@ alias testCommon : : : :
<library>..//adhocutil
<library>..//dryice
<library>..//icetray
- <library>..//IceBox
- <library>..//IceUtil
- <library>..//Ice
+ <library>..//IceBox++11
+ <library>..//Ice++11
<library>..//pthread
<library>boost_utf
<library>..//boost_system
diff --git a/icetray/unittests/testDefaultPool.cpp b/icetray/unittests/testDefaultPool.cpp
index d615386..d7dd28c 100644
--- a/icetray/unittests/testDefaultPool.cpp
+++ b/icetray/unittests/testDefaultPool.cpp
@@ -20,6 +20,5 @@ BOOST_AUTO_TEST_CASE( defaultPool )
auto c = pool->get();
c->ping();
}
- delete pool;
}
diff --git a/icetray/unittests/testIceBoxInterface.cpp b/icetray/unittests/testIceBoxInterface.cpp
index 13febe0..96aedf3 100644
--- a/icetray/unittests/testIceBoxInterface.cpp
+++ b/icetray/unittests/testIceBoxInterface.cpp
@@ -14,6 +14,7 @@ BOOST_AUTO_TEST_CASE( IceBoxInterface )
BOOST_REQUIRE(sf);
auto service = sf(nullptr);
BOOST_REQUIRE(service);
+ BOOST_REQUIRE_EQUAL(service, IceTray::Service::getCurrent());
delete service;
}
diff --git a/icetray/unittests/testIceTray.cpp b/icetray/unittests/testIceTray.cpp
index a8c22a1..81b5e03 100644
--- a/icetray/unittests/testIceTray.cpp
+++ b/icetray/unittests/testIceTray.cpp
@@ -11,10 +11,10 @@
#include <pq-mock.h>
#include <definedDirs.h>
-class Service : public IceTray::DryIce, PQ::Mock {
+class Service : public IceTray::DryIce, DB::PluginMock<PQ::Mock> {
public:
Service() :
- PQ::Mock("user=postgres dbname=postgres", "icetraydb", {
+ DB::PluginMock<PQ::Mock>("user=postgres dbname=postgres", "icetraydb", {
rootDir / "testIceTrayService.sql"
})
{
@@ -29,7 +29,7 @@ class Client : public IceTray::DryIceClient {
p(getProxy<TestIceTray::TestIceTrayServicePrx>("test"))
{
}
- TestIceTray::TestIceTrayServicePrx p;
+ TestIceTray::TestIceTrayServicePrxPtr p;
};
BOOST_FIXTURE_TEST_SUITE( client, Client );
@@ -55,7 +55,6 @@ BOOST_AUTO_TEST_CASE( sqlModify )
{
auto db = DB::MockDatabase::openConnectionTo("icetraydb");
BOOST_REQUIRE(db);
- BOOST_REQUIRE(TestIceTray::sql::testIceTrayServiceTestSql.modify(db));
- delete db;
+ BOOST_REQUIRE(TestIceTray::sql::testIceTrayServiceTestSql.modify(db.get()));
}
diff --git a/icetray/unittests/testIceTrayLogger.cpp b/icetray/unittests/testIceTrayLogger.cpp
index 68e8ccc..393a6f2 100644
--- a/icetray/unittests/testIceTrayLogger.cpp
+++ b/icetray/unittests/testIceTrayLogger.cpp
@@ -10,6 +10,7 @@
#include <boost/format.hpp>
#include <slicer/common.h>
#include <logWriterConsole.h>
+#include <slicer/modelPartsTypes.h>
#include "testService.h"
using namespace IceTray::Logging;
@@ -28,12 +29,12 @@ class TestLogWriter : public AbstractLogWriter {
{
}
- TestLogWriter(Ice::Properties * p) :
+ TestLogWriter(const Ice::PropertiesPtr & p) :
AbstractLogWriter("TestLogWriter", p)
{
}
- void message(LogLevel priority, const Domain & domain, const std::string & message, const Ice::Current &) override
+ void message(LogLevel priority, Domain domain, std::string message, const Ice::Current &) override
{
msgs.push_back({priority, domain, message});
}
@@ -50,6 +51,11 @@ namespace std {
}
return s;
}
+ ostream &
+ operator<<(ostream & s, const LogLevel & ll) {
+ s << Slicer::ModelPartForEnum<LogLevel>::lookup(ll);
+ return s;
+ }
}
class StaticLogTest {
@@ -87,9 +93,9 @@ class TestLogImpl {
ic->destroy();
}
- LogWriterPrx add(LogWriter * w)
+ LogWriterPrxPtr add(const LogWriterPtr & w)
{
- return LogWriterPrx::uncheckedCast(adp->addWithUUID(w));
+ return Ice::uncheckedCast<LogWriterPrx>(adp->addWithUUID(w));
}
protected:
@@ -104,8 +110,8 @@ class TestLogImpl {
BOOST_FIXTURE_TEST_SUITE(li, TestLogImpl);
BOOST_AUTO_TEST_CASE(no_writers) {
- log->message(EMERG, "");
- log->message(DEBUG, "");
+ log->message(LogLevel::EMERG, "");
+ log->message(LogLevel::DEBUG, "");
}
BOOST_AUTO_TEST_CASE(ostreamDomain) {
@@ -115,8 +121,8 @@ BOOST_AUTO_TEST_CASE(ostreamDomain) {
}
BOOST_AUTO_TEST_CASE(priority_filtering) {
- auto w = new TestLogWriter(WARNING);
- auto e = new TestLogWriter(ERR);
+ auto w = std::make_shared<TestLogWriter>(LogLevel::WARNING);
+ auto e = std::make_shared<TestLogWriter>(LogLevel::ERR);
auto wp = add(w);
auto ep = add(e);
manager.addWriter(wp);
@@ -124,58 +130,58 @@ BOOST_AUTO_TEST_CASE(priority_filtering) {
BOOST_REQUIRE(w->msgs.empty());
BOOST_REQUIRE(e->msgs.empty());
- log->message(DEBUG, "debug");
+ log->message(LogLevel::DEBUG, "debug");
BOOST_REQUIRE(w->msgs.empty());
BOOST_REQUIRE(e->msgs.empty());
- log->message(INFO, "into");
+ log->message(LogLevel::INFO, "info");
BOOST_REQUIRE(w->msgs.empty());
BOOST_REQUIRE(e->msgs.empty());
- log->message(NOTICE, "notice");
+ log->message(LogLevel::NOTICE, "notice");
BOOST_REQUIRE(w->msgs.empty());
BOOST_REQUIRE(e->msgs.empty());
- log->message(WARNING, "warning");
+ log->message(LogLevel::WARNING, "warning");
BOOST_REQUIRE_EQUAL(1, w->msgs.size());
BOOST_REQUIRE(e->msgs.empty());
- log->message(ERR, "err");
+ log->message(LogLevel::ERR, "err");
BOOST_REQUIRE_EQUAL(2, w->msgs.size());
BOOST_REQUIRE_EQUAL(1, e->msgs.size());
- log->message(CRIT, "crit");
+ log->message(LogLevel::CRIT, "crit");
BOOST_REQUIRE_EQUAL(3, w->msgs.size());
BOOST_REQUIRE_EQUAL(2, e->msgs.size());
- log->message(ALERT, "alert");
+ log->message(LogLevel::ALERT, "alert");
BOOST_REQUIRE_EQUAL(4, w->msgs.size());
BOOST_REQUIRE_EQUAL(3, e->msgs.size());
- log->message(EMERG, "emerg");
+ log->message(LogLevel::EMERG, "emerg");
BOOST_REQUIRE_EQUAL(5, w->msgs.size());
BOOST_REQUIRE_EQUAL(4, e->msgs.size());
manager.removeWriter(wp);
- log->message(ERR, "err2");
+ log->message(LogLevel::ERR, "err2");
BOOST_REQUIRE_EQUAL(5, w->msgs.size());
BOOST_REQUIRE_EQUAL(5, e->msgs.size());
}
BOOST_AUTO_TEST_CASE( no_domains )
{
- auto d = new TestLogWriter();
+ auto d = std::make_shared<TestLogWriter>();
manager.addWriter(add(d));
- log->message(DEBUG, "debug message.");
- log->message(EMERG, "emergency message.");
+ log->message(LogLevel::DEBUG, "debug message.");
+ log->message(LogLevel::EMERG, "emergency message.");
BOOST_REQUIRE(d->msgs.empty());
}
BOOST_AUTO_TEST_CASE(formatter_plain)
{
- auto d = new TestLogWriter(DEBUG);
+ auto d = std::make_shared<TestLogWriter>(LogLevel::DEBUG);
manager.addWriter(add(d));
- log->message(DEBUG, "plain message.");
+ log->message(LogLevel::DEBUG, "plain message.");
BOOST_REQUIRE_EQUAL(1, d->msgs.size());
BOOST_REQUIRE_EQUAL("plain message.", d->msgs.front().message);
BOOST_REQUIRE_EQUAL(testDomain, d->msgs.front().domain);
@@ -183,9 +189,9 @@ BOOST_AUTO_TEST_CASE(formatter_plain)
BOOST_AUTO_TEST_CASE(formatter_libc)
{
- auto d = new TestLogWriter(DEBUG);
+ auto d = std::make_shared<TestLogWriter>(LogLevel::DEBUG);
manager.addWriter(add(d));
- log->messagef(DEBUG, "plain %s.", "message");
+ log->messagef(LogLevel::DEBUG, "plain %s.", "message");
BOOST_REQUIRE_EQUAL(1, d->msgs.size());
BOOST_REQUIRE_EQUAL("plain message.", d->msgs.front().message);
BOOST_REQUIRE_EQUAL(testDomain, d->msgs.front().domain);
@@ -193,9 +199,9 @@ BOOST_AUTO_TEST_CASE(formatter_libc)
BOOST_AUTO_TEST_CASE(formatter_boost_format)
{
- auto d = new TestLogWriter(DEBUG);
+ auto d = std::make_shared<TestLogWriter>(LogLevel::DEBUG);
manager.addWriter(add(d));
- log->messagebf(DEBUG, "plain %s", std::string("message"));
+ log->messagebf(LogLevel::DEBUG, "plain %s", std::string("message"));
BOOST_REQUIRE_EQUAL(1, d->msgs.size());
BOOST_REQUIRE_EQUAL("plain message", d->msgs.front().message);
BOOST_REQUIRE_EQUAL(testDomain, d->msgs.front().domain);
@@ -204,9 +210,9 @@ BOOST_AUTO_TEST_CASE(formatter_boost_format)
AdHocFormatter(Plain, "plain %?.");
BOOST_AUTO_TEST_CASE(formatter_adhoc_compiletime)
{
- auto d = new TestLogWriter(DEBUG);
+ auto d = std::make_shared<TestLogWriter>(LogLevel::DEBUG);
manager.addWriter(add(d));
- log->messagectf<Plain>(DEBUG, "message");
+ log->messagectf<Plain>(LogLevel::DEBUG, "message");
BOOST_REQUIRE_EQUAL(1, d->msgs.size());
BOOST_REQUIRE_EQUAL("plain message.", d->msgs.front().message);
BOOST_REQUIRE_EQUAL(testDomain, d->msgs.front().domain);
@@ -215,7 +221,7 @@ BOOST_AUTO_TEST_CASE(formatter_adhoc_compiletime)
BOOST_AUTO_TEST_CASE( domains_none )
{
// No domains
- auto l = add(new TestLogWriter());
+ auto l = add(std::make_shared<TestLogWriter>());
BOOST_REQUIRE(!l->level(test));
BOOST_REQUIRE(!l->level(testDomain));
BOOST_REQUIRE(!l->lowestLevel());
@@ -224,21 +230,21 @@ BOOST_AUTO_TEST_CASE( domains_none )
BOOST_AUTO_TEST_CASE( domains_single )
{
// A single catch-all domain at the given level
- auto l = add(new TestLogWriter(ERR));
- BOOST_REQUIRE_EQUAL(ERR, *l->level(test));
- BOOST_REQUIRE_EQUAL(ERR, *l->level(testDomain));
+ auto l = add(std::make_shared<TestLogWriter>(LogLevel::ERR));
+ BOOST_REQUIRE_EQUAL(LogLevel::ERR, *l->level(test));
+ BOOST_REQUIRE_EQUAL(LogLevel::ERR, *l->level(testDomain));
BOOST_REQUIRE(l->lowestLevel());
- BOOST_REQUIRE_EQUAL(ERR, *l->lowestLevel());
+ BOOST_REQUIRE_EQUAL(LogLevel::ERR, *l->lowestLevel());
}
BOOST_AUTO_TEST_CASE( domains_fromNullProperties )
{
// A single catch-all domain at the default level (WARNING)
- auto l = add(new TestLogWriter("", Ice::PropertiesPtr()));
- BOOST_REQUIRE_EQUAL(WARNING, *l->level(test));
- BOOST_REQUIRE_EQUAL(WARNING, *l->level(testDomain));
+ auto l = add(std::make_shared<TestLogWriter>("", Ice::PropertiesPtr()));
+ BOOST_REQUIRE_EQUAL(LogLevel::WARNING, *l->level(test));
+ BOOST_REQUIRE_EQUAL(LogLevel::WARNING, *l->level(testDomain));
BOOST_REQUIRE(l->lowestLevel());
- BOOST_REQUIRE_EQUAL(WARNING, *l->lowestLevel());
+ BOOST_REQUIRE_EQUAL(LogLevel::WARNING, *l->lowestLevel());
}
BOOST_AUTO_TEST_CASE( domains_fromProperties )
@@ -249,13 +255,13 @@ BOOST_AUTO_TEST_CASE( domains_fromProperties )
p->setProperty("TestLogWriter.domains.test.debug", "DEBUG");
p->setProperty("TestLogWriter.domains", "ignored");
p->setProperty("TestLogWriter.default", "WARNING");
- auto l = add(new TestLogWriter("TestLogWriter", p));
- BOOST_REQUIRE_EQUAL(WARNING, *l->level(test));
- BOOST_REQUIRE_EQUAL(WARNING, *l->level(other));
- BOOST_REQUIRE_EQUAL(EMERG, *l->level(testDomain));
- BOOST_REQUIRE_EQUAL(DEBUG, *l->level(testDebug));
+ auto l = add(std::make_shared<TestLogWriter>("TestLogWriter", p));
+ BOOST_REQUIRE_EQUAL(LogLevel::WARNING, *l->level(test));
+ BOOST_REQUIRE_EQUAL(LogLevel::WARNING, *l->level(other));
+ BOOST_REQUIRE_EQUAL(LogLevel::EMERG, *l->level(testDomain));
+ BOOST_REQUIRE_EQUAL(LogLevel::DEBUG, *l->level(testDebug));
BOOST_REQUIRE(l->lowestLevel());
- BOOST_REQUIRE_EQUAL(DEBUG, *l->lowestLevel());
+ BOOST_REQUIRE_EQUAL(LogLevel::DEBUG, *l->lowestLevel());
}
BOOST_AUTO_TEST_CASE( domains_fromProperties_noDefault )
@@ -264,11 +270,11 @@ BOOST_AUTO_TEST_CASE( domains_fromProperties_noDefault )
Ice::PropertiesPtr p = ic->getProperties();
p->setProperty("TestLogWriter.domains.test.domain", "EMERG");
p->setProperty("TestLogWriter.domains.test.debug", "DEBUG");
- auto l = add(new TestLogWriter("TestLogWriter", p));
- BOOST_REQUIRE_EQUAL(EMERG, *l->level(testDomain));
- BOOST_REQUIRE_EQUAL(DEBUG, *l->level(testDebug));
+ auto l = add(std::make_shared<TestLogWriter>("TestLogWriter", p));
+ BOOST_REQUIRE_EQUAL(LogLevel::EMERG, *l->level(testDomain));
+ BOOST_REQUIRE_EQUAL(LogLevel::DEBUG, *l->level(testDebug));
BOOST_REQUIRE(l->lowestLevel());
- BOOST_REQUIRE_EQUAL(DEBUG, *l->lowestLevel());
+ BOOST_REQUIRE_EQUAL(LogLevel::DEBUG, *l->lowestLevel());
}
BOOST_AUTO_TEST_CASE( domains_fromProperties_onlyDefault )
@@ -276,13 +282,13 @@ BOOST_AUTO_TEST_CASE( domains_fromProperties_onlyDefault )
// Domains configured according to properties
Ice::PropertiesPtr p = ic->getProperties();
p->setProperty("TestLogWriter.default", "INFO");
- auto l = add(new TestLogWriter("TestLogWriter", p));
- BOOST_REQUIRE_EQUAL(INFO, *l->level(test));
- BOOST_REQUIRE_EQUAL(INFO, *l->level(other));
- BOOST_REQUIRE_EQUAL(INFO, *l->level(testDomain));
- BOOST_REQUIRE_EQUAL(INFO, *l->level(testDebug));
+ auto l = add(std::make_shared<TestLogWriter>("TestLogWriter", p));
+ BOOST_REQUIRE_EQUAL(LogLevel::INFO, *l->level(test));
+ BOOST_REQUIRE_EQUAL(LogLevel::INFO, *l->level(other));
+ BOOST_REQUIRE_EQUAL(LogLevel::INFO, *l->level(testDomain));
+ BOOST_REQUIRE_EQUAL(LogLevel::INFO, *l->level(testDebug));
BOOST_REQUIRE(l->lowestLevel());
- BOOST_REQUIRE_EQUAL(INFO, *l->lowestLevel());
+ BOOST_REQUIRE_EQUAL(LogLevel::INFO, *l->lowestLevel());
}
BOOST_AUTO_TEST_CASE( domains_fromProperties_badLevel )
@@ -325,55 +331,55 @@ BOOST_AUTO_TEST_CASE( console )
{
IceTray::Logging::LogWriterPtr lwp =
IceTray::Logging::LogWriterFactory::createNew("ConsoleLogWriter", NULL);
- lwp->message(DEBUG, testDomain, "some message");
+ lwp->message(LogLevel::DEBUG, testDomain, "some message", {});
}
BOOST_AUTO_TEST_CASE( consoleNoWidth )
{
std::stringstream str;
- ConsoleLogWriter::writeStream(str, -1, DEBUG, testDomain, "message");
+ ConsoleLogWriter::writeStream(str, -1, LogLevel::DEBUG, testDomain, "message");
BOOST_REQUIRE_EQUAL("DEBUG: test.domain: message\n", str.str());
}
BOOST_AUTO_TEST_CASE( consoleWidthJustRight )
{
std::stringstream str;
- ConsoleLogWriter::writeStream(str, 11, DEBUG, testDomain, "message");
+ ConsoleLogWriter::writeStream(str, 11, LogLevel::DEBUG, testDomain, "message");
BOOST_REQUIRE_EQUAL("DEBUG: test.domain: message\n", str.str());
}
BOOST_AUTO_TEST_CASE( consoleWidthSmall )
{
std::stringstream str;
- ConsoleLogWriter::writeStream(str, 10, DEBUG, testDomain, "message");
+ ConsoleLogWriter::writeStream(str, 10, LogLevel::DEBUG, testDomain, "message");
BOOST_REQUIRE_EQUAL("DEBUG: t.domain: message\n", str.str());
}
BOOST_AUTO_TEST_CASE( consoleWidthTiny )
{
std::stringstream str;
- ConsoleLogWriter::writeStream(str, 8, DEBUG, testDomain, "message");
+ ConsoleLogWriter::writeStream(str, 8, LogLevel::DEBUG, testDomain, "message");
BOOST_REQUIRE_EQUAL("DEBUG: t.domain: message\n", str.str());
}
BOOST_AUTO_TEST_CASE( consoleWidthTooTiny )
{
std::stringstream str;
- ConsoleLogWriter::writeStream(str, 7, DEBUG, testDomain, "message");
+ ConsoleLogWriter::writeStream(str, 7, LogLevel::DEBUG, testDomain, "message");
BOOST_REQUIRE_EQUAL("DEBUG: t.d: message\n", str.str());
}
BOOST_AUTO_TEST_CASE( consoleWidthOverflow )
{
std::stringstream str;
- ConsoleLogWriter::writeStream(str, 1, DEBUG, testDomain, "message");
+ ConsoleLogWriter::writeStream(str, 1, LogLevel::DEBUG, testDomain, "message");
BOOST_REQUIRE_EQUAL("DEBUG: t.d: message\n", str.str());
}
BOOST_AUTO_TEST_CASE( consoleNoDomain )
{
std::stringstream str;
- ConsoleLogWriter::writeStream(str, 0, DEBUG, {}, "message");
+ ConsoleLogWriter::writeStream(str, 0, LogLevel::DEBUG, {}, "message");
BOOST_REQUIRE_EQUAL("DEBUG: : message\n", str.str());
}
diff --git a/icetray/unittests/testIceTrayReplace.cpp b/icetray/unittests/testIceTrayReplace.cpp
index afbab51..346e0a1 100644
--- a/icetray/unittests/testIceTrayReplace.cpp
+++ b/icetray/unittests/testIceTrayReplace.cpp
@@ -14,7 +14,7 @@ namespace TestIceTray {
DummyTestIceTrayServiceI() { }
void method1(const Ice::Current &) override { }
- void method2(Ice::Int, const std::string &, const Ice::Current &) override { }
+ void method2(Ice::Int, std::string, const Ice::Current &) override { }
};
}
@@ -22,7 +22,7 @@ class Service : public IceTray::DryIce {
public:
Service()
{
- replace("test", new TestIceTray::DummyTestIceTrayServiceI());
+ replace("test", std::make_shared<TestIceTray::DummyTestIceTrayServiceI>());
}
};
@@ -34,7 +34,7 @@ class Client : public IceTray::DryIceClient {
p(getProxy<TestIceTray::TestIceTrayServicePrx>("test"))
{
}
- TestIceTray::TestIceTrayServicePrx p;
+ TestIceTray::TestIceTrayServicePrxPtr p;
};
BOOST_FIXTURE_TEST_SUITE( client, Client );
diff --git a/icetray/unittests/testIceTrayServiceI.cpp b/icetray/unittests/testIceTrayServiceI.cpp
index 141bdf7..2f15649 100644
--- a/icetray/unittests/testIceTrayServiceI.cpp
+++ b/icetray/unittests/testIceTrayServiceI.cpp
@@ -2,6 +2,7 @@
#include <factory.h>
#include <Ice/ObjectAdapter.h>
#include <Ice/Communicator.h>
+#include <Ice/Initialize.h>
#include <boost/assert.hpp>
#include <testIceTrayServiceTestSql.sql.h>
#include <subdir/some.sql.h>
@@ -13,14 +14,14 @@ class Foo { };
namespace IceTray {
template<>
void
- AbstractDatabaseClient::bind1(int o, DB::Command * cmd, const Foo &) \
+ AbstractDatabaseClient::bind1(int o, DB::Command * cmd, const Foo &)
{
cmd->bindNull(o);
}
}
namespace TestIceTray {
- TestIceTrayServiceI::TestIceTrayServiceI(IceTray::DatabasePoolPtr d) :
+ TestIceTrayServiceI::TestIceTrayServiceI(const IceTray::DatabasePoolPtr & d) :
IceTray::AbstractCachingDatabaseClient(d)
{
}
@@ -29,8 +30,8 @@ namespace TestIceTray {
TestIceTrayServiceI::fetchTest(const Type & value)
{
BOOST_REQUIRE_EQUAL(0, (fetch<int, int, Type>(sql::testIceTrayServiceTestSql, 1, value)));
- BOOST_REQUIRE_EQUAL(0, (fetch<int, boost::optional<Type>, boost::optional<Type>>(sql::testIceTrayServiceTestSql, boost::optional<Type>(), value)));
- BOOST_REQUIRE_EQUAL(0, (fetch<int, IceUtil::Optional<Type>, IceUtil::Optional<Type>>(sql::testIceTrayServiceTestSql, IceUtil::None, value)));
+ BOOST_REQUIRE_EQUAL(0, (fetch<int, std::optional<Type>, std::optional<Type>>(sql::testIceTrayServiceTestSql, {}, value)));
+ BOOST_REQUIRE_EQUAL(0, (fetch<int, Ice::optional<Type>, Ice::optional<Type>>(sql::testIceTrayServiceTestSql, IceUtil::None, value)));
}
void TestIceTrayServiceI::method1(const Ice::Current &)
@@ -60,14 +61,14 @@ namespace TestIceTray {
fetch<int>(dbc.get(), sql::testIceTrayServiceTestSql, 1, 1);
}
- void TestIceTrayServiceI::method2(Ice::Int id, const std::string & name, const Ice::Current &)
+ void TestIceTrayServiceI::method2(Ice::Int id, std::string name, const Ice::Current &)
{
BOOST_VERIFY((fetchCache<int>(sql::testIceTrayServiceTestSql, 10, id, name)) == (fetchCache<int>(sql::testIceTrayServiceTestSql, 10, id, name)));
}
void TestService::addObjects(const std::string &, const Ice::CommunicatorPtr & ic, const Ice::StringSeq &, const Ice::ObjectAdapterPtr & adp)
{
- adp->add(new TestIceTray::TestIceTrayServiceI(getConnectionPool(ic, "postgresql", "icetraydb")), ic->stringToIdentity("test"));
+ adp->add(std::make_shared<TestIceTray::TestIceTrayServiceI>(getConnectionPool(ic, "postgresql", "icetraydb")), Ice::stringToIdentity("test"));
}
NAMEDFACTORY("default", TestService, IceTray::ServiceFactory);
diff --git a/icetray/unittests/testIceTrayServiceI.h b/icetray/unittests/testIceTrayServiceI.h
index 355b7e5..7a96688 100644
--- a/icetray/unittests/testIceTrayServiceI.h
+++ b/icetray/unittests/testIceTrayServiceI.h
@@ -8,10 +8,10 @@
namespace TestIceTray {
class TestIceTrayServiceI : IceTray::AbstractCachingDatabaseClient, public TestIceTrayService {
public:
- TestIceTrayServiceI(boost::shared_ptr<AdHoc::ResourcePool<DB::Connection>> db);
+ TestIceTrayServiceI(const IceTray::DatabasePoolPtr & db);
void method1(const Ice::Current &) override;
- void method2(Ice::Int id, const std::string & name, const Ice::Current &) override;
+ void method2(Ice::Int id, std::string name, const Ice::Current &) override;
private:
template<typename Type> void fetchTest(const Type & value);