Merge lp:~ted/pay-service/lp1348231-account-creation into lp:pay-service/14.10

Proposed by Ted Gould
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 42
Merged at revision: 36
Proposed branch: lp:~ted/pay-service/lp1348231-account-creation
Merge into: lp:pay-service/14.10
Prerequisite: lp:~ted/pay-service/pay-test-app
Diff against target: 138 lines (+60/-7)
3 files modified
CMakeLists.txt (+1/-0)
debian/control (+1/-0)
service/token-grabber-u1.cpp (+58/-7)
To merge this branch: bzr merge lp:~ted/pay-service/lp1348231-account-creation
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Alejandro J. Cura (community) Approve
Ted Gould Pending
Review via email: mp+229956@code.launchpad.net

This proposal supersedes a proposal from 2014-08-07.

Commit message

Use libaccounts to get signals on account creation or deletion to update the stored token

Description of the change

Getting some signals from the Account Service and just asking for a refresh on them.

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Code looks good. Since the CI jenkins seems not to be working, I'll be testing the package with this branch from the silo.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alejandro J. Cura (alecu) wrote :

The CI jenkins is trying to run "make coverage-xml", and failing:

+ make -n coverage-xml
+ grep 'No rule to make target'
make: *** No rule to make target 'coverage-xml'. Stop.
+ gcovr --xml -r
/tmp/buildd/pay-service-2.0.0+14.10.20140801.1bzr42pkg0utopic48 -o
/iSCSI/storage/jenkins/workspace/pay-service-utopic-amd64-ci/work/results/coverage.xml
'--exclude=.*test.*' '--exclude=.*gmock.*'
Build timed out (after 120 minutes). Marking the build as failed.
java.lang.InterruptedException
Build step 'Debian PBuilder NG' marked build as failure
/usr/bin/pdebuild: line 39: 35730 Terminated tee
"${PBUILDER_BUILD_LOGFILE}"
Archiving artifacts
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
Sending e-mails to: <email address hidden>
Build was marked for publishing on https://jenkins.qa.ubuntu.com/
Finished: FAILURE

