diff options
Diffstat (limited to 'tests/pipelinetest.cpp')
-rw-r--r-- | tests/pipelinetest.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index 45e2fbb..7431deb 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp | |||
@@ -250,8 +250,9 @@ private slots: | |||
250 | // Get uid of written entity | 250 | // Get uid of written entity |
251 | auto keys = getKeys(instanceIdentifier(), "event.main"); | 251 | auto keys = getKeys(instanceIdentifier(), "event.main"); |
252 | QCOMPARE(keys.size(), 1); | 252 | QCOMPARE(keys.size(), 1); |
253 | const auto key = keys.first(); | 253 | auto key = Sink::Storage::Key::fromInternalByteArray(keys.first()); |
254 | const auto uid = Sink::Storage::DataStore::uidFromKey(key); | 254 | //const auto uid = Sink::Storage::DataStore::uidFromKey(key); |
255 | const auto uid = key.identifier().toDisplayByteArray(); | ||
255 | 256 | ||
256 | // Execute the modification | 257 | // Execute the modification |
257 | entityFbb.Clear(); | 258 | entityFbb.Clear(); |
@@ -260,8 +261,10 @@ private slots: | |||
260 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); | 261 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); |
261 | pipeline.commit(); | 262 | pipeline.commit(); |
262 | 263 | ||
264 | key.setRevision(2); | ||
265 | |||
263 | // Ensure we've got the new revision with the modification | 266 | // Ensure we've got the new revision with the modification |
264 | auto buffer = getEntity(instanceIdentifier(), "event.main", Sink::Storage::DataStore::assembleKey(uid, 2)); | 267 | auto buffer = getEntity(instanceIdentifier(), "event.main", key.toInternalByteArray()); |
265 | QVERIFY(!buffer.isEmpty()); | 268 | QVERIFY(!buffer.isEmpty()); |
266 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); | 269 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); |
267 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); | 270 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); |
@@ -296,7 +299,8 @@ private slots: | |||
296 | // Get uid of written entity | 299 | // Get uid of written entity |
297 | auto keys = getKeys(instanceIdentifier(), "event.main"); | 300 | auto keys = getKeys(instanceIdentifier(), "event.main"); |
298 | QCOMPARE(keys.size(), 1); | 301 | QCOMPARE(keys.size(), 1); |
299 | const auto uid = Sink::Storage::DataStore::uidFromKey(keys.first()); | 302 | auto key = Sink::Storage::Key::fromInternalByteArray(keys.first()); |
303 | const auto uid = key.identifier().toDisplayByteArray(); | ||
300 | 304 | ||
301 | 305 | ||
302 | // Create another operation inbetween | 306 | // Create another operation inbetween |
@@ -315,8 +319,10 @@ private slots: | |||
315 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); | 319 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); |
316 | pipeline.commit(); | 320 | pipeline.commit(); |
317 | 321 | ||
322 | key.setRevision(3); | ||
323 | |||
318 | // Ensure we've got the new revision with the modification | 324 | // Ensure we've got the new revision with the modification |
319 | auto buffer = getEntity(instanceIdentifier(), "event.main", Sink::Storage::DataStore::assembleKey(uid, 3)); | 325 | auto buffer = getEntity(instanceIdentifier(), "event.main", key.toInternalByteArray()); |
320 | QVERIFY(!buffer.isEmpty()); | 326 | QVERIFY(!buffer.isEmpty()); |
321 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); | 327 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); |
322 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); | 328 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); |
@@ -337,7 +343,7 @@ private slots: | |||
337 | auto result = getKeys(instanceIdentifier(), "event.main"); | 343 | auto result = getKeys(instanceIdentifier(), "event.main"); |
338 | QCOMPARE(result.size(), 1); | 344 | QCOMPARE(result.size(), 1); |
339 | 345 | ||
340 | const auto uid = Sink::Storage::DataStore::uidFromKey(result.first()); | 346 | const auto uid = Sink::Storage::Key::fromInternalByteArray(result.first()).identifier().toDisplayByteArray(); |
341 | 347 | ||
342 | // Delete entity | 348 | // Delete entity |
343 | auto deleteCommand = deleteEntityCommand(uid, 1); | 349 | auto deleteCommand = deleteEntityCommand(uid, 1); |
@@ -373,21 +379,23 @@ private slots: | |||
373 | QCOMPARE(testProcessor->newUids.size(), 1); | 379 | QCOMPARE(testProcessor->newUids.size(), 1); |
374 | QCOMPARE(testProcessor->newRevisions.size(), 1); | 380 | QCOMPARE(testProcessor->newRevisions.size(), 1); |
375 | // Key doesn't contain revision and is just the uid | 381 | // Key doesn't contain revision and is just the uid |
376 | QCOMPARE(testProcessor->newUids.at(0), Sink::Storage::DataStore::uidFromKey(testProcessor->newUids.at(0))); | 382 | const auto uid = Sink::Storage::Key::fromDisplayByteArray(testProcessor->newUids.at(0)).identifier().toDisplayByteArray(); |
383 | QCOMPARE(testProcessor->newUids.at(0), uid); | ||
377 | } | 384 | } |
378 | pipeline.commit(); | 385 | pipeline.commit(); |
379 | entityFbb.Clear(); | 386 | entityFbb.Clear(); |
380 | pipeline.startTransaction(); | 387 | pipeline.startTransaction(); |
381 | auto keys = getKeys(instanceIdentifier(), "event.main"); | 388 | auto keys = getKeys(instanceIdentifier(), "event.main"); |
382 | QCOMPARE(keys.size(), 1); | 389 | QCOMPARE(keys.size(), 1); |
383 | const auto uid = Sink::Storage::DataStore::uidFromKey(keys.first()); | 390 | const auto uid = Sink::Storage::Key::fromDisplayByteArray(keys.first()).identifier().toDisplayByteArray(); |
384 | { | 391 | { |
385 | auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); | 392 | auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); |
386 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); | 393 | pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); |
387 | QCOMPARE(testProcessor->modifiedUids.size(), 1); | 394 | QCOMPARE(testProcessor->modifiedUids.size(), 1); |
388 | QCOMPARE(testProcessor->modifiedRevisions.size(), 1); | 395 | QCOMPARE(testProcessor->modifiedRevisions.size(), 1); |
389 | // Key doesn't contain revision and is just the uid | 396 | // Key doesn't contain revision and is just the uid |
390 | QCOMPARE(testProcessor->modifiedUids.at(0), Sink::Storage::DataStore::uidFromKey(testProcessor->modifiedUids.at(0))); | 397 | const auto uid2 = Sink::Storage::Key::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).identifier().toDisplayByteArray(); |
398 | QCOMPARE(testProcessor->modifiedUids.at(0), uid2); | ||
391 | } | 399 | } |
392 | pipeline.commit(); | 400 | pipeline.commit(); |
393 | entityFbb.Clear(); | 401 | entityFbb.Clear(); |
@@ -399,7 +407,8 @@ private slots: | |||
399 | QCOMPARE(testProcessor->deletedUids.size(), 1); | 407 | QCOMPARE(testProcessor->deletedUids.size(), 1); |
400 | QCOMPARE(testProcessor->deletedSummaries.size(), 1); | 408 | QCOMPARE(testProcessor->deletedSummaries.size(), 1); |
401 | // Key doesn't contain revision and is just the uid | 409 | // Key doesn't contain revision and is just the uid |
402 | QCOMPARE(testProcessor->deletedUids.at(0), Sink::Storage::DataStore::uidFromKey(testProcessor->deletedUids.at(0))); | 410 | const auto uid2 = Sink::Storage::Key::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).identifier().toDisplayByteArray(); |
411 | QCOMPARE(testProcessor->deletedUids.at(0), uid2); | ||
403 | QCOMPARE(testProcessor->deletedSummaries.at(0), QByteArray("summary2")); | 412 | QCOMPARE(testProcessor->deletedSummaries.at(0), QByteArray("summary2")); |
404 | } | 413 | } |
405 | } | 414 | } |