Merge lp:~renatofilho/address-book-service/dummy-mode into lp:address-book-service
- dummy-mode
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Tiago Salem Herrmann |
Approved revision: | 114 |
Merged at revision: | 113 |
Proposed branch: | lp:~renatofilho/address-book-service/dummy-mode |
Merge into: | lp:address-book-service |
Prerequisite: | lp:~renatofilho/address-book-service/add-multiple-contacts |
Diff against target: |
627 lines (+187/-102) 17 files modified
3rd_party/folks/dummy/backend/CMakeLists.txt (+2/-0) 3rd_party/folks/dummy/backend/dummy-backend-factory.vala (+38/-1) README.test (+36/-0) common/dbus-service-defs.h (+1/-0) common/vcard-parser.h (+2/-2) contacts/contacts-service.cpp (+11/-5) contacts/contacts-service.h (+1/-0) debian/address-book-service-dummy.install (+1/-0) debian/address-book-service.install (+1/-1) debian/control (+9/-0) lib/addressbook-adaptor.cpp (+1/-0) lib/addressbook.cpp (+23/-11) lib/addressbook.h (+7/-2) src/main.cpp (+25/-2) tests/unittest/base-client-test.cpp (+9/-1) tests/unittest/dummy-backend.cpp (+19/-69) tests/unittest/dummy-backend.h (+1/-8) |
To merge this branch: | bzr merge lp:~renatofilho/address-book-service/dummy-mode |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tiago Salem Herrmann (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Omer Akram (community) | functional | Approve | |
Review via email:
|
This proposal supersedes a proposal from 2014-02-26.
Commit message
implement a dummy backend for testing purpose
Description of the change
Running the address-
Running address-
=======
# export CANONICAL_
# export FOLKS_BACKEND_
# export FOLKS_BACKENDS_
# export FOLKS_PRIMARY_
# export ADDRESS_
# /usr/libexec/
CANONICAL_
- Defines a new address book DBus service name
FOLKS_BACKEND_PATH
- Defines the path used by folks to find the backend
FOLKS_BACKENDS_
- Defines which backend folks is allowed to load
FOLKS_PRIMARY_STORE
- Defines which persona store should be used as primary store
Running any address-book client
=======
# export CANONICAL_
CANONICAL_
- Defines a new address book DBus service name, should be the same as the server
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:102
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:103
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Allan LeSage (allanlesage) wrote : Posted in a previous version of this proposal | # |
renato this test failure appears legitimate, I'm witnessing on my device too--have you looked into?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:104
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Omer Akram (om26er) wrote : Posted in a previous version of this proposal | # |
one tests failed for me
om26er@
Test project /home/om26er/
Start 1: clause-test
1/8 Test #1: clause-test .......
Start 2: sort-clause-test
2/8 Test #2: sort-clause-test ................. Passed 0.01 sec
Start 3: fetch-hint-test
3/8 Test #3: fetch-hint-test .................. Passed 0.00 sec
Start 4: contactmap-test
4/8 Test #4: contactmap-test .................. Passed 0.03 sec
Start 5: addressbook-test
5/8 Test #5: addressbook-test ................. Passed 2.70 sec
Start 6: service-
6/8 Test #6: service-
Start 7: readonly-prop-test
7/8 Test #7: readonly-prop-test ............... Passed 0.08 sec
Start 8: contact-link-test
8/8 Test #8: contact-link-test ................ Passed 0.10 sec
88% tests passed, 1 tests failed out of 8
Total Test time (real) = 3.19 sec
The following tests FAILED:
6 - service-
Errors while running CTest
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Omer Akram (om26er) wrote : Posted in a previous version of this proposal | # |
So I think I have found a bug. When I start address-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Omer Akram (om26er) : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:105
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:106
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:107
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:108
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:110
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Omer Akram (om26er) wrote : | # |
Works fine with my testing cases.
- 111. By Renato Araujo Oliveira Filho
-
Merged parent branch: lp:~renatofilho/address-book-service/add-multiple-contacts
- 112. By Renato Araujo Oliveira Filho
-
Added support for preload data during the server startup: ADDRESS_
BOOK_SERVICE_ DEMO_DATA
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:112
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 113. By Renato Araujo Oliveira Filho
-
Merged parent branch.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:113
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 114. By Renato Araujo Oliveira Filho
-
Removed use of old macro.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:114
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
Are there any related MPs required for this MP to build/function as expected? NO
Is your branch in sync with latest trunk: YES
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator? YES
Did you successfully run all tests found in your component's Test Plan (https:/
If you changed the UI, was the change specified/approved by design? NO
If you changed the packaging (debian), did you subscribe a core-dev to this MP? NO
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tiago Salem Herrmann (tiagosh) wrote : | # |
It looks good to me. Tested on the device and it works fine.
----------
Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes
Did CI run pass? If not, please explain why.
Yes
Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes
Preview Diff
1 | === modified file '3rd_party/folks/dummy/backend/CMakeLists.txt' |
2 | --- 3rd_party/folks/dummy/backend/CMakeLists.txt 2013-10-29 16:29:27 +0000 |
3 | +++ 3rd_party/folks/dummy/backend/CMakeLists.txt 2014-04-09 13:59:04 +0000 |
4 | @@ -39,5 +39,7 @@ |
5 | ${FOLKS_LIBRARIES} |
6 | ) |
7 | |
8 | +install(TARGETS dummy LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/address-book-service/) |
9 | + |
10 | |
11 | |
12 | |
13 | === modified file '3rd_party/folks/dummy/backend/dummy-backend-factory.vala' |
14 | --- 3rd_party/folks/dummy/backend/dummy-backend-factory.vala 2013-11-11 14:21:24 +0000 |
15 | +++ 3rd_party/folks/dummy/backend/dummy-backend-factory.vala 2014-04-09 13:59:04 +0000 |
16 | @@ -25,6 +25,7 @@ |
17 | */ |
18 | |
19 | using Folks; |
20 | +using Gee; |
21 | |
22 | /** |
23 | * The dummy backend module entry point. |
24 | @@ -34,7 +35,43 @@ |
25 | */ |
26 | public void module_init (BackendStore backend_store) |
27 | { |
28 | - backend_store.add_backend (new FolksDummy.Backend ()); |
29 | + string[] writable_properties = |
30 | + { |
31 | + Folks.PersonaStore.detail_key (PersonaDetail.AVATAR), |
32 | + Folks.PersonaStore.detail_key (PersonaDetail.BIRTHDAY), |
33 | + Folks.PersonaStore.detail_key (PersonaDetail.EMAIL_ADDRESSES), |
34 | + Folks.PersonaStore.detail_key (PersonaDetail.FULL_NAME), |
35 | + Folks.PersonaStore.detail_key (PersonaDetail.GENDER), |
36 | + Folks.PersonaStore.detail_key (PersonaDetail.IM_ADDRESSES), |
37 | + Folks.PersonaStore.detail_key (PersonaDetail.IS_FAVOURITE), |
38 | + Folks.PersonaStore.detail_key (PersonaDetail.NICKNAME), |
39 | + Folks.PersonaStore.detail_key (PersonaDetail.PHONE_NUMBERS), |
40 | + Folks.PersonaStore.detail_key (PersonaDetail.POSTAL_ADDRESSES), |
41 | + Folks.PersonaStore.detail_key (PersonaDetail.ROLES), |
42 | + Folks.PersonaStore.detail_key (PersonaDetail.STRUCTURED_NAME), |
43 | + Folks.PersonaStore.detail_key (PersonaDetail.LOCAL_IDS), |
44 | + Folks.PersonaStore.detail_key (PersonaDetail.LOCATION), |
45 | + Folks.PersonaStore.detail_key (PersonaDetail.WEB_SERVICE_ADDRESSES), |
46 | + Folks.PersonaStore.detail_key (PersonaDetail.NOTES), |
47 | + // Keep URLS as read-only fields for testing purpose |
48 | + //Folks.PersonaStore.detail_key (PersonaDetail.URLS), |
49 | + Folks.PersonaStore.detail_key (PersonaDetail.GROUPS), |
50 | + null |
51 | + }; |
52 | + |
53 | + /* Create a new persona store. */ |
54 | + var dummy_persona_store = |
55 | + new FolksDummy.PersonaStore ("dummy-store", "Dummy personas", writable_properties); |
56 | + dummy_persona_store.persona_type = typeof (FolksDummy.FullPersona); |
57 | + |
58 | + /* Register it with the backend. */ |
59 | + var persona_stores = new HashSet<PersonaStore> (); |
60 | + persona_stores.add (dummy_persona_store); |
61 | + |
62 | + var backend = new FolksDummy.Backend (); |
63 | + backend.register_persona_stores (persona_stores); |
64 | + dummy_persona_store.reach_quiescence(); |
65 | + backend_store.add_backend (backend); |
66 | } |
67 | |
68 | /** |
69 | |
70 | === added file 'README.test' |
71 | --- README.test 1970-01-01 00:00:00 +0000 |
72 | +++ README.test 2014-04-09 13:59:04 +0000 |
73 | @@ -0,0 +1,36 @@ |
74 | +Running the address-book-service and qtcontacts in dummy mode. |
75 | + |
76 | +Running address-book-service |
77 | +=========================== |
78 | + |
79 | +# export ALTERNATIVE_CPIM_SERVICE_NAME="com.canonical.test.pim" |
80 | +# export FOLKS_BACKEND_PATH="/usr/lib/address-book-service/dummy.so" |
81 | +# export FOLKS_BACKENDS_ALLOWED="dummy" |
82 | +# export FOLKS_PRIMARY_STORE="dummy" |
83 | +# export ADDRESS_BOOK_SERVICE_DEMO_DATA=<some-vcard-file> |
84 | +# /usr/libexec/address-book-service |
85 | + |
86 | +ALTERNATIVE_CPIM_SERVICE_NAME |
87 | + - Defines a new address book DBus service name |
88 | + |
89 | +FOLKS_BACKEND_PATH |
90 | + - Defines the path used by folks to find the backend |
91 | + |
92 | +FOLKS_BACKENDS_ALLOWED |
93 | + - Defines which backend folks is allowed to load |
94 | + |
95 | +FOLKS_PRIMARY_STORE |
96 | + - Defines which persona store should be used as primary store |
97 | + |
98 | +ADDRESS_BOOK_SERVICE_DEMO_DATA |
99 | + - VCard file which will be used to populate the server |
100 | + |
101 | + |
102 | +Running any address-book client |
103 | +=============================== |
104 | + |
105 | +# export ALTERNATIVE_CPIM_SERVICE_NAME="com.canonical.test.pim" |
106 | + |
107 | +ALTERNATIVE_CPIM_SERVICE_NAME |
108 | + - Defines a new address book DBus service name, should be the same as the server |
109 | + |
110 | |
111 | === modified file 'common/dbus-service-defs.h' |
112 | --- common/dbus-service-defs.h 2013-06-07 18:54:26 +0000 |
113 | +++ common/dbus-service-defs.h 2014-04-09 13:59:04 +0000 |
114 | @@ -19,6 +19,7 @@ |
115 | #ifndef __DBUS_SERVICE_DEFS_H__ |
116 | #define __DBUS_SERVICE_DEFS_H__ |
117 | |
118 | +#define ALTERNATIVE_CPIM_SERVICE_NAME "CANONICAL_PIN_SERVICE_NAME" |
119 | #define CPIM_SERVICE_NAME "com.canonical.pim" |
120 | #define CPIM_ADDRESSBOOK_OBJECT_PATH "/com/canonical/pim/AddressBook" |
121 | #define CPIM_ADDRESSBOOK_IFACE_NAME "com.canonical.pim.AddressBook" |
122 | |
123 | === modified file 'common/vcard-parser.h' |
124 | --- common/vcard-parser.h 2014-03-27 16:47:09 +0000 |
125 | +++ common/vcard-parser.h 2014-04-09 13:59:04 +0000 |
126 | @@ -53,6 +53,8 @@ |
127 | static QString contactToVcard(const QtContacts::QContact &contact); |
128 | static QStringList contactToVcardSync(QList<QtContacts::QContact> contacts); |
129 | |
130 | + static QStringList splitVcards(const QByteArray &vcardList); |
131 | + |
132 | Q_SIGNALS: |
133 | void vcardParsed(const QStringList &vcards); |
134 | void contactsParsed(QList<QtContacts::QContact> contacts); |
135 | @@ -68,8 +70,6 @@ |
136 | QtVersit::QVersitReader *m_versitReader; |
137 | |
138 | QByteArray m_vcardData; |
139 | - |
140 | - static QStringList splitVcards(const QByteArray &vcardList); |
141 | }; |
142 | |
143 | } |
144 | |
145 | === modified file 'contacts/contacts-service.cpp' |
146 | --- contacts/contacts-service.cpp 2014-04-09 13:59:04 +0000 |
147 | +++ contacts/contacts-service.cpp 2014-04-09 13:59:04 +0000 |
148 | @@ -107,7 +107,13 @@ |
149 | { |
150 | Source::registerMetaType(); |
151 | |
152 | - m_serviceWatcher = new QDBusServiceWatcher(CPIM_SERVICE_NAME, |
153 | + if (qEnvironmentVariableIsSet(ALTERNATIVE_CPIM_SERVICE_NAME)) { |
154 | + m_serviceName = qgetenv(ALTERNATIVE_CPIM_SERVICE_NAME); |
155 | + } else { |
156 | + m_serviceName = CPIM_SERVICE_NAME; |
157 | + } |
158 | + |
159 | + m_serviceWatcher = new QDBusServiceWatcher(m_serviceName, |
160 | QDBusConnection::sessionBus(), |
161 | QDBusServiceWatcher::WatchForOwnerChange, |
162 | this); |
163 | @@ -141,7 +147,7 @@ |
164 | void GaleraContactsService::serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner) |
165 | { |
166 | Q_UNUSED(oldOwner); |
167 | - if (name == CPIM_SERVICE_NAME) { |
168 | + if (name == m_serviceName) { |
169 | if (!newOwner.isEmpty()) { |
170 | // service appear |
171 | initialize(); |
172 | @@ -166,7 +172,7 @@ |
173 | void GaleraContactsService::initialize() |
174 | { |
175 | if (m_iface.isNull()) { |
176 | - m_iface = QSharedPointer<QDBusInterface>(new QDBusInterface(CPIM_SERVICE_NAME, |
177 | + m_iface = QSharedPointer<QDBusInterface>(new QDBusInterface(m_serviceName, |
178 | CPIM_ADDRESSBOOK_OBJECT_PATH, |
179 | CPIM_ADDRESSBOOK_IFACE_NAME)); |
180 | if (!m_iface->lastError().isValid()) { |
181 | @@ -232,7 +238,7 @@ |
182 | } |
183 | |
184 | QDBusObjectPath viewObjectPath = result.arguments()[0].value<QDBusObjectPath>(); |
185 | - QDBusInterface *view = new QDBusInterface(CPIM_SERVICE_NAME, |
186 | + QDBusInterface *view = new QDBusInterface(m_serviceName, |
187 | viewObjectPath.path(), |
188 | CPIM_ADDRESSBOOK_VIEW_IFACE_NAME); |
189 | |
190 | @@ -314,7 +320,7 @@ |
191 | destroyRequest(data); |
192 | } else { |
193 | QDBusObjectPath viewObjectPath = reply.value(); |
194 | - QDBusInterface *view = new QDBusInterface(CPIM_SERVICE_NAME, |
195 | + QDBusInterface *view = new QDBusInterface(m_serviceName, |
196 | viewObjectPath.path(), |
197 | CPIM_ADDRESSBOOK_VIEW_IFACE_NAME); |
198 | data->updateView(view); |
199 | |
200 | === modified file 'contacts/contacts-service.h' |
201 | --- contacts/contacts-service.h 2014-04-09 13:59:04 +0000 |
202 | +++ contacts/contacts-service.h 2014-04-09 13:59:04 +0000 |
203 | @@ -85,6 +85,7 @@ |
204 | bool m_serviceIsReady; |
205 | |
206 | QSharedPointer<QDBusInterface> m_iface; |
207 | + QString m_serviceName; |
208 | QSet<QContactRequestData*> m_runningRequests; |
209 | QQueue<QPointer<QtContacts::QContactAbstractRequest> > m_pendingRequests; |
210 | |
211 | |
212 | === added file 'debian/address-book-service-dummy.install' |
213 | --- debian/address-book-service-dummy.install 1970-01-01 00:00:00 +0000 |
214 | +++ debian/address-book-service-dummy.install 2014-04-09 13:59:04 +0000 |
215 | @@ -0,0 +1,1 @@ |
216 | +usr/lib/*/address-book-service/dummy.so |
217 | |
218 | === modified file 'debian/address-book-service.install' |
219 | --- debian/address-book-service.install 2013-07-17 20:53:00 +0000 |
220 | +++ debian/address-book-service.install 2014-04-09 13:59:04 +0000 |
221 | @@ -1,3 +1,3 @@ |
222 | -usr/lib/*/address-book-service/* |
223 | +usr/lib/*/address-book-service/address-book-service |
224 | usr/share/dbus-1/services/com.canonical.pim.service |
225 | upstart/address-book-service.conf /usr/share/upstart/sessions |
226 | |
227 | === modified file 'debian/control' |
228 | --- debian/control 2014-02-17 21:59:17 +0000 |
229 | +++ debian/control 2014-04-09 13:59:04 +0000 |
230 | @@ -29,6 +29,15 @@ |
231 | Description: Ubuntu contact service |
232 | A contact aggregator service, that exports all contact information through dbus. |
233 | |
234 | +Package: address-book-service-dummy |
235 | +Architecture: any |
236 | +Multi-Arch: same |
237 | +Depends: ${misc:Depends}, |
238 | + ${shlibs:Depends}, |
239 | +Description: A fork of folks dummy backend |
240 | + A fork of folks dummy backend to be used as standalone backend to test address-book-service. |
241 | + |
242 | + |
243 | Package: qtcontact5-galera |
244 | Architecture: any |
245 | Multi-Arch: same |
246 | |
247 | === modified file 'lib/addressbook-adaptor.cpp' |
248 | --- lib/addressbook-adaptor.cpp 2014-02-17 21:57:06 +0000 |
249 | +++ lib/addressbook-adaptor.cpp 2014-04-09 13:59:04 +0000 |
250 | @@ -29,6 +29,7 @@ |
251 | m_connection(connection) |
252 | { |
253 | setAutoRelaySignals(true); |
254 | + connect(m_addressBook, SIGNAL(ready()), SIGNAL(ready())); |
255 | } |
256 | |
257 | AddressBookAdaptor::~AddressBookAdaptor() |
258 | |
259 | === modified file 'lib/addressbook.cpp' |
260 | --- lib/addressbook.cpp 2014-04-09 13:59:04 +0000 |
261 | +++ lib/addressbook.cpp 2014-04-09 13:59:04 +0000 |
262 | @@ -91,6 +91,12 @@ |
263 | m_notifyIsQuiescentHandlerId(0), |
264 | m_connection(QDBusConnection::sessionBus()) |
265 | { |
266 | + if (qEnvironmentVariableIsSet(ALTERNATIVE_CPIM_SERVICE_NAME)) { |
267 | + m_serviceName = qgetenv(ALTERNATIVE_CPIM_SERVICE_NAME); |
268 | + qDebug() << "Using alternative service name:" << m_serviceName; |
269 | + } else { |
270 | + m_serviceName = CPIM_SERVICE_NAME; |
271 | + } |
272 | prepareUnixSignals(); |
273 | } |
274 | |
275 | @@ -111,11 +117,11 @@ |
276 | |
277 | bool AddressBook::registerObject(QDBusConnection &connection) |
278 | { |
279 | - if (connection.interface()->isServiceRegistered(CPIM_SERVICE_NAME)) { |
280 | + if (connection.interface()->isServiceRegistered(m_serviceName)) { |
281 | qWarning() << "Galera pin service already registered"; |
282 | return false; |
283 | - } else if (!connection.registerService(CPIM_SERVICE_NAME)) { |
284 | - qWarning() << "Could not register service!" << CPIM_SERVICE_NAME; |
285 | + } else if (!connection.registerService(m_serviceName)) { |
286 | + qWarning() << "Could not register service!" << m_serviceName; |
287 | return false; |
288 | } |
289 | |
290 | @@ -181,8 +187,8 @@ |
291 | m_connection.interface()->isValid()) { |
292 | |
293 | m_connection.unregisterObject(objectPath()); |
294 | - if (m_connection.interface()->isServiceRegistered(CPIM_SERVICE_NAME)) { |
295 | - m_connection.unregisterService(CPIM_SERVICE_NAME); |
296 | + if (m_connection.interface()->isServiceRegistered(m_serviceName)) { |
297 | + m_connection.unregisterService(m_serviceName); |
298 | } |
299 | } |
300 | |
301 | @@ -415,8 +421,10 @@ |
302 | } |
303 | } |
304 | |
305 | - QDBusMessage reply = message.createReply(QString()); |
306 | - QDBusConnection::sessionBus().send(reply); |
307 | + if (message.type() != QDBusMessage::InvalidMessage) { |
308 | + QDBusMessage reply = message.createReply(QString()); |
309 | + QDBusConnection::sessionBus().send(reply); |
310 | + } |
311 | return ""; |
312 | } |
313 | |
314 | @@ -749,13 +757,17 @@ |
315 | ContactEntry *entry = createData->m_addressbook->m_contacts->value(QString::fromUtf8(folks_individual_get_id(individual))); |
316 | if (entry) { |
317 | QString vcard = VCardParser::contactToVcard(entry->individual()->contact()); |
318 | - reply = createData->m_message.createReply(vcard); |
319 | - } else { |
320 | + if (createData->m_message.type() != QDBusMessage::InvalidMessage) { |
321 | + reply = createData->m_message.createReply(vcard); |
322 | + } |
323 | + } else if (createData->m_message.type() != QDBusMessage::InvalidMessage) { |
324 | reply = createData->m_message.createErrorReply("Failed to retrieve the new contact", error->message); |
325 | } |
326 | } |
327 | //TODO: use dbus connection |
328 | - QDBusConnection::sessionBus().send(reply); |
329 | + if (createData->m_message.type() != QDBusMessage::InvalidMessage) { |
330 | + QDBusConnection::sessionBus().send(reply); |
331 | + } |
332 | delete createData; |
333 | } |
334 | |
335 | @@ -766,7 +778,7 @@ |
336 | |
337 | g_object_get(source, "is-quiescent", &self->m_ready, NULL); |
338 | if (self->m_ready && self->m_adaptor) { |
339 | - Q_EMIT self->m_adaptor->ready(); |
340 | + Q_EMIT self->ready(); |
341 | } |
342 | } |
343 | |
344 | |
345 | === modified file 'lib/addressbook.h' |
346 | --- lib/addressbook.h 2014-04-09 13:59:04 +0000 |
347 | +++ lib/addressbook.h 2014-04-09 13:59:04 +0000 |
348 | @@ -63,6 +63,7 @@ |
349 | |
350 | Q_SIGNALS: |
351 | void stopped(); |
352 | + void ready(); |
353 | |
354 | public Q_SLOTS: |
355 | bool start(); |
356 | @@ -70,7 +71,7 @@ |
357 | SourceList availableSources(const QDBusMessage &message); |
358 | Source source(const QDBusMessage &message); |
359 | Source createSource(const QString &sourceId, const QDBusMessage &message); |
360 | - QString createContact(const QString &contact, const QString &source, const QDBusMessage &message); |
361 | + QString createContact(const QString &contact, const QString &source, const QDBusMessage &message = QDBusMessage()); |
362 | int removeContacts(const QStringList &contactIds, const QDBusMessage &message); |
363 | QStringList updateContacts(const QStringList &contacts, const QDBusMessage &message); |
364 | void updateContactsDone(const QString &contactId, const QString &error); |
365 | @@ -103,8 +104,12 @@ |
366 | |
367 | // Unix signals |
368 | static int m_sigQuitFd[2]; |
369 | - |
370 | QSocketNotifier *m_snQuit; |
371 | + |
372 | + // dbus service name |
373 | + QString m_serviceName; |
374 | + |
375 | + |
376 | // Disable copy contructor |
377 | AddressBook(const AddressBook&); |
378 | |
379 | |
380 | === modified file 'src/main.cpp' |
381 | --- src/main.cpp 2014-04-09 13:59:04 +0000 |
382 | +++ src/main.cpp 2014-04-09 13:59:04 +0000 |
383 | @@ -16,7 +16,12 @@ |
384 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
385 | */ |
386 | |
387 | +#define ADDRESS_BOOK_SERVICE_DEMO_DATA "ADDRESS_BOOK_SERVICE_DEMO_DATA" |
388 | +#define ADDRESS_BOOK_SERVICE_DEBUG "ADDRESS_BOOK_SERVICE_DEBUG" |
389 | + |
390 | #include "addressbook.h" |
391 | +#include "common/vcard-parser.h" |
392 | + |
393 | |
394 | void contactServiceMessageOutput(QtMsgType type, |
395 | const QMessageLogContext &context, |
396 | @@ -28,6 +33,22 @@ |
397 | //nothing |
398 | } |
399 | |
400 | +void onServiceReady(galera::AddressBook *book) |
401 | +{ |
402 | + // disable debug message if variable not exported |
403 | + if (qEnvironmentVariableIsSet(ADDRESS_BOOK_SERVICE_DEMO_DATA)) { |
404 | + QFile demoFileData(qgetenv(ADDRESS_BOOK_SERVICE_DEMO_DATA)); |
405 | + qDebug() << "Load demo data from:" << demoFileData.fileName(); |
406 | + if (demoFileData.open(QFile::ReadOnly)) { |
407 | + QByteArray demoData = demoFileData.readAll(); |
408 | + QStringList vcards = galera::VCardParser::splitVcards(demoData); |
409 | + Q_FOREACH(const QString &vcard, vcards) { |
410 | + book->createContact(vcard, ""); |
411 | + } |
412 | + } |
413 | + } |
414 | +} |
415 | + |
416 | |
417 | int main(int argc, char** argv) |
418 | { |
419 | @@ -35,7 +56,7 @@ |
420 | QCoreApplication app(argc, argv); |
421 | |
422 | // disable debug message if variable not exported |
423 | - if (qgetenv("ADDRESS_BOOK_SERVICE_DEBUG").isEmpty()) { |
424 | + if (qgetenv(ADDRESS_BOOK_SERVICE_DEBUG).isEmpty()) { |
425 | qInstallMessageHandler(contactServiceMessageOutput); |
426 | } |
427 | |
428 | @@ -45,8 +66,10 @@ |
429 | } |
430 | |
431 | galera::AddressBook book; |
432 | + QObject::connect(&book, &galera::AddressBook::ready, [&book] () { onServiceReady(&book); }); |
433 | + app.connect(&book, SIGNAL(stopped()), SLOT(quit())); |
434 | + |
435 | book.start(); |
436 | - app.connect(&book, SIGNAL(stopped()), SLOT(quit())); |
437 | |
438 | return app.exec(); |
439 | } |
440 | |
441 | === modified file 'tests/unittest/base-client-test.cpp' |
442 | --- tests/unittest/base-client-test.cpp 2014-03-19 13:54:25 +0000 |
443 | +++ tests/unittest/base-client-test.cpp 2014-04-09 13:59:04 +0000 |
444 | @@ -30,7 +30,15 @@ |
445 | void BaseClientTest::initTestCase() |
446 | { |
447 | galera::Source::registerMetaType(); |
448 | - m_serverIface = new QDBusInterface(CPIM_SERVICE_NAME, |
449 | + |
450 | + QString serviceName; |
451 | + if (qEnvironmentVariableIsSet(ALTERNATIVE_CPIM_SERVICE_NAME)) { |
452 | + serviceName = qgetenv(ALTERNATIVE_CPIM_SERVICE_NAME); |
453 | + } else { |
454 | + serviceName = CPIM_SERVICE_NAME; |
455 | + } |
456 | + |
457 | + m_serverIface = new QDBusInterface(serviceName, |
458 | CPIM_ADDRESSBOOK_OBJECT_PATH, |
459 | CPIM_ADDRESSBOOK_IFACE_NAME); |
460 | QVERIFY(!m_serverIface->lastError().isValid()); |
461 | |
462 | === modified file 'tests/unittest/dummy-backend.cpp' |
463 | --- tests/unittest/dummy-backend.cpp 2014-04-09 13:59:04 +0000 |
464 | +++ tests/unittest/dummy-backend.cpp 2014-04-09 13:59:04 +0000 |
465 | @@ -118,9 +118,9 @@ |
466 | void DummyBackendProxy::reset() |
467 | { |
468 | if (m_contacts.count()) { |
469 | - GeeMap *map = folks_persona_store_get_personas((FolksPersonaStore*)m_primaryPersonaStore); |
470 | + GeeMap *map = folks_persona_store_get_personas(m_primaryPersonaStore); |
471 | GeeCollection *personas = gee_map_get_values(map); |
472 | - folks_dummy_persona_store_unregister_personas(m_primaryPersonaStore, (GeeSet*)personas); |
473 | + folks_dummy_persona_store_unregister_personas(FOLKS_DUMMY_PERSONA_STORE(m_primaryPersonaStore), (GeeSet*)personas); |
474 | g_object_unref(personas); |
475 | m_contacts.clear(); |
476 | } |
477 | @@ -154,19 +154,6 @@ |
478 | |
479 | void DummyBackendProxy::initFolks() |
480 | { |
481 | - m_backendStore = folks_backend_store_dup(); |
482 | - folks_backend_store_load_backends(m_backendStore, |
483 | - (GAsyncReadyCallback) DummyBackendProxy::backendStoreLoaded, |
484 | - this); |
485 | -} |
486 | - |
487 | -bool DummyBackendProxy::isReady() const |
488 | -{ |
489 | - return m_isReady; |
490 | -} |
491 | - |
492 | -void DummyBackendProxy::prepareAggregator() |
493 | -{ |
494 | m_aggregator = folks_individual_aggregator_dup(); |
495 | m_individualsChangedDetailedId = g_signal_connect(m_aggregator, |
496 | "individuals-changed-detailed", |
497 | @@ -177,15 +164,21 @@ |
498 | this); |
499 | } |
500 | |
501 | +bool DummyBackendProxy::isReady() const |
502 | +{ |
503 | + return m_isReady; |
504 | +} |
505 | + |
506 | QString DummyBackendProxy::createContact(const QtContacts::QContact &qcontact) |
507 | { |
508 | ScopedEventLoop loop(&m_eventLoop); |
509 | |
510 | GHashTable *details = galera::QIndividual::parseDetails(qcontact); |
511 | Q_ASSERT(details); |
512 | + Q_ASSERT(m_aggregator); |
513 | folks_individual_aggregator_add_persona_from_details(m_aggregator, |
514 | NULL, //parent |
515 | - FOLKS_PERSONA_STORE(m_primaryPersonaStore), |
516 | + m_primaryPersonaStore, |
517 | details, |
518 | (GAsyncReadyCallback) DummyBackendProxy::individualAggregatorAddedPersona, |
519 | this); |
520 | @@ -213,59 +206,6 @@ |
521 | return i->id(); |
522 | } |
523 | |
524 | -void DummyBackendProxy::configurePrimaryStore() |
525 | -{ |
526 | - static const char* writableProperties[] = { |
527 | - folks_persona_store_detail_key(FOLKS_PERSONA_DETAIL_FULL_NAME), |
528 | - folks_persona_store_detail_key(FOLKS_PERSONA_DETAIL_ALIAS), |
529 | - folks_persona_store_detail_key(FOLKS_PERSONA_DETAIL_NICKNAME), |
530 | - folks_persona_store_detail_key(FOLKS_PERSONA_DETAIL_STRUCTURED_NAME), |
531 | - folks_persona_store_detail_key(FOLKS_PERSONA_DETAIL_IS_FAVOURITE), |
532 | - folks_persona_store_detail_key(FOLKS_PERSONA_DETAIL_EMAIL_ADDRESSES), |
533 | - folks_persona_store_detail_key(FOLKS_PERSONA_DETAIL_PHONE_NUMBERS), |
534 | - 0 |
535 | - }; |
536 | - |
537 | - m_primaryPersonaStore = folks_dummy_persona_store_new("dummy-store", |
538 | - "Dummy personas", |
539 | - const_cast<char**>(writableProperties), 7); |
540 | - folks_dummy_persona_store_set_persona_type(m_primaryPersonaStore, FOLKS_DUMMY_TYPE_FULL_PERSONA); |
541 | - folks_dummy_persona_store_update_trust_level(m_primaryPersonaStore, FOLKS_PERSONA_STORE_TRUST_FULL); |
542 | - |
543 | - GeeHashSet *personaStores = gee_hash_set_new(FOLKS_TYPE_PERSONA_STORE, |
544 | - (GBoxedCopyFunc) g_object_ref, g_object_unref, |
545 | - NULL, NULL, NULL, NULL, NULL, NULL); |
546 | - |
547 | - gee_abstract_collection_add(GEE_ABSTRACT_COLLECTION(personaStores), m_primaryPersonaStore); |
548 | - folks_dummy_backend_register_persona_stores(m_backend, GEE_SET(personaStores), true); |
549 | - folks_dummy_persona_store_reach_quiescence(m_primaryPersonaStore); |
550 | - g_object_unref(personaStores); |
551 | - prepareAggregator(); |
552 | -} |
553 | - |
554 | -void DummyBackendProxy::backendEnabled(FolksBackendStore *backendStore, |
555 | - GAsyncResult *res, |
556 | - DummyBackendProxy *self) |
557 | -{ |
558 | - folks_backend_store_enable_backend_finish(backendStore, res); |
559 | - self->m_eventLoop->quit(); |
560 | - self->m_eventLoop = 0; |
561 | -} |
562 | - |
563 | - |
564 | -void DummyBackendProxy::backendStoreLoaded(FolksBackendStore *backendStore, |
565 | - GAsyncResult *res, |
566 | - DummyBackendProxy *self) |
567 | -{ |
568 | - GError *error = 0; |
569 | - folks_backend_store_load_backends_finish(backendStore, res, &error); |
570 | - checkError(error); |
571 | - |
572 | - self->m_backend = FOLKS_DUMMY_BACKEND(folks_backend_store_dup_backend_by_name(self->m_backendStore, "dummy")); |
573 | - Q_ASSERT(self->m_backend != 0); |
574 | - self->configurePrimaryStore(); |
575 | -} |
576 | - |
577 | void DummyBackendProxy::checkError(GError *error) |
578 | { |
579 | if (error) { |
580 | @@ -358,6 +298,16 @@ |
581 | |
582 | folks_individual_aggregator_prepare_finish(fia, res, &error); |
583 | checkError(error); |
584 | + |
585 | + self->m_backendStore = folks_backend_store_dup(); |
586 | + self->m_backend = FOLKS_DUMMY_BACKEND(folks_backend_store_dup_backend_by_name(self->m_backendStore, "dummy")); |
587 | + if (!self->m_backend) { |
588 | + qWarning() << "fail to load dummy backend"; |
589 | + } |
590 | + |
591 | + self->m_primaryPersonaStore = folks_individual_aggregator_get_primary_store(fia); |
592 | + g_object_ref(self->m_primaryPersonaStore); |
593 | + |
594 | if (self->m_useDBus) { |
595 | self->registerObject(); |
596 | } |
597 | |
598 | === modified file 'tests/unittest/dummy-backend.h' |
599 | --- tests/unittest/dummy-backend.h 2014-03-18 16:38:48 +0000 |
600 | +++ tests/unittest/dummy-backend.h 2014-04-09 13:59:04 +0000 |
601 | @@ -66,7 +66,7 @@ |
602 | QTemporaryDir m_tmpDir; |
603 | DummyBackendAdaptor *m_adaptor; |
604 | FolksDummyBackend *m_backend; |
605 | - FolksDummyPersonaStore *m_primaryPersonaStore; |
606 | + FolksPersonaStore *m_primaryPersonaStore; |
607 | FolksBackendStore *m_backendStore; |
608 | QEventLoop *m_eventLoop; |
609 | FolksIndividualAggregator *m_aggregator; |
610 | @@ -78,17 +78,10 @@ |
611 | |
612 | bool registerObject(); |
613 | void initFolks(); |
614 | - void configurePrimaryStore(); |
615 | void initEnviroment(); |
616 | void prepareAggregator(); |
617 | void mkpath(const QString &path) const; |
618 | static void checkError(GError *error); |
619 | - static void backendEnabled(FolksBackendStore *backendStore, |
620 | - GAsyncResult *res, |
621 | - DummyBackendProxy *self); |
622 | - static void backendStoreLoaded(FolksBackendStore *backendStore, |
623 | - GAsyncResult *res, |
624 | - DummyBackendProxy *self); |
625 | static void individualAggregatorPrepared(FolksIndividualAggregator *fia, |
626 | GAsyncResult *res, |
627 | DummyBackendProxy *self); |
FAILED: Continuous integration, rev:101 jenkins. qa.ubuntu. com/job/ address- book-service- ci/160/ jenkins. qa.ubuntu. com/job/ address- book-service- trusty- amd64-ci/ 67/console jenkins. qa.ubuntu. com/job/ address- book-service- trusty- armhf-ci/ 67/console jenkins. qa.ubuntu. com/job/ address- book-service- trusty- i386-ci/ 68/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/address- book-service- ci/160/ rebuild
http://