File indexing completed on 2024-11-10 04:40:16

0001 /*
0002     SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "qtest_akonadi.h"
0008 #include "servermanager.h"
0009 
0010 #include <QDBusConnection>
0011 #include <QDBusConnectionInterface>
0012 #include <QObject>
0013 
0014 using namespace Akonadi;
0015 
0016 /**
0017   This test verifies that the testrunner set everything up correctly, so all the
0018   other tests work as expected.
0019 */
0020 class TestEnvironmentTest : public QObject
0021 {
0022     Q_OBJECT
0023 private Q_SLOTS:
0024     void initTestCase()
0025     {
0026         AkonadiTest::checkTestIsIsolated();
0027     }
0028 
0029     void testDBus()
0030     {
0031         QVERIFY(QDBusConnection::sessionBus().isConnected());
0032     }
0033 
0034     void testAkonadiServer()
0035     {
0036         QVERIFY(ServerManager::isRunning());
0037     }
0038 
0039     void testResources()
0040     {
0041         QVERIFY(QDBusConnection::sessionBus().interface()->isServiceRegistered(
0042             ServerManager::agentServiceName(ServerManager::Resource, QStringLiteral("akonadi_knut_resource_0"))));
0043         QVERIFY(QDBusConnection::sessionBus().interface()->isServiceRegistered(
0044             ServerManager::agentServiceName(ServerManager::Resource, QStringLiteral("akonadi_knut_resource_1"))));
0045         QVERIFY(QDBusConnection::sessionBus().interface()->isServiceRegistered(
0046             ServerManager::agentServiceName(ServerManager::Resource, QStringLiteral("akonadi_knut_resource_2"))));
0047     }
0048 };
0049 
0050 QTEST_AKONADIMAIN(TestEnvironmentTest)
0051 
0052 #include "testenvironmenttest.moc"