Merge lp:~thomas-voss/location-service/fix-1584860 into lp:location-service/trunk

Proposed by Thomas Voß
Status: Merged
Approved by: Thomas Voß
Approved revision: 252
Merged at revision: 248
Proposed branch: lp:~thomas-voss/location-service/fix-1584860
Merge into: lp:location-service/trunk
Diff against target: 109 lines (+17/-6)
6 files modified
src/location_service/com/ubuntu/location/connectivity/nm.h (+1/-1)
src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h (+2/-0)
src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp (+6/-2)
tests/acceptance_tests.cpp (+1/-0)
tests/ichnaea_reporter_test.cpp (+5/-3)
tests/wgs84_test.cpp (+2/-0)
To merge this branch: bzr merge lp:~thomas-voss/location-service/fix-1584860
Reviewer Review Type Date Requested Status
Scott Sweeny (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+295513@code.launchpad.net

Commit message

Fix #1584860. The NM update altered the type of LastSeen to int32.

Description of the change

Fix #1584860. The NM update altered the type of LastSeen to int32.

To post a comment you must log in.
Revision history for this message
Scott Sweeny (ssweeny) wrote :

LGTM

review: Approve
249. By Thomas Voß

Add missing include <random>.

250. By Thomas Voß

Add another missing include for <random>.

251. By Thomas Voß

And another missing include <random>.

252. By Thomas Voß

Make json value extraction more robust.
Adjust timing logic in test case.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/location_service/com/ubuntu/location/connectivity/nm.h'
--- src/location_service/com/ubuntu/location/connectivity/nm.h 2015-02-26 10:59:22 +0000
+++ src/location_service/com/ubuntu/location/connectivity/nm.h 2016-05-24 09:44:32 +0000
@@ -68,7 +68,7 @@
68 }68 }
6969
70 typedef AccessPoint Interface;70 typedef AccessPoint Interface;
71 typedef std::uint32_t ValueType;71 typedef std::int32_t ValueType;
72 static const bool readable = true;72 static const bool readable = true;
73 static const bool writable = false;73 static const bool writable = false;
74 };74 };
7575
=== modified file 'src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h'
--- src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h 2014-06-23 07:47:27 +0000
+++ src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h 2016-05-24 09:44:32 +0000
@@ -24,6 +24,8 @@
24#include <core/net/http/request.h>24#include <core/net/http/request.h>
25#include <core/net/http/response.h>25#include <core/net/http/response.h>
2626
27#include <random>
28
27namespace com { namespace ubuntu { namespace location { namespace providers { namespace gps { namespace android {29namespace com { namespace ubuntu { namespace location { namespace providers { namespace gps { namespace android {
28struct NetCppGpsXtraDownloader : public GpsXtraDownloader30struct NetCppGpsXtraDownloader : public GpsXtraDownloader
29{31{
3032
=== modified file 'src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp'
--- src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp 2014-08-14 20:31:09 +0000
+++ src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp 2016-05-24 09:44:32 +0000
@@ -122,8 +122,12 @@
122122
123double Object::to_double() const123double Object::to_double() const
124{124{
125 throw_if_type_mismatch<json_type_double>(object);125 if (json_object_is_type(object, json_type_double))
126 return json_object_get_double(object);126 return json_object_get_double(object);
127 if (json_object_is_type(object, json_type_int))
128 return json_object_get_int(object);
129
130 throw std::logic_error{"Type mismatch"};
127}131}
128132
129std::string Object::to_string() const133std::string Object::to_string() const
130134
=== modified file 'tests/acceptance_tests.cpp'
--- tests/acceptance_tests.cpp 2016-03-11 13:51:03 +0000
+++ tests/acceptance_tests.cpp 2016-05-24 09:44:32 +0000
@@ -56,6 +56,7 @@
56#include <chrono>56#include <chrono>
57#include <iostream>57#include <iostream>
58#include <memory>58#include <memory>
59#include <random>
59#include <set>60#include <set>
60#include <stdexcept>61#include <stdexcept>
6162
6263
=== modified file 'tests/ichnaea_reporter_test.cpp'
--- tests/ichnaea_reporter_test.cpp 2014-07-15 22:34:40 +0000
+++ tests/ichnaea_reporter_test.cpp 2016-05-24 09:44:32 +0000
@@ -190,7 +190,7 @@
190 item.get(Reporter::Json::lon).to_double());190 item.get(Reporter::Json::lon).to_double());
191191
192 auto wifis = item.get(Reporter::Json::wifi);192 auto wifis = item.get(Reporter::Json::wifi);
193 EXPECT_EQ(1u, wifis.array_size());193 EXPECT_EQ(1u, wifis.array_size());
194194
195 auto wifi = wifis.get_object_for_index(0);195 auto wifi = wifis.get_object_for_index(0);
196 EXPECT_EQ(ref_bssid.get(), wifi.get(Reporter::Json::Wifi::key).to_string());196 EXPECT_EQ(ref_bssid.get(), wifi.get(Reporter::Json::Wifi::key).to_string());
@@ -213,7 +213,7 @@
213213
214 core::posix::ChildProcess server = core::posix::fork(214 core::posix::ChildProcess server = core::posix::fork(
215 std::bind(testing::a_web_server(web_server_configuration), cps),215 std::bind(testing::a_web_server(web_server_configuration), cps),
216 core::posix::StandardStream::empty);216 core::posix::StandardStream::empty);
217217
218 using namespace ::testing;218 using namespace ::testing;
219219
@@ -225,6 +225,8 @@
225 ON_CALL(*wireless_network, frequency()).WillByDefault(ReturnRef(ref_frequency));225 ON_CALL(*wireless_network, frequency()).WillByDefault(ReturnRef(ref_frequency));
226 ON_CALL(*wireless_network, signal_strength()).WillByDefault(ReturnRef(ref_strength));226 ON_CALL(*wireless_network, signal_strength()).WillByDefault(ReturnRef(ref_strength));
227227
228 cps.wait_for_signal_ready_for(std::chrono::seconds{2});
229
228 location::service::ichnaea::Reporter::Configuration config230 location::service::ichnaea::Reporter::Configuration config
229 {231 {
230 "http://127.0.0.1:5000",232 "http://127.0.0.1:5000",
@@ -237,7 +239,7 @@
237 reporter.start();239 reporter.start();
238 reporter.report(reference_position_update, {wireless_network}, {ref_cell});240 reporter.report(reference_position_update, {wireless_network}, {ref_cell});
239241
240 cps.wait_for_signal_ready_for(std::chrono::seconds{2});242 std::this_thread::sleep_for(std::chrono::milliseconds{500});
241243
242 server.send_signal_or_throw(core::posix::Signal::sig_term);244 server.send_signal_or_throw(core::posix::Signal::sig_term);
243 auto result = server.wait_for(core::posix::wait::Flags::untraced);245 auto result = server.wait_for(core::posix::wait::Flags::untraced);
244246
=== modified file 'tests/wgs84_test.cpp'
--- tests/wgs84_test.cpp 2013-12-10 09:42:54 +0000
+++ tests/wgs84_test.cpp 2016-05-24 09:44:32 +0000
@@ -23,6 +23,8 @@
2323
24#include <gtest/gtest.h>24#include <gtest/gtest.h>
2525
26#include <random>
27
26TEST(Latitude, constructing_a_latitude_with_invalid_value_throws)28TEST(Latitude, constructing_a_latitude_with_invalid_value_throws)
27{29{
28 static const double min_value = com::ubuntu::location::wgs84::CoordinateTraits<com::ubuntu::location::wgs84::Latitude>::min();30 static const double min_value = com::ubuntu::location::wgs84::CoordinateTraits<com::ubuntu::location::wgs84::Latitude>::min();

Subscribers

People subscribed via source and target branches