[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:07:11 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=09589ad
The following commit has been merged in the master branch:
commit 09589ad5919a275ef3f6c20a630e224de2f51810
Author: Dario Freddi <drf at kde.org>
Date: Sun Sep 19 12:40:23 2010 +0000
Merge branch 'start-unit-tests'
svn path=/trunk/playground/network/telepathy-integration-daemon/; revision=1177099
---
kpeople/nepomuk-feeder/CMakeLists.txt | 34 +-
.../cmake/modules/FindKTelepathyTestLib.cmake | 8 +
kpeople/nepomuk-feeder/telepathyaccount.cpp | 29 +-
kpeople/nepomuk-feeder/telepathycontact.cpp | 4 +-
kpeople/nepomuk-feeder/tests/CMakeLists.txt | 26 ++
kpeople/nepomuk-feeder/tests/account-test.cpp | 191 +++++++++
kpeople/nepomuk-feeder/tests/account-test.h | 55 +++
kpeople/nepomuk-feeder/tests/contact-test.cpp | 448 +++++++++++++++++++++
kpeople/nepomuk-feeder/tests/contact-test.h | 54 +++
kpeople/nepomuk-feeder/tests/tid-base-test.cpp | 171 ++++++++
kpeople/nepomuk-feeder/tests/tid-base-test.h | 58 +++
11 files changed, 1056 insertions(+), 22 deletions(-)
diff --git a/kpeople/nepomuk-feeder/CMakeLists.txt b/kpeople/nepomuk-feeder/CMakeLists.txt
index 8dcdf4d..b8a5e47 100644
--- a/kpeople/nepomuk-feeder/CMakeLists.txt
+++ b/kpeople/nepomuk-feeder/CMakeLists.txt
@@ -31,6 +31,7 @@ set (KDE4_ICON_DIR
)
include_directories (${KDE4_INCLUDES}
+ ${CMAKE_CURRENT_SOURCE_DIR}
${KDEPIMLIBS_INCLUDE_DIRS}
${TELEPATHY_QT4_INCLUDE_DIR}
${NEPOMUK_INCLUDES}
@@ -64,13 +65,12 @@ target_link_libraries (nie
)
####################################
-# Second target - integration daemon
+# Second target - integration daemon static library
-set (telepathy_integration_daemon_SRCS
+set (telepathy_integration_daemon_static_SRCS
telepathyaccountmonitor.cpp
telepathyaccount.cpp
telepathycontact.cpp
- main.cpp
)
# Add the ontologies we want to build the vocabulary for.
@@ -95,15 +95,15 @@ soprano_add_ontology (telepathy_SRCS
"trig"
)
-# Build the daemon.
-kde4_add_executable (telepathy-integration-daemon
- ${telepathy_integration_daemon_SRCS}
- ${pimo_SRCS}
- ${nco_SRCS}
- ${telepathy_SRCS}
+kde4_add_library (telepathy-integration-daemon-static
+ STATIC
+ ${telepathy_integration_daemon_static_SRCS}
+ ${pimo_SRCS}
+ ${nco_SRCS}
+ ${telepathy_SRCS}
)
-target_link_libraries (telepathy-integration-daemon
+target_link_libraries (telepathy-integration-daemon-static
${QT_QTCORE_LIBRARY}
${QT_QTDBUS_LIBRARY}
${KDE4_KDECORE_LIBS}
@@ -113,6 +113,18 @@ target_link_libraries (telepathy-integration-daemon
nie
)
+####################################
+# Third target - integration daemon
+
+# Build the daemon.
+kde4_add_executable (telepathy-integration-daemon
+ main.cpp
+)
+
+target_link_libraries (telepathy-integration-daemon
+ telepathy-integration-daemon-static
+)
+
# Install the daemon.
install (TARGETS telepathy-integration-daemon
${INSTALL_TARGETS_DEFAULT_ARGS}
@@ -128,3 +140,5 @@ macro(INSTALL_ONTOLOGY _name _group)
endmacro(INSTALL_ONTOLOGY)
install_ontology (telepathy telepathy)
+
+add_subdirectory(tests)
diff --git a/kpeople/nepomuk-feeder/cmake/modules/FindKTelepathyTestLib.cmake b/kpeople/nepomuk-feeder/cmake/modules/FindKTelepathyTestLib.cmake
new file mode 100644
index 0000000..ce481c1
--- /dev/null
+++ b/kpeople/nepomuk-feeder/cmake/modules/FindKTelepathyTestLib.cmake
@@ -0,0 +1,8 @@
+# Try to find Telepathy-Qt4 Test Library
+#
+# Copyright (c) 2010, Dario Freddi <drf at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+find_package( KTelepathyTestLib QUIET NO_MODULE PATHS ${LIB_INSTALL_DIR}/KTelepathy/TestLib/cmake )
diff --git a/kpeople/nepomuk-feeder/telepathyaccount.cpp b/kpeople/nepomuk-feeder/telepathyaccount.cpp
index 7154d47..7ca2a60 100644
--- a/kpeople/nepomuk-feeder/telepathyaccount.cpp
+++ b/kpeople/nepomuk-feeder/telepathyaccount.cpp
@@ -100,7 +100,7 @@ void TelepathyAccount::onAccountReady(Tp::PendingOperation *op)
return;
}
- kDebug() << this;
+ kDebug() << "Account ready:" << this;
// Check that this Account is set up in nepomuk.
doNepomukSetup();
@@ -221,6 +221,8 @@ void TelepathyAccount::onHaveConnectionChanged(bool haveConnection)
return;
}
+ kDebug() << "Connection up:" << this;
+
m_connection = m_account->connection();
Tp::Features features;
@@ -236,6 +238,7 @@ void TelepathyAccount::onHaveConnectionChanged(bool haveConnection)
} else {
// Connection has gone down. Delete our pointer to it.
m_connection.reset();
+ kDebug() << "Connection fell:" << this;
}
}
@@ -256,6 +259,8 @@ void TelepathyAccount::onConnectionReady(Tp::PendingOperation *op)
return;
}
+ kDebug() << "Connection ready:" << this;
+
Tp::Contacts contacts = m_connection->contactManager()->allKnownContacts();
QSet<Tp::Contact::Feature> features;
@@ -322,15 +327,17 @@ void TelepathyAccount::onContactsUpgraded(Tp::PendingOperation* op)
if (!avatarsToRetrieve.isEmpty()) {
kDebug() << "Pulling avatars";
// Ok, pull the avatars here
- QDBusPendingReply< Tp::AvatarTokenMap > reply =
- m_connection->avatarsInterface()->GetKnownAvatarTokens(avatarsToRetrieve);
-
- reply.waitForFinished();
- if (!reply.value().isEmpty()) {
- Tp::AvatarTokenMap result = reply.value();
- for (Tp::AvatarTokenMap::const_iterator i = result.constBegin(); i != result.constEnd(); ++i) {
- if (!i.value().isEmpty()) {
- onContactAvatarUpdated(i.key(), i.value());
+ if (m_connection.data()->avatarsInterface()) {
+ QDBusPendingReply< Tp::AvatarTokenMap > reply =
+ m_connection.data()->avatarsInterface()->GetKnownAvatarTokens(avatarsToRetrieve);
+
+ reply.waitForFinished();
+ if (!reply.value().isEmpty()) {
+ Tp::AvatarTokenMap result = reply.value();
+ for (Tp::AvatarTokenMap::const_iterator i = result.constBegin(); i != result.constEnd(); ++i) {
+ if (!i.value().isEmpty()) {
+ onContactAvatarUpdated(i.key(), i.value());
+ }
}
}
}
@@ -367,7 +374,7 @@ void TelepathyAccount::onAvatarChanged(const Tp::Avatar& avatar)
Nepomuk::InformationElement photo;
photo.setPlainTextContents(QStringList() << avatar.avatarData.toBase64());
Nepomuk::DataObject dataObject(m_accountResource);
- dataObject.addInterpretedAs(photo);
+ dataObject.setInterpretedAses(QList< Nepomuk::InformationElement >() << photo);
m_accountResource.setProperty(Nepomuk::Vocabulary::NCO::photo(),
dataObject);
}
diff --git a/kpeople/nepomuk-feeder/telepathycontact.cpp b/kpeople/nepomuk-feeder/telepathycontact.cpp
index 1f2f5bd..b8b9eb8 100644
--- a/kpeople/nepomuk-feeder/telepathycontact.cpp
+++ b/kpeople/nepomuk-feeder/telepathycontact.cpp
@@ -105,7 +105,9 @@ TelepathyContact::TelepathyContact(Tp::ContactPtr contact,
onPublishStateChanged(m_contact->publishState());
onSubscriptionStateChanged(m_contact->subscriptionState());
onBlockStatusChanged(m_contact->isBlocked());
- onCapabilitiesChanged(m_contact->capabilities());
+ if (contact->capabilities() != 0) {
+ onCapabilitiesChanged(m_contact->capabilities());
+ }
}
TelepathyContact::~TelepathyContact()
diff --git a/kpeople/nepomuk-feeder/tests/CMakeLists.txt b/kpeople/nepomuk-feeder/tests/CMakeLists.txt
new file mode 100644
index 0000000..7914ceb
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/CMakeLists.txt
@@ -0,0 +1,26 @@
+find_package (KTelepathyTestLib REQUIRED)
+include (KTelepathyTestLibMacros)
+
+include_directories(${KTELEPATHYTESTLIB_INCLUDE_DIR})
+
+# Setup test environment first
+ktelepathy_setup_test_environment()
+
+# Create our static base test library
+kde4_add_library(tid-base-tests STATIC tid-base-test.cpp)
+target_link_libraries(tid-base-tests
+ ${KTELEPATHYTESTLIB_LIBRARIES}
+ ${QT_QTTEST_LIBRARY}
+ telepathy-integration-daemon-static)
+
+################################
+# Account test
+kde4_add_executable(account-test account-test.cpp)
+target_link_libraries(account-test tid-base-tests)
+add_ktelepathy_nepomuk_test(AccountTest ${CMAKE_CURRENT_BINARY_DIR}/account-test)
+
+################################
+# Contact test
+kde4_add_executable(contact-test contact-test.cpp)
+target_link_libraries(contact-test tid-base-tests)
+add_ktelepathy_nepomuk_test(ContactTest ${CMAKE_CURRENT_BINARY_DIR}/contact-test)
diff --git a/kpeople/nepomuk-feeder/tests/account-test.cpp b/kpeople/nepomuk-feeder/tests/account-test.cpp
new file mode 100644
index 0000000..e201556
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/account-test.cpp
@@ -0,0 +1,191 @@
+/*
+ * This file is part of telepathy-integration-daemon
+ *
+ * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
+ * @author Dario Freddi <dario.freddi at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "account-test.h"
+
+#include <KTempDir>
+
+#include <Soprano/Backend>
+#include <Soprano/PluginManager>
+#include <Soprano/StorageModel>
+#include <Soprano/QueryResultIterator>
+
+#include <Nepomuk/ResourceManager>
+#include <Nepomuk/Thing>
+#include <Nepomuk/Variant>
+
+#include <nco.h>
+#include <dataobject.h>
+#include <informationelement.h>
+
+#include <TelepathyQt4/ConnectionManager>
+
+#include <telepathyaccountmonitor.h>
+
+AccountTest::AccountTest(QObject* parent)
+ : TidBaseTest(parent)
+{
+
+}
+AccountTest::~AccountTest()
+{
+
+}
+
+void AccountTest::initTestCase()
+{
+ initTestCaseImpl();
+}
+
+void AccountTest::testSetupAccountMonitor()
+{
+ setupAccountMonitor();
+}
+
+void AccountTest::testAccountCreation()
+{
+ createAccount();
+
+ // Unfortunately there's no other way: let's wait until the account gets created
+ QTimer::singleShot(500, mLoop, SLOT(quit()));
+ mLoop->exec();
+
+ // Let's wait for the nepomuk resource to become available
+ QString query = QString("select distinct ?a where { %1 %2 ?a . ?a a %3 }")
+ .arg(Soprano::Node::resourceToN3(mePersonContact().resourceUri()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::hasIMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::IMAccount()));
+
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+
+ Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageSparql);
+
+ // Check that we got some results
+ QVERIFY(it.next());
+ Nepomuk::IMAccount foundImAccount(it.binding("a").uri());
+ // Check for the validity of the resource
+ QVERIFY(foundImAccount.isValid());
+
+ // See if the Account has the same Telepathy Account Identifier
+ QStringList accountIdentifiers = foundImAccount.accountIdentifiers();
+ QCOMPARE(accountIdentifiers.size(), 1);
+ QCOMPARE(accountIdentifiers.first(), account()->objectPath());
+
+ // Check if the specified ID matches
+ QCOMPARE(foundImAccount.imIDs().first(), QString("foobar"));
+
+ // Check that we got _one_ result
+ QVERIFY(!it.next());
+}
+
+void AccountTest::testChangeNickname()
+{
+ // Change the nickname to "Hello KDE"
+ Tp::PendingOperation *op = account()->setNickname("Hello KDE");
+ connect(op, SIGNAL(finished(Tp::PendingOperation*)),
+ this, SLOT(expectSuccessfulCall(Tp::PendingOperation*)));
+ QCOMPARE(mLoop->exec(), 0);
+
+ // Unfortunately there's no other way: let's wait until the account gets created
+ QTimer::singleShot(500, mLoop, SLOT(quit()));
+ mLoop->exec();
+
+ // Let's wait for the nepomuk resource to become available
+ QString query = QString("select distinct ?a where { %1 %2 ?a . ?a a %3 }")
+ .arg(Soprano::Node::resourceToN3(mePersonContact().resourceUri()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::hasIMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::IMAccount()));
+
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+
+ Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageSparql);
+
+ // Check that we got some results
+ QVERIFY(it.next());
+ Nepomuk::IMAccount foundImAccount(it.binding("a").uri());
+ // Check for the validity of the resource
+ QVERIFY(foundImAccount.isValid());
+
+ // See if the Account has the same Telepathy Account Identifier
+ QStringList accountIdentifiers = foundImAccount.accountIdentifiers();
+ QCOMPARE(accountIdentifiers.size(), 1);
+ QCOMPARE(accountIdentifiers.first(), account()->objectPath());
+
+ // Check if the nickname matches the new one
+ QCOMPARE(foundImAccount.imNicknames().first(), QString("Hello KDE"));
+
+ // Check that we got _one_ result
+ QVERIFY(!it.next());
+}
+
+void AccountTest::testChangeAvatar()
+{
+ Tp::Avatar avatar = { QByteArray("adadsdvds"), QLatin1String("image/jpeg") };
+ QVERIFY(connect(account()->setAvatar(avatar),
+ SIGNAL(finished(Tp::PendingOperation *)),
+ SLOT(expectSuccessfulCall(Tp::PendingOperation *))));
+ QCOMPARE(mLoop->exec(), 0);
+
+ // Unfortunately there's no other way: let's wait until the account gets created
+ QTimer::singleShot(500, mLoop, SLOT(quit()));
+ mLoop->exec();
+
+ // Let's wait for the nepomuk resource to become available
+ QString query = QString("select distinct ?a where { %1 %2 ?a . ?a a %3 }")
+ .arg(Soprano::Node::resourceToN3(mePersonContact().resourceUri()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::hasIMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::IMAccount()));
+
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+
+ Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageSparql);
+
+ // Check that we got some results
+ QVERIFY(it.next());
+ Nepomuk::IMAccount foundImAccount(it.binding("a").uri());
+ // Check for the validity of the resource
+ QVERIFY(foundImAccount.isValid());
+
+ // See if the Account has the same Telepathy Account Identifier
+ QStringList accountIdentifiers = foundImAccount.accountIdentifiers();
+ QCOMPARE(accountIdentifiers.size(), 1);
+ QCOMPARE(accountIdentifiers.first(), account()->objectPath());
+
+ // Check if the avatar matches the new one
+ Nepomuk::Variant vphoto = foundImAccount.property(Nepomuk::Vocabulary::NCO::photo());
+ QVERIFY(vphoto.isValid());
+ Nepomuk::DataObject photo = vphoto.toResource();
+
+ QCOMPARE(photo.interpretedAses().size(), 1);
+ QByteArray imgdata = QByteArray::fromBase64(photo.interpretedAses().first().plainTextContents().first().toUtf8());
+ QCOMPARE(QByteArray("adadsdvds"), imgdata);
+
+ // Check that we got _one_ result
+ QVERIFY(!it.next());
+}
+
+void AccountTest::cleanupTestCase()
+{
+ cleanupTestCaseImpl();
+}
+
+QTEST_MAIN(AccountTest)
+#include "account-test.moc"
diff --git a/kpeople/nepomuk-feeder/tests/account-test.h b/kpeople/nepomuk-feeder/tests/account-test.h
new file mode 100644
index 0000000..5df8c47
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/account-test.h
@@ -0,0 +1,55 @@
+/*
+ * This file is part of telepathy-integration-daemon
+ *
+ * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
+ * @author Dario Freddi <dario.freddi at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef ACCOUNT_TEST_H
+#define ACCOUNT_TEST_H
+
+#include "tid-base-test.h"
+
+#include <TelepathyQt4/Types>
+
+#include <Nepomuk/Resource>
+
+class TelepathyAccountMonitor;
+namespace Soprano {
+class StorageModel;
+}
+
+class KTempDir;
+class AccountTest : public TidBaseTest
+{
+ Q_OBJECT
+public:
+ AccountTest(QObject* parent = 0);
+ virtual ~AccountTest();
+
+private Q_SLOTS:
+ void initTestCase();
+
+ void testSetupAccountMonitor();
+ void testAccountCreation();
+ void testChangeNickname();
+ void testChangeAvatar();
+
+ void cleanupTestCase();
+};
+
+#endif // ACCOUNT_TEST_H
diff --git a/kpeople/nepomuk-feeder/tests/contact-test.cpp b/kpeople/nepomuk-feeder/tests/contact-test.cpp
new file mode 100644
index 0000000..9b9461d
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/contact-test.cpp
@@ -0,0 +1,448 @@
+/*
+ * This file is part of telepathy-integration-daemon
+ *
+ * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
+ * @author Dario Freddi <dario.freddi at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "contact-test.h"
+#include <TelepathyQt4/Connection>
+#include <TelepathyQt4/PendingContacts>
+#include <TelepathyQt4/PendingReady>
+#include <TelepathyQt4/ContactManager>
+#include <Soprano/Node>
+#include <telepathy.h>
+#include <nco.h>
+#include <Nepomuk/ResourceManager>
+#include <Soprano/QueryResultIterator>
+#include <Soprano/Model>
+#include <imaccount.h>
+#include <TelepathyQt4/Account>
+#include <TelepathyQt4/PendingVoid>
+
+ContactTest::ContactTest(QObject* parent)
+ : TidBaseTest(parent)
+{
+
+}
+
+ContactTest::~ContactTest()
+{
+
+}
+void ContactTest::expectPendingContactsFinished(Tp::PendingOperation *op)
+{
+ if (!op->isFinished()) {
+ qWarning() << "unfinished";
+ mLoop->exit(1);
+ return;
+ }
+
+ if (op->isError()) {
+ qWarning().nospace() << op->errorName()
+ << ": " << op->errorMessage();
+ mLoop->exit(2);
+ return;
+ }
+
+ if (!op->isValid()) {
+ qWarning() << "inconsistent results";
+ mLoop->exit(3);
+ return;
+ }
+
+ qDebug() << "finished";
+ Tp::PendingContacts *pending = qobject_cast< Tp::PendingContacts* >(op);
+ m_contacts = pending->contacts();
+
+ mLoop->exit(0);
+}
+
+void ContactTest::initTestCase()
+{
+ initTestCaseConnectionImpl();
+
+ Tp::Features features = Tp::Features() << Tp::Connection::FeatureRoster;
+ QVERIFY(connect(connection()->becomeReady(features),
+ SIGNAL(finished(Tp::PendingOperation*)),
+ this,
+ SLOT(expectSuccessfulCall(Tp::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+ QCOMPARE(connection()->isReady(features), true);
+}
+
+void ContactTest::testSetupAccountMonitor()
+{
+ setupAccountMonitor();
+}
+
+void ContactTest::testAccountCreation()
+{
+ createAccount();
+
+ // Unfortunately there's no other way: let's wait until the account gets created
+ QTimer::singleShot(500, mLoop, SLOT(quit()));
+ mLoop->exec();
+
+ // Let's wait for the nepomuk resource to become available
+ QString query = QString("select distinct ?a where { %1 %2 ?a . ?a a %3 }")
+ .arg(Soprano::Node::resourceToN3(mePersonContact().resourceUri()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::hasIMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::IMAccount()));
+
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+
+ Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageSparql);
+
+ // Check that we got some results
+ QVERIFY(it.next());
+ m_accountResource = Nepomuk::IMAccount(it.binding("a").uri());
+ // Check for the validity of the resource
+ QVERIFY(m_accountResource.isValid());
+ // Check that we got _one_ result
+ QVERIFY(!it.next());
+
+ // Go online
+ Tp::SimplePresence sp;
+ sp.status = "available";
+ sp.type = Tp::ConnectionPresenceTypeAvailable;
+ sp.statusMessage = QString();
+ QVERIFY(connect(account().data()->setRequestedPresence(sp),
+ SIGNAL(finished(Tp::PendingOperation*)),
+ this,
+ SLOT(expectSuccessfulCall(Tp::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+ Tp::PendingVoid *retvoid =
+ new Tp::PendingVoid(account()->propertiesInterface()->Set("org.freedesktop.Telepathy.Account", "Connection",
+ QDBusVariant(QVariant::fromValue(connection().data()->objectPath()))), this);
+ QVERIFY(connect(retvoid,
+ SIGNAL(finished(Tp::PendingOperation*)),
+ this,
+ SLOT(expectSuccessfulCall(Tp::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+ retvoid =
+ new Tp::PendingVoid(account().data()->propertiesInterface()->Set("org.freedesktop.Telepathy.Account",
+ "ConnectionStatus",
+ QDBusVariant(QVariant::fromValue(1))), this);
+ QVERIFY(connect(retvoid,
+ SIGNAL(finished(Tp::PendingOperation*)),
+ this,
+ SLOT(expectSuccessfulCall(Tp::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+
+ qDebug() << account().data()->connection().data();
+ QVERIFY(account().data()->haveConnection());
+}
+
+void ContactTest::testContactCreation()
+{
+ // Wait for the contacts to be built
+ QStringList ids = QStringList() << QString(QLatin1String("test1 at kde.org"))
+ << QString(QLatin1String("dario.freddi at collabora.co.uk"))
+ << QString(QLatin1String("george.grundleborg at collabora.co.uk"))
+ << QString(QLatin1String("drf at kde.org"));
+ QVERIFY(connect(connection()->contactManager()->contactsForIdentifiers(ids),
+ SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(expectPendingContactsFinished(Tp::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+
+ foreach (const Tp::ContactPtr &contact, m_contacts) {
+ qDebug() << "Asking subs for" << contact.data()->id();
+ QVERIFY(connect(contact.data(),
+ SIGNAL(subscriptionStateChanged(Tp::Contact::PresenceState)),
+ mLoop,
+ SLOT(quit())));
+ QVERIFY(connect(contact.data(),
+ SIGNAL(publishStateChanged(Tp::Contact::PresenceState)),
+ mLoop,
+ SLOT(quit())));
+ contact->requestPresenceSubscription(QLatin1String("please add me"));
+
+ QCOMPARE(mLoop->exec(), 0);
+ // I asked to see his presence
+ QCOMPARE(static_cast<uint>(contact->subscriptionState()),
+ static_cast<uint>(Tp::Contact::PresenceStateAsk));
+
+ QCOMPARE(mLoop->exec(), 0);
+ // He asked to see my presence
+ QCOMPARE(static_cast<uint>(contact->publishState()),
+ static_cast<uint>(Tp::Contact::PresenceStateAsk));
+
+ contact->authorizePresencePublication();
+ QCOMPARE(mLoop->exec(), 0);
+ // I authorized him to see my presence
+ QCOMPARE(static_cast<uint>(contact->publishState()),
+ static_cast<uint>(Tp::Contact::PresenceStateYes));
+ // He replied the presence request
+ QCOMPARE(static_cast<uint>(contact->subscriptionState()),
+ static_cast<uint>(Tp::Contact::PresenceStateYes));
+ }
+
+ // Unfortunately there's no other way: let's wait until the account gets created
+ QTimer::singleShot(500, mLoop, SLOT(quit()));
+ mLoop->exec();
+
+ // Query Nepomuk for all IM accounts that isBuddyOf the accountResource
+ QString query = QString("select distinct ?a where { ?a %1 %2 . ?a a %3 . ?r %4 ?a . ?r a %5}")
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::Telepathy::isBuddyOf()))
+ .arg(Soprano::Node::resourceToN3(m_accountResource.uri()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::IMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::hasIMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::PersonContact()));
+
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+
+ Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageSparql);
+
+ // Ok now, let's cache all known contacts ids
+ QStringList allKnownIds;
+ foreach (const Tp::ContactPtr &contact, connection().data()->contactManager()->allKnownContacts()) {
+ if (contact.data()->subscriptionState() == Tp::Contact::PresenceStateYes) {
+ allKnownIds << contact.data()->id();
+ }
+ }
+ qDebug() << "All known ids: " << allKnownIds;
+
+ for (int i = 0; i < allKnownIds.size(); ++i) {
+ // Check that we got some results
+ QVERIFY(it.next());
+ Nepomuk::IMAccount foundImAccount(it.binding("a").uri());
+
+ // Check that the IM account only has one ID.
+ QStringList accountIDs = foundImAccount.imIDs();
+
+ QCOMPARE(accountIDs.size(), 1);
+
+ // Exactly one ID found. Check if it matches one of the ids provided
+ QString accountID = accountIDs.first();
+
+ qDebug() << "Contact found, " << accountID;
+ QVERIFY(allKnownIds.contains(accountID));
+ }
+
+ // Check that we have no more results
+ qDebug() << "End results";
+ QVERIFY(!it.next());
+}
+
+void ContactTest::testContactRequestAndAuthorize()
+{
+ // Tp-qt4 test stuff
+ QStringList toCheck = QStringList() <<
+ QLatin1String("sjoerd at example.com") <<
+ QLatin1String("travis at example.com") <<
+ QLatin1String("wim at example.com") <<
+ QLatin1String("olivier at example.com") <<
+ QLatin1String("helen at example.com") <<
+ QLatin1String("geraldine at example.com") <<
+ QLatin1String("guillaume at example.com") <<
+ QLatin1String("christian at example.com") <<
+ QLatin1String("test1 at kde.org") <<
+ QLatin1String("dario.freddi at collabora.co.uk") <<
+ QLatin1String("george.grundleborg at collabora.co.uk") <<
+ QLatin1String("drf at kde.org");
+ QStringList ids;
+ QList<Tp::ContactPtr> pendingPublish;
+ foreach (const Tp::ContactPtr &contact,
+ connection()->contactManager()->allKnownContacts()) {
+ qDebug() << " contact:" << contact->id() <<
+ "- subscription:" << contact->subscriptionState() <<
+ "- publish:" << contact->publishState();
+ ids << contact->id();
+ if (contact->publishState() == Tp::Contact::PresenceStateAsk) {
+ pendingPublish.append(contact);
+ }
+ }
+ ids.sort();
+ toCheck.sort();
+ QCOMPARE(ids, toCheck);
+ QCOMPARE(pendingPublish.size(), 2);
+
+ // Ok now, let's cache all known contacts ids
+ QStringList allKnownIds;
+ foreach (const Tp::ContactPtr &contact, connection().data()->contactManager()->allKnownContacts()) {
+ if (contact.data()->subscriptionState() == Tp::Contact::PresenceStateYes) {
+ allKnownIds << contact.data()->id();
+ }
+ }
+
+ foreach (const Tp::ContactPtr &contact, pendingPublish) {
+ QVERIFY(connect(contact.data(),
+ SIGNAL(subscriptionStateChanged(Tp::Contact::PresenceState)),
+ mLoop,
+ SLOT(quit())));
+ QVERIFY(connect(contact.data(),
+ SIGNAL(publishStateChanged(Tp::Contact::PresenceState)),
+ mLoop,
+ SLOT(quit())));
+ contact->requestPresenceSubscription(QLatin1String("please add me"));
+
+ QCOMPARE(mLoop->exec(), 0);
+ // I asked to see his presence
+ QCOMPARE(static_cast<uint>(contact->subscriptionState()),
+ static_cast<uint>(Tp::Contact::PresenceStateAsk));
+
+ QCOMPARE(mLoop->exec(), 0);
+
+ contact->authorizePresencePublication();
+
+ QCOMPARE(mLoop->exec(), 0);
+ QCOMPARE(static_cast<uint>(contact->publishState()),
+ static_cast<uint>(Tp::Contact::PresenceStateYes));
+ allKnownIds << contact.data()->id();
+ }
+
+ // Unfortunately there's no other way: let's wait until the account gets created
+ QTimer::singleShot(500, mLoop, SLOT(quit()));
+ mLoop->exec();
+
+ // Query Nepomuk for all IM accounts that isBuddyOf the accountResource
+ QString query = QString("select distinct ?a where { ?a %1 %2 . ?a a %3 . ?r %4 ?a . ?r a %5}")
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::Telepathy::isBuddyOf()))
+ .arg(Soprano::Node::resourceToN3(m_accountResource.uri()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::IMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::hasIMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::PersonContact()));
+
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+
+ Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageSparql);
+
+ qDebug() << "All known ids: " << allKnownIds;
+
+ for (int i = 0; i < allKnownIds.size(); ++i) {
+ // Check that we got some results
+ QVERIFY(it.next());
+ Nepomuk::IMAccount foundImAccount(it.binding("a").uri());
+
+ // Check that the IM account only has one ID.
+ QStringList accountIDs = foundImAccount.imIDs();
+
+ QCOMPARE(accountIDs.size(), 1);
+
+ // Exactly one ID found. Check if it matches one of the ids provided
+ QString accountID = accountIDs.first();
+
+ qDebug() << "Contact found, " << accountID;
+ QVERIFY(allKnownIds.contains(accountID));
+ }
+
+ // Check that we have no more results
+ qDebug() << "End results";
+ QVERIFY(!it.next());
+}
+
+void ContactTest::testContactRemove()
+{
+ QStringList ids = QStringList() <<
+ QLatin1String("sjoerd at example.com") <<
+ QLatin1String("travis at example.com") <<
+ QLatin1String("wim at example.com") <<
+ QLatin1String("olivier at example.com");
+
+ QList<Tp::ContactPtr> toRemove;
+ foreach (const Tp::ContactPtr &contact,
+ connection()->contactManager()->allKnownContacts()) {
+ qDebug() << " contact:" << contact->id() <<
+ "- subscription:" << contact->subscriptionState() <<
+ "- publish:" << contact->publishState();
+ if (ids.contains(contact->id())) {
+ toRemove << contact;
+ }
+ }
+ QCOMPARE(toRemove.size(), 4);
+
+ // Ok now, let's cache all known contacts ids
+ QStringList allKnownIds;
+ foreach (const Tp::ContactPtr &contact, connection().data()->contactManager()->allKnownContacts()) {
+ if (contact.data()->subscriptionState() == Tp::Contact::PresenceStateYes) {
+ allKnownIds << contact.data()->id();
+ }
+ }
+
+ // Remove the presence subscription
+ foreach (const Tp::ContactPtr &contact, toRemove) {
+ QVERIFY(connect(contact.data(),
+ SIGNAL(subscriptionStateChanged(Tp::Contact::PresenceState)),
+ mLoop,
+ SLOT(quit())));
+ QVERIFY(connect(contact.data(),
+ SIGNAL(publishStateChanged(Tp::Contact::PresenceState)),
+ mLoop,
+ SLOT(quit())));
+ contact->removePresenceSubscription(QLatin1String("go to hell!"));
+
+ QCOMPARE(mLoop->exec(), 0);
+ // I asked to see his presence
+ QCOMPARE(static_cast<uint>(contact->subscriptionState()),
+ static_cast<uint>(Tp::Contact::PresenceStateNo));
+
+ contact->removePresencePublication();
+
+ QCOMPARE(mLoop->exec(), 0);
+ QCOMPARE(static_cast<uint>(contact->publishState()),
+ static_cast<uint>(Tp::Contact::PresenceStateNo));
+ allKnownIds.removeOne(contact.data()->id());
+ }
+
+ // Unfortunately there's no other way: let's wait until the account gets created
+ QTimer::singleShot(500, mLoop, SLOT(quit()));
+ mLoop->exec();
+
+ // Query Nepomuk for all IM accounts that isBuddyOf the accountResource
+ QString query = QString("select distinct ?a where { ?a %1 %2 . ?a a %3 . ?r %4 ?a . ?r a %5}")
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::Telepathy::isBuddyOf()))
+ .arg(Soprano::Node::resourceToN3(m_accountResource.uri()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::IMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::hasIMAccount()))
+ .arg(Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NCO::PersonContact()));
+
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+
+ Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageSparql);
+
+ qDebug() << "All known ids: " << allKnownIds;
+
+ for (int i = 0; i < allKnownIds.size(); ++i) {
+ // Check that we got some results
+ QVERIFY(it.next());
+ Nepomuk::IMAccount foundImAccount(it.binding("a").uri());
+
+ // Check that the IM account only has one ID.
+ QStringList accountIDs = foundImAccount.imIDs();
+
+ QCOMPARE(accountIDs.size(), 1);
+
+ // Exactly one ID found. Check if it matches one of the ids provided
+ QString accountID = accountIDs.first();
+
+ qDebug() << "Contact found, " << accountID;
+ QVERIFY(allKnownIds.contains(accountID));
+ }
+
+ // Check that we have no more results
+ qDebug() << "End results";
+ QVERIFY(!it.next());
+}
+
+void ContactTest::cleanupTestCase()
+{
+ cleanupTestCaseConnectionImpl();
+}
+
+QTEST_MAIN(ContactTest)
+#include "contact-test.moc"
diff --git a/kpeople/nepomuk-feeder/tests/contact-test.h b/kpeople/nepomuk-feeder/tests/contact-test.h
new file mode 100644
index 0000000..f606e38
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/contact-test.h
@@ -0,0 +1,54 @@
+/*
+ * This file is part of telepathy-integration-daemon
+ *
+ * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
+ * @author Dario Freddi <dario.freddi at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef CONTACT_TEST_H
+#define CONTACT_TEST_H
+
+#include <tid-base-test.h>
+#include <imaccount.h>
+
+class ContactTest : public TidBaseTest
+{
+ Q_OBJECT
+public:
+ ContactTest(QObject* parent = 0);
+ virtual ~ContactTest();
+
+public Q_SLOTS:
+ void expectPendingContactsFinished(Tp::PendingOperation *op);
+
+private Q_SLOTS:
+ void initTestCase();
+
+ void testSetupAccountMonitor();
+ void testAccountCreation();
+ void testContactCreation();
+ void testContactRequestAndAuthorize();
+ void testContactRemove();
+
+ void cleanupTestCase();
+
+private:
+ QList< Tp::ContactPtr > m_contacts;
+ Nepomuk::IMAccount m_accountResource;
+};
+
+#endif // CONTACT_TEST_H
diff --git a/kpeople/nepomuk-feeder/tests/tid-base-test.cpp b/kpeople/nepomuk-feeder/tests/tid-base-test.cpp
new file mode 100644
index 0000000..6a00a90
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/tid-base-test.cpp
@@ -0,0 +1,171 @@
+/*
+ * This file is part of telepathy-integration-daemon
+ *
+ * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
+ * @author Dario Freddi <dario.freddi at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "tid-base-test.h"
+
+#include <Soprano/Backend>
+#include <Soprano/StorageModel>
+#include <Soprano/PluginManager>
+
+#include <Nepomuk/ResourceManager>
+#include <Nepomuk/Thing>
+
+#include <nco.h>
+
+#include <TelepathyQt4/PendingAccount>
+#include <TelepathyQt4/PendingReady>
+
+#include <KTempDir>
+
+#include <telepathyaccountmonitor.h>
+
+class TidBaseTest::Private
+{
+ Q_DECLARE_PUBLIC(TidBaseTest)
+ TidBaseTest * const q_ptr;
+ public:
+ Private(TidBaseTest *parent) : q_ptr(parent) {}
+ virtual ~Private() {}
+
+ TelepathyAccountMonitor *monitor;
+ Nepomuk::Resource mePersonContact;
+ Tp::AccountPtr account;
+ Tp::ConnectionPtr connection;
+};
+
+TidBaseTest::TidBaseTest(QObject* parent)
+ : NepomukTest(parent)
+ , d(new Private(this))
+{
+}
+
+TidBaseTest::~TidBaseTest()
+{
+ delete d;
+}
+
+void TidBaseTest::initTestCaseImpl()
+{
+ Tp::NepomukTest::initTestCaseImpl();
+}
+
+void TidBaseTest::initTestCaseConnectionImpl()
+{
+ initTestCaseImpl();
+
+ setupExampleConnection("account", QLatin1String("foobar"), "protocol", "contactlist");
+
+ d->connection = Tp::Connection::create(exampleConnectionData().first, exampleConnectionData().second);
+
+ QVERIFY(connect(d->connection->requestConnect(),
+ SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(expectSuccessfulCall(Tp::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+ QCOMPARE(d->connection->isReady(), true);
+ qDebug() << d->connection->status();
+ QCOMPARE(d->connection->status(), Tp::Connection::StatusConnected);
+}
+
+void TidBaseTest::cleanupTestCaseConnectionImpl()
+{
+ if (d->connection) {
+ // Disconnect and wait for the readiness change
+ QVERIFY(connect(d->connection->requestDisconnect(),
+ SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(expectSuccessfulCall(Tp::PendingOperation*))));
+ QCOMPARE(mLoop->exec(), 0);
+
+ if (d->connection->isValid()) {
+ QVERIFY(connect(d->connection.data(),
+ SIGNAL(invalidated(Tp::DBusProxy *,
+ const QString &, const QString &)),
+ mLoop,
+ SLOT(quit())));
+ QCOMPARE(mLoop->exec(), 0);
+ }
+ }
+
+ cleanupTestCaseImpl();
+}
+
+void TidBaseTest::cleanupTestCaseImpl()
+{
+ Tp::NepomukTest::cleanupTestCaseImpl();
+}
+void TidBaseTest::setupAccountMonitor()
+{
+ d->monitor = new TelepathyAccountMonitor();
+
+ // At this very point, we should have a "me" PIMO person up and running
+ // FIXME: Port to new OSCAF standard for accessing "me" as soon as it
+ // becomes available.
+ Nepomuk::Thing me(QUrl::fromEncoded("nepomuk:/myself"));
+
+ QVERIFY(me.exists());
+ // Loop through all the grounding instances of this person
+ Q_FOREACH (Nepomuk::Resource resource, me.groundingOccurrences()) {
+ // See if this grounding instance is of type nco:contact.
+ if (resource.hasType(Nepomuk::Vocabulary::NCO::PersonContact())) {
+ // FIXME: We are going to assume the first NCO::PersonContact is the
+ // right one. Can we improve this?
+ d->mePersonContact = resource;
+ break;
+ }
+ }
+ QVERIFY(d->mePersonContact.isValid());
+ QVERIFY(me.groundingOccurrences().contains(d->mePersonContact));
+}
+
+TelepathyAccountMonitor* TidBaseTest::accountMonitor()
+{
+ return d->monitor;
+}
+
+Nepomuk::Resource TidBaseTest::mePersonContact()
+{
+ return d->mePersonContact;
+}
+
+void TidBaseTest::createAccount()
+{
+ QVariantMap parameters;
+ parameters[QLatin1String("account")] = QLatin1String("foobar");
+ Tp::PendingAccount *pacc = accountMonitor()->accountManager()->createAccount(QLatin1String("foo"),
+ QLatin1String("bar"), QLatin1String("foobar"), parameters);
+ QVERIFY(connect(pacc,
+ SIGNAL(finished(Tp::PendingOperation *)),
+ SLOT(expectSuccessfulCall(Tp::PendingOperation *))));
+ QCOMPARE(mLoop->exec(), 0);
+ d->account = pacc->account();
+ QVERIFY(d->account);
+}
+
+Tp::AccountPtr TidBaseTest::account()
+{
+ return d->account;
+}
+
+Tp::ConnectionPtr TidBaseTest::connection()
+{
+ return d->connection;
+}
+
+#include "tid-base-test.moc"
diff --git a/kpeople/nepomuk-feeder/tests/tid-base-test.h b/kpeople/nepomuk-feeder/tests/tid-base-test.h
new file mode 100644
index 0000000..2e0727e
--- /dev/null
+++ b/kpeople/nepomuk-feeder/tests/tid-base-test.h
@@ -0,0 +1,58 @@
+/*
+ * This file is part of telepathy-integration-daemon
+ *
+ * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
+ * @author Dario Freddi <dario.freddi at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef TELEPATHY_BASE_TEST_H
+#define TELEPATHY_BASE_TEST_H
+
+#include <KTelepathy/TestLib/NepomukTest>
+#include <Nepomuk/Resource>
+#include <TelepathyQt4/Types>
+
+class TelepathyAccountMonitor;
+
+
+class TidBaseTest : public Tp::NepomukTest
+{
+ Q_OBJECT
+public:
+ TidBaseTest(QObject* parent = 0);
+ virtual ~TidBaseTest();
+
+ void initTestCaseConnectionImpl();
+ void cleanupTestCaseConnectionImpl();
+
+ virtual void initTestCaseImpl();
+ virtual void cleanupTestCaseImpl();
+ virtual void createAccount();
+
+ void setupAccountMonitor();
+
+ TelepathyAccountMonitor *accountMonitor();
+ Nepomuk::Resource mePersonContact();
+ Tp::AccountPtr account();
+ Tp::ConnectionPtr connection();
+
+private:
+ class Private;
+ Private * const d;
+};
+
+#endif // TELEPATHY_BASE_TEST_H
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list