diff options
-rw-r--r-- | common/domain/applicationdomaintype.h | 2 | ||||
-rw-r--r-- | common/propertymapper.cpp | 12 | ||||
-rw-r--r-- | common/storage/entitystore.cpp | 1 | ||||
-rw-r--r-- | tests/mailsynctest.cpp | 16 |
4 files changed, 23 insertions, 8 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 98b7de7..7380c04 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -280,7 +280,7 @@ inline QDebug operator<< (QDebug d, const Reference &ref) | |||
280 | 280 | ||
281 | inline QDebug operator<< (QDebug d, const BLOB &blob) | 281 | inline QDebug operator<< (QDebug d, const BLOB &blob) |
282 | { | 282 | { |
283 | d << blob.value; | 283 | d << blob.value << "external:" << blob.isExternal ; |
284 | return d; | 284 | return d; |
285 | } | 285 | } |
286 | 286 | ||
diff --git a/common/propertymapper.cpp b/common/propertymapper.cpp index 4cfe154..4d45644 100644 --- a/common/propertymapper.cpp +++ b/common/propertymapper.cpp | |||
@@ -36,7 +36,9 @@ template <> | |||
36 | flatbuffers::uoffset_t variantToProperty<Sink::ApplicationDomain::BLOB>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb) | 36 | flatbuffers::uoffset_t variantToProperty<Sink::ApplicationDomain::BLOB>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb) |
37 | { | 37 | { |
38 | if (property.isValid()) { | 38 | if (property.isValid()) { |
39 | return fbb.CreateString(property.value<Sink::ApplicationDomain::BLOB>().value.toStdString()).o; | 39 | const auto blob = property.value<Sink::ApplicationDomain::BLOB>(); |
40 | auto s = blob.value + (blob.isExternal ? ":ext" : ":int"); | ||
41 | return fbb.CreateString(s.toStdString()).o; | ||
40 | } | 42 | } |
41 | return 0; | 43 | return 0; |
42 | } | 44 | } |
@@ -133,7 +135,13 @@ QVariant propertyToVariant<Sink::ApplicationDomain::BLOB>(const flatbuffers::Str | |||
133 | { | 135 | { |
134 | if (property) { | 136 | if (property) { |
135 | // We have to copy the memory, otherwise it would become eventually invalid | 137 | // We have to copy the memory, otherwise it would become eventually invalid |
136 | return QVariant::fromValue(Sink::ApplicationDomain::BLOB{QString::fromStdString(property->c_str())}); | 138 | auto s = QString::fromStdString(property->c_str()); |
139 | auto ext = s.endsWith(":ext"); | ||
140 | s.chop(4); | ||
141 | |||
142 | auto blob = Sink::ApplicationDomain::BLOB{s}; | ||
143 | blob.isExternal = ext; | ||
144 | return QVariant::fromValue(blob); | ||
137 | } | 145 | } |
138 | return QVariant(); | 146 | return QVariant(); |
139 | } | 147 | } |
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index 51e5da7..9156dd4 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp | |||
@@ -162,6 +162,7 @@ void EntityStore::copyBlobs(ApplicationDomain::ApplicationDomainType &entity, qi | |||
162 | SinkWarningCtx(d->logCtx) << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); | 162 | SinkWarningCtx(d->logCtx) << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); |
163 | } | 163 | } |
164 | origFile.close(); | 164 | origFile.close(); |
165 | SinkTraceCtx(d->logCtx) << "Moved blob property: " << property << " from " << oldPath << "to" << filePath; | ||
165 | entity.setProperty(property, QVariant::fromValue(ApplicationDomain::BLOB{filePath})); | 166 | entity.setProperty(property, QVariant::fromValue(ApplicationDomain::BLOB{filePath})); |
166 | } | 167 | } |
167 | } | 168 | } |
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index d3b0fe3..3e5a928 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp | |||
@@ -271,16 +271,17 @@ void MailSyncTest::testListMails() | |||
271 | 271 | ||
272 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { | 272 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
273 | QCOMPARE(mails.size(), 1); | 273 | QCOMPARE(mails.size(), 1); |
274 | QVERIFY(mails.first()->getSubject().startsWith(QString("[Nepomuk] Jenkins build is still unstable"))); | 274 | auto mail = mails.first(); |
275 | const auto data = mails.first()->getMimeMessage(); | 275 | QVERIFY(mail->getSubject().startsWith(QString("[Nepomuk] Jenkins build is still unstable"))); |
276 | const auto data = mail->getMimeMessage(); | ||
276 | QVERIFY(!data.isEmpty()); | 277 | QVERIFY(!data.isEmpty()); |
277 | 278 | ||
278 | KMime::Message m; | 279 | KMime::Message m; |
279 | m.setContent(data); | 280 | m.setContent(data); |
280 | m.parse(); | 281 | m.parse(); |
281 | QCOMPARE(mails.first()->getSubject(), m.subject(true)->asUnicodeString()); | 282 | QCOMPARE(mail->getSubject(), m.subject(true)->asUnicodeString()); |
282 | QVERIFY(!mails.first()->getFolder().isEmpty()); | 283 | QVERIFY(!mail->getFolder().isEmpty()); |
283 | QVERIFY(mails.first()->getDate().isValid()); | 284 | QVERIFY(mail->getDate().isValid()); |
284 | }); | 285 | }); |
285 | VERIFYEXEC(job); | 286 | VERIFYEXEC(job); |
286 | } | 287 | } |
@@ -289,6 +290,8 @@ void MailSyncTest::testResyncMails() | |||
289 | { | 290 | { |
290 | Sink::Query query; | 291 | Sink::Query query; |
291 | query.resourceFilter(mResourceInstanceIdentifier); | 292 | query.resourceFilter(mResourceInstanceIdentifier); |
293 | query.request<Mail::MimeMessage>(); | ||
294 | query.request<Mail::Subject>(); | ||
292 | 295 | ||
293 | // Ensure all local data is processed | 296 | // Ensure all local data is processed |
294 | VERIFYEXEC(Store::synchronize(query)); | 297 | VERIFYEXEC(Store::synchronize(query)); |
@@ -300,6 +303,9 @@ void MailSyncTest::testResyncMails() | |||
300 | 303 | ||
301 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { | 304 | auto job = Store::fetchAll<Mail>(query).then([](const QList<Mail::Ptr> &mails) { |
302 | QCOMPARE(mails.size(), 1); | 305 | QCOMPARE(mails.size(), 1); |
306 | auto mail = mails.first(); | ||
307 | QVERIFY(!mail->getSubject().isEmpty()); | ||
308 | QVERIFY(!mail->getMimeMessagePath().isEmpty()); | ||
303 | }); | 309 | }); |
304 | VERIFYEXEC(job); | 310 | VERIFYEXEC(job); |
305 | } | 311 | } |