47
constexpr char BUS_NAME[] = "com.canonical.StorageFramework.Provider.ProviderTest";
48
static const map<QString, QString> BUS_NAMES =
50
{ "google-drive-scope", "com.canonical.StorageFramework.Provider.ProviderTest" },
51
{ "com.canonical.scopes.mcloud_mcloud_mcloud", "com.canonical.StorageFramework.Provider.McloudProvider" }
81
catch (std::exception const&)
87
catch (std::exception const& e)
83
qCritical() << "shutdown error"; // TODO, log the error properly
89
qCritical() << "shutdown error" << e.what();
127
134
make_exceptional_future(qf_, RuntimeDestroyedException("Runtime::accounts()"));
133
static QString const service_ids[] = { "com.canonical.scopes.mcloud_mcloud_mcloud", "google-drive-scope" };
137
143
QVector<Account::SPtr> accounts;
138
for (auto const service_id : service_ids)
144
for (auto const map_entry : BUS_NAMES)
146
auto service_id = map_entry.first;
140
147
for (auto const& a : manager_->availableAccounts(service_id))
142
qDebug() << "got account:" << a->displayName() << a->serviceId() << a->id();
143
149
auto object_path = QStringLiteral("/provider/%1").arg(a->id());
144
accounts.append(make_account(BUS_NAME, object_path,
145
"", a->serviceId(), a->displayName()));
152
auto bus_name = map_entry.second;
153
accounts.append(make_account(bus_name, object_path,
154
"", a->serviceId(), a->displayName()));
157
catch (LocalCommsException const& e)
159
qDebug() << "RuntimeImpl: ignoring non-existent provider" << a->serviceId();
148
163
accounts_ = accounts;
149
164
make_ready_future(qf_, accounts);
151
167
catch (StorageException const& e)
153
169
make_exceptional_future(qf_, e);
157
175
void RuntimeImpl::timeout()
159
177
make_exceptional_future(qf_, ResourceException("Runtime::accounts(): timeout retrieving Online accounts", 0));
162
181
shared_ptr<Account> RuntimeImpl::make_test_account(QString const& bus_name,
163
182
QString const& object_path)