diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-15 12:46:26 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-11-15 12:46:26 +0100 |
commit | 972f3a4e96876e4c36162a11062e40863d88a2a1 (patch) | |
tree | e5173c26f35895e8f3386822d47b7b0d93374db5 /tests/genericfacadetest.cpp | |
parent | d4b10a3de396eebc6c815093e9e1725ece270e9e (diff) | |
download | sink-972f3a4e96876e4c36162a11062e40863d88a2a1.tar.gz sink-972f3a4e96876e4c36162a11062e40863d88a2a1.zip |
Cleanup
Diffstat (limited to 'tests/genericfacadetest.cpp')
-rw-r--r-- | tests/genericfacadetest.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/tests/genericfacadetest.cpp b/tests/genericfacadetest.cpp index 67320c3..9e7500f 100644 --- a/tests/genericfacadetest.cpp +++ b/tests/genericfacadetest.cpp | |||
@@ -17,6 +17,7 @@ | |||
17 | * Test for the generic facade implementation. | 17 | * Test for the generic facade implementation. |
18 | * | 18 | * |
19 | * This test doesn't use the actual storage and thus only tests the update logic of the facade. | 19 | * This test doesn't use the actual storage and thus only tests the update logic of the facade. |
20 | * //FIXME this now uses the actual storage | ||
20 | */ | 21 | */ |
21 | class GenericFacadeTest : public QObject | 22 | class GenericFacadeTest : public QObject |
22 | { | 23 | { |
@@ -34,10 +35,9 @@ private Q_SLOTS: | |||
34 | query.liveQuery = false; | 35 | query.liveQuery = false; |
35 | 36 | ||
36 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 37 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
37 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
38 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 38 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
39 | storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); | 39 | // storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); |
40 | TestResourceFacade facade("identifier", storage, resourceAccess); | 40 | TestResourceFacade facade("identifier", resourceAccess); |
41 | 41 | ||
42 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 42 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
43 | 43 | ||
@@ -56,10 +56,9 @@ private Q_SLOTS: | |||
56 | query.liveQuery = true; | 56 | query.liveQuery = true; |
57 | 57 | ||
58 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 58 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
59 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
60 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 59 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
61 | storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); | 60 | // storage->mResults << Akonadi2::ApplicationDomain::Event::Ptr::create(); |
62 | TestResourceFacade facade("identifier", storage, resourceAccess); | 61 | TestResourceFacade facade("identifier", resourceAccess); |
63 | 62 | ||
64 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 63 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
65 | 64 | ||
@@ -70,9 +69,9 @@ private Q_SLOTS: | |||
70 | QCOMPARE(result.size(), 1); | 69 | QCOMPARE(result.size(), 1); |
71 | 70 | ||
72 | //Enter a second result | 71 | //Enter a second result |
73 | storage->mResults.clear(); | 72 | // storage->mResults.clear(); |
74 | storage->mResults << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 73 | // storage->mResults << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
75 | storage->mLatestRevision = 2; | 74 | // storage->mLatestRevision = 2; |
76 | resourceAccess->emit revisionChanged(2); | 75 | resourceAccess->emit revisionChanged(2); |
77 | 76 | ||
78 | //Hack to get event loop in synclistresult to abort again | 77 | //Hack to get event loop in synclistresult to abort again |
@@ -88,12 +87,11 @@ private Q_SLOTS: | |||
88 | query.liveQuery = true; | 87 | query.liveQuery = true; |
89 | 88 | ||
90 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 89 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
91 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
92 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 90 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
93 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 91 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); |
94 | entity->setProperty("test", "test1"); | 92 | entity->setProperty("test", "test1"); |
95 | storage->mResults << entity; | 93 | // storage->mResults << entity; |
96 | TestResourceFacade facade("identifier", storage, resourceAccess); | 94 | TestResourceFacade facade("identifier", resourceAccess); |
97 | 95 | ||
98 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 96 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
99 | 97 | ||
@@ -104,11 +102,11 @@ private Q_SLOTS: | |||
104 | QCOMPARE(result.size(), 1); | 102 | QCOMPARE(result.size(), 1); |
105 | 103 | ||
106 | //Modify the entity again | 104 | //Modify the entity again |
107 | storage->mResults.clear(); | 105 | // storage->mResults.clear(); |
108 | entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); | 106 | entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create()); |
109 | entity->setProperty("test", "test2"); | 107 | entity->setProperty("test", "test2"); |
110 | storage->mModifications << entity; | 108 | // storage->mModifications << entity; |
111 | storage->mLatestRevision = 2; | 109 | // storage->mLatestRevision = 2; |
112 | resourceAccess->emit revisionChanged(2); | 110 | resourceAccess->emit revisionChanged(2); |
113 | 111 | ||
114 | //Hack to get event loop in synclistresult to abort again | 112 | //Hack to get event loop in synclistresult to abort again |
@@ -125,11 +123,10 @@ private Q_SLOTS: | |||
125 | query.liveQuery = true; | 123 | query.liveQuery = true; |
126 | 124 | ||
127 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 125 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); |
128 | auto storage = QSharedPointer<TestEntityStorage>::create("identifier"); | ||
129 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 126 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
130 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 127 | auto entity = QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
131 | storage->mResults << entity; | 128 | // storage->mResults << entity; |
132 | TestResourceFacade facade("identifier", storage, resourceAccess); | 129 | TestResourceFacade facade("identifier", resourceAccess); |
133 | 130 | ||
134 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); | 131 | async::SyncListResult<Akonadi2::ApplicationDomain::Event::Ptr> result(resultSet->emitter()); |
135 | 132 | ||
@@ -140,9 +137,9 @@ private Q_SLOTS: | |||
140 | QCOMPARE(result.size(), 1); | 137 | QCOMPARE(result.size(), 1); |
141 | 138 | ||
142 | //Remove the entity again | 139 | //Remove the entity again |
143 | storage->mResults.clear(); | 140 | // storage->mResults.clear(); |
144 | storage->mRemovals << entity; | 141 | // storage->mRemovals << entity; |
145 | storage->mLatestRevision = 2; | 142 | // storage->mLatestRevision = 2; |
146 | resourceAccess->emit revisionChanged(2); | 143 | resourceAccess->emit revisionChanged(2); |
147 | 144 | ||
148 | //Hack to get event loop in synclistresult to abort again | 145 | //Hack to get event loop in synclistresult to abort again |