/* * Copyright (C) 2015 Christian Mollekopf * * 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) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * 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, see . */ #pragma once #include #include #include #include #include #include #include #include #include //Replace with something different #include "event_generated.h" class TestEventAdaptorFactory : public DomainTypeAdaptorFactory { public: TestEventAdaptorFactory() : DomainTypeAdaptorFactory() { } virtual ~TestEventAdaptorFactory() {}; }; class TestEntityStorage : public EntityStorage { public: using EntityStorage::EntityStorage; virtual qint64 read(const Akonadi2::Query &query, qint64 oldRevision, const QSharedPointer > &resultProvider) Q_DECL_OVERRIDE { for (const auto &res : mResults) { resultProvider->add(res); } for (const auto &res : mModifications) { resultProvider->modify(res); } for (const auto &res : mRemovals) { resultProvider->remove(res); } return mLatestRevision; } QList mResults; QList mModifications; QList mRemovals; qint64 mLatestRevision; }; class TestResourceAccess : public Akonadi2::ResourceAccessInterface { Q_OBJECT public: virtual ~TestResourceAccess() {}; KAsync::Job sendCommand(int commandId) Q_DECL_OVERRIDE { return KAsync::null(); } KAsync::Job sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb) Q_DECL_OVERRIDE { return KAsync::null(); } KAsync::Job synchronizeResource(bool remoteSync, bool localSync) Q_DECL_OVERRIDE { return KAsync::null(); } public Q_SLOTS: void open() Q_DECL_OVERRIDE {} void close() Q_DECL_OVERRIDE {} }; class TestResourceFacade : public Akonadi2::GenericFacade { public: TestResourceFacade(const QByteArray &instanceIdentifier, const QSharedPointer resourceAccess) : Akonadi2::GenericFacade(instanceIdentifier, QSharedPointer::create(), resourceAccess) { } virtual ~TestResourceFacade() { } }; class TestResource : public Akonadi2::GenericResource { public: TestResource(const QByteArray &instanceIdentifier, QSharedPointer pipeline) : Akonadi2::GenericResource(instanceIdentifier, pipeline) { } KAsync::Job synchronizeWithSource() Q_DECL_OVERRIDE { return KAsync::null(); } };