Merge lp:~michihenning/storage-framework/more-tests into lp:storage-framework/devel
- more-tests
- Merge into devel
Status: | Merged |
---|---|
Approved by: | James Henstridge |
Approved revision: | 89 |
Merged at revision: | 73 |
Proposed branch: | lp:~michihenning/storage-framework/more-tests |
Merge into: | lp:storage-framework/devel |
Prerequisite: | lp:~michihenning/storage-framework/api2 |
Diff against target: |
1420 lines (+796/-151) 18 files modified
include/unity/storage/qt/Account.h (+1/-1) include/unity/storage/qt/Item.h (+1/-1) include/unity/storage/qt/VoidJob.h (+20/-4) include/unity/storage/qt/internal/AccountImpl.h (+1/-1) include/unity/storage/qt/internal/ItemImpl.h (+2/-1) include/unity/storage/qt/internal/ItemJobImpl.h (+4/-4) include/unity/storage/qt/internal/ItemListJobImpl.h (+3/-3) include/unity/storage/qt/internal/VoidJobImpl.h (+69/-0) src/qt/CMakeLists.txt (+4/-0) src/qt/VoidJob.cpp (+57/-0) src/qt/internal/AccountImpl.cpp (+16/-7) src/qt/internal/ItemImpl.cpp (+23/-19) src/qt/internal/ItemJobImpl.cpp (+12/-1) src/qt/internal/ItemListJobImpl.cpp (+11/-0) src/qt/internal/RuntimeImpl.cpp (+2/-0) src/qt/internal/VoidJobImpl.cpp (+117/-0) tests/remote-client/MockProvider.cpp (+32/-2) tests/remote-client/remote-client_test.cpp (+421/-107) |
To merge this branch: | bzr merge lp:~michihenning/storage-framework/more-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Henstridge | Approve | ||
unity-api-1-bot | continuous-integration | Approve | |
Review via email:
|
Commit message
Added VoidJob.
Implemeted get().
Implemeted deleteItem().
Some minor refactoring and tidy-up.
Lots more tests.
Description of the change
Added VoidJob.
Implemeted get().
Implemeted deleteItem().
Some minor refactoring and tidy-up.
Lots more tests.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
- 88. By Michi Henning
-
Fixed whitespace.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:88
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
James Henstridge (jamesh) wrote : | # |
Just a few minor issues that I've included as inline comments.
- 89. By Michi Henning
-
Review comments from James.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michi Henning (michihenning) wrote : | # |
Thanks for the review!
I'll go and make the corresponding changes in the follow-up branches.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:89
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'include/unity/storage/qt/Account.h' | |||
2 | --- include/unity/storage/qt/Account.h 2016-09-26 02:12:30 +0000 | |||
3 | +++ include/unity/storage/qt/Account.h 2016-09-29 13:09:41 +0000 | |||
4 | @@ -94,7 +94,7 @@ | |||
5 | 94 | 94 | ||
6 | 95 | template<> struct Q_DECL_EXPORT hash<unity::storage::qt::Account> | 95 | template<> struct Q_DECL_EXPORT hash<unity::storage::qt::Account> |
7 | 96 | { | 96 | { |
9 | 97 | std::size_t operator()(unity::storage::qt::Account const& a) | 97 | std::size_t operator()(unity::storage::qt::Account const& a) const |
10 | 98 | { | 98 | { |
11 | 99 | return a.hash(); | 99 | return a.hash(); |
12 | 100 | } | 100 | } |
13 | 101 | 101 | ||
14 | === modified file 'include/unity/storage/qt/Item.h' | |||
15 | --- include/unity/storage/qt/Item.h 2016-09-26 02:12:30 +0000 | |||
16 | +++ include/unity/storage/qt/Item.h 2016-09-29 13:09:41 +0000 | |||
17 | @@ -146,7 +146,7 @@ | |||
18 | 146 | 146 | ||
19 | 147 | template<> struct Q_DECL_EXPORT hash<unity::storage::qt::Item> | 147 | template<> struct Q_DECL_EXPORT hash<unity::storage::qt::Item> |
20 | 148 | { | 148 | { |
22 | 149 | std::size_t operator()(unity::storage::qt::Item const& i) | 149 | std::size_t operator()(unity::storage::qt::Item const& i) const |
23 | 150 | { | 150 | { |
24 | 151 | return i.hash(); | 151 | return i.hash(); |
25 | 152 | } | 152 | } |
26 | 153 | 153 | ||
27 | === modified file 'include/unity/storage/qt/VoidJob.h' | |||
28 | --- include/unity/storage/qt/VoidJob.h 2016-09-20 23:52:45 +0000 | |||
29 | +++ include/unity/storage/qt/VoidJob.h 2016-09-29 13:09:41 +0000 | |||
30 | @@ -20,22 +20,29 @@ | |||
31 | 20 | 20 | ||
32 | 21 | #include <QObject> | 21 | #include <QObject> |
33 | 22 | 22 | ||
34 | 23 | #include <memory> | ||
35 | 24 | |||
36 | 23 | namespace unity | 25 | namespace unity |
37 | 24 | { | 26 | { |
38 | 25 | namespace storage | 27 | namespace storage |
39 | 26 | { | 28 | { |
40 | 27 | namespace qt | 29 | namespace qt |
41 | 28 | { | 30 | { |
42 | 31 | namespace internal | ||
43 | 32 | { | ||
44 | 33 | |||
45 | 34 | class VoidJobImpl; | ||
46 | 35 | |||
47 | 36 | } // namespace internal | ||
48 | 29 | 37 | ||
49 | 30 | class StorageError; | 38 | class StorageError; |
50 | 31 | 39 | ||
51 | 32 | class Q_DECL_EXPORT VoidJob final : public QObject | 40 | class Q_DECL_EXPORT VoidJob final : public QObject |
52 | 33 | { | 41 | { |
53 | 34 | // TODO: notify, CONSTANT where needed | ||
54 | 35 | Q_OBJECT | 42 | Q_OBJECT |
58 | 36 | Q_PROPERTY(bool READ isValid FINAL) | 43 | Q_PROPERTY(bool isValid READ isValid NOTIFY statusChanged FINAL) |
59 | 37 | Q_PROPERTY(unity::storage::qt::VoidJob::Status READ status NOTIFY statusChanged FINAL) | 44 | Q_PROPERTY(unity::storage::qt::VoidJob::Status status READ status NOTIFY statusChanged FINAL) |
60 | 38 | Q_PROPERTY(unity::storage::qt::StorageError READ error FINAL) | 45 | Q_PROPERTY(unity::storage::qt::StorageError error READ error NOTIFY statusChanged FINAL) |
61 | 39 | 46 | ||
62 | 40 | public: | 47 | public: |
63 | 41 | virtual ~VoidJob(); | 48 | virtual ~VoidJob(); |
64 | @@ -49,8 +56,17 @@ | |||
65 | 49 | 56 | ||
66 | 50 | Q_SIGNALS: | 57 | Q_SIGNALS: |
67 | 51 | void statusChanged(unity::storage::qt::VoidJob::Status status) const; | 58 | void statusChanged(unity::storage::qt::VoidJob::Status status) const; |
68 | 59 | |||
69 | 60 | private: | ||
70 | 61 | VoidJob(std::unique_ptr<internal::VoidJobImpl> p); | ||
71 | 62 | |||
72 | 63 | std::unique_ptr<internal::VoidJobImpl> const p_; | ||
73 | 64 | |||
74 | 65 | friend class internal::VoidJobImpl; | ||
75 | 52 | }; | 66 | }; |
76 | 53 | 67 | ||
77 | 54 | } // namespace qt | 68 | } // namespace qt |
78 | 55 | } // namespace storage | 69 | } // namespace storage |
79 | 56 | } // namespace unity | 70 | } // namespace unity |
80 | 71 | |||
81 | 72 | Q_DECLARE_METATYPE(unity::storage::qt::VoidJob::Status) | ||
82 | 57 | 73 | ||
83 | === modified file 'include/unity/storage/qt/internal/AccountImpl.h' | |||
84 | --- include/unity/storage/qt/internal/AccountImpl.h 2016-09-20 02:24:36 +0000 | |||
85 | +++ include/unity/storage/qt/internal/AccountImpl.h 2016-09-29 13:09:41 +0000 | |||
86 | @@ -63,7 +63,7 @@ | |||
87 | 63 | 63 | ||
88 | 64 | size_t hash() const; | 64 | size_t hash() const; |
89 | 65 | 65 | ||
91 | 66 | //std::shared_ptr<RuntimeImpl> runtime() const; | 66 | std::shared_ptr<RuntimeImpl> runtime() const; |
92 | 67 | std::shared_ptr<ProviderInterface> provider() const; | 67 | std::shared_ptr<ProviderInterface> provider() const; |
93 | 68 | 68 | ||
94 | 69 | static Account make_account(std::shared_ptr<RuntimeImpl> const& runtime, | 69 | static Account make_account(std::shared_ptr<RuntimeImpl> const& runtime, |
95 | 70 | 70 | ||
96 | === modified file 'include/unity/storage/qt/internal/ItemImpl.h' | |||
97 | --- include/unity/storage/qt/internal/ItemImpl.h 2016-09-26 02:12:30 +0000 | |||
98 | +++ include/unity/storage/qt/internal/ItemImpl.h 2016-09-29 13:09:41 +0000 | |||
99 | @@ -49,7 +49,6 @@ | |||
100 | 49 | QString itemId() const; | 49 | QString itemId() const; |
101 | 50 | QString name() const; | 50 | QString name() const; |
102 | 51 | Account account() const; | 51 | Account account() const; |
103 | 52 | //Item root() const; | ||
104 | 53 | QString etag() const; | 52 | QString etag() const; |
105 | 54 | Item::Type type() const; | 53 | Item::Type type() const; |
106 | 55 | QVariantMap metadata() const; | 54 | QVariantMap metadata() const; |
107 | @@ -82,6 +81,8 @@ | |||
108 | 82 | storage::internal::ItemMetadata const& md, | 81 | storage::internal::ItemMetadata const& md, |
109 | 83 | std::shared_ptr<AccountImpl> const& account); | 82 | std::shared_ptr<AccountImpl> const& account); |
110 | 84 | 83 | ||
111 | 84 | std::shared_ptr<RuntimeImpl> runtime() const; | ||
112 | 85 | |||
113 | 85 | private: | 86 | private: |
114 | 86 | //std::shared_ptr<RuntimeImpl> get_runtime(QString const& method) const; | 87 | //std::shared_ptr<RuntimeImpl> get_runtime(QString const& method) const; |
115 | 87 | 88 | ||
116 | 88 | 89 | ||
117 | === modified file 'include/unity/storage/qt/internal/ItemJobImpl.h' | |||
118 | --- include/unity/storage/qt/internal/ItemJobImpl.h 2016-09-26 02:12:30 +0000 | |||
119 | +++ include/unity/storage/qt/internal/ItemJobImpl.h 2016-09-29 13:09:41 +0000 | |||
120 | @@ -20,10 +20,10 @@ | |||
121 | 20 | 20 | ||
122 | 21 | #include <unity/storage/qt/ItemJob.h> | 21 | #include <unity/storage/qt/ItemJob.h> |
123 | 22 | 22 | ||
124 | 23 | #include <unity/storage/qt/Account.h> | ||
125 | 24 | #include <unity/storage/qt/internal/Handler.h> | ||
126 | 25 | #include <unity/storage/qt/StorageError.h> | 23 | #include <unity/storage/qt/StorageError.h> |
127 | 26 | 24 | ||
128 | 25 | #include <QDBusPendingReply> | ||
129 | 26 | |||
130 | 27 | namespace unity | 27 | namespace unity |
131 | 28 | { | 28 | { |
132 | 29 | namespace storage | 29 | namespace storage |
133 | @@ -33,14 +33,14 @@ | |||
134 | 33 | 33 | ||
135 | 34 | class ItemMetadata; | 34 | class ItemMetadata; |
136 | 35 | 35 | ||
138 | 36 | } | 36 | } // namespace internal |
139 | 37 | 37 | ||
140 | 38 | namespace qt | 38 | namespace qt |
141 | 39 | { | 39 | { |
142 | 40 | namespace internal | 40 | namespace internal |
143 | 41 | { | 41 | { |
144 | 42 | 42 | ||
146 | 43 | class RuntimeImpl; | 43 | class AccountImpl; |
147 | 44 | 44 | ||
148 | 45 | class ItemJobImpl : public QObject | 45 | class ItemJobImpl : public QObject |
149 | 46 | { | 46 | { |
150 | 47 | 47 | ||
151 | === modified file 'include/unity/storage/qt/internal/ItemListJobImpl.h' | |||
152 | --- include/unity/storage/qt/internal/ItemListJobImpl.h 2016-09-26 02:12:30 +0000 | |||
153 | +++ include/unity/storage/qt/internal/ItemListJobImpl.h 2016-09-29 13:09:41 +0000 | |||
154 | @@ -20,10 +20,10 @@ | |||
155 | 20 | 20 | ||
156 | 21 | #include <unity/storage/qt/ItemListJob.h> | 21 | #include <unity/storage/qt/ItemListJob.h> |
157 | 22 | 22 | ||
158 | 23 | #include <unity/storage/qt/Account.h> | ||
159 | 24 | #include <unity/storage/qt/internal/Handler.h> | ||
160 | 25 | #include <unity/storage/qt/StorageError.h> | 23 | #include <unity/storage/qt/StorageError.h> |
161 | 26 | 24 | ||
162 | 25 | #include <QDBusPendingReply> | ||
163 | 26 | |||
164 | 27 | namespace unity | 27 | namespace unity |
165 | 28 | { | 28 | { |
166 | 29 | namespace storage | 29 | namespace storage |
167 | @@ -40,7 +40,7 @@ | |||
168 | 40 | namespace internal | 40 | namespace internal |
169 | 41 | { | 41 | { |
170 | 42 | 42 | ||
172 | 43 | class RuntimeImpl; | 43 | class AccountImpl; |
173 | 44 | 44 | ||
174 | 45 | class ItemListJobImpl : public QObject | 45 | class ItemListJobImpl : public QObject |
175 | 46 | { | 46 | { |
176 | 47 | 47 | ||
177 | === added file 'include/unity/storage/qt/internal/VoidJobImpl.h' | |||
178 | --- include/unity/storage/qt/internal/VoidJobImpl.h 1970-01-01 00:00:00 +0000 | |||
179 | +++ include/unity/storage/qt/internal/VoidJobImpl.h 2016-09-29 13:09:41 +0000 | |||
180 | @@ -0,0 +1,69 @@ | |||
181 | 1 | /* | ||
182 | 2 | * Copyright (C) 2016 Canonical Ltd | ||
183 | 3 | * | ||
184 | 4 | * This program is free software: you can redistribute it and/or modify | ||
185 | 5 | * it under the terms of the GNU Lesser General Public License version 3 as | ||
186 | 6 | * published by the Free Software Foundation. | ||
187 | 7 | * | ||
188 | 8 | * This program is distributed in the hope that it will be useful, | ||
189 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
190 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
191 | 11 | * GNU Lesser General Public License for more details. | ||
192 | 12 | * | ||
193 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
194 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
195 | 15 | * | ||
196 | 16 | * Authors: Michi Henning <michi.henning@canonical.com> | ||
197 | 17 | */ | ||
198 | 18 | |||
199 | 19 | #pragma once | ||
200 | 20 | |||
201 | 21 | #include <unity/storage/qt/VoidJob.h> | ||
202 | 22 | |||
203 | 23 | #include <unity/storage/qt/StorageError.h> | ||
204 | 24 | |||
205 | 25 | #include <QDBusPendingReply> | ||
206 | 26 | |||
207 | 27 | namespace unity | ||
208 | 28 | { | ||
209 | 29 | namespace storage | ||
210 | 30 | { | ||
211 | 31 | namespace qt | ||
212 | 32 | { | ||
213 | 33 | namespace internal | ||
214 | 34 | { | ||
215 | 35 | |||
216 | 36 | class ItemImpl; | ||
217 | 37 | |||
218 | 38 | class VoidJobImpl : public QObject | ||
219 | 39 | { | ||
220 | 40 | Q_OBJECT | ||
221 | 41 | public: | ||
222 | 42 | virtual ~VoidJobImpl() = default; | ||
223 | 43 | |||
224 | 44 | bool isValid() const; | ||
225 | 45 | VoidJob::Status status() const; | ||
226 | 46 | StorageError error() const; | ||
227 | 47 | |||
228 | 48 | static VoidJob* make_void_job(std::shared_ptr<ItemImpl> const& item, | ||
229 | 49 | QString const& method, | ||
230 | 50 | QDBusPendingReply<void> const& reply); | ||
231 | 51 | static VoidJob* make_void_job(StorageError const& e); | ||
232 | 52 | |||
233 | 53 | private: | ||
234 | 54 | VoidJobImpl(std::shared_ptr<ItemImpl> const& item, | ||
235 | 55 | QString const& method, | ||
236 | 56 | QDBusPendingReply<void> const& reply); | ||
237 | 57 | VoidJobImpl(StorageError const& e); | ||
238 | 58 | |||
239 | 59 | VoidJob* public_instance_; | ||
240 | 60 | VoidJob::Status status_; | ||
241 | 61 | StorageError error_; | ||
242 | 62 | QString method_; | ||
243 | 63 | std::shared_ptr<ItemImpl> item_; | ||
244 | 64 | }; | ||
245 | 65 | |||
246 | 66 | } // namespace internal | ||
247 | 67 | } // namespace qt | ||
248 | 68 | } // namespace storage | ||
249 | 69 | } // namespace unity | ||
250 | 0 | 70 | ||
251 | === modified file 'src/qt/CMakeLists.txt' | |||
252 | --- src/qt/CMakeLists.txt 2016-09-16 06:25:08 +0000 | |||
253 | +++ src/qt/CMakeLists.txt 2016-09-29 13:09:41 +0000 | |||
254 | @@ -23,6 +23,7 @@ | |||
255 | 23 | ItemListJob.cpp | 23 | ItemListJob.cpp |
256 | 24 | Runtime.cpp | 24 | Runtime.cpp |
257 | 25 | StorageError.cpp | 25 | StorageError.cpp |
258 | 26 | VoidJob.cpp | ||
259 | 26 | internal/AccountImpl.cpp | 27 | internal/AccountImpl.cpp |
260 | 27 | internal/AccountsJobImpl.cpp | 28 | internal/AccountsJobImpl.cpp |
261 | 28 | internal/HandlerBase.cpp | 29 | internal/HandlerBase.cpp |
262 | @@ -33,16 +34,19 @@ | |||
263 | 33 | internal/StorageErrorImpl.cpp | 34 | internal/StorageErrorImpl.cpp |
264 | 34 | internal/unmarshal_error.cpp | 35 | internal/unmarshal_error.cpp |
265 | 35 | internal/validate.cpp | 36 | internal/validate.cpp |
266 | 37 | internal/VoidJobImpl.cpp | ||
267 | 36 | ${generated_files} | 38 | ${generated_files} |
268 | 37 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/AccountsJob.h | 39 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/AccountsJob.h |
269 | 38 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/Item.h | 40 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/Item.h |
270 | 39 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/ItemJob.h | 41 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/ItemJob.h |
271 | 40 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/ItemListJob.h | 42 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/ItemListJob.h |
272 | 41 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/Runtime.h | 43 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/Runtime.h |
273 | 44 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/VoidJob.h | ||
274 | 42 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/AccountsJobImpl.h | 45 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/AccountsJobImpl.h |
275 | 43 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/HandlerBase.h | 46 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/HandlerBase.h |
276 | 44 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/ItemJobImpl.h | 47 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/ItemJobImpl.h |
277 | 45 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/ItemListJobImpl.h | 48 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/ItemListJobImpl.h |
278 | 49 | ${CMAKE_SOURCE_DIR}/include/unity/storage/qt/internal/VoidJobImpl.h | ||
279 | 46 | ) | 50 | ) |
280 | 47 | 51 | ||
281 | 48 | add_library(storage-framework-qt-client-v2 SHARED | 52 | add_library(storage-framework-qt-client-v2 SHARED |
282 | 49 | 53 | ||
283 | === added file 'src/qt/VoidJob.cpp' | |||
284 | --- src/qt/VoidJob.cpp 1970-01-01 00:00:00 +0000 | |||
285 | +++ src/qt/VoidJob.cpp 2016-09-29 13:09:41 +0000 | |||
286 | @@ -0,0 +1,57 @@ | |||
287 | 1 | /* | ||
288 | 2 | * Copyright (C) 2016 Canonical Ltd | ||
289 | 3 | * | ||
290 | 4 | * This program is free software: you can redistribute it and/or modify | ||
291 | 5 | * it under the terms of the GNU Lesser General Public License version 3 as | ||
292 | 6 | * published by the Free Software Foundation. | ||
293 | 7 | * | ||
294 | 8 | * This program is distributed in the hope that it will be useful, | ||
295 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
296 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
297 | 11 | * GNU Lesser General Public License for more details. | ||
298 | 12 | * | ||
299 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
300 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
301 | 15 | * | ||
302 | 16 | * Authors: Michi Henning <michi.henning@canonical.com> | ||
303 | 17 | */ | ||
304 | 18 | |||
305 | 19 | #include <unity/storage/qt/VoidJob.h> | ||
306 | 20 | |||
307 | 21 | #include <unity/storage/qt/internal/VoidJobImpl.h> | ||
308 | 22 | |||
309 | 23 | using namespace unity::storage::qt; | ||
310 | 24 | using namespace std; | ||
311 | 25 | |||
312 | 26 | namespace unity | ||
313 | 27 | { | ||
314 | 28 | namespace storage | ||
315 | 29 | { | ||
316 | 30 | namespace qt | ||
317 | 31 | { | ||
318 | 32 | |||
319 | 33 | VoidJob::VoidJob(unique_ptr<internal::VoidJobImpl> p) | ||
320 | 34 | : p_(move(p)) | ||
321 | 35 | { | ||
322 | 36 | } | ||
323 | 37 | |||
324 | 38 | VoidJob::~VoidJob() = default; | ||
325 | 39 | |||
326 | 40 | bool VoidJob::isValid() const | ||
327 | 41 | { | ||
328 | 42 | return p_->isValid(); | ||
329 | 43 | } | ||
330 | 44 | |||
331 | 45 | VoidJob::Status VoidJob::status() const | ||
332 | 46 | { | ||
333 | 47 | return p_->status(); | ||
334 | 48 | } | ||
335 | 49 | |||
336 | 50 | StorageError VoidJob::error() const | ||
337 | 51 | { | ||
338 | 52 | return p_->error(); | ||
339 | 53 | } | ||
340 | 54 | |||
341 | 55 | } // namespace qt | ||
342 | 56 | } // namespace storage | ||
343 | 57 | } // namespace unity | ||
344 | 0 | 58 | ||
345 | === modified file 'src/qt/internal/AccountImpl.cpp' | |||
346 | --- src/qt/internal/AccountImpl.cpp 2016-09-22 01:52:20 +0000 | |||
347 | +++ src/qt/internal/AccountImpl.cpp 2016-09-29 13:09:41 +0000 | |||
348 | @@ -24,6 +24,7 @@ | |||
349 | 24 | #include <unity/storage/qt/internal/ItemJobImpl.h> | 24 | #include <unity/storage/qt/internal/ItemJobImpl.h> |
350 | 25 | #include <unity/storage/qt/internal/ItemListJobImpl.h> | 25 | #include <unity/storage/qt/internal/ItemListJobImpl.h> |
351 | 26 | #include <unity/storage/qt/internal/RuntimeImpl.h> | 26 | #include <unity/storage/qt/internal/RuntimeImpl.h> |
352 | 27 | #include <unity/storage/qt/internal/StorageErrorImpl.h> | ||
353 | 27 | #include <unity/storage/qt/Runtime.h> | 28 | #include <unity/storage/qt/Runtime.h> |
354 | 28 | 29 | ||
355 | 29 | #include <boost/functional/hash.hpp> | 30 | #include <boost/functional/hash.hpp> |
356 | @@ -82,24 +83,25 @@ | |||
357 | 82 | 83 | ||
358 | 83 | ItemListJob* AccountImpl::roots() const | 84 | ItemListJob* AccountImpl::roots() const |
359 | 84 | { | 85 | { |
360 | 86 | QString const method = "Account::roots()"; | ||
361 | 87 | |||
362 | 85 | auto runtime = runtime_.lock(); | 88 | auto runtime = runtime_.lock(); |
363 | 86 | if (!runtime || !runtime->isValid()) | 89 | if (!runtime || !runtime->isValid()) |
364 | 87 | { | 90 | { |
366 | 88 | auto e = StorageErrorImpl::runtime_destroyed_error("Account::roots(): Runtime was destroyed previously"); | 91 | auto e = StorageErrorImpl::runtime_destroyed_error(method + ": Runtime was destroyed previously"); |
367 | 89 | return ItemListJobImpl::make_item_list_job(e); | 92 | return ItemListJobImpl::make_item_list_job(e); |
368 | 90 | } | 93 | } |
369 | 91 | 94 | ||
371 | 92 | auto validate = [](storage::internal::ItemMetadata const& md) | 95 | auto validate = [method](storage::internal::ItemMetadata const& md) |
372 | 93 | { | 96 | { |
373 | 94 | if (md.type != ItemType::root) | 97 | if (md.type != ItemType::root) |
374 | 95 | { | 98 | { |
376 | 96 | QString msg = "provider returned non-root item type: " + QString::number(int(md.type)); | 99 | QString msg = method + ": provider returned non-root item type: " + QString::number(int(md.type)); |
377 | 97 | qCritical() << msg; | 100 | qCritical() << msg; |
378 | 98 | throw StorageErrorImpl::local_comms_error(msg); | 101 | throw StorageErrorImpl::local_comms_error(msg); |
379 | 99 | } | 102 | } |
380 | 100 | }; | 103 | }; |
381 | 101 | 104 | ||
382 | 102 | QString method = "Account::roots()"; | ||
383 | 103 | auto reply = provider_->Roots(); | 105 | auto reply = provider_->Roots(); |
384 | 104 | auto This = const_pointer_cast<AccountImpl>(shared_from_this()); | 106 | auto This = const_pointer_cast<AccountImpl>(shared_from_this()); |
385 | 105 | return ItemListJobImpl::make_item_list_job(This, method, reply, validate); | 107 | return ItemListJobImpl::make_item_list_job(This, method, reply, validate); |
386 | @@ -107,19 +109,21 @@ | |||
387 | 107 | 109 | ||
388 | 108 | ItemJob* AccountImpl::get(QString const& itemId) const | 110 | ItemJob* AccountImpl::get(QString const& itemId) const |
389 | 109 | { | 111 | { |
390 | 112 | QString const method = "Account::get()"; | ||
391 | 113 | |||
392 | 110 | auto runtime = runtime_.lock(); | 114 | auto runtime = runtime_.lock(); |
393 | 111 | if (!runtime || !runtime->isValid()) | 115 | if (!runtime || !runtime->isValid()) |
394 | 112 | { | 116 | { |
396 | 113 | auto e = StorageErrorImpl::runtime_destroyed_error("Account::get(): Runtime was destroyed previously"); | 117 | auto e = StorageErrorImpl::runtime_destroyed_error(method + ": Runtime was destroyed previously"); |
397 | 114 | return ItemJobImpl::make_item_job(e); | 118 | return ItemJobImpl::make_item_job(e); |
398 | 115 | } | 119 | } |
399 | 116 | 120 | ||
401 | 117 | // TODO: use defaulted param? | 121 | // LCOV_EXCL_START |
402 | 118 | auto validate = [](storage::internal::ItemMetadata const&) | 122 | auto validate = [](storage::internal::ItemMetadata const&) |
403 | 119 | { | 123 | { |
404 | 120 | }; | 124 | }; |
405 | 125 | // LCOV_EXCL_STOP | ||
406 | 121 | 126 | ||
407 | 122 | QString method = "Item::get()"; | ||
408 | 123 | auto reply = provider_->Metadata(itemId); | 127 | auto reply = provider_->Metadata(itemId); |
409 | 124 | auto This = const_pointer_cast<AccountImpl>(shared_from_this()); | 128 | auto This = const_pointer_cast<AccountImpl>(shared_from_this()); |
410 | 125 | return ItemJobImpl::make_item_job(This, method, reply, validate); | 129 | return ItemJobImpl::make_item_job(This, method, reply, validate); |
411 | @@ -187,6 +191,11 @@ | |||
412 | 187 | return !operator<(other); | 191 | return !operator<(other); |
413 | 188 | } | 192 | } |
414 | 189 | 193 | ||
415 | 194 | shared_ptr<RuntimeImpl> AccountImpl::runtime() const | ||
416 | 195 | { | ||
417 | 196 | return runtime_.lock(); | ||
418 | 197 | } | ||
419 | 198 | |||
420 | 190 | shared_ptr<ProviderInterface> AccountImpl::provider() const | 199 | shared_ptr<ProviderInterface> AccountImpl::provider() const |
421 | 191 | { | 200 | { |
422 | 192 | return provider_; | 201 | return provider_; |
423 | 193 | 202 | ||
424 | === modified file 'src/qt/internal/ItemImpl.cpp' | |||
425 | --- src/qt/internal/ItemImpl.cpp 2016-09-26 02:12:30 +0000 | |||
426 | +++ src/qt/internal/ItemImpl.cpp 2016-09-29 13:09:41 +0000 | |||
427 | @@ -23,6 +23,8 @@ | |||
428 | 23 | #include <unity/storage/qt/internal/AccountImpl.h> | 23 | #include <unity/storage/qt/internal/AccountImpl.h> |
429 | 24 | #include <unity/storage/qt/internal/ItemJobImpl.h> | 24 | #include <unity/storage/qt/internal/ItemJobImpl.h> |
430 | 25 | #include <unity/storage/qt/internal/RuntimeImpl.h> | 25 | #include <unity/storage/qt/internal/RuntimeImpl.h> |
431 | 26 | #include <unity/storage/qt/internal/StorageErrorImpl.h> | ||
432 | 27 | #include <unity/storage/qt/internal/VoidJobImpl.h> | ||
433 | 26 | #include <unity/storage/qt/internal/validate.h> | 28 | #include <unity/storage/qt/internal/validate.h> |
434 | 27 | 29 | ||
435 | 28 | #include <boost/functional/hash.hpp> | 30 | #include <boost/functional/hash.hpp> |
436 | @@ -70,13 +72,6 @@ | |||
437 | 70 | return is_valid_ ? account_ : Account(); | 72 | return is_valid_ ? account_ : Account(); |
438 | 71 | } | 73 | } |
439 | 72 | 74 | ||
440 | 73 | #if 0 | ||
441 | 74 | Item ItemImpl::root() const | ||
442 | 75 | { | ||
443 | 76 | return is_valid_ ? root_ : Item(); | ||
444 | 77 | } | ||
445 | 78 | #endif | ||
446 | 79 | |||
447 | 80 | QString ItemImpl::etag() const | 75 | QString ItemImpl::etag() const |
448 | 81 | { | 76 | { |
449 | 82 | return is_valid_ ? md_.etag : ""; | 77 | return is_valid_ ? md_.etag : ""; |
450 | @@ -131,7 +126,25 @@ | |||
451 | 131 | 126 | ||
452 | 132 | VoidJob* ItemImpl::deleteItem() const | 127 | VoidJob* ItemImpl::deleteItem() const |
453 | 133 | { | 128 | { |
455 | 134 | return nullptr; // TODO | 129 | QString const method = "Item::deleteItem()"; |
456 | 130 | |||
457 | 131 | assert(account_); | ||
458 | 132 | auto runtime = account_->runtime(); | ||
459 | 133 | if (!runtime || !runtime->isValid()) | ||
460 | 134 | { | ||
461 | 135 | auto e = StorageErrorImpl::runtime_destroyed_error(method + ": Runtime was destroyed previously"); | ||
462 | 136 | return VoidJobImpl::make_void_job(e); | ||
463 | 137 | } | ||
464 | 138 | |||
465 | 139 | if (md_.type == storage::ItemType::root) | ||
466 | 140 | { | ||
467 | 141 | auto e = StorageErrorImpl::logic_error(method + ": cannot delete root"); | ||
468 | 142 | return VoidJobImpl::make_void_job(e); | ||
469 | 143 | } | ||
470 | 144 | |||
471 | 145 | auto reply = account_->provider()->Delete(md_.item_id); | ||
472 | 146 | auto This = const_pointer_cast<ItemImpl>(shared_from_this()); | ||
473 | 147 | return VoidJobImpl::make_void_job(This, method, reply); | ||
474 | 135 | } | 148 | } |
475 | 136 | 149 | ||
476 | 137 | Uploader* ItemImpl::createUploader(Item::ConflictPolicy policy, qint64 sizeInBytes) const | 150 | Uploader* ItemImpl::createUploader(Item::ConflictPolicy policy, qint64 sizeInBytes) const |
477 | @@ -248,19 +261,10 @@ | |||
478 | 248 | return Item(p); | 261 | return Item(p); |
479 | 249 | } | 262 | } |
480 | 250 | 263 | ||
483 | 251 | #if 0 | 264 | shared_ptr<RuntimeImpl> ItemImpl::runtime() const |
482 | 252 | shared_ptr<RuntimeImpl> ItemImpl::get_runtime(QString const& method) const | ||
484 | 253 | { | 265 | { |
493 | 254 | auto runtime = account_->runtime_.lock(); | 266 | return account_->runtime(); |
486 | 255 | if (!runtime || !runtime->isValid()) | ||
487 | 256 | { | ||
488 | 257 | QString msg = method + ": Runtime was destroyed previously"; | ||
489 | 258 | auto This = const_cast<ItemImpl*>(this); | ||
490 | 259 | This->error_ = StorageErrorImpl::runtime_destroyed_error(msg); | ||
491 | 260 | } | ||
492 | 261 | return runtime; | ||
494 | 262 | } | 267 | } |
495 | 263 | #endif | ||
496 | 264 | 268 | ||
497 | 265 | } // namespace internal | 269 | } // namespace internal |
498 | 266 | } // namespace qt | 270 | } // namespace qt |
499 | 267 | 271 | ||
500 | === modified file 'src/qt/internal/ItemJobImpl.cpp' | |||
501 | --- src/qt/internal/ItemJobImpl.cpp 2016-09-26 02:12:30 +0000 | |||
502 | +++ src/qt/internal/ItemJobImpl.cpp 2016-09-29 13:09:41 +0000 | |||
503 | @@ -20,8 +20,10 @@ | |||
504 | 20 | 20 | ||
505 | 21 | #include <unity/storage/internal/dbusmarshal.h> | 21 | #include <unity/storage/internal/dbusmarshal.h> |
506 | 22 | #include <unity/storage/internal/ItemMetadata.h> | 22 | #include <unity/storage/internal/ItemMetadata.h> |
507 | 23 | #include <unity/storage/qt/internal/AccountImpl.h> | ||
508 | 23 | #include <unity/storage/qt/internal/Handler.h> | 24 | #include <unity/storage/qt/internal/Handler.h> |
509 | 24 | #include <unity/storage/qt/internal/ItemImpl.h> | 25 | #include <unity/storage/qt/internal/ItemImpl.h> |
510 | 26 | #include <unity/storage/qt/internal/RuntimeImpl.h> | ||
511 | 25 | 27 | ||
512 | 26 | using namespace std; | 28 | using namespace std; |
513 | 27 | 29 | ||
514 | @@ -49,6 +51,15 @@ | |||
515 | 49 | 51 | ||
516 | 50 | auto process_reply = [this](decltype(reply)& r) | 52 | auto process_reply = [this](decltype(reply)& r) |
517 | 51 | { | 53 | { |
518 | 54 | auto runtime = account_->runtime(); | ||
519 | 55 | if (!runtime || !runtime->isValid()) | ||
520 | 56 | { | ||
521 | 57 | error_ = StorageErrorImpl::runtime_destroyed_error(method_ + ": Runtime was destroyed previously"); | ||
522 | 58 | status_ = ItemJob::Error; | ||
523 | 59 | Q_EMIT public_instance_->statusChanged(status_); | ||
524 | 60 | return; | ||
525 | 61 | } | ||
526 | 62 | |||
527 | 52 | auto metadata = r.value(); | 63 | auto metadata = r.value(); |
528 | 53 | try | 64 | try |
529 | 54 | { | 65 | { |
530 | @@ -98,7 +109,7 @@ | |||
531 | 98 | 109 | ||
532 | 99 | Item ItemJobImpl::item() const | 110 | Item ItemJobImpl::item() const |
533 | 100 | { | 111 | { |
535 | 101 | return Item(); // TODO | 112 | return item_; |
536 | 102 | } | 113 | } |
537 | 103 | 114 | ||
538 | 104 | ItemJob* ItemJobImpl::make_item_job(shared_ptr<AccountImpl> const& account, | 115 | ItemJob* ItemJobImpl::make_item_job(shared_ptr<AccountImpl> const& account, |
539 | 105 | 116 | ||
540 | === modified file 'src/qt/internal/ItemListJobImpl.cpp' | |||
541 | --- src/qt/internal/ItemListJobImpl.cpp 2016-09-26 02:12:30 +0000 | |||
542 | +++ src/qt/internal/ItemListJobImpl.cpp 2016-09-29 13:09:41 +0000 | |||
543 | @@ -20,8 +20,10 @@ | |||
544 | 20 | 20 | ||
545 | 21 | #include <unity/storage/internal/dbusmarshal.h> | 21 | #include <unity/storage/internal/dbusmarshal.h> |
546 | 22 | #include <unity/storage/internal/ItemMetadata.h> | 22 | #include <unity/storage/internal/ItemMetadata.h> |
547 | 23 | #include <unity/storage/qt/internal/AccountImpl.h> | ||
548 | 23 | #include <unity/storage/qt/internal/Handler.h> | 24 | #include <unity/storage/qt/internal/Handler.h> |
549 | 24 | #include <unity/storage/qt/internal/ItemImpl.h> | 25 | #include <unity/storage/qt/internal/ItemImpl.h> |
550 | 26 | #include <unity/storage/qt/internal/RuntimeImpl.h> | ||
551 | 25 | 27 | ||
552 | 26 | using namespace std; | 28 | using namespace std; |
553 | 27 | 29 | ||
554 | @@ -49,6 +51,15 @@ | |||
555 | 49 | 51 | ||
556 | 50 | auto process_reply = [this](decltype(reply)& r) | 52 | auto process_reply = [this](decltype(reply)& r) |
557 | 51 | { | 53 | { |
558 | 54 | auto runtime = account_->runtime(); | ||
559 | 55 | if (!runtime || !runtime->isValid()) | ||
560 | 56 | { | ||
561 | 57 | error_ = StorageErrorImpl::runtime_destroyed_error(method_ + ": Runtime was destroyed previously"); | ||
562 | 58 | status_ = ItemListJob::Error; | ||
563 | 59 | Q_EMIT public_instance_->statusChanged(status_); | ||
564 | 60 | return; | ||
565 | 61 | } | ||
566 | 62 | |||
567 | 52 | QList<Item> items; | 63 | QList<Item> items; |
568 | 53 | auto metadata = r.value(); | 64 | auto metadata = r.value(); |
569 | 54 | for (auto const& md : metadata) | 65 | for (auto const& md : metadata) |
570 | 55 | 66 | ||
571 | === modified file 'src/qt/internal/RuntimeImpl.cpp' | |||
572 | --- src/qt/internal/RuntimeImpl.cpp 2016-09-26 02:12:30 +0000 | |||
573 | +++ src/qt/internal/RuntimeImpl.cpp 2016-09-29 13:09:41 +0000 | |||
574 | @@ -26,6 +26,7 @@ | |||
575 | 26 | #include <unity/storage/qt/ItemJob.h> | 26 | #include <unity/storage/qt/ItemJob.h> |
576 | 27 | #include <unity/storage/qt/ItemListJob.h> | 27 | #include <unity/storage/qt/ItemListJob.h> |
577 | 28 | #include <unity/storage/qt/Runtime.h> | 28 | #include <unity/storage/qt/Runtime.h> |
578 | 29 | #include <unity/storage/qt/VoidJob.h> | ||
579 | 29 | 30 | ||
580 | 30 | #include <QDBusError> | 31 | #include <QDBusError> |
581 | 31 | #include <QDBusMetaType> | 32 | #include <QDBusMetaType> |
582 | @@ -50,6 +51,7 @@ | |||
583 | 50 | qRegisterMetaType<QList<unity::storage::qt::Item>>(); | 51 | qRegisterMetaType<QList<unity::storage::qt::Item>>(); |
584 | 51 | qRegisterMetaType<unity::storage::qt::ItemJob::Status>(); | 52 | qRegisterMetaType<unity::storage::qt::ItemJob::Status>(); |
585 | 52 | qRegisterMetaType<unity::storage::qt::ItemListJob::Status>(); | 53 | qRegisterMetaType<unity::storage::qt::ItemListJob::Status>(); |
586 | 54 | qRegisterMetaType<unity::storage::qt::VoidJob::Status>(); | ||
587 | 53 | 55 | ||
588 | 54 | qDBusRegisterMetaType<unity::storage::internal::ItemMetadata>(); | 56 | qDBusRegisterMetaType<unity::storage::internal::ItemMetadata>(); |
589 | 55 | qDBusRegisterMetaType<QList<unity::storage::internal::ItemMetadata>>(); | 57 | qDBusRegisterMetaType<QList<unity::storage::internal::ItemMetadata>>(); |
590 | 56 | 58 | ||
591 | === added file 'src/qt/internal/VoidJobImpl.cpp' | |||
592 | --- src/qt/internal/VoidJobImpl.cpp 1970-01-01 00:00:00 +0000 | |||
593 | +++ src/qt/internal/VoidJobImpl.cpp 2016-09-29 13:09:41 +0000 | |||
594 | @@ -0,0 +1,117 @@ | |||
595 | 1 | /* | ||
596 | 2 | * Copyright (C) 2016 Canonical Ltd | ||
597 | 3 | * | ||
598 | 4 | * This program is free software: you can redistribute it and/or modify | ||
599 | 5 | * it under the terms of the GNU Lesser General Public License version 3 as | ||
600 | 6 | * published by the Free Software Foundation. | ||
601 | 7 | * | ||
602 | 8 | * This program is distributed in the hope that it will be useful, | ||
603 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
604 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
605 | 11 | * GNU Lesser General Public License for more details. | ||
606 | 12 | * | ||
607 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
608 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
609 | 15 | * | ||
610 | 16 | * Authors: Michi Henning <michi.henning@canonical.com> | ||
611 | 17 | */ | ||
612 | 18 | |||
613 | 19 | #include <unity/storage/qt/internal/VoidJobImpl.h> | ||
614 | 20 | |||
615 | 21 | #include <unity/storage/qt/internal/Handler.h> | ||
616 | 22 | #include <unity/storage/qt/internal/ItemImpl.h> | ||
617 | 23 | #include <unity/storage/qt/internal/RuntimeImpl.h> | ||
618 | 24 | |||
619 | 25 | using namespace std; | ||
620 | 26 | |||
621 | 27 | namespace unity | ||
622 | 28 | { | ||
623 | 29 | namespace storage | ||
624 | 30 | { | ||
625 | 31 | namespace qt | ||
626 | 32 | { | ||
627 | 33 | namespace internal | ||
628 | 34 | { | ||
629 | 35 | |||
630 | 36 | VoidJobImpl::VoidJobImpl(shared_ptr<ItemImpl> const& item, | ||
631 | 37 | QString const& method, | ||
632 | 38 | QDBusPendingReply<void> const& reply) | ||
633 | 39 | : status_(VoidJob::Loading) | ||
634 | 40 | , method_(method) | ||
635 | 41 | , item_(item) | ||
636 | 42 | { | ||
637 | 43 | assert(!method_.isEmpty()); | ||
638 | 44 | assert(item); | ||
639 | 45 | |||
640 | 46 | auto process_reply = [this](decltype(reply)&) | ||
641 | 47 | { | ||
642 | 48 | auto runtime = item_->runtime(); | ||
643 | 49 | if (!runtime || !runtime->isValid()) | ||
644 | 50 | { | ||
645 | 51 | error_ = StorageErrorImpl::runtime_destroyed_error(method_ + ": Runtime was destroyed previously"); | ||
646 | 52 | status_ = VoidJob::Error; | ||
647 | 53 | Q_EMIT public_instance_->statusChanged(status_); | ||
648 | 54 | return; | ||
649 | 55 | } | ||
650 | 56 | |||
651 | 57 | status_ = VoidJob::Finished; | ||
652 | 58 | Q_EMIT public_instance_->statusChanged(status_); | ||
653 | 59 | }; | ||
654 | 60 | |||
655 | 61 | auto process_error = [this](StorageError const& error) | ||
656 | 62 | { | ||
657 | 63 | error_ = error; | ||
658 | 64 | status_ = VoidJob::Error; | ||
659 | 65 | Q_EMIT public_instance_->statusChanged(status_); | ||
660 | 66 | }; | ||
661 | 67 | |||
662 | 68 | new Handler<void>(this, reply, process_reply, process_error); | ||
663 | 69 | } | ||
664 | 70 | |||
665 | 71 | VoidJobImpl::VoidJobImpl(StorageError const& error) | ||
666 | 72 | : status_(VoidJob::Error) | ||
667 | 73 | , error_(error) | ||
668 | 74 | { | ||
669 | 75 | } | ||
670 | 76 | |||
671 | 77 | bool VoidJobImpl::isValid() const | ||
672 | 78 | { | ||
673 | 79 | return status_ != VoidJob::Status::Error; | ||
674 | 80 | } | ||
675 | 81 | |||
676 | 82 | VoidJob::Status VoidJobImpl::status() const | ||
677 | 83 | { | ||
678 | 84 | return status_; | ||
679 | 85 | } | ||
680 | 86 | |||
681 | 87 | StorageError VoidJobImpl::error() const | ||
682 | 88 | { | ||
683 | 89 | return error_; | ||
684 | 90 | } | ||
685 | 91 | |||
686 | 92 | VoidJob* VoidJobImpl::make_void_job(shared_ptr<ItemImpl> const& item, | ||
687 | 93 | QString const& method, | ||
688 | 94 | QDBusPendingReply<void> const& reply) | ||
689 | 95 | { | ||
690 | 96 | unique_ptr<VoidJobImpl> impl(new VoidJobImpl(item, method, reply)); | ||
691 | 97 | auto job = new VoidJob(move(impl)); | ||
692 | 98 | job->p_->public_instance_ = job; | ||
693 | 99 | return job; | ||
694 | 100 | } | ||
695 | 101 | |||
696 | 102 | VoidJob* VoidJobImpl::make_void_job(StorageError const& error) | ||
697 | 103 | { | ||
698 | 104 | unique_ptr<VoidJobImpl> impl(new VoidJobImpl(error)); | ||
699 | 105 | auto job = new VoidJob(move(impl)); | ||
700 | 106 | job->p_->public_instance_ = job; | ||
701 | 107 | QMetaObject::invokeMethod(job, | ||
702 | 108 | "statusChanged", | ||
703 | 109 | Qt::QueuedConnection, | ||
704 | 110 | Q_ARG(unity::storage::qt::VoidJob::Status, job->p_->status_)); | ||
705 | 111 | return job; | ||
706 | 112 | } | ||
707 | 113 | |||
708 | 114 | } // namespace internal | ||
709 | 115 | } // namespace qt | ||
710 | 116 | } // namespace storage | ||
711 | 117 | } // namespace unity | ||
712 | 0 | 118 | ||
713 | === modified file 'tests/remote-client/MockProvider.cpp' | |||
714 | --- tests/remote-client/MockProvider.cpp 2016-09-16 06:25:08 +0000 | |||
715 | +++ tests/remote-client/MockProvider.cpp 2016-09-29 13:09:41 +0000 | |||
716 | @@ -46,7 +46,19 @@ | |||
717 | 46 | 46 | ||
718 | 47 | boost::future<ItemList> MockProvider::roots(Context const&) | 47 | boost::future<ItemList> MockProvider::roots(Context const&) |
719 | 48 | { | 48 | { |
721 | 49 | cerr << "roots CALLED" << endl; | 49 | if (cmd_ == "slow_roots") |
722 | 50 | { | ||
723 | 51 | this_thread::sleep_for(chrono::seconds(1)); | ||
724 | 52 | } | ||
725 | 53 | if (cmd_ == "not_a_root") | ||
726 | 54 | { | ||
727 | 55 | ItemList roots = | ||
728 | 56 | { | ||
729 | 57 | {"root_id", {}, "Root", "etag", ItemType::file, {}} | ||
730 | 58 | }; | ||
731 | 59 | return make_ready_future<ItemList>(roots); | ||
732 | 60 | } | ||
733 | 61 | |||
734 | 50 | ItemList roots = | 62 | ItemList roots = |
735 | 51 | { | 63 | { |
736 | 52 | {"root_id", {}, "Root", "etag", ItemType::root, {}} | 64 | {"root_id", {}, "Root", "etag", ItemType::root, {}} |
737 | @@ -103,6 +115,15 @@ | |||
738 | 103 | 115 | ||
739 | 104 | boost::future<Item> MockProvider::metadata(string const& item_id, Context const&) | 116 | boost::future<Item> MockProvider::metadata(string const& item_id, Context const&) |
740 | 105 | { | 117 | { |
741 | 118 | if (cmd_ == "slow_metadata") | ||
742 | 119 | { | ||
743 | 120 | this_thread::sleep_for(chrono::seconds(1)); | ||
744 | 121 | } | ||
745 | 122 | if (cmd_ == "empty_id") | ||
746 | 123 | { | ||
747 | 124 | Item metadata{"", {}, "Root", "etag", ItemType::root, {}}; | ||
748 | 125 | return make_ready_future<Item>(metadata); | ||
749 | 126 | } | ||
750 | 106 | if (item_id == "root_id") | 127 | if (item_id == "root_id") |
751 | 107 | { | 128 | { |
752 | 108 | Item metadata{"root_id", {}, "Root", "etag", ItemType::root, {}}; | 129 | Item metadata{"root_id", {}, "Root", "etag", ItemType::root, {}}; |
753 | @@ -168,8 +189,17 @@ | |||
754 | 168 | } | 189 | } |
755 | 169 | 190 | ||
756 | 170 | boost::future<void> MockProvider::delete_item( | 191 | boost::future<void> MockProvider::delete_item( |
758 | 171 | string const&, Context const&) | 192 | string const& item_id, Context const&) |
759 | 172 | { | 193 | { |
760 | 194 | if (cmd_ == "slow_delete") | ||
761 | 195 | { | ||
762 | 196 | this_thread::sleep_for(chrono::seconds(1)); | ||
763 | 197 | } | ||
764 | 198 | if (cmd_ == "delete_no_such_item") | ||
765 | 199 | { | ||
766 | 200 | string msg = "delete_item(): no such item: " + item_id; | ||
767 | 201 | return make_exceptional_future<void>(NotExistsException(msg, item_id)); | ||
768 | 202 | } | ||
769 | 173 | return make_ready_future(); | 203 | return make_ready_future(); |
770 | 174 | } | 204 | } |
771 | 175 | 205 | ||
772 | 176 | 206 | ||
773 | === modified file 'tests/remote-client/remote-client_test.cpp' | |||
774 | --- tests/remote-client/remote-client_test.cpp 2016-09-26 02:37:03 +0000 | |||
775 | +++ tests/remote-client/remote-client_test.cpp 2016-09-29 13:09:41 +0000 | |||
776 | @@ -24,6 +24,8 @@ | |||
777 | 24 | #include <gtest/gtest.h> | 24 | #include <gtest/gtest.h> |
778 | 25 | #include <QSignalSpy> | 25 | #include <QSignalSpy> |
779 | 26 | 26 | ||
780 | 27 | #include <unordered_set> | ||
781 | 28 | |||
782 | 27 | using namespace unity::storage; | 29 | using namespace unity::storage; |
783 | 28 | using namespace unity::storage::qt; | 30 | using namespace unity::storage::qt; |
784 | 29 | using namespace std; | 31 | using namespace std; |
785 | @@ -52,10 +54,12 @@ | |||
786 | 52 | Account acc_; | 54 | Account acc_; |
787 | 53 | }; | 55 | }; |
788 | 54 | 56 | ||
789 | 55 | class RuntimeTest : public ProviderFixture {}; | ||
790 | 56 | class AccountTest : public RemoteClientTest {}; | 57 | class AccountTest : public RemoteClientTest {}; |
791 | 58 | class DeleteTest : public RemoteClientTest {}; | ||
792 | 59 | class GetTest : public RemoteClientTest {}; | ||
793 | 60 | class ItemTest : public RemoteClientTest {}; | ||
794 | 57 | class RootsTest : public RemoteClientTest {}; | 61 | class RootsTest : public RemoteClientTest {}; |
796 | 58 | class ItemTest : public RemoteClientTest {}; | 62 | class RuntimeTest : public ProviderFixture {}; |
797 | 59 | 63 | ||
798 | 60 | TEST(Runtime, lifecycle) | 64 | TEST(Runtime, lifecycle) |
799 | 61 | { | 65 | { |
800 | @@ -75,6 +79,7 @@ | |||
801 | 75 | } | 79 | } |
802 | 76 | 80 | ||
803 | 77 | #if 0 | 81 | #if 0 |
804 | 82 | // TODO, how to test this? | ||
805 | 78 | TEST_F(RuntimeTest, init_error) | 83 | TEST_F(RuntimeTest, init_error) |
806 | 79 | { | 84 | { |
807 | 80 | QDBusConnection conn(connection()); | 85 | QDBusConnection conn(connection()); |
808 | @@ -299,9 +304,12 @@ | |||
809 | 299 | 304 | ||
810 | 300 | TEST_F(AccountTest, hash) | 305 | TEST_F(AccountTest, hash) |
811 | 301 | { | 306 | { |
812 | 307 | unordered_set<Account>(); // Just to show that this works. | ||
813 | 308 | |||
814 | 302 | Account a1; | 309 | Account a1; |
815 | 310 | EXPECT_EQ(0, hash<Account>()(a1)); | ||
816 | 303 | EXPECT_EQ(0, a1.hash()); | 311 | EXPECT_EQ(0, a1.hash()); |
818 | 304 | EXPECT_EQ(a1.hash(), qHash(a1)); | 312 | EXPECT_EQ(0, qHash(a1)); |
819 | 305 | 313 | ||
820 | 306 | auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "a", "a"); | 314 | auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "a", "a"); |
821 | 307 | // Due to different return types (size_t vs uint), hash() and qHash() do not return the same value. | 315 | // Due to different return types (size_t vs uint), hash() and qHash() do not return the same value. |
822 | @@ -317,11 +325,11 @@ | |||
823 | 317 | EXPECT_EQ(StorageError::NoError, j->error().type()); | 325 | EXPECT_EQ(StorageError::NoError, j->error().type()); |
824 | 318 | EXPECT_EQ(QList<Account>(), j->accounts()); // We haven't waited for the result yet. | 326 | EXPECT_EQ(QList<Account>(), j->accounts()); // We haven't waited for the result yet. |
825 | 319 | 327 | ||
827 | 320 | QSignalSpy spy(j.get(), &unity::storage::qt::AccountsJob::statusChanged); | 328 | QSignalSpy spy(j.get(), &AccountsJob::statusChanged); |
828 | 321 | spy.wait(SIGNAL_WAIT_TIME); | 329 | spy.wait(SIGNAL_WAIT_TIME); |
829 | 322 | ASSERT_EQ(1, spy.count()); | 330 | ASSERT_EQ(1, spy.count()); |
830 | 323 | auto arg = spy.takeFirst(); | 331 | auto arg = spy.takeFirst(); |
832 | 324 | EXPECT_EQ(AccountsJob::Finished, qvariant_cast<unity::storage::qt::AccountsJob::Status>(arg.at(0))); | 332 | EXPECT_EQ(AccountsJob::Finished, qvariant_cast<AccountsJob::Status>(arg.at(0))); |
833 | 325 | 333 | ||
834 | 326 | EXPECT_TRUE(j->isValid()); | 334 | EXPECT_TRUE(j->isValid()); |
835 | 327 | EXPECT_EQ(AccountsJob::Finished, j->status()); | 335 | EXPECT_EQ(AccountsJob::Finished, j->status()); |
836 | @@ -342,16 +350,15 @@ | |||
837 | 342 | EXPECT_FALSE(j->isValid()); | 350 | EXPECT_FALSE(j->isValid()); |
838 | 343 | EXPECT_EQ(AccountsJob::Error, j->status()); | 351 | EXPECT_EQ(AccountsJob::Error, j->status()); |
839 | 344 | EXPECT_EQ(StorageError::RuntimeDestroyed, j->error().type()); | 352 | EXPECT_EQ(StorageError::RuntimeDestroyed, j->error().type()); |
842 | 345 | EXPECT_EQ("Runtime::accounts(): Runtime was destroyed previously", | 353 | EXPECT_EQ("Runtime::accounts(): Runtime was destroyed previously", j->error().message()); |
841 | 346 | j->error().message()) << j->error().message().toStdString(); | ||
843 | 347 | EXPECT_EQ(QList<Account>(), j->accounts()); | 354 | EXPECT_EQ(QList<Account>(), j->accounts()); |
844 | 348 | 355 | ||
845 | 349 | // Signal must be received. | 356 | // Signal must be received. |
847 | 350 | QSignalSpy spy(j, &unity::storage::qt::AccountsJob::statusChanged); | 357 | QSignalSpy spy(j, &AccountsJob::statusChanged); |
848 | 351 | spy.wait(SIGNAL_WAIT_TIME); | 358 | spy.wait(SIGNAL_WAIT_TIME); |
849 | 352 | ASSERT_EQ(1, spy.count()); | 359 | ASSERT_EQ(1, spy.count()); |
850 | 353 | auto arg = spy.takeFirst(); | 360 | auto arg = spy.takeFirst(); |
852 | 354 | EXPECT_EQ(AccountsJob::Error, qvariant_cast<unity::storage::qt::AccountsJob::Status>(arg.at(0))); | 361 | EXPECT_EQ(AccountsJob::Error, qvariant_cast<AccountsJob::Status>(arg.at(0))); |
853 | 355 | } | 362 | } |
854 | 356 | 363 | ||
855 | 357 | TEST_F(RootsTest, roots) | 364 | TEST_F(RootsTest, roots) |
856 | @@ -364,19 +371,19 @@ | |||
857 | 364 | EXPECT_EQ(StorageError::NoError, j->error().type()); | 371 | EXPECT_EQ(StorageError::NoError, j->error().type()); |
858 | 365 | 372 | ||
859 | 366 | // Check that we get the statusChanged and itemsReady signals. | 373 | // Check that we get the statusChanged and itemsReady signals. |
862 | 367 | QSignalSpy ready_spy(j.get(), &unity::storage::qt::ItemListJob::itemsReady); | 374 | QSignalSpy ready_spy(j.get(), &ItemListJob::itemsReady); |
863 | 368 | QSignalSpy status_spy(j.get(), &unity::storage::qt::ItemListJob::statusChanged); | 375 | QSignalSpy status_spy(j.get(), &ItemListJob::statusChanged); |
864 | 369 | 376 | ||
865 | 370 | ASSERT_TRUE(ready_spy.wait(SIGNAL_WAIT_TIME)); | 377 | ASSERT_TRUE(ready_spy.wait(SIGNAL_WAIT_TIME)); |
866 | 371 | 378 | ||
867 | 372 | ASSERT_EQ(1, ready_spy.count()); | 379 | ASSERT_EQ(1, ready_spy.count()); |
868 | 373 | auto arg = ready_spy.takeFirst(); | 380 | auto arg = ready_spy.takeFirst(); |
869 | 374 | auto items = qvariant_cast<QList<Item>>(arg.at(0)); | 381 | auto items = qvariant_cast<QList<Item>>(arg.at(0)); |
871 | 375 | EXPECT_EQ(1, items.size()); | 382 | ASSERT_EQ(1, items.size()); |
872 | 376 | 383 | ||
873 | 377 | ASSERT_EQ(1, status_spy.count()); | 384 | ASSERT_EQ(1, status_spy.count()); |
874 | 378 | arg = status_spy.takeFirst(); | 385 | arg = status_spy.takeFirst(); |
876 | 379 | EXPECT_EQ(ItemListJob::Finished, qvariant_cast<unity::storage::qt::ItemListJob::Status>(arg.at(0))); | 386 | EXPECT_EQ(ItemListJob::Finished, qvariant_cast<ItemListJob::Status>(arg.at(0))); |
877 | 380 | EXPECT_EQ(StorageError::NoError, j->error().type()); | 387 | EXPECT_EQ(StorageError::NoError, j->error().type()); |
878 | 381 | 388 | ||
879 | 382 | EXPECT_TRUE(j->isValid()); | 389 | EXPECT_TRUE(j->isValid()); |
880 | @@ -403,38 +410,349 @@ | |||
881 | 403 | EXPECT_FALSE(j->isValid()); | 410 | EXPECT_FALSE(j->isValid()); |
882 | 404 | EXPECT_EQ(ItemListJob::Error, j->status()); | 411 | EXPECT_EQ(ItemListJob::Error, j->status()); |
883 | 405 | EXPECT_EQ(StorageError::RuntimeDestroyed, j->error().type()); | 412 | EXPECT_EQ(StorageError::RuntimeDestroyed, j->error().type()); |
896 | 406 | EXPECT_EQ("Account::roots(): Runtime was destroyed previously", | 413 | EXPECT_EQ("Account::roots(): Runtime was destroyed previously", j->error().message()); |
897 | 407 | j->error().message()) << j->error().message().toStdString(); | 414 | |
898 | 408 | 415 | // Signal must be received. | |
899 | 409 | // Signal must be received. | 416 | QSignalSpy spy(j.get(), &ItemListJob::statusChanged); |
900 | 410 | QSignalSpy spy(j.get(), &unity::storage::qt::ItemListJob::statusChanged); | 417 | spy.wait(SIGNAL_WAIT_TIME); |
901 | 411 | spy.wait(SIGNAL_WAIT_TIME); | 418 | ASSERT_EQ(1, spy.count()); |
902 | 412 | ASSERT_EQ(1, spy.count()); | 419 | auto arg = spy.takeFirst(); |
903 | 413 | auto arg = spy.takeFirst(); | 420 | EXPECT_EQ(ItemListJob::Error, qvariant_cast<ItemListJob::Status>(arg.at(0))); |
904 | 414 | EXPECT_EQ(ItemListJob::Error, qvariant_cast<unity::storage::qt::ItemListJob::Status>(arg.at(0))); | 421 | } |
905 | 415 | } | 422 | |
906 | 416 | 423 | TEST_F(RootsTest, runtime_destroyed_while_item_list_job_running) | |
907 | 417 | TEST_F(ItemTest, comparison) | 424 | { |
908 | 425 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("slow_roots"))); | ||
909 | 426 | |||
910 | 427 | unique_ptr<ItemListJob> j(acc_.roots()); | ||
911 | 428 | EXPECT_TRUE(j->isValid()); | ||
912 | 429 | EXPECT_EQ(ItemListJob::Loading, j->status()); | ||
913 | 430 | EXPECT_EQ(StorageError::NoError, j->error().type()); | ||
914 | 431 | |||
915 | 432 | EXPECT_EQ(StorageError::NoError, runtime_->shutdown().type()); // Destroy runtime, provider still sleeping | ||
916 | 433 | |||
917 | 434 | // Signal must be received. | ||
918 | 435 | QSignalSpy spy(j.get(), &ItemListJob::statusChanged); | ||
919 | 436 | spy.wait(SIGNAL_WAIT_TIME); | ||
920 | 437 | ASSERT_EQ(1, spy.count()); | ||
921 | 438 | auto arg = spy.takeFirst(); | ||
922 | 439 | EXPECT_EQ(ItemListJob::Error, qvariant_cast<ItemListJob::Status>(arg.at(0))); | ||
923 | 440 | |||
924 | 441 | EXPECT_EQ("Account::roots(): Runtime was destroyed previously", j->error().message()); | ||
925 | 442 | } | ||
926 | 443 | |||
927 | 444 | TEST_F(RootsTest, not_a_root) | ||
928 | 445 | { | ||
929 | 446 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("not_a_root"))); | ||
930 | 447 | |||
931 | 448 | unique_ptr<ItemListJob> j(acc_.roots()); | ||
932 | 449 | |||
933 | 450 | QSignalSpy ready_spy(j.get(), &ItemListJob::itemsReady); | ||
934 | 451 | QSignalSpy status_spy(j.get(), &ItemListJob::statusChanged); | ||
935 | 452 | status_spy.wait(SIGNAL_WAIT_TIME); | ||
936 | 453 | auto arg = status_spy.takeFirst(); | ||
937 | 454 | |||
938 | 455 | // Bad metadata is ignored, so status is finished, and itemsReady was never called. | ||
939 | 456 | EXPECT_EQ(ItemListJob::Finished, qvariant_cast<ItemListJob::Status>(arg.at(0))); | ||
940 | 457 | EXPECT_EQ(0, status_spy.count()); | ||
941 | 458 | } | ||
942 | 459 | |||
943 | 460 | TEST_F(GetTest, basic) | ||
944 | 461 | { | ||
945 | 462 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider())); | ||
946 | 463 | |||
947 | 464 | // Get root. | ||
948 | 465 | { | ||
949 | 466 | unique_ptr<ItemJob> j(acc_.get("root_id")); | ||
950 | 467 | |||
951 | 468 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
952 | 469 | spy.wait(SIGNAL_WAIT_TIME); | ||
953 | 470 | |||
954 | 471 | EXPECT_EQ("root_id", j->item().itemId()); | ||
955 | 472 | EXPECT_EQ("Root", j->item().name()); | ||
956 | 473 | EXPECT_EQ(Item::Root, j->item().type()); | ||
957 | 474 | } | ||
958 | 475 | |||
959 | 476 | // Get a file. | ||
960 | 477 | { | ||
961 | 478 | unique_ptr<ItemJob> j(acc_.get("child_id")); | ||
962 | 479 | |||
963 | 480 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
964 | 481 | spy.wait(SIGNAL_WAIT_TIME); | ||
965 | 482 | |||
966 | 483 | EXPECT_EQ("child_id", j->item().itemId()); | ||
967 | 484 | EXPECT_EQ("Child", j->item().name()); | ||
968 | 485 | EXPECT_EQ(Item::File, j->item().type()); | ||
969 | 486 | } | ||
970 | 487 | |||
971 | 488 | // Get a folder. | ||
972 | 489 | { | ||
973 | 490 | unique_ptr<ItemJob> j(acc_.get("child_folder_id")); | ||
974 | 491 | |||
975 | 492 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
976 | 493 | spy.wait(SIGNAL_WAIT_TIME); | ||
977 | 494 | |||
978 | 495 | EXPECT_EQ("child_folder_id", j->item().itemId()); | ||
979 | 496 | EXPECT_EQ("Child_Folder", j->item().name()); | ||
980 | 497 | EXPECT_EQ(Item::Folder, j->item().type()); | ||
981 | 498 | } | ||
982 | 499 | } | ||
983 | 500 | |||
984 | 501 | TEST_F(GetTest, runtime_destroyed) | ||
985 | 502 | { | ||
986 | 503 | EXPECT_EQ(StorageError::NoError, runtime_->shutdown().type()); // Destroy runtime. | ||
987 | 504 | |||
988 | 505 | unique_ptr<ItemJob> j(acc_.get("root_id")); | ||
989 | 506 | EXPECT_FALSE(j->isValid()); | ||
990 | 507 | EXPECT_EQ(ItemJob::Error, j->status()); | ||
991 | 508 | EXPECT_EQ(StorageError::RuntimeDestroyed, j->error().type()); | ||
992 | 509 | EXPECT_EQ("Account::get(): Runtime was destroyed previously", j->error().message()); | ||
993 | 510 | |||
994 | 511 | // Signal must be received. | ||
995 | 512 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
996 | 513 | spy.wait(SIGNAL_WAIT_TIME); | ||
997 | 514 | auto arg = spy.takeFirst(); | ||
998 | 515 | EXPECT_EQ(ItemJob::Error, qvariant_cast<ItemJob::Status>(arg.at(0))); | ||
999 | 516 | |||
1000 | 517 | EXPECT_EQ("Account::get(): Runtime was destroyed previously", j->error().message()); | ||
1001 | 518 | } | ||
1002 | 519 | |||
1003 | 520 | TEST_F(GetTest, runtime_destroyed_while_item_job_running) | ||
1004 | 521 | { | ||
1005 | 522 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("slow_metadata"))); | ||
1006 | 523 | |||
1007 | 524 | unique_ptr<ItemJob> j(acc_.get("child_folder_id")); | ||
1008 | 525 | EXPECT_TRUE(j->isValid()); | ||
1009 | 526 | |||
1010 | 527 | EXPECT_EQ(StorageError::NoError, runtime_->shutdown().type()); // Destroy runtime, provider still sleeping | ||
1011 | 528 | |||
1012 | 529 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1013 | 530 | spy.wait(SIGNAL_WAIT_TIME); | ||
1014 | 531 | auto arg = spy.takeFirst(); | ||
1015 | 532 | EXPECT_EQ(ItemListJob::Error, qvariant_cast<ItemJob::Status>(arg.at(0))); | ||
1016 | 533 | |||
1017 | 534 | EXPECT_EQ("Account::get(): Runtime was destroyed previously", j->error().message()); | ||
1018 | 535 | } | ||
1019 | 536 | |||
1020 | 537 | TEST_F(GetTest, empty_id_from_provider) | ||
1021 | 538 | { | ||
1022 | 539 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("empty_id"))); | ||
1023 | 540 | |||
1024 | 541 | unique_ptr<ItemJob> j(acc_.get("child_folder_id")); | ||
1025 | 542 | EXPECT_TRUE(j->isValid()); | ||
1026 | 543 | |||
1027 | 544 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1028 | 545 | spy.wait(SIGNAL_WAIT_TIME); | ||
1029 | 546 | auto arg = spy.takeFirst(); | ||
1030 | 547 | EXPECT_EQ(ItemListJob::Error, qvariant_cast<ItemJob::Status>(arg.at(0))); | ||
1031 | 548 | |||
1032 | 549 | EXPECT_EQ("Account::get(): received invalid metadata from provider: item_id cannot be empty", j->error().message()); | ||
1033 | 550 | } | ||
1034 | 551 | |||
1035 | 552 | TEST_F(GetTest, no_such_id) | ||
1036 | 553 | { | ||
1037 | 554 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider())); | ||
1038 | 555 | |||
1039 | 556 | unique_ptr<ItemJob> j(acc_.get("no_such_id")); | ||
1040 | 557 | EXPECT_TRUE(j->isValid()); | ||
1041 | 558 | |||
1042 | 559 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1043 | 560 | spy.wait(SIGNAL_WAIT_TIME); | ||
1044 | 561 | auto arg = spy.takeFirst(); | ||
1045 | 562 | EXPECT_EQ(ItemListJob::Error, qvariant_cast<ItemJob::Status>(arg.at(0))); | ||
1046 | 563 | |||
1047 | 564 | EXPECT_EQ("metadata(): no such item: no_such_id", j->error().message()) << j->error().message().toStdString(); | ||
1048 | 565 | EXPECT_EQ("no_such_id", j->error().itemId()); | ||
1049 | 566 | } | ||
1050 | 567 | |||
1051 | 568 | TEST_F(DeleteTest, basic) | ||
1052 | 569 | { | ||
1053 | 570 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider)); | ||
1054 | 571 | |||
1055 | 572 | Item item; | ||
1056 | 573 | { | ||
1057 | 574 | unique_ptr<ItemJob> j(acc_.get("child_id")); | ||
1058 | 575 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1059 | 576 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); | ||
1060 | 577 | item = j->item(); | ||
1061 | 578 | } | ||
1062 | 579 | |||
1063 | 580 | unique_ptr<VoidJob> j(item.deleteItem()); | ||
1064 | 581 | EXPECT_TRUE(j->isValid()); | ||
1065 | 582 | EXPECT_EQ(VoidJob::Loading, j->status()); | ||
1066 | 583 | EXPECT_EQ(StorageError::NoError, j->error().type()); | ||
1067 | 584 | |||
1068 | 585 | EXPECT_EQ("child_id", item.itemId()); | ||
1069 | 586 | |||
1070 | 587 | QSignalSpy spy(j.get(), &VoidJob::statusChanged); | ||
1071 | 588 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); | ||
1072 | 589 | |||
1073 | 590 | EXPECT_EQ(VoidJob::Finished, j->status()); | ||
1074 | 591 | EXPECT_TRUE(j->isValid()); | ||
1075 | 592 | EXPECT_EQ(StorageError::NoError, j->error().type()); | ||
1076 | 593 | EXPECT_EQ(VoidJob::Finished, j->status()); | ||
1077 | 594 | } | ||
1078 | 595 | |||
1079 | 596 | TEST_F(DeleteTest, no_such_item) | ||
1080 | 597 | { | ||
1081 | 598 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("delete_no_such_item"))); | ||
1082 | 599 | |||
1083 | 600 | Item item; | ||
1084 | 601 | { | ||
1085 | 602 | unique_ptr<ItemJob> j(acc_.get("child_id")); | ||
1086 | 603 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1087 | 604 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); | ||
1088 | 605 | item = j->item(); | ||
1089 | 606 | } | ||
1090 | 607 | |||
1091 | 608 | unique_ptr<VoidJob> j(item.deleteItem()); | ||
1092 | 609 | EXPECT_TRUE(j->isValid()); | ||
1093 | 610 | EXPECT_EQ(VoidJob::Loading, j->status()); | ||
1094 | 611 | EXPECT_EQ(StorageError::NoError, j->error().type()); | ||
1095 | 612 | |||
1096 | 613 | EXPECT_EQ("child_id", item.itemId()); | ||
1097 | 614 | |||
1098 | 615 | QSignalSpy spy(j.get(), &VoidJob::statusChanged); | ||
1099 | 616 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); | ||
1100 | 617 | |||
1101 | 618 | EXPECT_EQ(VoidJob::Error, j->status()); | ||
1102 | 619 | EXPECT_FALSE(j->isValid()); | ||
1103 | 620 | EXPECT_EQ(StorageError::NotExists, j->error().type()); | ||
1104 | 621 | EXPECT_EQ("delete_item(): no such item: child_id", j->error().message()); | ||
1105 | 622 | } | ||
1106 | 623 | |||
1107 | 624 | TEST_F(DeleteTest, delete_root) | ||
1108 | 625 | { | ||
1109 | 626 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider)); | ||
1110 | 627 | |||
1111 | 628 | Item item; | ||
1112 | 629 | { | ||
1113 | 630 | unique_ptr<ItemJob> j(acc_.get("root_id")); | ||
1114 | 631 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1115 | 632 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); | ||
1116 | 633 | item = j->item(); | ||
1117 | 634 | } | ||
1118 | 635 | |||
1119 | 636 | unique_ptr<VoidJob> j(item.deleteItem()); | ||
1120 | 637 | EXPECT_FALSE(j->isValid()); | ||
1121 | 638 | EXPECT_EQ(VoidJob::Error, j->status()); | ||
1122 | 639 | EXPECT_EQ(StorageError::LogicError, j->error().type()); | ||
1123 | 640 | |||
1124 | 641 | // Signal must be received. | ||
1125 | 642 | QSignalSpy spy(j.get(), &VoidJob::statusChanged); | ||
1126 | 643 | spy.wait(SIGNAL_WAIT_TIME); | ||
1127 | 644 | auto arg = spy.takeFirst(); | ||
1128 | 645 | EXPECT_EQ(ItemJob::Error, qvariant_cast<VoidJob::Status>(arg.at(0))); | ||
1129 | 646 | |||
1130 | 647 | EXPECT_EQ("Item::deleteItem(): cannot delete root", j->error().message()); | ||
1131 | 648 | } | ||
1132 | 649 | |||
1133 | 650 | TEST_F(DeleteTest, runtime_destroyed) | ||
1134 | 651 | { | ||
1135 | 652 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider)); | ||
1136 | 653 | |||
1137 | 654 | Item item; | ||
1138 | 655 | { | ||
1139 | 656 | unique_ptr<ItemJob> j(acc_.get("child_id")); | ||
1140 | 657 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1141 | 658 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); | ||
1142 | 659 | item = j->item(); | ||
1143 | 660 | } | ||
1144 | 661 | |||
1145 | 662 | EXPECT_EQ(StorageError::NoError, runtime_->shutdown().type()); // Destroy runtime. | ||
1146 | 663 | |||
1147 | 664 | unique_ptr<VoidJob> j(item.deleteItem()); | ||
1148 | 665 | EXPECT_FALSE(j->isValid()); | ||
1149 | 666 | EXPECT_EQ(ItemJob::Error, j->status()); | ||
1150 | 667 | EXPECT_EQ(StorageError::RuntimeDestroyed, j->error().type()); | ||
1151 | 668 | EXPECT_EQ("Item::deleteItem(): Runtime was destroyed previously", j->error().message()); | ||
1152 | 669 | |||
1153 | 670 | // Signal must be received. | ||
1154 | 671 | QSignalSpy spy(j.get(), &VoidJob::statusChanged); | ||
1155 | 672 | spy.wait(SIGNAL_WAIT_TIME); | ||
1156 | 673 | auto arg = spy.takeFirst(); | ||
1157 | 674 | EXPECT_EQ(ItemJob::Error, qvariant_cast<VoidJob::Status>(arg.at(0))); | ||
1158 | 675 | |||
1159 | 676 | EXPECT_EQ("Item::deleteItem(): Runtime was destroyed previously", j->error().message()); | ||
1160 | 677 | } | ||
1161 | 678 | |||
1162 | 679 | TEST_F(DeleteTest, runtime_destroyed_while_void_job_running) | ||
1163 | 680 | { | ||
1164 | 681 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("slow_delete"))); | ||
1165 | 682 | |||
1166 | 683 | Item item; | ||
1167 | 684 | { | ||
1168 | 685 | unique_ptr<ItemJob> j(acc_.get("child_id")); | ||
1169 | 686 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | ||
1170 | 687 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); | ||
1171 | 688 | item = j->item(); | ||
1172 | 689 | } | ||
1173 | 690 | |||
1174 | 691 | unique_ptr<VoidJob> j(item.deleteItem()); | ||
1175 | 692 | EXPECT_TRUE(j->isValid()); | ||
1176 | 693 | EXPECT_EQ(VoidJob::Loading, j->status()); | ||
1177 | 694 | EXPECT_EQ(StorageError::NoError, j->error().type()); | ||
1178 | 695 | |||
1179 | 696 | EXPECT_EQ(StorageError::NoError, runtime_->shutdown().type()); // Destroy runtime. | ||
1180 | 697 | |||
1181 | 698 | // Signal must be received. | ||
1182 | 699 | QSignalSpy spy(j.get(), &VoidJob::statusChanged); | ||
1183 | 700 | spy.wait(SIGNAL_WAIT_TIME); | ||
1184 | 701 | auto arg = spy.takeFirst(); | ||
1185 | 702 | EXPECT_EQ(VoidJob::Error, qvariant_cast<VoidJob::Status>(arg.at(0))); | ||
1186 | 703 | |||
1187 | 704 | EXPECT_EQ("Item::deleteItem(): Runtime was destroyed previously", j->error().message()) << j->error().message().toStdString(); | ||
1188 | 705 | } | ||
1189 | 706 | |||
1190 | 707 | #if 0 | ||
1191 | 708 | // TODO: need to make internal symbols available for testing. | ||
1192 | 709 | TEST_F(ValidateTest, basic) | ||
1193 | 710 | { | ||
1194 | 711 | using namespace unity::storage::qt::internal; | ||
1195 | 712 | |||
1196 | 713 | unity::storage::internal::ItemMetadata md; | ||
1197 | 714 | |||
1198 | 715 | validate("foo", md); | ||
1199 | 716 | } | ||
1200 | 717 | #endif | ||
1201 | 718 | |||
1202 | 719 | |||
1203 | 720 | TEST_F(ItemTest, comparison_and_hash) | ||
1204 | 418 | { | 721 | { |
1205 | 419 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider)); | 722 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider)); |
1206 | 420 | 723 | ||
1207 | 421 | { | 724 | { |
1208 | 422 | // Both items invalid. | 725 | // Both items invalid. |
1209 | 423 | Item i1; | 726 | Item i1; |
1217 | 424 | Item a2; | 727 | Item i2; |
1218 | 425 | EXPECT_TRUE(i1 == a2); | 728 | EXPECT_TRUE(i1 == i2); |
1219 | 426 | EXPECT_FALSE(i1 != a2); | 729 | EXPECT_FALSE(i1 != i2); |
1220 | 427 | EXPECT_FALSE(i1 < a2); | 730 | EXPECT_FALSE(i1 < i2); |
1221 | 428 | EXPECT_TRUE(i1 <= a2); | 731 | EXPECT_TRUE(i1 <= i2); |
1222 | 429 | EXPECT_FALSE(i1 > a2); | 732 | EXPECT_FALSE(i1 > i2); |
1223 | 430 | EXPECT_TRUE(i1 >= a2); | 733 | EXPECT_TRUE(i1 >= i2); |
1224 | 734 | |||
1225 | 735 | unordered_set<Item>(); // Just to show that this works. | ||
1226 | 736 | |||
1227 | 737 | EXPECT_EQ(0, hash<Item>()(i1)); | ||
1228 | 738 | EXPECT_EQ(0, i1.hash()); | ||
1229 | 739 | EXPECT_EQ(0, qHash(i1)); | ||
1230 | 431 | } | 740 | } |
1231 | 432 | 741 | ||
1232 | 433 | #if 0 | ||
1233 | 434 | { | 742 | { |
1234 | 435 | // i1 valid, i2 invalid | 743 | // i1 valid, i2 invalid |
1237 | 436 | auto i1 = runtime_->make_test_account(service_connection_->baseService(), bus_path()); | 744 | unique_ptr<ItemListJob> j(acc_.roots()); |
1238 | 437 | Account i2; | 745 | |
1239 | 746 | QSignalSpy ready_spy(j.get(), &ItemListJob::itemsReady); | ||
1240 | 747 | ASSERT_TRUE(ready_spy.wait(SIGNAL_WAIT_TIME)); | ||
1241 | 748 | |||
1242 | 749 | ASSERT_EQ(1, ready_spy.count()); | ||
1243 | 750 | auto arg = ready_spy.takeFirst(); | ||
1244 | 751 | auto items = qvariant_cast<QList<Item>>(arg.at(0)); | ||
1245 | 752 | ASSERT_EQ(1, items.size()); | ||
1246 | 753 | |||
1247 | 754 | auto i1 = items[0]; | ||
1248 | 755 | Item i2; | ||
1249 | 438 | EXPECT_FALSE(i1 == i2); | 756 | EXPECT_FALSE(i1 == i2); |
1250 | 439 | EXPECT_TRUE(i1 != i2); | 757 | EXPECT_TRUE(i1 != i2); |
1251 | 440 | EXPECT_FALSE(i1 < i2); | 758 | EXPECT_FALSE(i1 < i2); |
1252 | @@ -449,75 +767,69 @@ | |||
1253 | 449 | EXPECT_TRUE(i2 <= i1); | 767 | EXPECT_TRUE(i2 <= i1); |
1254 | 450 | EXPECT_FALSE(i2 > i1); | 768 | EXPECT_FALSE(i2 > i1); |
1255 | 451 | EXPECT_FALSE(i2 >= i1); | 769 | EXPECT_FALSE(i2 >= i1); |
1325 | 452 | } | 770 | |
1326 | 453 | 771 | EXPECT_NE(0, i1.hash()); | |
1327 | 454 | { | 772 | EXPECT_NE(0, qHash(i1)); |
1328 | 455 | // i1 < i2 for owner ID | 773 | } |
1329 | 456 | auto i1 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "a", "x", "x"); | 774 | |
1330 | 457 | auto i2 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "b", "x", "x"); | 775 | { |
1331 | 458 | 776 | // Both items valid with identical metadata, but different accounts (a1 < a2). | |
1332 | 459 | EXPECT_FALSE(i1 == i2); | 777 | |
1333 | 460 | EXPECT_TRUE(i1 != i2); | 778 | auto a1 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "x", "x"); |
1334 | 461 | EXPECT_TRUE(i1 < i2); | 779 | auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "b", "x", "x"); |
1335 | 462 | EXPECT_TRUE(i1 <= i2); | 780 | |
1336 | 463 | EXPECT_FALSE(i1 > i2); | 781 | Item i1; |
1337 | 464 | EXPECT_FALSE(i1 >= i2); | 782 | Item i2; |
1338 | 465 | 783 | ||
1339 | 466 | // And with swapped operands: | 784 | { |
1340 | 467 | EXPECT_FALSE(i2 == i1); | 785 | unique_ptr<ItemJob> j(a1.get("root_id")); |
1341 | 468 | EXPECT_TRUE(i2 != i1); | 786 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); |
1342 | 469 | EXPECT_FALSE(i2 < i1); | 787 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); |
1343 | 470 | EXPECT_FALSE(i2 <= i1); | 788 | i1 = j->item(); |
1344 | 471 | EXPECT_TRUE(i2 > i1); | 789 | } |
1345 | 472 | EXPECT_TRUE(i2 >= i1); | 790 | { |
1346 | 473 | } | 791 | unique_ptr<ItemJob> j(a2.get("root_id")); |
1347 | 474 | 792 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); | |
1348 | 475 | { | 793 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); |
1349 | 476 | // i1 < i2 for owner | 794 | i2 = j->item(); |
1350 | 477 | auto i1 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "a", "a", "x"); | 795 | } |
1351 | 478 | auto i2 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "a", "b", "x"); | 796 | |
1352 | 479 | 797 | ASSERT_EQ(i1.itemId(), i2.itemId()); | |
1353 | 480 | EXPECT_FALSE(i1 == i2); | 798 | |
1354 | 481 | EXPECT_TRUE(i1 != i2); | 799 | EXPECT_FALSE(i1 == i2); |
1355 | 482 | EXPECT_TRUE(i1 < i2); | 800 | EXPECT_TRUE(i1 != i2); |
1356 | 483 | EXPECT_TRUE(i1 <= i2); | 801 | EXPECT_TRUE(i1 < i2); |
1357 | 484 | EXPECT_FALSE(i1 > i2); | 802 | EXPECT_TRUE(i1 <= i2); |
1358 | 485 | EXPECT_FALSE(i1 >= i2); | 803 | EXPECT_FALSE(i1 > i2); |
1359 | 486 | 804 | EXPECT_FALSE(i1 >= i2); | |
1360 | 487 | // And with swapped operands: | 805 | |
1361 | 488 | EXPECT_FALSE(i2 == i1); | 806 | // And with swapped operands: |
1362 | 489 | EXPECT_TRUE(i2 != i1); | 807 | EXPECT_FALSE(i2 == i1); |
1363 | 490 | EXPECT_FALSE(i2 < i1); | 808 | EXPECT_TRUE(i2 != i1); |
1364 | 491 | EXPECT_FALSE(i2 <= i1); | 809 | EXPECT_FALSE(i2 < i1); |
1365 | 492 | EXPECT_TRUE(i2 > i1); | 810 | EXPECT_FALSE(i2 <= i1); |
1366 | 493 | EXPECT_TRUE(i2 >= i1); | 811 | EXPECT_TRUE(i2 > i1); |
1367 | 494 | } | 812 | EXPECT_TRUE(i2 >= i1); |
1368 | 495 | 813 | } | |
1369 | 496 | { | 814 | |
1370 | 497 | // i1 < i2 for description | 815 | { |
1371 | 498 | auto i1 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "a", "a", "a"); | 816 | // Both items valid with identical metadata, but different instances, so we do deep comparison. |
1372 | 499 | auto i2 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "a", "a", "b"); | 817 | |
1373 | 500 | 818 | Item i1; | |
1374 | 501 | EXPECT_FALSE(i1 == i2); | 819 | Item i2; |
1375 | 502 | EXPECT_TRUE(i1 != i2); | 820 | |
1376 | 503 | EXPECT_TRUE(i1 < i2); | 821 | { |
1377 | 504 | EXPECT_TRUE(i1 <= i2); | 822 | unique_ptr<ItemJob> j(acc_.get("root_id")); |
1378 | 505 | EXPECT_FALSE(i1 > i2); | 823 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); |
1379 | 506 | EXPECT_FALSE(i1 >= i2); | 824 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); |
1380 | 507 | 825 | i1 = j->item(); | |
1381 | 508 | // And with swapped operands: | 826 | } |
1382 | 509 | EXPECT_FALSE(i2 == i1); | 827 | { |
1383 | 510 | EXPECT_TRUE(i2 != i1); | 828 | unique_ptr<ItemJob> j(acc_.get("root_id")); |
1384 | 511 | EXPECT_FALSE(i2 < i1); | 829 | QSignalSpy spy(j.get(), &ItemJob::statusChanged); |
1385 | 512 | EXPECT_FALSE(i2 <= i1); | 830 | ASSERT_TRUE(spy.wait(SIGNAL_WAIT_TIME)); |
1386 | 513 | EXPECT_TRUE(i2 > i1); | 831 | i2 = j->item(); |
1387 | 514 | EXPECT_TRUE(i2 >= i1); | 832 | } |
1319 | 515 | } | ||
1320 | 516 | |||
1321 | 517 | { | ||
1322 | 518 | // i1 == i2 | ||
1323 | 519 | auto i1 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "a", "a", "a"); | ||
1324 | 520 | auto i2 = runtime_->make_test_account(service_connection_->baseService(), bus_path(), "a", "a", "a"); | ||
1388 | 521 | 833 | ||
1389 | 522 | EXPECT_TRUE(i1 == i2); | 834 | EXPECT_TRUE(i1 == i2); |
1390 | 523 | EXPECT_FALSE(i1 != i2); | 835 | EXPECT_FALSE(i1 != i2); |
1391 | @@ -533,8 +845,10 @@ | |||
1392 | 533 | EXPECT_TRUE(i2 <= i1); | 845 | EXPECT_TRUE(i2 <= i1); |
1393 | 534 | EXPECT_FALSE(i2 > i1); | 846 | EXPECT_FALSE(i2 > i1); |
1394 | 535 | EXPECT_TRUE(i2 >= i1); | 847 | EXPECT_TRUE(i2 >= i1); |
1395 | 848 | |||
1396 | 849 | EXPECT_EQ(i1.hash(), i2.hash()); | ||
1397 | 850 | EXPECT_EQ(qHash(i1), qHash(i2)); | ||
1398 | 536 | } | 851 | } |
1399 | 537 | #endif | ||
1400 | 538 | } | 852 | } |
1401 | 539 | 853 | ||
1402 | 540 | #if 0 | 854 | #if 0 |
1403 | @@ -1290,7 +1604,7 @@ | |||
1404 | 1290 | 1604 | ||
1405 | 1291 | TEST_F(DestroyedTest, get_destroyed_while_reply_outstanding) | 1605 | TEST_F(DestroyedTest, get_destroyed_while_reply_outstanding) |
1406 | 1292 | { | 1606 | { |
1408 | 1293 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("metadata slow"))); | 1607 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("slow_metadata"))); |
1409 | 1294 | 1608 | ||
1410 | 1295 | auto root = call(acc_->roots())[0]; | 1609 | auto root = call(acc_->roots())[0]; |
1411 | 1296 | auto fut = root->get("root_id"); | 1610 | auto fut = root->get("root_id"); |
1412 | @@ -1328,7 +1642,7 @@ | |||
1413 | 1328 | 1642 | ||
1414 | 1329 | TEST_F(DestroyedTest, move_destroyed_while_reply_outstanding) | 1643 | TEST_F(DestroyedTest, move_destroyed_while_reply_outstanding) |
1415 | 1330 | { | 1644 | { |
1417 | 1331 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("move slow"))); | 1645 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider("slow_move"))); |
1418 | 1332 | 1646 | ||
1419 | 1333 | auto root = call(acc_->roots())[0]; | 1647 | auto root = call(acc_->roots())[0]; |
1420 | 1334 | auto file = dynamic_pointer_cast<File>(call(root->get("child_id"))); | 1648 | auto file = dynamic_pointer_cast<File>(call(root->get("child_id"))); |
FAILED: Continuous integration, rev:87 /jenkins. canonical. com/unity- api-1/job/ lp-storage- framework- ci/128/ /jenkins. canonical. com/unity- api-1/job/ build/768/ console /jenkins. canonical. com/unity- api-1/job/ build-0- fetch/774 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 582/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= yakkety/ 582/console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/unity- api-1/job/ lp-storage- framework- ci/128/ rebuild
https:/