Permalink
Browse files

Fix finding the resource interface when running in the test environment

  • Loading branch information...
1 parent 8fc867c commit 8b7e7bfd2e9751e6bd7f4a292c42dc5468dacf0a @vkrause vkrause committed Sep 17, 2017
Showing with 13 additions and 2 deletions.
  1. +6 −1 resources/maildir/autotests/synctest.cpp
  2. +7 −1 resources/pop3/autotests/pop3test.cpp
@@ -46,7 +46,12 @@ void SyncTest::initTestCase()
QVERIFY(agentCreateJob->exec());
mMaildirIdentifier = agentCreateJob->instance().identifier();
- OrgKdeAkonadiMaildirSettingsInterface interface(QStringLiteral("org.freedesktop.Akonadi.Resource.%1").arg(mMaildirIdentifier), QStringLiteral("/"), QDBusConnection::sessionBus());
+ QString service = QStringLiteral("org.freedesktop.Akonadi.Resource.") + mMaildirIdentifier;
+ if (Akonadi::ServerManager::hasInstanceIdentifier()) {
+ service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier();
+ }
+
+ OrgKdeAkonadiMaildirSettingsInterface interface(service, QStringLiteral("/"), QDBusConnection::sessionBus());
QVERIFY(interface.isValid());
const QString mailPath = QFINDTESTDATA("maildir");
QVERIFY(!mailPath.isEmpty());
@@ -71,8 +71,14 @@ void Pop3Test::initTestCase()
//
QString maildirRootPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QLatin1String("tester");
mMaildirPath = maildirRootPath + QLatin1String("/new");
+
+ QString service = QLatin1String("org.freedesktop.Akonadi.Resource.") + mMaildirIdentifier;
+ if (Akonadi::ServerManager::hasInstanceIdentifier()) {
+ service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier();
+ }
+
mMaildirSettingsInterface = new OrgKdeAkonadiMaildirSettingsInterface(
- QLatin1String("org.freedesktop.Akonadi.Resource.") + mMaildirIdentifier,
+ service,
QStringLiteral("/Settings"), QDBusConnection::sessionBus(), this);
QDBusReply<void> setPathReply = mMaildirSettingsInterface->setPath(maildirRootPath);
QVERIFY(setPathReply.isValid());

0 comments on commit 8b7e7bf

Please sign in to comment.