diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-04 12:40:24 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-04 12:40:24 +0100 |
commit | ba94c4300c52dd80774ed7affc2ef9b4508cb7be (patch) | |
tree | 3c8bf6ce042a4544e81901d901a3a3759d0a128a | |
parent | 98b682acb8c57cadaea5ff0ac6709d21a591b97b (diff) | |
download | sink-ba94c4300c52dd80774ed7affc2ef9b4508cb7be.tar.gz sink-ba94c4300c52dd80774ed7affc2ef9b4508cb7be.zip |
Don't expose the live query flag directly.
-rw-r--r-- | common/query.h | 22 | ||||
-rw-r--r-- | common/queryrunner.cpp | 8 | ||||
-rw-r--r-- | common/resourcefacade.cpp | 2 | ||||
-rw-r--r-- | common/store.cpp | 9 | ||||
-rw-r--r-- | sinksh/sinksh_utils.cpp | 1 | ||||
-rw-r--r-- | sinksh/syntax_modules/sink_count.cpp | 1 | ||||
-rw-r--r-- | sinksh/syntax_modules/sink_list.cpp | 2 | ||||
-rw-r--r-- | sinksh/syntax_modules/sink_show.cpp | 1 | ||||
-rw-r--r-- | sinksh/syntax_modules/sink_stat.cpp | 1 | ||||
-rw-r--r-- | tests/accountstest.cpp | 4 | ||||
-rw-r--r-- | tests/clientapitest.cpp | 9 | ||||
-rw-r--r-- | tests/databasepopulationandfacadequerybenchmark.cpp | 1 | ||||
-rw-r--r-- | tests/dummyresourcetest.cpp | 2 | ||||
-rw-r--r-- | tests/mailquerybenchmark.cpp | 1 | ||||
-rw-r--r-- | tests/modelinteractivitytest.cpp | 2 | ||||
-rw-r--r-- | tests/querytest.cpp | 15 | ||||
-rw-r--r-- | tests/resourceconfigtest.cpp | 2 |
17 files changed, 39 insertions, 44 deletions
diff --git a/common/query.h b/common/query.h index c0ea0f3..c9d52b7 100644 --- a/common/query.h +++ b/common/query.h | |||
@@ -200,13 +200,13 @@ public: | |||
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | Query(const ApplicationDomain::Entity &value) : limit(0), liveQuery(false), synchronousQuery(false) | 203 | Query(const ApplicationDomain::Entity &value) : limit(0) |
204 | { | 204 | { |
205 | filter(value.identifier()); | 205 | filter(value.identifier()); |
206 | resourceFilter(value.resourceInstanceIdentifier()); | 206 | resourceFilter(value.resourceInstanceIdentifier()); |
207 | } | 207 | } |
208 | 208 | ||
209 | Query(Flags flags = Flags()) : limit(0), liveQuery(false), synchronousQuery(false) | 209 | Query(Flags flags = Flags()) : limit(0), mFlags(flags) |
210 | { | 210 | { |
211 | } | 211 | } |
212 | 212 | ||
@@ -214,8 +214,21 @@ public: | |||
214 | QByteArray parentProperty; | 214 | QByteArray parentProperty; |
215 | QByteArray sortProperty; | 215 | QByteArray sortProperty; |
216 | int limit; | 216 | int limit; |
217 | bool liveQuery; | 217 | |
218 | bool synchronousQuery; | 218 | void setFlags(Flags flags) |
219 | { | ||
220 | mFlags = flags; | ||
221 | } | ||
222 | |||
223 | bool liveQuery() const | ||
224 | { | ||
225 | return mFlags & LiveQuery; | ||
226 | } | ||
227 | |||
228 | bool synchronousQuery() const | ||
229 | { | ||
230 | return mFlags & SynchronousQuery; | ||
231 | } | ||
219 | 232 | ||
220 | class FilterStage { | 233 | class FilterStage { |
221 | public: | 234 | public: |
@@ -376,6 +389,7 @@ public: | |||
376 | } | 389 | } |
377 | 390 | ||
378 | private: | 391 | private: |
392 | Flags mFlags; | ||
379 | Filter mResourceFilter; | 393 | Filter mResourceFilter; |
380 | QList<QSharedPointer<FilterStage>> mFilterStages; | 394 | QList<QSharedPointer<FilterStage>> mFilterStages; |
381 | }; | 395 | }; |
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp index 1eacb8e..780b341 100644 --- a/common/queryrunner.cpp +++ b/common/queryrunner.cpp | |||
@@ -72,7 +72,7 @@ QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::Resou | |||
72 | const QByteArray parentId = parent ? parent->identifier() : QByteArray(); | 72 | const QByteArray parentId = parent ? parent->identifier() : QByteArray(); |
73 | SinkTrace() << "Running fetcher. Offset: " << mOffset[parentId] << " Batchsize: " << mBatchSize; | 73 | SinkTrace() << "Running fetcher. Offset: " << mOffset[parentId] << " Batchsize: " << mBatchSize; |
74 | auto resultProvider = mResultProvider; | 74 | auto resultProvider = mResultProvider; |
75 | if (query.synchronousQuery) { | 75 | if (query.synchronousQuery()) { |
76 | QueryWorker<DomainType> worker(query, mResourceContext, bufferType, mResultTransformation); | 76 | QueryWorker<DomainType> worker(query, mResourceContext, bufferType, mResultTransformation); |
77 | worker.executeInitialQuery(query, parent, *resultProvider, mOffset[parentId], mBatchSize); | 77 | worker.executeInitialQuery(query, parent, *resultProvider, mOffset[parentId], mBatchSize); |
78 | resultProvider->initialResultSetComplete(parent); | 78 | resultProvider->initialResultSetComplete(parent); |
@@ -94,7 +94,7 @@ QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::Resou | |||
94 | } | 94 | } |
95 | mOffset[parentId] += newRevisionAndReplayedEntities.second; | 95 | mOffset[parentId] += newRevisionAndReplayedEntities.second; |
96 | // Only send the revision replayed information if we're connected to the resource, there's no need to start the resource otherwise. | 96 | // Only send the revision replayed information if we're connected to the resource, there's no need to start the resource otherwise. |
97 | if (query.liveQuery) { | 97 | if (query.liveQuery()) { |
98 | mResourceAccess->sendRevisionReplayedCommand(newRevisionAndReplayedEntities.first); | 98 | mResourceAccess->sendRevisionReplayedCommand(newRevisionAndReplayedEntities.first); |
99 | } | 99 | } |
100 | resultProvider->setRevision(newRevisionAndReplayedEntities.first); | 100 | resultProvider->setRevision(newRevisionAndReplayedEntities.first); |
@@ -105,8 +105,8 @@ QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::Resou | |||
105 | }); | 105 | }); |
106 | 106 | ||
107 | // In case of a live query we keep the runner for as long alive as the result provider exists | 107 | // In case of a live query we keep the runner for as long alive as the result provider exists |
108 | if (query.liveQuery) { | 108 | if (query.liveQuery()) { |
109 | Q_ASSERT(!query.synchronousQuery); | 109 | Q_ASSERT(!query.synchronousQuery()); |
110 | // Incremental updates are always loaded directly, leaving it up to the result to discard the changes if they are not interesting | 110 | // Incremental updates are always loaded directly, leaving it up to the result to discard the changes if they are not interesting |
111 | setQuery([=]() -> KAsync::Job<void> { | 111 | setQuery([=]() -> KAsync::Job<void> { |
112 | auto resultProvider = mResultProvider; | 112 | auto resultProvider = mResultProvider; |
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 09323a0..e5b4496 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -89,7 +89,7 @@ LocalStorageQueryRunner<DomainType>::LocalStorageQueryRunner(const Query &query, | |||
89 | mResultProvider->initialResultSetComplete(typename DomainType::Ptr()); | 89 | mResultProvider->initialResultSetComplete(typename DomainType::Ptr()); |
90 | mResultProvider->complete(); | 90 | mResultProvider->complete(); |
91 | }); | 91 | }); |
92 | if (query.liveQuery) { | 92 | if (query.liveQuery()) { |
93 | { | 93 | { |
94 | auto ret = QObject::connect(&configNotifier, &ConfigNotifier::added, guard, [this](const ApplicationDomain::ApplicationDomainType::Ptr &entry) { | 94 | auto ret = QObject::connect(&configNotifier, &ConfigNotifier::added, guard, [this](const ApplicationDomain::ApplicationDomainType::Ptr &entry) { |
95 | auto entity = entry.staticCast<DomainType>(); | 95 | auto entity = entry.staticCast<DomainType>(); |
diff --git a/common/store.cpp b/common/store.cpp index d569133..5d6e197 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -134,7 +134,7 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query) | |||
134 | SinkTrace() << " Filter: " << query.getBaseFilters(); | 134 | SinkTrace() << " Filter: " << query.getBaseFilters(); |
135 | SinkTrace() << " Parent: " << query.parentProperty; | 135 | SinkTrace() << " Parent: " << query.parentProperty; |
136 | SinkTrace() << " Ids: " << query.ids(); | 136 | SinkTrace() << " Ids: " << query.ids(); |
137 | SinkTrace() << " IsLive: " << query.liveQuery; | 137 | SinkTrace() << " IsLive: " << query.liveQuery(); |
138 | SinkTrace() << " Sorting: " << query.sortProperty; | 138 | SinkTrace() << " Sorting: " << query.sortProperty; |
139 | auto model = QSharedPointer<ModelResult<DomainType, typename DomainType::Ptr>>::create(query, query.requestedProperties); | 139 | auto model = QSharedPointer<ModelResult<DomainType, typename DomainType::Ptr>>::create(query, query.requestedProperties); |
140 | 140 | ||
@@ -149,12 +149,12 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query) | |||
149 | auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); | 149 | auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); |
150 | model->setEmitter(aggregatingEmitter); | 150 | model->setEmitter(aggregatingEmitter); |
151 | 151 | ||
152 | if (query.liveQuery && query.getResourceFilter().ids.isEmpty() && !ApplicationDomain::isGlobalType(ApplicationDomain::getTypeName<DomainType>())) { | 152 | if (query.liveQuery() && query.getResourceFilter().ids.isEmpty() && !ApplicationDomain::isGlobalType(ApplicationDomain::getTypeName<DomainType>())) { |
153 | SinkTrace() << "Listening for new resources"; | 153 | SinkTrace() << "Listening for new resources"; |
154 | auto facade = FacadeFactory::instance().getFacade<ApplicationDomain::SinkResource>("", ""); | 154 | auto facade = FacadeFactory::instance().getFacade<ApplicationDomain::SinkResource>("", ""); |
155 | Q_ASSERT(facade); | 155 | Q_ASSERT(facade); |
156 | Sink::Query resourceQuery; | 156 | Sink::Query resourceQuery; |
157 | resourceQuery.liveQuery = query.liveQuery; | 157 | query.setFlags(Query::LiveQuery); |
158 | auto result = facade->load(resourceQuery); | 158 | auto result = facade->load(resourceQuery); |
159 | auto emitter = result.second; | 159 | auto emitter = result.second; |
160 | emitter->onAdded([query, aggregatingEmitter](const ApplicationDomain::SinkResource::Ptr &resource) { | 160 | emitter->onAdded([query, aggregatingEmitter](const ApplicationDomain::SinkResource::Ptr &resource) { |
@@ -344,8 +344,7 @@ template <class DomainType> | |||
344 | QList<DomainType> Store::read(const Sink::Query &q) | 344 | QList<DomainType> Store::read(const Sink::Query &q) |
345 | { | 345 | { |
346 | auto query = q; | 346 | auto query = q; |
347 | query.synchronousQuery = true; | 347 | query.setFlags(Query::SynchronousQuery); |
348 | query.liveQuery = false; | ||
349 | QList<DomainType> list; | 348 | QList<DomainType> list; |
350 | auto resources = getResources(query.getResourceFilter(), ApplicationDomain::getTypeName<DomainType>()); | 349 | auto resources = getResources(query.getResourceFilter(), ApplicationDomain::getTypeName<DomainType>()); |
351 | auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); | 350 | auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); |
diff --git a/sinksh/sinksh_utils.cpp b/sinksh/sinksh_utils.cpp index ec07e47..cb53ff2 100644 --- a/sinksh/sinksh_utils.cpp +++ b/sinksh/sinksh_utils.cpp | |||
@@ -90,7 +90,6 @@ QSharedPointer<QAbstractItemModel> loadModel(const QString &type, Sink::Query qu | |||
90 | QStringList resourceIds() | 90 | QStringList resourceIds() |
91 | { | 91 | { |
92 | Sink::Query query; | 92 | Sink::Query query; |
93 | query.liveQuery = false; | ||
94 | QStringList resources; | 93 | QStringList resources; |
95 | for (const auto &r : getStore("resource").read(query)) { | 94 | for (const auto &r : getStore("resource").read(query)) { |
96 | resources << r.identifier(); | 95 | resources << r.identifier(); |
diff --git a/sinksh/syntax_modules/sink_count.cpp b/sinksh/syntax_modules/sink_count.cpp index 7e04c79..84bbabd 100644 --- a/sinksh/syntax_modules/sink_count.cpp +++ b/sinksh/syntax_modules/sink_count.cpp | |||
@@ -53,7 +53,6 @@ bool count(const QStringList &args, State &state) | |||
53 | for (const auto &res : resources) { | 53 | for (const auto &res : resources) { |
54 | query.resourceFilter(res.toLatin1()); | 54 | query.resourceFilter(res.toLatin1()); |
55 | } | 55 | } |
56 | query.liveQuery = false; | ||
57 | 56 | ||
58 | auto model = SinkshUtils::loadModel(type, query); | 57 | auto model = SinkshUtils::loadModel(type, query); |
59 | QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [model, state](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { | 58 | QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [model, state](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { |
diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp index e176aab..bb2f1fe 100644 --- a/sinksh/syntax_modules/sink_list.cpp +++ b/sinksh/syntax_modules/sink_list.cpp | |||
@@ -68,8 +68,6 @@ bool list(const QStringList &args, State &state) | |||
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | query.liveQuery = false; | ||
72 | |||
73 | query.requestedProperties = SinkshUtils::requestedProperties(type); | 71 | query.requestedProperties = SinkshUtils::requestedProperties(type); |
74 | 72 | ||
75 | QStringList line; | 73 | QStringList line; |
diff --git a/sinksh/syntax_modules/sink_show.cpp b/sinksh/syntax_modules/sink_show.cpp index 45fd62c..8e3f715 100644 --- a/sinksh/syntax_modules/sink_show.cpp +++ b/sinksh/syntax_modules/sink_show.cpp | |||
@@ -62,7 +62,6 @@ bool show(const QStringList &args, State &state) | |||
62 | } else { | 62 | } else { |
63 | query.resourceFilter(resource.toLatin1()); | 63 | query.resourceFilter(resource.toLatin1()); |
64 | } | 64 | } |
65 | query.liveQuery = false; | ||
66 | 65 | ||
67 | QTime time; | 66 | QTime time; |
68 | time.start(); | 67 | time.start(); |
diff --git a/sinksh/syntax_modules/sink_stat.cpp b/sinksh/syntax_modules/sink_stat.cpp index 5978c01..982d4cf 100644 --- a/sinksh/syntax_modules/sink_stat.cpp +++ b/sinksh/syntax_modules/sink_stat.cpp | |||
@@ -69,7 +69,6 @@ void statResources(const QStringList &resources, const State &state) | |||
69 | bool statAllResources(State &state) | 69 | bool statAllResources(State &state) |
70 | { | 70 | { |
71 | Sink::Query query; | 71 | Sink::Query query; |
72 | query.liveQuery = false; | ||
73 | QStringList resources; | 72 | QStringList resources; |
74 | for (const auto &r : SinkshUtils::getStore("resource").read(query)) { | 73 | for (const auto &r : SinkshUtils::getStore("resource").read(query)) { |
75 | resources << r.identifier(); | 74 | resources << r.identifier(); |
diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp index 8216210..88b13f3 100644 --- a/tests/accountstest.cpp +++ b/tests/accountstest.cpp | |||
@@ -99,7 +99,7 @@ private slots: | |||
99 | Store::create(account).exec().waitForFinished(); | 99 | Store::create(account).exec().waitForFinished(); |
100 | 100 | ||
101 | Query query; | 101 | Query query; |
102 | query.liveQuery = true; | 102 | query.setFlags(Query::LiveQuery); |
103 | auto model = Store::loadModel<SinkAccount>(query); | 103 | auto model = Store::loadModel<SinkAccount>(query); |
104 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 104 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |
105 | 105 | ||
@@ -130,7 +130,7 @@ private slots: | |||
130 | VERIFYEXEC(Sink::Store::create(res)); | 130 | VERIFYEXEC(Sink::Store::create(res)); |
131 | { | 131 | { |
132 | Sink::Query query; | 132 | Sink::Query query; |
133 | query.liveQuery = true; | 133 | query.setFlags(Query::LiveQuery); |
134 | query.request<Sink::ApplicationDomain::SinkAccount::Status>(); | 134 | query.request<Sink::ApplicationDomain::SinkAccount::Status>(); |
135 | 135 | ||
136 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkAccount>(query); | 136 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkAccount>(query); |
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 94c78a7..3f500b7 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -107,7 +107,6 @@ private slots: | |||
107 | 107 | ||
108 | Sink::Query query; | 108 | Sink::Query query; |
109 | query.resourceFilter("dummyresource.instance1"); | 109 | query.resourceFilter("dummyresource.instance1"); |
110 | query.liveQuery = false; | ||
111 | 110 | ||
112 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 111 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
113 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 112 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -118,7 +117,6 @@ private slots: | |||
118 | { | 117 | { |
119 | Sink::Query query; | 118 | Sink::Query query; |
120 | query.resourceFilter("nonexisting.resource"); | 119 | query.resourceFilter("nonexisting.resource"); |
121 | query.liveQuery = false; | ||
122 | 120 | ||
123 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 121 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
124 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); | 122 | QTRY_VERIFY(model->data(QModelIndex(), Sink::Store::ChildrenFetchedRole).toBool()); |
@@ -132,7 +130,6 @@ private slots: | |||
132 | 130 | ||
133 | Sink::Query query; | 131 | Sink::Query query; |
134 | query.resourceFilter("dummyresource.instance1"); | 132 | query.resourceFilter("dummyresource.instance1"); |
135 | query.liveQuery = false; | ||
136 | 133 | ||
137 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 134 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
138 | QTRY_COMPARE(model->rowCount(), 1); | 135 | QTRY_COMPARE(model->rowCount(), 1); |
@@ -150,7 +147,6 @@ private slots: | |||
150 | // Test | 147 | // Test |
151 | Sink::Query query; | 148 | Sink::Query query; |
152 | query.resourceFilter("dummyresource.instance1"); | 149 | query.resourceFilter("dummyresource.instance1"); |
153 | query.liveQuery = false; | ||
154 | query.parentProperty = "parent"; | 150 | query.parentProperty = "parent"; |
155 | 151 | ||
156 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 152 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
@@ -173,7 +169,6 @@ private slots: | |||
173 | // Test | 169 | // Test |
174 | Sink::Query query; | 170 | Sink::Query query; |
175 | query.resourceFilter("dummyresource.instance1"); | 171 | query.resourceFilter("dummyresource.instance1"); |
176 | query.liveQuery = false; | ||
177 | query.parentProperty = "parent"; | 172 | query.parentProperty = "parent"; |
178 | 173 | ||
179 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 174 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
@@ -196,7 +191,7 @@ private slots: | |||
196 | // Test | 191 | // Test |
197 | Sink::Query query; | 192 | Sink::Query query; |
198 | query.resourceFilter("dummyresource.instance1"); | 193 | query.resourceFilter("dummyresource.instance1"); |
199 | query.liveQuery = true; | 194 | query.setFlags(Sink::Query::LiveQuery); |
200 | query.parentProperty = "parent"; | 195 | query.parentProperty = "parent"; |
201 | 196 | ||
202 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | 197 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); |
@@ -247,7 +242,6 @@ private slots: | |||
247 | ResourceConfig::addResource("dummyresource.instance2", "dummyresource"); | 242 | ResourceConfig::addResource("dummyresource.instance2", "dummyresource"); |
248 | 243 | ||
249 | Sink::Query query; | 244 | Sink::Query query; |
250 | query.liveQuery = false; | ||
251 | 245 | ||
252 | int childrenFetchedCount = 0; | 246 | int childrenFetchedCount = 0; |
253 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); | 247 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
@@ -271,7 +265,6 @@ private slots: | |||
271 | 265 | ||
272 | Sink::Query query; | 266 | Sink::Query query; |
273 | query.resourceFilter("dummyresource.instance1"); | 267 | query.resourceFilter("dummyresource.instance1"); |
274 | query.liveQuery = false; | ||
275 | 268 | ||
276 | bool gotValue = false; | 269 | bool gotValue = false; |
277 | auto result = Sink::Store::fetchOne<Sink::ApplicationDomain::Event>(query) | 270 | auto result = Sink::Store::fetchOne<Sink::ApplicationDomain::Event>(query) |
diff --git a/tests/databasepopulationandfacadequerybenchmark.cpp b/tests/databasepopulationandfacadequerybenchmark.cpp index 834ce30..f1904ad 100644 --- a/tests/databasepopulationandfacadequerybenchmark.cpp +++ b/tests/databasepopulationandfacadequerybenchmark.cpp | |||
@@ -90,7 +90,6 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
90 | const auto startingRss = getCurrentRSS(); | 90 | const auto startingRss = getCurrentRSS(); |
91 | 91 | ||
92 | Sink::Query query; | 92 | Sink::Query query; |
93 | query.liveQuery = false; | ||
94 | query.requestedProperties << "uid" | 93 | query.requestedProperties << "uid" |
95 | << "summary"; | 94 | << "summary"; |
96 | 95 | ||
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 0883a13..f8d8543 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -238,7 +238,7 @@ private slots: | |||
238 | void testWriteModifyDeleteLive() | 238 | void testWriteModifyDeleteLive() |
239 | { | 239 | { |
240 | auto query = Query().resourceFilter("sink.dummy.instance1"); | 240 | auto query = Query().resourceFilter("sink.dummy.instance1"); |
241 | query.liveQuery = true; | 241 | query.setFlags(Query::LiveQuery); |
242 | query.filter<Event::Uid>("testuid"); | 242 | query.filter<Event::Uid>("testuid"); |
243 | 243 | ||
244 | auto model = Sink::Store::loadModel<Event>(query); | 244 | auto model = Sink::Store::loadModel<Event>(query); |
diff --git a/tests/mailquerybenchmark.cpp b/tests/mailquerybenchmark.cpp index 90cc4ba..e2c6864 100644 --- a/tests/mailquerybenchmark.cpp +++ b/tests/mailquerybenchmark.cpp | |||
@@ -152,7 +152,6 @@ private slots: | |||
152 | void test50k() | 152 | void test50k() |
153 | { | 153 | { |
154 | Sink::Query query; | 154 | Sink::Query query; |
155 | query.liveQuery = false; | ||
156 | query.request<Mail::Uid>() | 155 | query.request<Mail::Uid>() |
157 | .request<Mail::Subject>() | 156 | .request<Mail::Subject>() |
158 | .request<Mail::Date>(); | 157 | .request<Mail::Date>(); |
diff --git a/tests/modelinteractivitytest.cpp b/tests/modelinteractivitytest.cpp index 6d1c51c..5231c1a 100644 --- a/tests/modelinteractivitytest.cpp +++ b/tests/modelinteractivitytest.cpp | |||
@@ -78,7 +78,7 @@ private slots: | |||
78 | 78 | ||
79 | Sink::Query query; | 79 | Sink::Query query; |
80 | query.resourceFilter("sink.dummy.instance1"); | 80 | query.resourceFilter("sink.dummy.instance1"); |
81 | query.liveQuery = true; | 81 | query.setFlags(Sink::Query::LiveQuery); |
82 | 82 | ||
83 | VERIFYEXEC(Sink::ResourceControl::flushMessageQueue(QByteArrayList() << "sink.dummy.instance1")); | 83 | VERIFYEXEC(Sink::ResourceControl::flushMessageQueue(QByteArrayList() << "sink.dummy.instance1")); |
84 | 84 | ||
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index 9ae3c74..a5e1caf 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -50,7 +50,7 @@ private slots: | |||
50 | // Test | 50 | // Test |
51 | Sink::Query query; | 51 | Sink::Query query; |
52 | query.resourceFilter("foobar"); | 52 | query.resourceFilter("foobar"); |
53 | query.liveQuery = true; | 53 | query.setFlags(Query::LiveQuery); |
54 | 54 | ||
55 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 55 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
56 | auto model = Sink::Store::loadModel<Mail>(query); | 56 | auto model = Sink::Store::loadModel<Mail>(query); |
@@ -70,7 +70,7 @@ private slots: | |||
70 | // Test | 70 | // Test |
71 | Sink::Query query; | 71 | Sink::Query query; |
72 | query.resourceFilter("sink.dummy.instance1"); | 72 | query.resourceFilter("sink.dummy.instance1"); |
73 | query.liveQuery = true; | 73 | query.setFlags(Query::LiveQuery); |
74 | 74 | ||
75 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 75 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
76 | auto model = Sink::Store::loadModel<Mail>(query); | 76 | auto model = Sink::Store::loadModel<Mail>(query); |
@@ -88,7 +88,6 @@ private slots: | |||
88 | // Test | 88 | // Test |
89 | Sink::Query query; | 89 | Sink::Query query; |
90 | query.resourceFilter("sink.dummy.instance1"); | 90 | query.resourceFilter("sink.dummy.instance1"); |
91 | query.liveQuery = false; | ||
92 | 91 | ||
93 | // Ensure all local data is processed | 92 | // Ensure all local data is processed |
94 | VERIFYEXEC(Sink::ResourceControl::flushMessageQueue(QByteArrayList() << "sink.dummy.instance1")); | 93 | VERIFYEXEC(Sink::ResourceControl::flushMessageQueue(QByteArrayList() << "sink.dummy.instance1")); |
@@ -119,7 +118,7 @@ private slots: | |||
119 | // Test | 118 | // Test |
120 | Sink::Query query; | 119 | Sink::Query query; |
121 | query.resourceFilter("sink.dummy.instance1"); | 120 | query.resourceFilter("sink.dummy.instance1"); |
122 | query.liveQuery = true; | 121 | query.setFlags(Query::LiveQuery); |
123 | query.filter<Mail::Folder>("folder1"); | 122 | query.filter<Mail::Folder>("folder1"); |
124 | 123 | ||
125 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 124 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
@@ -182,7 +181,7 @@ private slots: | |||
182 | // Test | 181 | // Test |
183 | Sink::Query query; | 182 | Sink::Query query; |
184 | query.resourceFilter("sink.dummy.instance1"); | 183 | query.resourceFilter("sink.dummy.instance1"); |
185 | query.liveQuery = true; | 184 | query.setFlags(Query::LiveQuery); |
186 | 185 | ||
187 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data | 186 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data |
188 | auto model = Sink::Store::loadModel<Folder>(query); | 187 | auto model = Sink::Store::loadModel<Folder>(query); |
@@ -253,7 +252,6 @@ private slots: | |||
253 | // Test | 252 | // Test |
254 | Sink::Query query; | 253 | Sink::Query query; |
255 | query.resourceFilter("sink.dummy.instance1"); | 254 | query.resourceFilter("sink.dummy.instance1"); |
256 | query.liveQuery = false; | ||
257 | query.filter<Mail::Uid>("test1"); | 255 | query.filter<Mail::Uid>("test1"); |
258 | 256 | ||
259 | // Ensure all local data is processed | 257 | // Ensure all local data is processed |
@@ -412,7 +410,6 @@ private slots: | |||
412 | query.filter<Mail::Folder>(*folderEntity); | 410 | query.filter<Mail::Folder>(*folderEntity); |
413 | query.sort<Mail::Date>(); | 411 | query.sort<Mail::Date>(); |
414 | query.limit = 1; | 412 | query.limit = 1; |
415 | query.liveQuery = false; | ||
416 | 413 | ||
417 | // Ensure all local data is processed | 414 | // Ensure all local data is processed |
418 | VERIFYEXEC(Sink::ResourceControl::flushMessageQueue(QByteArrayList() << "sink.dummy.instance1")); | 415 | VERIFYEXEC(Sink::ResourceControl::flushMessageQueue(QByteArrayList() << "sink.dummy.instance1")); |
@@ -433,7 +430,7 @@ private slots: | |||
433 | void testReactToNewResource() | 430 | void testReactToNewResource() |
434 | { | 431 | { |
435 | Sink::Query query; | 432 | Sink::Query query; |
436 | query.liveQuery = true; | 433 | query.setFlags(Query::LiveQuery); |
437 | auto model = Sink::Store::loadModel<Folder>(query); | 434 | auto model = Sink::Store::loadModel<Folder>(query); |
438 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); | 435 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); |
439 | 436 | ||
@@ -560,7 +557,7 @@ private slots: | |||
560 | Query query; | 557 | Query query; |
561 | query.filter<Mail::Folder>(Sink::Query().containsFilter<Folder::SpecialPurpose>("purpose1")); | 558 | query.filter<Mail::Folder>(Sink::Query().containsFilter<Folder::SpecialPurpose>("purpose1")); |
562 | query.request<Mail::Uid>(); | 559 | query.request<Mail::Uid>(); |
563 | query.liveQuery = true; | 560 | query.setFlags(Query::LiveQuery); |
564 | 561 | ||
565 | auto model = Sink::Store::loadModel<Mail>(query); | 562 | auto model = Sink::Store::loadModel<Mail>(query); |
566 | QTRY_COMPARE(model->rowCount(), 1); | 563 | QTRY_COMPARE(model->rowCount(), 1); |
diff --git a/tests/resourceconfigtest.cpp b/tests/resourceconfigtest.cpp index c06b0fb..df98a61 100644 --- a/tests/resourceconfigtest.cpp +++ b/tests/resourceconfigtest.cpp | |||
@@ -86,7 +86,7 @@ private slots: | |||
86 | VERIFYEXEC(Sink::Store::create(res)); | 86 | VERIFYEXEC(Sink::Store::create(res)); |
87 | { | 87 | { |
88 | Sink::Query query; | 88 | Sink::Query query; |
89 | query.liveQuery = true; | 89 | query.setFlags(Query::LiveQuery); |
90 | query.request<SinkResource::Status>(); | 90 | query.request<SinkResource::Status>(); |
91 | auto model = Sink::Store::loadModel<SinkResource>(query); | 91 | auto model = Sink::Store::loadModel<SinkResource>(query); |
92 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | 92 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); |