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
1=== modified file 'src/location_service/com/ubuntu/location/connectivity/nm.h'
2--- src/location_service/com/ubuntu/location/connectivity/nm.h 2015-02-26 10:59:22 +0000
3+++ src/location_service/com/ubuntu/location/connectivity/nm.h 2016-05-24 09:44:32 +0000
4@@ -68,7 +68,7 @@
5 }
6
7 typedef AccessPoint Interface;
8- typedef std::uint32_t ValueType;
9+ typedef std::int32_t ValueType;
10 static const bool readable = true;
11 static const bool writable = false;
12 };
13
14=== modified file 'src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h'
15--- src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h 2014-06-23 07:47:27 +0000
16+++ src/location_service/com/ubuntu/location/providers/gps/net_cpp_gps_xtra_downloader.h 2016-05-24 09:44:32 +0000
17@@ -24,6 +24,8 @@
18 #include <core/net/http/request.h>
19 #include <core/net/http/response.h>
20
21+#include <random>
22+
23 namespace com { namespace ubuntu { namespace location { namespace providers { namespace gps { namespace android {
24 struct NetCppGpsXtraDownloader : public GpsXtraDownloader
25 {
26
27=== modified file 'src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp'
28--- src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp 2014-08-14 20:31:09 +0000
29+++ src/location_service/com/ubuntu/location/service/ichnaea_reporter.cpp 2016-05-24 09:44:32 +0000
30@@ -122,8 +122,12 @@
31
32 double Object::to_double() const
33 {
34- throw_if_type_mismatch<json_type_double>(object);
35- return json_object_get_double(object);
36+ if (json_object_is_type(object, json_type_double))
37+ return json_object_get_double(object);
38+ if (json_object_is_type(object, json_type_int))
39+ return json_object_get_int(object);
40+
41+ throw std::logic_error{"Type mismatch"};
42 }
43
44 std::string Object::to_string() const
45
46=== modified file 'tests/acceptance_tests.cpp'
47--- tests/acceptance_tests.cpp 2016-03-11 13:51:03 +0000
48+++ tests/acceptance_tests.cpp 2016-05-24 09:44:32 +0000
49@@ -56,6 +56,7 @@
50 #include <chrono>
51 #include <iostream>
52 #include <memory>
53+#include <random>
54 #include <set>
55 #include <stdexcept>
56
57
58=== modified file 'tests/ichnaea_reporter_test.cpp'
59--- tests/ichnaea_reporter_test.cpp 2014-07-15 22:34:40 +0000
60+++ tests/ichnaea_reporter_test.cpp 2016-05-24 09:44:32 +0000
61@@ -190,7 +190,7 @@
62 item.get(Reporter::Json::lon).to_double());
63
64 auto wifis = item.get(Reporter::Json::wifi);
65- EXPECT_EQ(1u, wifis.array_size());
66+ EXPECT_EQ(1u, wifis.array_size());
67
68 auto wifi = wifis.get_object_for_index(0);
69 EXPECT_EQ(ref_bssid.get(), wifi.get(Reporter::Json::Wifi::key).to_string());
70@@ -213,7 +213,7 @@
71
72 core::posix::ChildProcess server = core::posix::fork(
73 std::bind(testing::a_web_server(web_server_configuration), cps),
74- core::posix::StandardStream::empty);
75+ core::posix::StandardStream::empty);
76
77 using namespace ::testing;
78
79@@ -225,6 +225,8 @@
80 ON_CALL(*wireless_network, frequency()).WillByDefault(ReturnRef(ref_frequency));
81 ON_CALL(*wireless_network, signal_strength()).WillByDefault(ReturnRef(ref_strength));
82
83+ cps.wait_for_signal_ready_for(std::chrono::seconds{2});
84+
85 location::service::ichnaea::Reporter::Configuration config
86 {
87 "http://127.0.0.1:5000",
88@@ -237,7 +239,7 @@
89 reporter.start();
90 reporter.report(reference_position_update, {wireless_network}, {ref_cell});
91
92- cps.wait_for_signal_ready_for(std::chrono::seconds{2});
93+ std::this_thread::sleep_for(std::chrono::milliseconds{500});
94
95 server.send_signal_or_throw(core::posix::Signal::sig_term);
96 auto result = server.wait_for(core::posix::wait::Flags::untraced);
97
98=== modified file 'tests/wgs84_test.cpp'
99--- tests/wgs84_test.cpp 2013-12-10 09:42:54 +0000
100+++ tests/wgs84_test.cpp 2016-05-24 09:44:32 +0000
101@@ -23,6 +23,8 @@
102
103 #include <gtest/gtest.h>
104
105+#include <random>
106+
107 TEST(Latitude, constructing_a_latitude_with_invalid_value_throws)
108 {
109 static const double min_value = com::ubuntu::location::wgs84::CoordinateTraits<com::ubuntu::location::wgs84::Latitude>::min();

Subscribers

People subscribed via source and target branches