On Thu, Aug 7, 2014 at 11:28 PM, PS Jenkins bot
<email address hidden> wrote:
> Review: Needs Fixing continuous-integration
>
> FAILED: Continuous integration, rev:42
> http://jenkins.qa.ubuntu.com/job/pay-service-ci/47/
> Executed test runs:
> FAILURE: http://jenkins.qa.ubuntu.com/job/pay-service-utopic-amd64-ci/48/console
> FAILURE: http://jenkins.qa.ubuntu.com/job/pay-service-utopic-armhf-ci/48/console
>
> Click here to trigger a rebuild:
> http://s-jenkins.ubuntu-ci:8080/job/pay-service-ci/47/rebuild
>
> --
> https://code.launchpad.net/~ted/pay-service/lp1348231-account-creation/+merge/229956
> You are reviewing the proposed merge of lp:~ted/pay-service/lp1348231-account-creation into lp:pay-service.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-08-07 15:20:27 +0000
3+++ CMakeLists.txt 2014-08-07 15:20:27 +0000
4@@ -35,6 +35,7 @@
5 find_package (Qt5Core REQUIRED)
6
7 pkg_check_modules (SERVICE_DEPS REQUIRED
8+ accounts-qt5
9 libcurl
10 ubuntu-app-launch-2
11 dbustest-1
12
13=== modified file 'debian/control'
14--- debian/control 2014-08-07 15:20:27 +0000
15+++ debian/control 2014-08-07 15:20:27 +0000
16@@ -13,6 +13,7 @@
17 # in libstdc++ causing us issues, we explicitly select a G++
18 # version.
19 g++-4.9,
20+ libaccounts-qt5-dev,
21 libclick-0.4-dev,
22 libcurl4-gnutls-dev,
23 libdbustest1-dev,
24
25=== modified file 'service/token-grabber-u1.cpp'
26--- service/token-grabber-u1.cpp 2014-07-15 14:34:16 +0000
27+++ service/token-grabber-u1.cpp 2014-08-07 15:20:27 +0000
28@@ -20,9 +20,13 @@
29 #include "token-grabber-u1.h"
30 #include "qtbridge.h"
31
32+/* U1 Creds */
33 #include <ssoservice.h>
34 #include <token.h>
35
36+/* Accounts Service */
37+#include <Accounts/Manager>
38+
39 class TokenGrabberU1Qt: public QObject
40 {
41 Q_OBJECT
42@@ -35,22 +39,45 @@
43 private Q_SLOTS:
44 void handleCredentialsFound(const UbuntuOne::Token& token);
45 void handleCredentialsNotFound();
46+ void handleCredentialsStored();
47+ void accountChanged(Accounts::AccountId id);
48
49 private:
50 UbuntuOne::Token token;
51 UbuntuOne::SSOService service;
52+ Accounts::Manager manager;
53 };
54
55 TokenGrabberU1Qt::TokenGrabberU1Qt (QObject* parent) :
56- QObject(parent)
57+ QObject(parent),
58+ manager("ubuntuone")
59 {
60- std::cout << "Token grabber built" << std::endl;
61+ qDebug() << "Token grabber built";
62 }
63
64 void TokenGrabberU1Qt::run (void)
65 {
66- std::cout << "Token grabber running" << std::endl;
67-
68+ qDebug() << "Token grabber running";
69+
70+ /* Accounts Manager */
71+ QObject::connect(&manager,
72+ &Accounts::Manager::accountCreated,
73+ this,
74+ &TokenGrabberU1Qt::accountChanged);
75+ QObject::connect(&manager,
76+ &Accounts::Manager::accountRemoved,
77+ this,
78+ &TokenGrabberU1Qt::accountChanged);
79+ QObject::connect(&manager,
80+ &Accounts::Manager::accountUpdated,
81+ this,
82+ &TokenGrabberU1Qt::accountChanged);
83+ QObject::connect(&manager,
84+ &Accounts::Manager::enabledEvent,
85+ this,
86+ &TokenGrabberU1Qt::accountChanged);
87+
88+ /* U1 signals */
89 QObject::connect(&service,
90 &UbuntuOne::SSOService::credentialsFound,
91 this,
92@@ -59,19 +86,43 @@
93 &UbuntuOne::SSOService::credentialsNotFound,
94 this,
95 &TokenGrabberU1Qt::handleCredentialsNotFound);
96-
97+ QObject::connect(&service,
98+ &UbuntuOne::SSOService::credentialsStored,
99+ this,
100+ &TokenGrabberU1Qt::handleCredentialsStored);
101+
102+
103+
104+ service.getCredentials();
105+}
106+
107+void TokenGrabberU1Qt::accountChanged(Accounts::AccountId id)
108+{
109+ /* We don't need to worry about @id here because there
110+ can only be one U1 account for the user at a time, so
111+ we're not getting a specific account or anything. Just
112+ watching for changes */
113+ qDebug() << "Account changed, try to get a new token";
114+ token = UbuntuOne::Token();
115 service.getCredentials();
116 }
117
118 void TokenGrabberU1Qt::handleCredentialsFound(const UbuntuOne::Token& in_token)
119 {
120+ qDebug() << "Got a Token";
121 token = in_token;
122- std::cout << "Got a Token" << std::endl;
123 }
124
125 void TokenGrabberU1Qt::handleCredentialsNotFound()
126 {
127- std::cout << "No Token :-(" << std::endl;
128+ qWarning() << "No Token :-(";
129+ token = UbuntuOne::Token();
130+}
131+
132+void TokenGrabberU1Qt::handleCredentialsStored()
133+{
134+ qDebug() << "New Credentials Stored";
135+ service.getCredentials();
136 }
137
138 std::string TokenGrabberU1Qt::signUrl (std::string url, std::string type)

Subscribers

People subscribed via source and target branches