diff options
-rw-r--r-- | common/clientapi.cpp | 12 | ||||
-rw-r--r-- | common/clientapi.h | 26 | ||||
-rw-r--r-- | common/inspection.h | 2 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 4 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 4 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 16 | ||||
-rw-r--r-- | tests/inspectiontest.cpp | 4 | ||||
-rw-r--r-- | tests/maildirresourcetest.cpp | 54 | ||||
-rw-r--r-- | tests/modelinteractivitytest.cpp | 2 | ||||
-rw-r--r-- | tests/querytest.cpp | 12 |
10 files changed, 68 insertions, 68 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index f67606e..cbbfdd8 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -155,7 +155,7 @@ KAsync::Job<void> Store::remove(const DomainType &domainObject) | |||
155 | }); | 155 | }); |
156 | } | 156 | } |
157 | 157 | ||
158 | KAsync::Job<void> Resources::shutdown(const QByteArray &identifier) | 158 | KAsync::Job<void> ResourceControl::shutdown(const QByteArray &identifier) |
159 | { | 159 | { |
160 | Trace() << "shutdown " << identifier; | 160 | Trace() << "shutdown " << identifier; |
161 | auto time = QSharedPointer<QTime>::create(); | 161 | auto time = QSharedPointer<QTime>::create(); |
@@ -178,7 +178,7 @@ KAsync::Job<void> Resources::shutdown(const QByteArray &identifier) | |||
178 | .template then<void>([](){}); | 178 | .template then<void>([](){}); |
179 | } | 179 | } |
180 | 180 | ||
181 | KAsync::Job<void> Resources::start(const QByteArray &identifier) | 181 | KAsync::Job<void> ResourceControl::start(const QByteArray &identifier) |
182 | { | 182 | { |
183 | Trace() << "start " << identifier; | 183 | Trace() << "start " << identifier; |
184 | auto time = QSharedPointer<QTime>::create(); | 184 | auto time = QSharedPointer<QTime>::create(); |
@@ -221,7 +221,7 @@ KAsync::Job<void> Store::synchronize(const Sink::Query &query) | |||
221 | .template then<void>([](){}); | 221 | .template then<void>([](){}); |
222 | } | 222 | } |
223 | 223 | ||
224 | KAsync::Job<void> Resources::flushMessageQueue(const QByteArrayList &resourceIdentifier) | 224 | KAsync::Job<void> ResourceControl::flushMessageQueue(const QByteArrayList &resourceIdentifier) |
225 | { | 225 | { |
226 | Trace() << "flushMessageQueue" << resourceIdentifier; | 226 | Trace() << "flushMessageQueue" << resourceIdentifier; |
227 | return KAsync::iterate(resourceIdentifier) | 227 | return KAsync::iterate(resourceIdentifier) |
@@ -237,7 +237,7 @@ KAsync::Job<void> Resources::flushMessageQueue(const QByteArrayList &resourceIde | |||
237 | .template then<void>([](){}); | 237 | .template then<void>([](){}); |
238 | } | 238 | } |
239 | 239 | ||
240 | KAsync::Job<void> Resources::flushReplayQueue(const QByteArrayList &resourceIdentifier) | 240 | KAsync::Job<void> ResourceControl::flushReplayQueue(const QByteArrayList &resourceIdentifier) |
241 | { | 241 | { |
242 | return flushMessageQueue(resourceIdentifier); | 242 | return flushMessageQueue(resourceIdentifier); |
243 | } | 243 | } |
@@ -304,7 +304,7 @@ KAsync::Job<QList<typename DomainType::Ptr> > Store::fetch(const Sink::Query &qu | |||
304 | } | 304 | } |
305 | 305 | ||
306 | template <class DomainType> | 306 | template <class DomainType> |
307 | KAsync::Job<void> Resources::inspect(const Inspection &inspectionCommand) | 307 | KAsync::Job<void> ResourceControl::inspect(const Inspection &inspectionCommand) |
308 | { | 308 | { |
309 | auto resource = inspectionCommand.resourceIdentifier; | 309 | auto resource = inspectionCommand.resourceIdentifier; |
310 | 310 | ||
@@ -375,7 +375,7 @@ void Notifier::registerHandler(std::function<void(const Notification &)> handler | |||
375 | template KAsync::Job<void> Store::create<T>(const T &domainObject); \ | 375 | template KAsync::Job<void> Store::create<T>(const T &domainObject); \ |
376 | template KAsync::Job<void> Store::modify<T>(const T &domainObject); \ | 376 | template KAsync::Job<void> Store::modify<T>(const T &domainObject); \ |
377 | template QSharedPointer<QAbstractItemModel> Store::loadModel<T>(Query query); \ | 377 | template QSharedPointer<QAbstractItemModel> Store::loadModel<T>(Query query); \ |
378 | template KAsync::Job<void> Resources::inspect<T>(const Inspection &); \ | 378 | template KAsync::Job<void> ResourceControl::inspect<T>(const Inspection &); \ |
379 | template KAsync::Job<T> Store::fetchOne<T>(const Query &); \ | 379 | template KAsync::Job<T> Store::fetchOne<T>(const Query &); \ |
380 | template KAsync::Job<QList<T::Ptr> > Store::fetchAll<T>(const Query &); \ | 380 | template KAsync::Job<QList<T::Ptr> > Store::fetchAll<T>(const Query &); \ |
381 | template KAsync::Job<QList<T::Ptr> > Store::fetch<T>(const Query &, int); \ | 381 | template KAsync::Job<QList<T::Ptr> > Store::fetch<T>(const Query &, int); \ |
diff --git a/common/clientapi.h b/common/clientapi.h index fb44ca2..2b49826 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -111,33 +111,33 @@ KAsync::Job<QList<typename DomainType::Ptr> > SINK_EXPORT fetch(const Sink::Quer | |||
111 | 111 | ||
112 | }; | 112 | }; |
113 | 113 | ||
114 | namespace Resources { | 114 | namespace ResourceControl { |
115 | 115 | ||
116 | template <class DomainType> | 116 | template <class DomainType> |
117 | KAsync::Job<void> SINK_EXPORT inspect(const Inspection &inspectionCommand); | 117 | KAsync::Job<void> SINK_EXPORT inspect(const Inspection &inspectionCommand); |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Shutdown resource. | 120 | * Shutdown resource. |
121 | */ | 121 | */ |
122 | KAsync::Job<void> SINK_EXPORT shutdown(const QByteArray &resourceIdentifier); | 122 | KAsync::Job<void> SINK_EXPORT shutdown(const QByteArray &resourceIdentifier); |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Start resource. | 125 | * Start resource. |
126 | * | 126 | * |
127 | * The resource is ready for operation once this command completes. | 127 | * The resource is ready for operation once this command completes. |
128 | * This command is only necessary if a resource was shutdown previously, | 128 | * This command is only necessary if a resource was shutdown previously, |
129 | * otherwise the resource process will automatically start as necessary. | 129 | * otherwise the resource process will automatically start as necessary. |
130 | */ | 130 | */ |
131 | KAsync::Job<void> SINK_EXPORT start(const QByteArray &resourceIdentifier); | 131 | KAsync::Job<void> SINK_EXPORT start(const QByteArray &resourceIdentifier); |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * Flushes any pending messages to disk | 134 | * Flushes any pending messages to disk |
135 | */ | 135 | */ |
136 | KAsync::Job<void> SINK_EXPORT flushMessageQueue(const QByteArrayList &resourceIdentifier); | 136 | KAsync::Job<void> SINK_EXPORT flushMessageQueue(const QByteArrayList &resourceIdentifier); |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Flushes any pending messages that haven't been replayed to the source. | 139 | * Flushes any pending messages that haven't been replayed to the source. |
140 | */ | 140 | */ |
141 | KAsync::Job<void> SINK_EXPORT flushReplayQueue(const QByteArrayList &resourceIdentifier); | 141 | KAsync::Job<void> SINK_EXPORT flushReplayQueue(const QByteArrayList &resourceIdentifier); |
142 | 142 | ||
143 | } | 143 | } |
diff --git a/common/inspection.h b/common/inspection.h index b9f6bf3..d85eab6 100644 --- a/common/inspection.h +++ b/common/inspection.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "applicationdomaintype.h" | 24 | #include "applicationdomaintype.h" |
25 | 25 | ||
26 | namespace Sink { | 26 | namespace Sink { |
27 | namespace Resources { | 27 | namespace ResourceControl { |
28 | 28 | ||
29 | struct Inspection { | 29 | struct Inspection { |
30 | static Inspection PropertyInspection(const Sink::ApplicationDomain::Entity &entity, const QByteArray &property, const QVariant &expectedValue) | 30 | static Inspection PropertyInspection(const Sink::ApplicationDomain::Entity &entity, const QByteArray &property, const QVariant &expectedValue) |
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 6fd70a0..4648717 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -338,7 +338,7 @@ KAsync::Job<void> MaildirResource::inspect(int inspectionType, const QByteArray | |||
338 | auto synchronizationTransaction = synchronizationStore->createTransaction(Sink::Storage::ReadOnly); | 338 | auto synchronizationTransaction = synchronizationStore->createTransaction(Sink::Storage::ReadOnly); |
339 | Trace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; | 339 | Trace() << "Inspecting " << inspectionType << domainType << entityId << property << expectedValue; |
340 | if (domainType == ENTITY_TYPE_MAIL) { | 340 | if (domainType == ENTITY_TYPE_MAIL) { |
341 | if (inspectionType == Sink::Resources::Inspection::PropertyInspectionType) { | 341 | if (inspectionType == Sink::ResourceControl::Inspection::PropertyInspectionType) { |
342 | if (property == "unread") { | 342 | if (property == "unread") { |
343 | const auto remoteId = resolveLocalId(ENTITY_TYPE_MAIL, entityId, synchronizationTransaction); | 343 | const auto remoteId = resolveLocalId(ENTITY_TYPE_MAIL, entityId, synchronizationTransaction); |
344 | const auto flags = KPIM::Maildir::readEntryFlags(remoteId.split('/').last()); | 344 | const auto flags = KPIM::Maildir::readEntryFlags(remoteId.split('/').last()); |
@@ -363,7 +363,7 @@ KAsync::Job<void> MaildirResource::inspect(int inspectionType, const QByteArray | |||
363 | return KAsync::null<void>(); | 363 | return KAsync::null<void>(); |
364 | } | 364 | } |
365 | } | 365 | } |
366 | if (inspectionType == Sink::Resources::Inspection::ExistenceInspectionType) { | 366 | if (inspectionType == Sink::ResourceControl::Inspection::ExistenceInspectionType) { |
367 | const auto remoteId = resolveLocalId(ENTITY_TYPE_MAIL, entityId, synchronizationTransaction); | 367 | const auto remoteId = resolveLocalId(ENTITY_TYPE_MAIL, entityId, synchronizationTransaction); |
368 | if (QFileInfo(remoteId).exists() != expectedValue.toBool()) { | 368 | if (QFileInfo(remoteId).exists() != expectedValue.toBool()) { |
369 | return KAsync::error<void>(1, "Wrong file existence: " + remoteId); | 369 | return KAsync::error<void>(1, "Wrong file existence: " + remoteId); |
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index 6170f49..60ebe74 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -102,7 +102,7 @@ private Q_SLOTS: | |||
102 | QTRY_VERIFY(gotNotification); | 102 | QTRY_VERIFY(gotNotification); |
103 | 103 | ||
104 | QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1()); | 104 | QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1()); |
105 | Sink::Resources::shutdown("org.kde.dummy.instance1").exec().waitForFinished(); | 105 | Sink::ResourceControl::shutdown("org.kde.dummy.instance1").exec().waitForFinished(); |
106 | qDebug() << "Single command took [ms]: " << duration; | 106 | qDebug() << "Single command took [ms]: " << duration; |
107 | } | 107 | } |
108 | 108 | ||
@@ -127,7 +127,7 @@ private Q_SLOTS: | |||
127 | { | 127 | { |
128 | Sink::Query query; | 128 | Sink::Query query; |
129 | query.resources << "org.kde.dummy.instance1"; | 129 | query.resources << "org.kde.dummy.instance1"; |
130 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 130 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
131 | } | 131 | } |
132 | auto allProcessedTime = time.elapsed(); | 132 | auto allProcessedTime = time.elapsed(); |
133 | 133 | ||
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index e74fe25..1253e6c 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -65,7 +65,7 @@ private Q_SLOTS: | |||
65 | query.resources << "org.kde.dummy.instance1"; | 65 | query.resources << "org.kde.dummy.instance1"; |
66 | 66 | ||
67 | //Ensure all local data is processed | 67 | //Ensure all local data is processed |
68 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 68 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
69 | 69 | ||
70 | query.propertyFilter.insert("uid", "testuid"); | 70 | query.propertyFilter.insert("uid", "testuid"); |
71 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 71 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
@@ -89,7 +89,7 @@ private Q_SLOTS: | |||
89 | query.resources << "org.kde.dummy.instance1"; | 89 | query.resources << "org.kde.dummy.instance1"; |
90 | 90 | ||
91 | //Ensure all local data is processed | 91 | //Ensure all local data is processed |
92 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 92 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
93 | 93 | ||
94 | query.propertyFilter.insert("uid", "testuid"); | 94 | query.propertyFilter.insert("uid", "testuid"); |
95 | 95 | ||
@@ -117,7 +117,7 @@ private Q_SLOTS: | |||
117 | query.resources << "org.kde.dummy.instance1"; | 117 | query.resources << "org.kde.dummy.instance1"; |
118 | 118 | ||
119 | //Ensure all local data is processed | 119 | //Ensure all local data is processed |
120 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 120 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
121 | 121 | ||
122 | query.propertyFilter.insert("summary", "summaryValue2"); | 122 | query.propertyFilter.insert("summary", "summaryValue2"); |
123 | 123 | ||
@@ -151,7 +151,7 @@ private Q_SLOTS: | |||
151 | 151 | ||
152 | //Ensure all local data is processed | 152 | //Ensure all local data is processed |
153 | Sink::Store::synchronize(query).exec().waitForFinished(); | 153 | Sink::Store::synchronize(query).exec().waitForFinished(); |
154 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 154 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
155 | 155 | ||
156 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 156 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
157 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 157 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
@@ -168,7 +168,7 @@ private Q_SLOTS: | |||
168 | 168 | ||
169 | //Ensure all local data is processed | 169 | //Ensure all local data is processed |
170 | Sink::Store::synchronize(query).exec().waitForFinished(); | 170 | Sink::Store::synchronize(query).exec().waitForFinished(); |
171 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 171 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
172 | 172 | ||
173 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 173 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
174 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); | 174 | QTRY_VERIFY(model->rowCount(QModelIndex()) >= 1); |
@@ -191,7 +191,7 @@ private Q_SLOTS: | |||
191 | query.propertyFilter.insert("uid", "testuid"); | 191 | query.propertyFilter.insert("uid", "testuid"); |
192 | 192 | ||
193 | //Ensure all local data is processed | 193 | //Ensure all local data is processed |
194 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 194 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
195 | 195 | ||
196 | //Test create | 196 | //Test create |
197 | Sink::ApplicationDomain::Event event2; | 197 | Sink::ApplicationDomain::Event event2; |
@@ -210,7 +210,7 @@ private Q_SLOTS: | |||
210 | Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 210 | Sink::Store::modify<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
211 | 211 | ||
212 | //Ensure all local data is processed | 212 | //Ensure all local data is processed |
213 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 213 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
214 | 214 | ||
215 | //Test modify | 215 | //Test modify |
216 | { | 216 | { |
@@ -225,7 +225,7 @@ private Q_SLOTS: | |||
225 | Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); | 225 | Sink::Store::remove<Sink::ApplicationDomain::Event>(event2).exec().waitForFinished(); |
226 | 226 | ||
227 | //Ensure all local data is processed | 227 | //Ensure all local data is processed |
228 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 228 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
229 | 229 | ||
230 | //Test remove | 230 | //Test remove |
231 | { | 231 | { |
diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp index 70806fa..0323225 100644 --- a/tests/inspectiontest.cpp +++ b/tests/inspectiontest.cpp | |||
@@ -41,8 +41,8 @@ private Q_SLOTS: | |||
41 | Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create()); | 41 | Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create()); |
42 | 42 | ||
43 | //testInspection is a magic property that the dummyresource supports | 43 | //testInspection is a magic property that the dummyresource supports |
44 | auto inspectionCommand = Resources::Inspection::PropertyInspection(mail, "testInspection", success); | 44 | auto inspectionCommand = ResourceControl::Inspection::PropertyInspection(mail, "testInspection", success); |
45 | auto result = Resources::inspect<Mail>(inspectionCommand).exec(); | 45 | auto result = ResourceControl::inspect<Mail>(inspectionCommand).exec(); |
46 | result.waitForFinished(); | 46 | result.waitForFinished(); |
47 | if (success) { | 47 | if (success) { |
48 | QVERIFY(!result.errorCode()); | 48 | QVERIFY(!result.errorCode()); |
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index c5c9348..176ab9f 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp | |||
@@ -68,7 +68,7 @@ private Q_SLOTS: | |||
68 | 68 | ||
69 | void cleanup() | 69 | void cleanup() |
70 | { | 70 | { |
71 | Sink::Resources::shutdown(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); | 71 | Sink::ResourceControl::shutdown(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); |
72 | MaildirResource::removeFromDisk("org.kde.maildir.instance1"); | 72 | MaildirResource::removeFromDisk("org.kde.maildir.instance1"); |
73 | QDir dir(targetPath); | 73 | QDir dir(targetPath); |
74 | dir.removeRecursively(); | 74 | dir.removeRecursively(); |
@@ -80,7 +80,7 @@ private Q_SLOTS: | |||
80 | qDebug() << "-----------------------------------------"; | 80 | qDebug() << "-----------------------------------------"; |
81 | qDebug(); | 81 | qDebug(); |
82 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); | 82 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); |
83 | Sink::Resources::start(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); | 83 | Sink::ResourceControl::start(QByteArray("org.kde.maildir.instance1")).exec().waitForFinished(); |
84 | } | 84 | } |
85 | 85 | ||
86 | void testListFolders() | 86 | void testListFolders() |
@@ -90,7 +90,7 @@ private Q_SLOTS: | |||
90 | 90 | ||
91 | //Ensure all local data is processed | 91 | //Ensure all local data is processed |
92 | Sink::Store::synchronize(query).exec().waitForFinished(); | 92 | Sink::Store::synchronize(query).exec().waitForFinished(); |
93 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 93 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
94 | 94 | ||
95 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 95 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
96 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 96 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -105,7 +105,7 @@ private Q_SLOTS: | |||
105 | 105 | ||
106 | //Ensure all local data is processed | 106 | //Ensure all local data is processed |
107 | Sink::Store::synchronize(query).exec().waitForFinished(); | 107 | Sink::Store::synchronize(query).exec().waitForFinished(); |
108 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 108 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
109 | 109 | ||
110 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 110 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
111 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 111 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -123,7 +123,7 @@ private Q_SLOTS: | |||
123 | //Ensure all local data is processed | 123 | //Ensure all local data is processed |
124 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); | 124 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); |
125 | Store::synchronize(query).exec().waitForFinished(); | 125 | Store::synchronize(query).exec().waitForFinished(); |
126 | Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 126 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
127 | auto result = Store::fetchOne<Folder>( | 127 | auto result = Store::fetchOne<Folder>( |
128 | Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name") | 128 | Query::ResourceFilter("org.kde.maildir.instance1") + Query::RequestedProperties(QByteArrayList() << "name") |
129 | ) | 129 | ) |
@@ -149,7 +149,7 @@ private Q_SLOTS: | |||
149 | 149 | ||
150 | //Ensure all local data is processed | 150 | //Ensure all local data is processed |
151 | Sink::Store::synchronize(query).exec().waitForFinished(); | 151 | Sink::Store::synchronize(query).exec().waitForFinished(); |
152 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 152 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
153 | 153 | ||
154 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 154 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
155 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 155 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -172,7 +172,7 @@ private Q_SLOTS: | |||
172 | 172 | ||
173 | //Ensure all local data is processed | 173 | //Ensure all local data is processed |
174 | Sink::Store::synchronize(query).exec().waitForFinished(); | 174 | Sink::Store::synchronize(query).exec().waitForFinished(); |
175 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 175 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
176 | 176 | ||
177 | auto targetPath = tempDir.path() + "/maildir1/"; | 177 | auto targetPath = tempDir.path() + "/maildir1/"; |
178 | QDir dir(targetPath); | 178 | QDir dir(targetPath); |
@@ -180,7 +180,7 @@ private Q_SLOTS: | |||
180 | 180 | ||
181 | //Ensure all local data is processed | 181 | //Ensure all local data is processed |
182 | Sink::Store::synchronize(query).exec().waitForFinished(); | 182 | Sink::Store::synchronize(query).exec().waitForFinished(); |
183 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 183 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
184 | 184 | ||
185 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 185 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
186 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 186 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -196,11 +196,11 @@ private Q_SLOTS: | |||
196 | 196 | ||
197 | //Ensure all local data is processed | 197 | //Ensure all local data is processed |
198 | Sink::Store::synchronize(query).exec().waitForFinished(); | 198 | Sink::Store::synchronize(query).exec().waitForFinished(); |
199 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 199 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
200 | 200 | ||
201 | //Ensure all local data is processed | 201 | //Ensure all local data is processed |
202 | Sink::Store::synchronize(query).exec().waitForFinished(); | 202 | Sink::Store::synchronize(query).exec().waitForFinished(); |
203 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 203 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
204 | 204 | ||
205 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 205 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
206 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 206 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -215,7 +215,7 @@ private Q_SLOTS: | |||
215 | 215 | ||
216 | //Ensure all local data is processed | 216 | //Ensure all local data is processed |
217 | Sink::Store::synchronize(query).exec().waitForFinished(); | 217 | Sink::Store::synchronize(query).exec().waitForFinished(); |
218 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 218 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
219 | 219 | ||
220 | auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; | 220 | auto targetPath = tempDir.path() + "/maildir1/cur/1365777830.R28.localhost.localdomain:2,S"; |
221 | QFile file(targetPath); | 221 | QFile file(targetPath); |
@@ -223,7 +223,7 @@ private Q_SLOTS: | |||
223 | 223 | ||
224 | //Ensure all local data is processed | 224 | //Ensure all local data is processed |
225 | Sink::Store::synchronize(query).exec().waitForFinished(); | 225 | Sink::Store::synchronize(query).exec().waitForFinished(); |
226 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 226 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
227 | 227 | ||
228 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 228 | auto mailModel = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
229 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 229 | QTRY_VERIFY(mailModel->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -236,7 +236,7 @@ private Q_SLOTS: | |||
236 | query.resources << "org.kde.maildir.instance1"; | 236 | query.resources << "org.kde.maildir.instance1"; |
237 | 237 | ||
238 | //Ensure all local data is processed | 238 | //Ensure all local data is processed |
239 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 239 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
240 | 240 | ||
241 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | 241 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); |
242 | folder.setProperty("name", "testCreateFolder"); | 242 | folder.setProperty("name", "testCreateFolder"); |
@@ -244,7 +244,7 @@ private Q_SLOTS: | |||
244 | Sink::Store::create(folder).exec().waitForFinished(); | 244 | Sink::Store::create(folder).exec().waitForFinished(); |
245 | 245 | ||
246 | //Ensure all local data is processed | 246 | //Ensure all local data is processed |
247 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 247 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
248 | 248 | ||
249 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; | 249 | auto targetPath = tempDir.path() + "/maildir1/testCreateFolder"; |
250 | QFileInfo file(targetPath); | 250 | QFileInfo file(targetPath); |
@@ -262,7 +262,7 @@ private Q_SLOTS: | |||
262 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); | 262 | Sink::ApplicationDomain::Folder folder("org.kde.maildir.instance1"); |
263 | folder.setProperty("name", "testCreateFolder"); | 263 | folder.setProperty("name", "testCreateFolder"); |
264 | Sink::Store::create(folder).exec().waitForFinished(); | 264 | Sink::Store::create(folder).exec().waitForFinished(); |
265 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 265 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
266 | QTRY_VERIFY(QFileInfo(targetPath).exists()); | 266 | QTRY_VERIFY(QFileInfo(targetPath).exists()); |
267 | 267 | ||
268 | Sink::Query folderQuery; | 268 | Sink::Query folderQuery; |
@@ -274,7 +274,7 @@ private Q_SLOTS: | |||
274 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); | 274 | auto createdFolder = model->index(0, 0, QModelIndex()).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Folder::Ptr>(); |
275 | 275 | ||
276 | Sink::Store::remove(*createdFolder).exec().waitForFinished(); | 276 | Sink::Store::remove(*createdFolder).exec().waitForFinished(); |
277 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 277 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
278 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); | 278 | QTRY_VERIFY(!QFileInfo(targetPath).exists()); |
279 | } | 279 | } |
280 | 280 | ||
@@ -284,7 +284,7 @@ private Q_SLOTS: | |||
284 | query.resources << "org.kde.maildir.instance1"; | 284 | query.resources << "org.kde.maildir.instance1"; |
285 | 285 | ||
286 | //Ensure all local data is processed | 286 | //Ensure all local data is processed |
287 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 287 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
288 | 288 | ||
289 | Sink::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); | 289 | Sink::ApplicationDomain::Mail mail("org.kde.maildir.instance1"); |
290 | mail.setProperty("name", "testCreateMail"); | 290 | mail.setProperty("name", "testCreateMail"); |
@@ -293,7 +293,7 @@ private Q_SLOTS: | |||
293 | Sink::Store::create(mail).exec().waitForFinished(); | 293 | Sink::Store::create(mail).exec().waitForFinished(); |
294 | 294 | ||
295 | //Ensure all local data is processed | 295 | //Ensure all local data is processed |
296 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 296 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
297 | 297 | ||
298 | auto targetPath = tempDir.path() + "/maildir1/new"; | 298 | auto targetPath = tempDir.path() + "/maildir1/new"; |
299 | QDir dir(targetPath); | 299 | QDir dir(targetPath); |
@@ -308,7 +308,7 @@ private Q_SLOTS: | |||
308 | 308 | ||
309 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); | 309 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); |
310 | Store::synchronize(query).exec().waitForFinished(); | 310 | Store::synchronize(query).exec().waitForFinished(); |
311 | Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 311 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
312 | 312 | ||
313 | auto result = Store::fetchOne<Folder>( | 313 | auto result = Store::fetchOne<Folder>( |
314 | Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("name", "maildir1") + Query::RequestedProperties(QByteArrayList() << "name") | 314 | Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("name", "maildir1") + Query::RequestedProperties(QByteArrayList() << "name") |
@@ -325,10 +325,10 @@ private Q_SLOTS: | |||
325 | auto mail = mails.first(); | 325 | auto mail = mails.first(); |
326 | 326 | ||
327 | return Store::remove(*mail) | 327 | return Store::remove(*mail) |
328 | .then(Resources::flushReplayQueue(query.resources)) //The change needs to be replayed already | 328 | .then(ResourceControl::flushReplayQueue(query.resources)) //The change needs to be replayed already |
329 | .then(Resources::inspect<Mail>(Resources::Inspection::ExistenceInspection(*mail, false))); | 329 | .then(ResourceControl::inspect<Mail>(ResourceControl::Inspection::ExistenceInspection(*mail, false))); |
330 | }) | 330 | }); |
331 | .then<void>([](){}); | 331 | // .then<void>([](){}); |
332 | }) | 332 | }) |
333 | .exec(); | 333 | .exec(); |
334 | result.waitForFinished(); | 334 | result.waitForFinished(); |
@@ -342,7 +342,7 @@ private Q_SLOTS: | |||
342 | 342 | ||
343 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); | 343 | auto query = Query::ResourceFilter("org.kde.maildir.instance1"); |
344 | Store::synchronize(query).exec().waitForFinished(); | 344 | Store::synchronize(query).exec().waitForFinished(); |
345 | Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 345 | ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
346 | 346 | ||
347 | Folder f; | 347 | Folder f; |
348 | 348 | ||
@@ -362,9 +362,9 @@ private Q_SLOTS: | |||
362 | auto mail = mails.first(); | 362 | auto mail = mails.first(); |
363 | mail->setProperty("unread", true); | 363 | mail->setProperty("unread", true); |
364 | return Store::modify(*mail) | 364 | return Store::modify(*mail) |
365 | .then<void>(Resources::flushReplayQueue(query.resources)) //The change needs to be replayed already | 365 | .then<void>(ResourceControl::flushReplayQueue(query.resources)) //The change needs to be replayed already |
366 | .then(Resources::inspect<Mail>(Resources::Inspection::PropertyInspection(*mail, "unread", true))) | 366 | .then(ResourceControl::inspect<Mail>(ResourceControl::Inspection::PropertyInspection(*mail, "unread", true))) |
367 | .then(Resources::inspect<Mail>(Resources::Inspection::PropertyInspection(*mail, "subject", mail->getProperty("subject")))); | 367 | .then(ResourceControl::inspect<Mail>(ResourceControl::Inspection::PropertyInspection(*mail, "subject", mail->getProperty("subject")))); |
368 | }) | 368 | }) |
369 | .then<void>([](){}); | 369 | .then<void>([](){}); |
370 | }) | 370 | }) |
diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index f180f9c..51a9cd8 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp | |||
@@ -73,7 +73,7 @@ private Q_SLOTS: | |||
73 | query.resources << "org.kde.dummy.instance1"; | 73 | query.resources << "org.kde.dummy.instance1"; |
74 | query.liveQuery = true; | 74 | query.liveQuery = true; |
75 | 75 | ||
76 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 76 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
77 | 77 | ||
78 | //Test | 78 | //Test |
79 | QTime time; | 79 | QTime time; |
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index 89d8693..42064c6 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -86,7 +86,7 @@ private Q_SLOTS: | |||
86 | query.liveQuery = false; | 86 | query.liveQuery = false; |
87 | 87 | ||
88 | //Ensure all local data is processed | 88 | //Ensure all local data is processed |
89 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 89 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
90 | 90 | ||
91 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 91 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
92 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 92 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
@@ -161,7 +161,7 @@ private Q_SLOTS: | |||
161 | query.resources << "org.kde.dummy.instance1"; | 161 | query.resources << "org.kde.dummy.instance1"; |
162 | 162 | ||
163 | //Ensure all local data is processed | 163 | //Ensure all local data is processed |
164 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 164 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
165 | 165 | ||
166 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 166 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
167 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 167 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -181,7 +181,7 @@ private Q_SLOTS: | |||
181 | query.parentProperty = "parent"; | 181 | query.parentProperty = "parent"; |
182 | 182 | ||
183 | //Ensure all local data is processed | 183 | //Ensure all local data is processed |
184 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 184 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
185 | 185 | ||
186 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data | 186 | //We fetch after the data is available and don't rely on the live query mechanism to deliver the actual data |
187 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 187 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
@@ -210,7 +210,7 @@ private Q_SLOTS: | |||
210 | query.propertyFilter.insert("uid", "test1"); | 210 | query.propertyFilter.insert("uid", "test1"); |
211 | 211 | ||
212 | //Ensure all local data is processed | 212 | //Ensure all local data is processed |
213 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 213 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
214 | 214 | ||
215 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 215 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
216 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 216 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |
@@ -230,7 +230,7 @@ private Q_SLOTS: | |||
230 | query.resources << "org.kde.dummy.instance1"; | 230 | query.resources << "org.kde.dummy.instance1"; |
231 | 231 | ||
232 | //Ensure all local data is processed | 232 | //Ensure all local data is processed |
233 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 233 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
234 | 234 | ||
235 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 235 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
236 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 236 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -251,7 +251,7 @@ private Q_SLOTS: | |||
251 | query.propertyFilter.insert("folder", folderEntity->identifier()); | 251 | query.propertyFilter.insert("folder", folderEntity->identifier()); |
252 | 252 | ||
253 | //Ensure all local data is processed | 253 | //Ensure all local data is processed |
254 | Sink::Resources::flushMessageQueue(query.resources).exec().waitForFinished(); | 254 | Sink::ResourceControl::flushMessageQueue(query.resources).exec().waitForFinished(); |
255 | 255 | ||
256 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 256 | //We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
257 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 257 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |