Merge lp:~mikemc/unity-scope-click/cxx-dlmgr-add-tool into lp:unity-scope-click

Proposed by Mike McCracken
Status: Merged
Approved by: dobey
Approved revision: 118
Merged at revision: 116
Proposed branch: lp:~mikemc/unity-scope-click/cxx-dlmgr-add-tool
Merge into: lp:unity-scope-click
Prerequisite: lp:~mikemc/unity-scope-click/cxx-dlmgr-more-tests
Diff against target: 174 lines (+150/-0)
4 files modified
scope/tests/CMakeLists.txt (+1/-0)
scope/tests/download_manager_tool/CMakeLists.txt (+11/-0)
scope/tests/download_manager_tool/download_manager_tool.cpp (+79/-0)
scope/tests/download_manager_tool/download_manager_tool.h (+59/-0)
To merge this branch: bzr merge lp:~mikemc/unity-scope-click/cxx-dlmgr-add-tool
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Diego Sarmentero (community) Approve
Manuel de la Peña (community) Approve
Review via email: mp+202570@code.launchpad.net

This proposal supersedes a proposal from 2014-01-21.

Commit message

- Add CLI tool for getting the click token from a store URL using download manager, for IRL testing.

Description of the change

- Add CLI tool for getting the click token from a store URL using download manager, for IRL testing.

usage:

U1_DEBUG=1 $builddir/scope/tests/download_manager_tool/download_manager_tool https://public.apps.ubuntu.com/download/com.ubuntu.developer.mzanetti/fahrplan2/com.ubuntu.developer.mzanetti.fahrplan2_2.0.14.1_unknown.click

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:117
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://code.launchpad.net/~mikemc/unity-scope-click/cxx-dlmgr-add-tool/+merge/202570/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-scope-click-ci/185/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-scope-click-trusty-amd64-ci/83
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-scope-click-trusty-armhf-ci/83/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity-scope-click-ci/185/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Manuel de la Peña (mandel) wrote :

A small thing, please use explicit for the single argument constructors and maybe always set the QObject* parent parameter to be optional, for example:

explicit DownloadManagerTool(QObject *parent=0);

review: Needs Fixing
113. By Alejandro J. Cura

A webclient that uses Qt, and the scaffolding for unit and integration tests.

Approved by Manuel de la Peña, Rodney Dawes, PS Jenkins bot.

114. By Leo Arias

Added a test to try to install without credentials. Fixes: https://bugs.launchpad.net/bugs/1271722.

Approved by Roberto Alsina, PS Jenkins bot.

115. By Mike McCracken

Add command-line tool to test getting click token from apps server

116. By Mike McCracken

constructor default arg fix according to review

117. By Mike McCracken

merge with cxx-dlmgr-more tests

Revision history for this message
Manuel de la Peña (mandel) :
review: Approve
118. By Mike McCracken

merge with cxx-dlmgr-more-tests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scope/tests/CMakeLists.txt'
2--- scope/tests/CMakeLists.txt 2014-01-24 17:21:03 +0000
3+++ scope/tests/CMakeLists.txt 2014-01-24 17:21:03 +0000
4@@ -47,3 +47,4 @@
5
6 add_definitions( -DUSE_FAKE_NAM )
7 add_subdirectory( integration )
8+add_subdirectory(download_manager_tool)
9\ No newline at end of file
10
11=== added directory 'scope/tests/download_manager_tool'
12=== added file 'scope/tests/download_manager_tool/CMakeLists.txt'
13--- scope/tests/download_manager_tool/CMakeLists.txt 1970-01-01 00:00:00 +0000
14+++ scope/tests/download_manager_tool/CMakeLists.txt 2014-01-24 17:21:03 +0000
15@@ -0,0 +1,11 @@
16+set(DOWNLOAD_MANAGER_TOOL_TARGET download_manager_tool)
17+
18+add_executable(${DOWNLOAD_MANAGER_TOOL_TARGET}
19+ download_manager_tool.cpp download_manager_tool.h
20+)
21+
22+target_link_libraries(${DOWNLOAD_MANAGER_TOOL_TARGET}
23+ -Wl,-rpath,${CMAKE_BINARY_DIR}/src
24+ -L${CMAKE_BINARY_DIR}/src
25+ ${SCOPE_LIB_NAME}
26+ )
27
28=== added file 'scope/tests/download_manager_tool/download_manager_tool.cpp'
29--- scope/tests/download_manager_tool/download_manager_tool.cpp 1970-01-01 00:00:00 +0000
30+++ scope/tests/download_manager_tool/download_manager_tool.cpp 2014-01-24 17:21:03 +0000
31@@ -0,0 +1,79 @@
32+/*
33+ * Copyright (C) 2014 Canonical Ltd.
34+ *
35+ * This program is free software: you can redistribute it and/or modify it
36+ * under the terms of the GNU General Public License version 3, as published
37+ * by the Free Software Foundation.
38+ *
39+ * This program is distributed in the hope that it will be useful, but
40+ * WITHOUT ANY WARRANTY; without even the implied warranties of
41+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
42+ * PURPOSE. See the GNU General Public License for more details.
43+ *
44+ * You should have received a copy of the GNU General Public License along
45+ * with this program. If not, see <http://www.gnu.org/licenses/>.
46+ *
47+ * In addition, as a special exception, the copyright holders give
48+ * permission to link the code of portions of this program with the
49+ * OpenSSL library under certain conditions as described in each
50+ * individual source file, and distribute linked combinations
51+ * including the two.
52+ * You must obey the GNU General Public License in all respects
53+ * for all of the code used other than OpenSSL. If you modify
54+ * file(s) with this exception, you may extend this exception to your
55+ * version of the file(s), but you are not obligated to do so. If you
56+ * do not wish to do so, delete this exception statement from your
57+ * version. If you delete this exception statement from all source
58+ * files in the program, then also delete it here.
59+ */
60+
61+#include <QCoreApplication>
62+#include <QDebug>
63+#include <QString>
64+#include <QTimer>
65+#include <QTextStream>
66+
67+#include <download_manager_tool.h>
68+
69+DownloadManagerTool::DownloadManagerTool(QObject *parent):
70+ QObject(parent)
71+{
72+ QObject::connect(&_dm, &ClickScope::DownloadManager::clickTokenFetched,
73+ this, &DownloadManagerTool::handleFetchResponse);
74+ QObject::connect(&_dm, &ClickScope::DownloadManager::clickTokenFetchError,
75+ this, &DownloadManagerTool::handleFetchResponse);
76+}
77+
78+void DownloadManagerTool::handleFetchResponse(QString response)
79+{
80+ QTextStream(stdout) << "DONE: response is " << response << "\n";
81+ emit finished();
82+}
83+
84+void DownloadManagerTool::fetchClickToken()
85+{
86+ _dm.fetchClickToken(_url);
87+}
88+
89+int main(int argc, char *argv[])
90+{
91+
92+ QCoreApplication a(argc, argv);
93+ DownloadManagerTool tool(&a);
94+
95+ if (argc != 2) {
96+ QTextStream(stderr) << "Usage: download_manager_tool https://public.apps.ubuntu.com/download/<<rest of click package dl url>>"
97+ << "\n\t - when run with a valid U1 credential in the system, should print the click token to stdout.\n";
98+ return 1;
99+ }
100+
101+
102+ tool.setClickTokenURL(QString(argv[1]));
103+
104+ QObject::connect(&tool, SIGNAL(finished()), &a, SLOT(quit()));
105+
106+ QTimer::singleShot(0, &tool, SLOT(fetchClickToken()));
107+
108+ return a.exec();
109+}
110+
111
112=== added file 'scope/tests/download_manager_tool/download_manager_tool.h'
113--- scope/tests/download_manager_tool/download_manager_tool.h 1970-01-01 00:00:00 +0000
114+++ scope/tests/download_manager_tool/download_manager_tool.h 2014-01-24 17:21:03 +0000
115@@ -0,0 +1,59 @@
116+/*
117+ * Copyright (C) 2014 Canonical Ltd.
118+ *
119+ * This program is free software: you can redistribute it and/or modify it
120+ * under the terms of the GNU General Public License version 3, as published
121+ * by the Free Software Foundation.
122+ *
123+ * This program is distributed in the hope that it will be useful, but
124+ * WITHOUT ANY WARRANTY; without even the implied warranties of
125+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
126+ * PURPOSE. See the GNU General Public License for more details.
127+ *
128+ * You should have received a copy of the GNU General Public License along
129+ * with this program. If not, see <http://www.gnu.org/licenses/>.
130+ *
131+ * In addition, as a special exception, the copyright holders give
132+ * permission to link the code of portions of this program with the
133+ * OpenSSL library under certain conditions as described in each
134+ * individual source file, and distribute linked combinations
135+ * including the two.
136+ * You must obey the GNU General Public License in all respects
137+ * for all of the code used other than OpenSSL. If you modify
138+ * file(s) with this exception, you may extend this exception to your
139+ * version of the file(s), but you are not obligated to do so. If you
140+ * do not wish to do so, delete this exception statement from your
141+ * version. If you delete this exception statement from all source
142+ * files in the program, then also delete it here.
143+ */
144+
145+#ifndef _DOWNLOAD_MANAGER_TOOL_H_
146+#define _DOWNLOAD_MANAGER_TOOL_H_
147+
148+#include <QString>
149+#include <download-manager.h>
150+
151+class DownloadManagerTool : public QObject {
152+ Q_OBJECT
153+
154+public:
155+ explicit DownloadManagerTool(QObject *parent=0);
156+
157+public slots:
158+ void setClickTokenURL(QString url) { _url = url;};
159+ void fetchClickToken();
160+
161+private slots:
162+ void handleFetchResponse(QString response);
163+
164+signals:
165+ void finished();
166+
167+private:
168+ QString _url;
169+ ClickScope::DownloadManager _dm;
170+};
171+
172+#endif /* _DOWNLOAD_MANAGER_TOOL_H_ */
173+
174+

Subscribers

People subscribed via source and target branches

to all changes: