summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-08-23 23:57:09 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-08-23 23:57:09 +0200
commit9c3d000e11d3b1fc6c6c205fe9e7ea26c11092c6 (patch)
tree7cf47fd2334487a0e4f2bfef73c8e09e165dc4cc /tests
parentae0255bf8eb913004082278af27d69047503ea71 (diff)
downloadsink-9c3d000e11d3b1fc6c6c205fe9e7ea26c11092c6.tar.gz
sink-9c3d000e11d3b1fc6c6c205fe9e7ea26c11092c6.zip
Removed convenience API
Diffstat (limited to 'tests')
-rw-r--r--tests/hawd/dataset.cpp6
-rw-r--r--tests/storagebenchmark.cpp6
-rw-r--r--tests/storagetest.cpp16
3 files changed, 14 insertions, 14 deletions
diff --git a/tests/hawd/dataset.cpp b/tests/hawd/dataset.cpp
index 96479e0..e1cc3a4 100644
--- a/tests/hawd/dataset.cpp
+++ b/tests/hawd/dataset.cpp
@@ -237,7 +237,7 @@ qint64 Dataset::insertRow(const Row &row)
237 } 237 }
238 238
239 qint64 key = row.key(); 239 qint64 key = row.key();
240 m_transaction.write(QByteArray::fromRawData((const char *)&key, sizeof(qint64)), row.toBinary()); 240 m_transaction.openDatabase().write(QByteArray::fromRawData((const char *)&key, sizeof(qint64)), row.toBinary());
241 return key; 241 return key;
242} 242}
243 243
@@ -253,7 +253,7 @@ void Dataset::eachRow(const std::function<void(const Row &row)> &resultHandler)
253 } 253 }
254 254
255 Row row(*this); 255 Row row(*this);
256 m_transaction.scan("", 256 m_transaction.openDatabase().scan("",
257 [&](const QByteArray &key, const QByteArray &value) -> bool { 257 [&](const QByteArray &key, const QByteArray &value) -> bool {
258 if (key.size() != sizeof(qint64)) { 258 if (key.size() != sizeof(qint64)) {
259 return true; 259 return true;
@@ -276,7 +276,7 @@ Dataset::Row Dataset::row(qint64 key)
276 } 276 }
277 277
278 Row row(*this, key); 278 Row row(*this, key);
279 m_transaction.scan(QByteArray::fromRawData((const char *)&key, sizeof(qint64)), 279 m_transaction.openDatabase().scan(QByteArray::fromRawData((const char *)&key, sizeof(qint64)),
280 [&row](const QByteArray &key, const QByteArray &value) -> bool { 280 [&row](const QByteArray &key, const QByteArray &value) -> bool {
281 row.fromBinary(value); 281 row.fromBinary(value);
282 return true; 282 return true;
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp
index f143c4d..e6ab049 100644
--- a/tests/storagebenchmark.cpp
+++ b/tests/storagebenchmark.cpp
@@ -98,7 +98,7 @@ private Q_SLOTS:
98 if (store) { 98 if (store) {
99 auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); 99 auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite);
100 for (int i = 0; i < count; i++) { 100 for (int i = 0; i < count; i++) {
101 transaction.write(keyPrefix + QByteArray::number(i), event); 101 transaction.openDatabase().write(keyPrefix + QByteArray::number(i), event);
102 if ((i % 10000) == 0) { 102 if ((i % 10000) == 0) {
103 transaction.commit(); 103 transaction.commit();
104 transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); 104 transaction = store->createTransaction(Akonadi2::Storage::ReadWrite);
@@ -149,7 +149,7 @@ private Q_SLOTS:
149 149
150 QBENCHMARK { 150 QBENCHMARK {
151 int hit = 0; 151 int hit = 0;
152 store->createTransaction(Akonadi2::Storage::ReadOnly).scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { 152 store->createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool {
153 if (key == "key10000") { 153 if (key == "key10000") {
154 //qDebug() << "hit"; 154 //qDebug() << "hit";
155 hit++; 155 hit++;
@@ -166,7 +166,7 @@ private Q_SLOTS:
166 166
167 QBENCHMARK { 167 QBENCHMARK {
168 int hit = 0; 168 int hit = 0;
169 store->createTransaction(Akonadi2::Storage::ReadOnly).scan("key40000", [&](const QByteArray &key, const QByteArray &value) -> bool { 169 store->createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("key40000", [&](const QByteArray &key, const QByteArray &value) -> bool {
170 hit++; 170 hit++;
171 return true; 171 return true;
172 }); 172 });
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index 2e69634..7060ef2 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -29,7 +29,7 @@ private:
29 transaction = std::move(storage.createTransaction(Akonadi2::Storage::ReadWrite)); 29 transaction = std::move(storage.createTransaction(Akonadi2::Storage::ReadWrite));
30 } 30 }
31 } 31 }
32 transaction.write(keyPrefix + QByteArray::number(i), keyPrefix + QByteArray::number(i)); 32 transaction.openDatabase().write(keyPrefix + QByteArray::number(i), keyPrefix + QByteArray::number(i));
33 } 33 }
34 transaction.commit(); 34 transaction.commit();
35 } 35 }
@@ -39,7 +39,7 @@ private:
39 bool success = true; 39 bool success = true;
40 bool keyMatch = true; 40 bool keyMatch = true;
41 const auto reference = keyPrefix + QByteArray::number(i); 41 const auto reference = keyPrefix + QByteArray::number(i);
42 storage.createTransaction(Akonadi2::Storage::ReadOnly).scan(keyPrefix + QByteArray::number(i), 42 storage.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan(keyPrefix + QByteArray::number(i),
43 [&keyMatch, &reference](const QByteArray &key, const QByteArray &value) -> bool { 43 [&keyMatch, &reference](const QByteArray &key, const QByteArray &value) -> bool {
44 if (value != reference) { 44 if (value != reference) {
45 qDebug() << "Mismatch while reading"; 45 qDebug() << "Mismatch while reading";
@@ -103,7 +103,7 @@ private Q_SLOTS:
103 { 103 {
104 int hit = 0; 104 int hit = 0;
105 Akonadi2::Storage store(testDataPath, dbName); 105 Akonadi2::Storage store(testDataPath, dbName);
106 store.createTransaction(Akonadi2::Storage::ReadOnly).scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { 106 store.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool {
107 if (key == "key50") { 107 if (key == "key50") {
108 hit++; 108 hit++;
109 } 109 }
@@ -117,7 +117,7 @@ private Q_SLOTS:
117 int hit = 0; 117 int hit = 0;
118 bool foundInvalidValue = false; 118 bool foundInvalidValue = false;
119 Akonadi2::Storage store(testDataPath, dbName); 119 Akonadi2::Storage store(testDataPath, dbName);
120 store.createTransaction(Akonadi2::Storage::ReadOnly).scan("key50", [&](const QByteArray &key, const QByteArray &value) -> bool { 120 store.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("key50", [&](const QByteArray &key, const QByteArray &value) -> bool {
121 if (key != "key50") { 121 if (key != "key50") {
122 foundInvalidValue = true; 122 foundInvalidValue = true;
123 } 123 }
@@ -134,8 +134,8 @@ private Q_SLOTS:
134 populate(3); 134 populate(3);
135 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); 135 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
136 auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite); 136 auto transaction = store.createTransaction(Akonadi2::Storage::ReadWrite);
137 transaction.scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool { 137 transaction.openDatabase().scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool {
138 transaction.remove(key, [](const Akonadi2::Storage::Error &) { 138 transaction.openDatabase().remove(key, [](const Akonadi2::Storage::Error &) {
139 QVERIFY(false); 139 QVERIFY(false);
140 }); 140 });
141 return false; 141 return false;
@@ -146,8 +146,8 @@ private Q_SLOTS:
146 { 146 {
147 populate(3); 147 populate(3);
148 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite); 148 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
149 store.createTransaction(Akonadi2::Storage::ReadOnly).scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool { 149 store.createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("key1", [&](const QByteArray &key, const QByteArray &value) -> bool {
150 store.createTransaction(Akonadi2::Storage::ReadWrite).remove(key, [](const Akonadi2::Storage::Error &) { 150 store.createTransaction(Akonadi2::Storage::ReadWrite).openDatabase().remove(key, [](const Akonadi2::Storage::Error &) {
151 QVERIFY(false); 151 QVERIFY(false);
152 }); 152 });
153 return false; 153 return false;