summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2014-12-15 19:28:05 +0100
committerAaron Seigo <aseigo@kde.org>2014-12-15 19:28:05 +0100
commit3dd90236e7927028ff5c98635f8075189c9869c2 (patch)
treeaefb7ce4e698b6c9d6993546d5e437a61d7ce4e3 /tests
parentcb0f5fb769380db5771ff8e0dba8d780cdc92edb (diff)
downloadsink-3dd90236e7927028ff5c98635f8075189c9869c2.tar.gz
sink-3dd90236e7927028ff5c98635f8075189c9869c2.zip
namespace everything in libs with Akonadi2
Diffstat (limited to 'tests')
-rw-r--r--tests/dummyresourcefacadetest.cpp6
-rw-r--r--tests/hawd/dataset.cpp6
-rw-r--r--tests/hawd/dataset.h2
-rw-r--r--tests/storagebenchmark.cpp14
-rw-r--r--tests/storagetest.cpp22
5 files changed, 25 insertions, 25 deletions
diff --git a/tests/dummyresourcefacadetest.cpp b/tests/dummyresourcefacadetest.cpp
index 26daa23..d815e9b 100644
--- a/tests/dummyresourcefacadetest.cpp
+++ b/tests/dummyresourcefacadetest.cpp
@@ -19,7 +19,7 @@ private:
19 19
20 void populate(int count) 20 void populate(int count)
21 { 21 {
22 Storage storage(testDataPath, dbName, Storage::ReadWrite); 22 Akonadi2::Storage storage(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
23 for (int i = 0; i < count; i++) { 23 for (int i = 0; i < count; i++) {
24 storage.write(keyPrefix + std::to_string(i), keyPrefix + std::to_string(i)); 24 storage.write(keyPrefix + std::to_string(i), keyPrefix + std::to_string(i));
25 } 25 }
@@ -38,7 +38,7 @@ private Q_SLOTS:
38 38
39 void cleanupTestCase() 39 void cleanupTestCase()
40 { 40 {
41 Storage storage(testDataPath, dbName); 41 Akonadi2::Storage storage(testDataPath, dbName);
42 storage.removeFromDisk(); 42 storage.removeFromDisk();
43 } 43 }
44 44
@@ -63,7 +63,7 @@ private Q_SLOTS:
63 QTRY_VERIFY(complete); 63 QTRY_VERIFY(complete);
64 QCOMPARE(results.size(), 1); 64 QCOMPARE(results.size(), 1);
65 65
66 Storage storage(testDataPath, dbName); 66 Akonadi2::Storage storage(testDataPath, dbName);
67 storage.removeFromDisk(); 67 storage.removeFromDisk();
68 } 68 }
69 69
diff --git a/tests/hawd/dataset.cpp b/tests/hawd/dataset.cpp
index a5328e4..6e73c5c 100644
--- a/tests/hawd/dataset.cpp
+++ b/tests/hawd/dataset.cpp
@@ -207,7 +207,7 @@ QString Dataset::Row::toString(const QStringList &cols, int standardCols, const
207 207
208Dataset::Dataset(const QString &name, const State &state) 208Dataset::Dataset(const QString &name, const State &state)
209 : m_definition(state.datasetDefinition(name)), 209 : m_definition(state.datasetDefinition(name)),
210 m_storage(state.resultsPath(), name, Storage::ReadWrite), 210 m_storage(state.resultsPath(), name, Akonadi2::Storage::ReadWrite),
211 m_commitHash(state.commitHash()) 211 m_commitHash(state.commitHash())
212{ 212{
213 m_storage.startTransaction(); 213 m_storage.startTransaction();
@@ -264,7 +264,7 @@ void Dataset::eachRow(const std::function<void(const Row &row)> &resultHandler)
264 resultHandler(row); 264 resultHandler(row);
265 return true; 265 return true;
266 }, 266 },
267 Storage::basicErrorHandler()); 267 Akonadi2::Storage::basicErrorHandler());
268} 268}
269 269
270Dataset::Row Dataset::row(qint64 key) 270Dataset::Row Dataset::row(qint64 key)
@@ -282,7 +282,7 @@ Dataset::Row Dataset::row(qint64 key)
282 row.fromBinary(array); 282 row.fromBinary(array);
283 return true; 283 return true;
284 }, 284 },
285 Storage::basicErrorHandler() 285 Akonadi2::Storage::basicErrorHandler()
286 ); 286 );
287 return row; 287 return row;
288} 288}
diff --git a/tests/hawd/dataset.h b/tests/hawd/dataset.h
index 09a5828..dd1d6f2 100644
--- a/tests/hawd/dataset.h
+++ b/tests/hawd/dataset.h
@@ -83,7 +83,7 @@ public:
83 83
84private: 84private:
85 DatasetDefinition m_definition; 85 DatasetDefinition m_definition;
86 Storage m_storage; 86 Akonadi2::Storage m_storage;
87 QString m_commitHash; 87 QString m_commitHash;
88}; 88};
89 89
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp
index 130753f..9cf9a71 100644
--- a/tests/storagebenchmark.cpp
+++ b/tests/storagebenchmark.cpp
@@ -62,7 +62,7 @@ private Q_SLOTS:
62 62
63 void cleanupTestCase() 63 void cleanupTestCase()
64 { 64 {
65 Storage store(testDataPath, dbName); 65 Akonadi2::Storage store(testDataPath, dbName);
66 store.removeFromDisk(); 66 store.removeFromDisk();
67 } 67 }
68 68
@@ -80,9 +80,9 @@ private Q_SLOTS:
80 QFETCH(bool, useDb); 80 QFETCH(bool, useDb);
81 QFETCH(int, count); 81 QFETCH(int, count);
82 82
83 QScopedPointer<Storage> store; 83 QScopedPointer<Akonadi2::Storage> store;
84 if (useDb) { 84 if (useDb) {
85 store.reset(new Storage(testDataPath, dbName, Storage::ReadWrite)); 85 store.reset(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadWrite));
86 } 86 }
87 87
88 std::ofstream myfile; 88 std::ofstream myfile;
@@ -143,10 +143,10 @@ private Q_SLOTS:
143 qDebug() << "File reading is not implemented."; 143 qDebug() << "File reading is not implemented.";
144 } 144 }
145 } 145 }
146 146
147 void testScan() 147 void testScan()
148 { 148 {
149 QScopedPointer<Storage> store(new Storage(testDataPath, dbName, Storage::ReadOnly)); 149 QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadOnly));
150 150
151 QBENCHMARK { 151 QBENCHMARK {
152 int hit = 0; 152 int hit = 0;
@@ -163,7 +163,7 @@ private Q_SLOTS:
163 163
164 void testKeyLookup() 164 void testKeyLookup()
165 { 165 {
166 QScopedPointer<Storage> store(new Storage(testDataPath, dbName, Storage::ReadOnly)); 166 QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadOnly));
167 167
168 QBENCHMARK { 168 QBENCHMARK {
169 int hit = 0; 169 int hit = 0;
@@ -203,7 +203,7 @@ private Q_SLOTS:
203 203
204 void testSizes() 204 void testSizes()
205 { 205 {
206 Storage store(testDataPath, dbName); 206 Akonadi2::Storage store(testDataPath, dbName);
207 qDebug() << "Database size [kb]: " << store.diskUsage()/1024; 207 qDebug() << "Database size [kb]: " << store.diskUsage()/1024;
208 208
209 QFileInfo fileInfo(filePath); 209 QFileInfo fileInfo(filePath);
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index 3c20135..a771042 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -19,7 +19,7 @@ private:
19 19
20 void populate(int count) 20 void populate(int count)
21 { 21 {
22 Storage storage(testDataPath, dbName, Storage::ReadWrite); 22 Akonadi2::Storage storage(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
23 for (int i = 0; i < count; i++) { 23 for (int i = 0; i < count; i++) {
24 //This should perhaps become an implementation detail of the db? 24 //This should perhaps become an implementation detail of the db?
25 if (i % 10000 == 0) { 25 if (i % 10000 == 0) {
@@ -33,7 +33,7 @@ private:
33 storage.commitTransaction(); 33 storage.commitTransaction();
34 } 34 }
35 35
36 bool verify(Storage &storage, int i) 36 bool verify(Akonadi2::Storage &storage, int i)
37 { 37 {
38 bool success = true; 38 bool success = true;
39 bool keyMatch = true; 39 bool keyMatch = true;
@@ -46,7 +46,7 @@ private:
46 } 46 }
47 return keyMatch; 47 return keyMatch;
48 }, 48 },
49 [&success](const Storage::Error &) { success = false; } 49 [&success](const Akonadi2::Storage::Error &) { success = false; }
50 ); 50 );
51 return success && keyMatch; 51 return success && keyMatch;
52 } 52 }
@@ -60,7 +60,7 @@ private Q_SLOTS:
60 60
61 void cleanupTestCase() 61 void cleanupTestCase()
62 { 62 {
63 Storage storage(testDataPath, dbName); 63 Akonadi2::Storage storage(testDataPath, dbName);
64 storage.removeFromDisk(); 64 storage.removeFromDisk();
65 } 65 }
66 66
@@ -72,13 +72,13 @@ private Q_SLOTS:
72 72
73 //ensure we can read everything back correctly 73 //ensure we can read everything back correctly
74 { 74 {
75 Storage storage(testDataPath, dbName); 75 Akonadi2::Storage storage(testDataPath, dbName);
76 for (int i = 0; i < count; i++) { 76 for (int i = 0; i < count; i++) {
77 QVERIFY(verify(storage, i)); 77 QVERIFY(verify(storage, i));
78 } 78 }
79 } 79 }
80 80
81 Storage storage(testDataPath, dbName); 81 Akonadi2::Storage storage(testDataPath, dbName);
82 storage.removeFromDisk(); 82 storage.removeFromDisk();
83 } 83 }
84 84
@@ -90,7 +90,7 @@ private Q_SLOTS:
90 //ensure we can scan for values 90 //ensure we can scan for values
91 { 91 {
92 int hit = 0; 92 int hit = 0;
93 Storage store(testDataPath, dbName); 93 Akonadi2::Storage store(testDataPath, dbName);
94 store.scan("", [&](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool { 94 store.scan("", [&](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool {
95 if (std::string(static_cast<char*>(keyValue), keySize) == "key50") { 95 if (std::string(static_cast<char*>(keyValue), keySize) == "key50") {
96 hit++; 96 hit++;
@@ -104,7 +104,7 @@ private Q_SLOTS:
104 { 104 {
105 int hit = 0; 105 int hit = 0;
106 bool foundInvalidValue = false; 106 bool foundInvalidValue = false;
107 Storage store(testDataPath, dbName); 107 Akonadi2::Storage store(testDataPath, dbName);
108 store.scan("key50", [&](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool { 108 store.scan("key50", [&](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool {
109 if (std::string(static_cast<char*>(keyValue), keySize) != "key50") { 109 if (std::string(static_cast<char*>(keyValue), keySize) != "key50") {
110 foundInvalidValue = true; 110 foundInvalidValue = true;
@@ -116,7 +116,7 @@ private Q_SLOTS:
116 QCOMPARE(hit, 1); 116 QCOMPARE(hit, 1);
117 } 117 }
118 118
119 Storage storage(testDataPath, dbName); 119 Akonadi2::Storage storage(testDataPath, dbName);
120 storage.removeFromDisk(); 120 storage.removeFromDisk();
121 } 121 }
122 122
@@ -132,7 +132,7 @@ private Q_SLOTS:
132 const int concurrencyLevel = 10; 132 const int concurrencyLevel = 10;
133 for (int num = 0; num < concurrencyLevel; num++) { 133 for (int num = 0; num < concurrencyLevel; num++) {
134 futures << QtConcurrent::run([this, count, &error](){ 134 futures << QtConcurrent::run([this, count, &error](){
135 Storage storage(testDataPath, dbName); 135 Akonadi2::Storage storage(testDataPath, dbName);
136 for (int i = 0; i < count; i++) { 136 for (int i = 0; i < count; i++) {
137 if (!verify(storage, i)) { 137 if (!verify(storage, i)) {
138 error = true; 138 error = true;
@@ -146,7 +146,7 @@ private Q_SLOTS:
146 } 146 }
147 QVERIFY(!error); 147 QVERIFY(!error);
148 148
149 Storage storage(testDataPath, dbName); 149 Akonadi2::Storage storage(testDataPath, dbName);
150 storage.removeFromDisk(); 150 storage.removeFromDisk();
151 } 151 }
152}; 152};