Merge lp:~marcustomlinson/unity-scopes-api/merge-trunk into lp:unity-scopes-api/devel

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Michal Hruby
Approved revision: 422
Merged at revision: 421
Proposed branch: lp:~marcustomlinson/unity-scopes-api/merge-trunk
Merge into: lp:unity-scopes-api/devel
Diff against target: 856 lines (+257/-86)
25 files modified
CONFIGFILES (+4/-4)
debian/changelog (+24/-0)
include/unity/scopes/internal/DfltConfig.h.in (+3/-3)
scoperegistry/scoperegistry.cpp (+69/-2)
src/scopes/internal/JsonSettingsSchema.cpp (+1/-1)
src/scopes/internal/smartscopes/SSRegistryObject.cpp (+3/-2)
src/scopes/internal/zmq_middleware/ZmqConfig.cpp (+2/-2)
src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp (+1/-1)
src/scopes/internal/zmq_middleware/ZmqObject.cpp (+32/-35)
test/gtest/scopes/Activation/Activation_test.cpp (+18/-1)
test/gtest/scopes/Activation/Runtime.ini.in (+1/-1)
test/gtest/scopes/Filters/Filters_test.cpp (+18/-1)
test/gtest/scopes/Filters/Runtime.ini.in (+1/-1)
test/gtest/scopes/IdleShutdown/IdleShutdown_test.cpp (+14/-0)
test/gtest/scopes/IdleShutdown/Runtime.ini.in (+1/-1)
test/gtest/scopes/Invocation/Invocation_test.cpp (+17/-2)
test/gtest/scopes/Invocation/Runtime.ini.in (+1/-1)
test/gtest/scopes/Invocation/TestScope.cpp (+1/-1)
test/gtest/scopes/Registry/CMakeLists.txt (+1/-0)
test/gtest/scopes/Registry/Registry_test.cpp (+4/-4)
test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in (+2/-2)
test/gtest/scopes/Runtime/Runtime.ini.in (+1/-1)
test/gtest/scopes/Runtime/Runtime_test.cpp (+22/-0)
test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp (+6/-10)
test/gtest/scopes/internal/zmq_middleware/RegistryI/RegistryI_test.cpp (+10/-10)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/merge-trunk
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michal Hruby (community) Approve
Review via email: mp+228118@code.launchpad.net

Commit message

Merge trunk.

Description of the change

Merge trunk.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

Yep, +1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
422. By Marcus Tomlinson

Whoops, one change that shouldn't have been reverted

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CONFIGFILES'
--- CONFIGFILES 2014-07-14 06:54:43 +0000
+++ CONFIGFILES 2014-07-24 15:00:51 +0000
@@ -84,7 +84,7 @@
84 or terminate correctly. If a scope does not respond84 or terminate correctly. If a scope does not respond
85 within the allotted time, it is killed with SIGKILL.85 within the allotted time, it is killed with SIGKILL.
8686
87 The default value is 2500 milliseconds.87 The default value is 4000 milliseconds.
8888
89 Note that this value must be less than Locate.Timeout in the [<Middleware>]89 Note that this value must be less than Locate.Timeout in the [<Middleware>]
90 config group, otherwise the middleware can prematurely conclude that90 config group, otherwise the middleware can prematurely conclude that
@@ -144,7 +144,7 @@
144 within the specified time, the invocation throws a TimeoutException, possibly144 within the specified time, the invocation throws a TimeoutException, possibly
145 after asking the registry to start the target process first (see Locate.Timeout).145 after asking the registry to start the target process first (see Locate.Timeout).
146146
147 The default value is 300 milliseconds.147 The default value is 500 milliseconds.
148148
149- Smartscopes.Registry.EndpointDir149- Smartscopes.Registry.EndpointDir
150150
@@ -164,11 +164,11 @@
164 in Registry.ini, otherwise invocations on a scope that needs to be activated164 in Registry.ini, otherwise invocations on a scope that needs to be activated
165 first can fail, even though the activation succeeded.165 first can fail, even though the activation succeeded.
166166
167 Only values in the range 10 to 5000 milliseconds are accepted. (Values outside167 Only values in the range 10 to 15000 milliseconds are accepted. (Values outside
168 this range would either cause locate() to falsely conclude that a scope168 this range would either cause locate() to falsely conclude that a scope
169 could not be started, or cause an unacceptably long wait time.)169 could not be started, or cause an unacceptably long wait time.)
170170
171 The default value is 3000 milliseconds.171 The default value is 5000 milliseconds.
172172
173- Registry.Timeout173- Registry.Timeout
174174
175175
=== modified file 'debian/changelog'
--- debian/changelog 2014-07-23 14:12:45 +0000
+++ debian/changelog 2014-07-24 15:00:51 +0000
@@ -5,6 +5,30 @@
55
6 -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Mon, 21 Jul 2014 09:14:39 +02006 -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Mon, 21 Jul 2014 09:14:39 +0200
77
8unity-scopes-api (0.5.2+14.10.20140723-0ubuntu1) utopic; urgency=low
9
10 [ Pete Woods ]
11 * Normalize relative paths (LP: #1340135)
12
13 [ Marcus Tomlinson ]
14 * Call locate() before every two-way request. Increased two-way
15 invocation timeouts.
16
17 [ Michi Henning ]
18 * Normalize relative paths (LP: #1340135)
19
20 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 23 Jul 2014 22:06:06 +0000
21
22unity-scopes-api (0.5.2+14.10.20140722-0ubuntu1) utopic; urgency=low
23
24 [ thomas-voss ]
25 * Force building with g++ 4.9
26
27 [ Michi Henning ]
28 * Force building with g++ 4.9
29
30 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 22 Jul 2014 09:52:30 +0000
31
8unity-scopes-api (0.5.2+14.10.20140715-0ubuntu1) utopic; urgency=low32unity-scopes-api (0.5.2+14.10.20140715-0ubuntu1) utopic; urgency=low
933
10 [ Michal Hruby ]34 [ Michal Hruby ]
1135
=== modified file 'include/unity/scopes/internal/DfltConfig.h.in'
--- include/unity/scopes/internal/DfltConfig.h.in 2014-07-14 06:54:43 +0000
+++ include/unity/scopes/internal/DfltConfig.h.in 2014-07-24 15:00:51 +0000
@@ -49,9 +49,9 @@
4949
50static const int DFLT_REAP_EXPIRY = 45; // seconds50static const int DFLT_REAP_EXPIRY = 45; // seconds
51static const int DFLT_REAP_INTERVAL = 10; // seconds51static const int DFLT_REAP_INTERVAL = 10; // seconds
52static const int DFLT_PROCESS_TIMEOUT = 2500; // milliseconds52static const int DFLT_PROCESS_TIMEOUT = 4000; // milliseconds
53static const int DFLT_ZMQ_TWOWAY_TIMEOUT = 300; // milliseconds53static const int DFLT_ZMQ_TWOWAY_TIMEOUT = 500; // milliseconds
54static const int DFLT_ZMQ_LOCATE_TIMEOUT = 3000; // milliseconds54static const int DFLT_ZMQ_LOCATE_TIMEOUT = 5000; // milliseconds
55static const int DFLT_ZMQ_REGISTRY_TIMEOUT = 5000; // milliseconds55static const int DFLT_ZMQ_REGISTRY_TIMEOUT = 5000; // milliseconds
5656
57} // namespace internal57} // namespace internal
5858
=== modified file 'scoperegistry/scoperegistry.cpp'
--- scoperegistry/scoperegistry.cpp 2014-07-15 05:50:10 +0000
+++ scoperegistry/scoperegistry.cpp 2014-07-24 15:00:51 +0000
@@ -235,6 +235,44 @@
235 return click_scopes;235 return click_scopes;
236}236}
237237
238static bool starts_with(const string& compare, const string& prefix)
239{
240 bool result = false;
241 if (compare.length() >= prefix.length())
242 {
243 result = (compare.compare(0, prefix.length(), prefix) == 0);
244 }
245 return result;
246}
247
248static bool is_uri(const string& path)
249{
250 return starts_with(path, "color://")
251 || starts_with(path, "file://")
252 || starts_with(path, "ftp://")
253 || starts_with(path, "gradient://")
254 || starts_with(path, "http://")
255 || starts_with(path, "https://")
256 || starts_with(path, "image://");
257}
258
259void convert_relative_attribute(VariantMap& inner_map, const string& id, const filesystem::path& scope_dir)
260{
261 auto logo_it = inner_map.find(id);
262 if (logo_it != inner_map.end()
263 && logo_it->second.which() == Variant::String)
264 {
265 auto path = logo_it->second.get_string();
266
267 // Do not normalize supported URI schemas
268 if(!is_uri(path))
269 {
270 logo_it->second = Variant(
271 relative_scope_path_to_abs_path(path, scope_dir).native());
272 }
273 }
274}
275
238// For each scope, open the config file for the scope, create the metadata info from the config,276// For each scope, open the config file for the scope, create the metadata info from the config,
239// and add an entry to the RegistryObject.277// and add an entry to the RegistryObject.
240// If the scope uses settings, also parse the settings file and add the settings to the metadata.278// If the scope uses settings, also parse the settings file and add the settings to the metadata.
@@ -277,20 +315,49 @@
277 mi->set_author(sc.author());315 mi->set_author(sc.author());
278 mi->set_invisible(sc.invisible());316 mi->set_invisible(sc.invisible());
279 mi->set_appearance_attributes(sc.appearance_attributes());317 mi->set_appearance_attributes(sc.appearance_attributes());
318
319 // Prepend scope_dir to pageheader logo path if logo path is relative.
320 // TODO: Once we have type-safe parsing in the config files, remove
321 // the calls to which(). We should be able to rely on things
322 // having the correct type. That's the whole point of having
323 // the *Config classes.
324 auto app_attrs = sc.appearance_attributes();
325 auto ph_it = app_attrs.find("page-header");
326 if (ph_it != app_attrs.end() && ph_it->second.which() == Variant::Dict)
327 {
328 auto inner_map = ph_it->second.get_dict();
329 convert_relative_attribute(inner_map, "logo", scope_dir);
330 convert_relative_attribute(inner_map, "background", scope_dir);
331 convert_relative_attribute(inner_map, "navigation-background", scope_dir);
332 app_attrs["page-header"] = Variant(inner_map);
333 }
334 convert_relative_attribute(app_attrs, "category-header-background", scope_dir);
335 mi->set_appearance_attributes(app_attrs);
336
280 mi->set_scope_directory(scope_dir.native());337 mi->set_scope_directory(scope_dir.native());
281 mi->set_results_ttl_type(sc.results_ttl_type());338 mi->set_results_ttl_type(sc.results_ttl_type());
282 mi->set_location_data_needed(sc.location_data_needed());339 mi->set_location_data_needed(sc.location_data_needed());
283340
284 try341 try
285 {342 {
286 mi->set_art(relative_scope_path_to_abs_path(sc.art(), scope_dir).native());343 auto art = sc.art();
344 if (!is_uri(art))
345 {
346 art = relative_scope_path_to_abs_path(art, scope_dir).native();
347 }
348 mi->set_art(art);
287 }349 }
288 catch (NotFoundException const&)350 catch (NotFoundException const&)
289 {351 {
290 }352 }
291 try353 try
292 {354 {
293 mi->set_icon(relative_scope_path_to_abs_path(sc.icon(), scope_dir).native());355 auto icon = sc.icon();
356 if (!is_uri(icon))
357 {
358 icon = relative_scope_path_to_abs_path(icon, scope_dir).native();
359 }
360 mi->set_icon(icon);
294 }361 }
295 catch (NotFoundException const&)362 catch (NotFoundException const&)
296 {363 {
297364
=== modified file 'src/scopes/internal/JsonSettingsSchema.cpp'
--- src/scopes/internal/JsonSettingsSchema.cpp 2014-07-16 08:42:30 +0000
+++ src/scopes/internal/JsonSettingsSchema.cpp 2014-07-24 15:00:51 +0000
@@ -49,7 +49,7 @@
49public:49public:
50 NONCOPYABLE(Setting);50 NONCOPYABLE(Setting);
5151
52 explicit Setting(Json::Value const& v);52 Setting(Json::Value const& v);
53 ~Setting() = default;53 ~Setting() = default;
5454
55 string id() const;55 string id() const;
5656
=== modified file 'src/scopes/internal/smartscopes/SSRegistryObject.cpp'
--- src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-07-04 04:50:38 +0000
+++ src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-07-24 15:00:51 +0000
@@ -124,9 +124,10 @@
124 return scopes_;124 return scopes_;
125}125}
126126
127ObjectProxy SSRegistryObject::locate(std::string const& /*identity*/)127ObjectProxy SSRegistryObject::locate(std::string const& identity)
128{128{
129 throw internal::RegistryException("SSRegistryObject::locate(): operation not available");129 // Smart Scopes are not fork and execed, so we simply return the proxy here
130 return get_metadata(identity).proxy();
130}131}
131132
132bool SSRegistryObject::is_scope_running(std::string const&)133bool SSRegistryObject::is_scope_running(std::string const&)
133134
=== modified file 'src/scopes/internal/zmq_middleware/ZmqConfig.cpp'
--- src/scopes/internal/zmq_middleware/ZmqConfig.cpp 2014-07-14 06:54:43 +0000
+++ src/scopes/internal/zmq_middleware/ZmqConfig.cpp 2014-07-24 15:00:51 +0000
@@ -80,9 +80,9 @@
80 }80 }
8181
82 locate_timeout_ = get_optional_int(zmq_config_group, locate_timeout_key, DFLT_ZMQ_LOCATE_TIMEOUT);82 locate_timeout_ = get_optional_int(zmq_config_group, locate_timeout_key, DFLT_ZMQ_LOCATE_TIMEOUT);
83 if (locate_timeout_ < 10 || locate_timeout_ > 5000)83 if (locate_timeout_ < 10 || locate_timeout_ > 15000)
84 {84 {
85 throw_ex("Illegal value (" + to_string(locate_timeout_) + ") for " + locate_timeout_key + ": value must be 10-5000");85 throw_ex("Illegal value (" + to_string(locate_timeout_) + ") for " + locate_timeout_key + ": value must be 10-15000");
86 }86 }
8787
88 registry_endpoint_dir_ = get_optional_string(zmq_config_group, registry_endpoint_dir_key);88 registry_endpoint_dir_ = get_optional_string(zmq_config_group, registry_endpoint_dir_key);
8989
=== modified file 'src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp'
--- src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp 2014-07-16 08:46:47 +0000
+++ src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp 2014-07-24 15:00:51 +0000
@@ -863,7 +863,7 @@
863 endpoint = "ipc://" + endpoint_dir + "/" + name;863 endpoint = "ipc://" + endpoint_dir + "/" + name;
864 }864 }
865865
866 auto a = make_shared<ObjectAdapter>(*this, name, endpoint, mode, pool_size, idle_timeout);866 shared_ptr<ObjectAdapter> a(new ObjectAdapter(*this, name, endpoint, mode, pool_size, idle_timeout));
867 a->activate();867 a->activate();
868 am_[name] = a;868 am_[name] = a;
869 return a;869 return a;
870870
=== modified file 'src/scopes/internal/zmq_middleware/ZmqObject.cpp'
--- src/scopes/internal/zmq_middleware/ZmqObject.cpp 2014-05-29 15:41:42 +0000
+++ src/scopes/internal/zmq_middleware/ZmqObject.cpp 2014-07-24 15:00:51 +0000
@@ -208,41 +208,38 @@
208208
209ZmqReceiver ZmqObjectProxy::invoke_twoway_(capnp::MessageBuilder& out_params, int64_t timeout)209ZmqReceiver ZmqObjectProxy::invoke_twoway_(capnp::MessageBuilder& out_params, int64_t timeout)
210{210{
211 try211 auto registry_proxy = mw_base()->registry_proxy();
212 {212
213 return invoke_twoway__(out_params, timeout);213 // If a registry is configured and this object is not the registry itself,
214 }214 // attempt to locate the scope before invoking it.
215 catch (TimeoutException const&)215 if (registry_proxy && identity() != registry_proxy->identity())
216 {216 {
217 auto registry_proxy = mw_base()->registry_proxy();217 try
218218 {
219 // If no registry is configured or if this object is the registry itself, rethrow the exception219 ObjectProxy new_proxy = registry_proxy->locate(identity());
220 if (!registry_proxy || identity() == registry_proxy->identity())220 // update our proxy with the newly received data
221 {221 // (we need to first store values in local variables outside of the mutex,
222 throw;222 // otherwise we will deadlock on the following ZmqObjectProxy methods)
223 }223 std::string endpoint = new_proxy->endpoint();
224224 std::string identity = new_proxy->identity();
225 // rebind225 std::string category = new_proxy->target_category();
226 ObjectProxy new_proxy = registry_proxy->locate(identity());226 int64_t timeout = new_proxy->timeout();
227227 {
228 // update our proxy with the newly received data228 lock_guard<mutex> lock(shared_mutex);
229 // (we need to first store values in local variables outside of the mutex,229 endpoint_ = endpoint;
230 // otherwise we will deadlock on the following ZmqObjectProxy methods)230 identity_ = identity;
231 std::string endpoint = new_proxy->endpoint();231 category_ = category;
232 std::string identity = new_proxy->identity();232 timeout_ = timeout;
233 std::string category = new_proxy->target_category();233 }
234 int64_t timeout = new_proxy->timeout();234 }
235 {235 catch (NotFoundException const&)
236 lock_guard<mutex> lock(shared_mutex);236 {
237 endpoint_ = endpoint;237 // Ignore a failed locate() for scopes unknown to the registry
238 identity_ = identity;238 }
239 category_ = category;239 }
240 timeout_ = timeout;240
241 }241 // Try the invocation
242242 return invoke_twoway__(out_params, timeout);
243 // retry the invocation
244 return invoke_twoway__(out_params, timeout);
245 }
246}243}
247244
248// Get a socket to the endpoint for this proxy and write the request on the wire.245// Get a socket to the endpoint for this proxy and write the request on the wire.
249246
=== modified file 'test/gtest/scopes/Activation/Activation_test.cpp'
--- test/gtest/scopes/Activation/Activation_test.cpp 2014-07-02 09:36:34 +0000
+++ test/gtest/scopes/Activation/Activation_test.cpp 2014-07-24 15:00:51 +0000
@@ -21,6 +21,7 @@
21#include <unity/scopes/CategoryRenderer.h>21#include <unity/scopes/CategoryRenderer.h>
22#include <unity/scopes/internal/CategoryRegistry.h>22#include <unity/scopes/internal/CategoryRegistry.h>
23#include <unity/scopes/internal/CategorisedResultImpl.h>23#include <unity/scopes/internal/CategorisedResultImpl.h>
24#include <unity/scopes/internal/RegistryObject.h>
24#include <unity/scopes/internal/ResultReplyObject.h>25#include <unity/scopes/internal/ResultReplyObject.h>
25#include <unity/scopes/internal/RuntimeImpl.h>26#include <unity/scopes/internal/RuntimeImpl.h>
26#include <unity/scopes/internal/ScopeImpl.h>27#include <unity/scopes/internal/ScopeImpl.h>
@@ -514,7 +515,10 @@
514515
515 RaiiScopeThread(std::string const& scope_id, std::string const& configfile)516 RaiiScopeThread(std::string const& scope_id, std::string const& configfile)
516 : runtime(Runtime::create_scope_runtime(scope_id, configfile)),517 : runtime(Runtime::create_scope_runtime(scope_id, configfile)),
517 scope_thread([this, configfile]{ runtime->run_scope(&scope, configfile, ""); }) {}518 scope_thread([this, configfile]{ runtime->run_scope(&scope, configfile, ""); })
519 {
520 std::this_thread::sleep_for(std::chrono::milliseconds(500));
521 }
518522
519 ~RaiiScopeThread()523 ~RaiiScopeThread()
520 {524 {
@@ -523,9 +527,22 @@
523 }527 }
524};528};
525529
530std::shared_ptr<core::posix::SignalTrap> trap(core::posix::trap_signals_for_all_subsequent_threads({core::posix::Signal::sig_chld}));
531std::unique_ptr<core::posix::ChildProcess::DeathObserver> death_observer(core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap(trap));
532
533RuntimeImpl::SPtr run_test_registry()
534{
535 RuntimeImpl::SPtr runtime = RuntimeImpl::create("TestRegistry", "Runtime.ini");
536 MiddlewareBase::SPtr middleware = runtime->factory()->create("TestRegistry", "Zmq", "Zmq.ini");
537 RegistryObject::SPtr reg_obj(std::make_shared<RegistryObject>(*death_observer, std::make_shared<Executor>(), middleware));
538 middleware->add_registry_object("TestRegistry", reg_obj);
539 return runtime;
540}
541
526// does actual activation with a test scope542// does actual activation with a test scope
527TEST(Activation, scope)543TEST(Activation, scope)
528{544{
545 auto reg_rt = run_test_registry();
529 RaiiScopeThread<TestScope> scope_thread("TestScope", "Runtime.ini");546 RaiiScopeThread<TestScope> scope_thread("TestScope", "Runtime.ini");
530547
531 // parent: connect to scope and run a query548 // parent: connect to scope and run a query
532549
=== modified file 'test/gtest/scopes/Activation/Runtime.ini.in'
--- test/gtest/scopes/Activation/Runtime.ini.in 2014-01-14 17:31:16 +0000
+++ test/gtest/scopes/Activation/Runtime.ini.in 2014-07-24 15:00:51 +0000
@@ -1,5 +1,5 @@
1[Runtime]1[Runtime]
2Registry.Identity = Registry2Registry.Identity = TestRegistry
3Registry.ConfigFile = Registry.ini3Registry.ConfigFile = Registry.ini
4Default.Middleware = Zmq4Default.Middleware = Zmq
5Zmq.ConfigFile = Zmq.ini5Zmq.ConfigFile = Zmq.ini
66
=== modified file 'test/gtest/scopes/Filters/Filters_test.cpp'
--- test/gtest/scopes/Filters/Filters_test.cpp 2014-06-17 10:30:03 +0000
+++ test/gtest/scopes/Filters/Filters_test.cpp 2014-07-24 15:00:51 +0000
@@ -16,6 +16,7 @@
16 * Authored by: Pawel Stolowski <pawel.stolowski@canonical.com>16 * Authored by: Pawel Stolowski <pawel.stolowski@canonical.com>
17 */17 */
1818
19#include <unity/scopes/internal/RegistryObject.h>
19#include <unity/scopes/internal/RuntimeImpl.h>20#include <unity/scopes/internal/RuntimeImpl.h>
20#include <unity/scopes/internal/ScopeImpl.h>21#include <unity/scopes/internal/ScopeImpl.h>
21#include <unity/scopes/internal/FilterBaseImpl.h>22#include <unity/scopes/internal/FilterBaseImpl.h>
@@ -86,7 +87,10 @@
8687
87 RaiiScopeThread(std::string const& scope_id, std::string const& configfile)88 RaiiScopeThread(std::string const& scope_id, std::string const& configfile)
88 : runtime(Runtime::create_scope_runtime(scope_id, configfile)),89 : runtime(Runtime::create_scope_runtime(scope_id, configfile)),
89 scope_thread([this, configfile]{ runtime->run_scope(&scope, configfile, ""); }) {}90 scope_thread([this, configfile]{ runtime->run_scope(&scope, configfile, ""); })
91 {
92 std::this_thread::sleep_for(std::chrono::milliseconds(500));
93 }
9094
91 ~RaiiScopeThread()95 ~RaiiScopeThread()
92 {96 {
@@ -95,8 +99,21 @@
95 }99 }
96};100};
97101
102std::shared_ptr<core::posix::SignalTrap> trap(core::posix::trap_signals_for_all_subsequent_threads({core::posix::Signal::sig_chld}));
103std::unique_ptr<core::posix::ChildProcess::DeathObserver> death_observer(core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap(trap));
104
105RuntimeImpl::SPtr run_test_registry()
106{
107 RuntimeImpl::SPtr runtime = RuntimeImpl::create("TestRegistry", "Runtime.ini");
108 MiddlewareBase::SPtr middleware = runtime->factory()->create("TestRegistry", "Zmq", "Zmq.ini");
109 RegistryObject::SPtr reg_obj(std::make_shared<RegistryObject>(*death_observer, std::make_shared<Executor>(), middleware));
110 middleware->add_registry_object("TestRegistry", reg_obj);
111 return runtime;
112}
113
98TEST(Filters, scope)114TEST(Filters, scope)
99{115{
116 auto reg_rt = run_test_registry();
100 RaiiScopeThread<TestScope> scope_thread("TestScope", "Runtime.ini");117 RaiiScopeThread<TestScope> scope_thread("TestScope", "Runtime.ini");
101118
102 // parent: connect to scope and run a query119 // parent: connect to scope and run a query
103120
=== modified file 'test/gtest/scopes/Filters/Runtime.ini.in'
--- test/gtest/scopes/Filters/Runtime.ini.in 2014-01-24 12:51:40 +0000
+++ test/gtest/scopes/Filters/Runtime.ini.in 2014-07-24 15:00:51 +0000
@@ -1,5 +1,5 @@
1[Runtime]1[Runtime]
2Registry.Identity = Registry2Registry.Identity = TestRegistry
3Registry.ConfigFile = Registry.ini3Registry.ConfigFile = Registry.ini
4Default.Middleware = Zmq4Default.Middleware = Zmq
5Zmq.ConfigFile = Zmq.ini5Zmq.ConfigFile = Zmq.ini
66
=== modified file 'test/gtest/scopes/IdleShutdown/IdleShutdown_test.cpp'
--- test/gtest/scopes/IdleShutdown/IdleShutdown_test.cpp 2014-07-14 06:39:34 +0000
+++ test/gtest/scopes/IdleShutdown/IdleShutdown_test.cpp 2014-07-24 15:00:51 +0000
@@ -17,6 +17,7 @@
17 */17 */
1818
19#include <unity/scopes/CategorisedResult.h>19#include <unity/scopes/CategorisedResult.h>
20#include <unity/scopes/internal/RegistryObject.h>
20#include <unity/scopes/internal/RuntimeImpl.h>21#include <unity/scopes/internal/RuntimeImpl.h>
21#include <unity/scopes/internal/ScopeImpl.h>22#include <unity/scopes/internal/ScopeImpl.h>
2223
@@ -91,11 +92,24 @@
91 EXPECT_TRUE(duration < chrono::seconds(6));92 EXPECT_TRUE(duration < chrono::seconds(6));
92}93}
9394
95std::shared_ptr<core::posix::SignalTrap> trap(core::posix::trap_signals_for_all_subsequent_threads({core::posix::Signal::sig_chld}));
96std::unique_ptr<core::posix::ChildProcess::DeathObserver> death_observer(core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap(trap));
97
98RuntimeImpl::SPtr run_test_registry()
99{
100 RuntimeImpl::SPtr runtime = RuntimeImpl::create("TestRegistry", "Runtime.ini");
101 MiddlewareBase::SPtr middleware = runtime->factory()->create("TestRegistry", "Zmq", "Zmq.ini");
102 RegistryObject::SPtr reg_obj(std::make_shared<RegistryObject>(*death_observer, std::make_shared<Executor>(), middleware));
103 middleware->add_registry_object("TestRegistry", reg_obj);
104 return runtime;
105}
106
94// Check that the idle timeout for a server waits for synchronous operations107// Check that the idle timeout for a server waits for synchronous operations
95// to complete.108// to complete.
96109
97TEST(IdleTimeout, server_idle_timeout_while_operation_in_progress)110TEST(IdleTimeout, server_idle_timeout_while_operation_in_progress)
98{111{
112 auto reg_rt = run_test_registry();
99 auto start_time = chrono::steady_clock::now();113 auto start_time = chrono::steady_clock::now();
100114
101 {115 {
102116
=== modified file 'test/gtest/scopes/IdleShutdown/Runtime.ini.in'
--- test/gtest/scopes/IdleShutdown/Runtime.ini.in 2014-05-14 04:50:14 +0000
+++ test/gtest/scopes/IdleShutdown/Runtime.ini.in 2014-07-24 15:00:51 +0000
@@ -1,5 +1,5 @@
1[Runtime]1[Runtime]
2Registry.Identity = Registry2Registry.Identity = TestRegistry
3Registry.ConfigFile = Registry.ini3Registry.ConfigFile = Registry.ini
4Default.Middleware = Zmq4Default.Middleware = Zmq
5Zmq.ConfigFile = Zmq.ini5Zmq.ConfigFile = Zmq.ini
66
=== modified file 'test/gtest/scopes/Invocation/Invocation_test.cpp'
--- test/gtest/scopes/Invocation/Invocation_test.cpp 2014-07-22 04:38:48 +0000
+++ test/gtest/scopes/Invocation/Invocation_test.cpp 2014-07-24 15:00:51 +0000
@@ -25,6 +25,7 @@
25#include <unity/scopes/ActionMetadata.h>25#include <unity/scopes/ActionMetadata.h>
26#include <unity/scopes/CategorisedResult.h>26#include <unity/scopes/CategorisedResult.h>
27#include <unity/scopes/internal/MWScope.h>27#include <unity/scopes/internal/MWScope.h>
28#include <unity/scopes/internal/RegistryObject.h>
28#include <unity/scopes/internal/RuntimeImpl.h>29#include <unity/scopes/internal/RuntimeImpl.h>
29#include <unity/scopes/internal/ScopeImpl.h>30#include <unity/scopes/internal/ScopeImpl.h>
30#include <unity/scopes/ListenerBase.h>31#include <unity/scopes/ListenerBase.h>
@@ -40,6 +41,7 @@
4041
41using namespace std;42using namespace std;
42using namespace unity::scopes;43using namespace unity::scopes;
44using namespace unity::scopes::internal;
4345
44class TestReceiver : public SearchListenerBase46class TestReceiver : public SearchListenerBase
45{47{
@@ -89,12 +91,25 @@
89 condition_variable cond_;91 condition_variable cond_;
90};92};
9193
94std::shared_ptr<core::posix::SignalTrap> trap(core::posix::trap_signals_for_all_subsequent_threads({core::posix::Signal::sig_chld}));
95std::unique_ptr<core::posix::ChildProcess::DeathObserver> death_observer(core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap(trap));
96
97RuntimeImpl::SPtr run_test_registry()
98{
99 RuntimeImpl::SPtr runtime = RuntimeImpl::create("TestRegistry", "Runtime.ini");
100 MiddlewareBase::SPtr middleware = runtime->factory()->create("TestRegistry", "Zmq", "Zmq.ini");
101 RegistryObject::SPtr reg_obj(std::make_shared<RegistryObject>(*death_observer, std::make_shared<Executor>(), middleware));
102 middleware->add_registry_object("TestRegistry", reg_obj);
103 return runtime;
104}
105
92// Check that invoking on a scope after a timeout exception from a previous106// Check that invoking on a scope after a timeout exception from a previous
93// invocation works correctly. This tests that a failed socket is removed107// invocation works correctly. This tests that a failed socket is removed
94// from the connection pool in ZmqObject::invoke_twoway_().108// from the connection pool in ZmqObject::invoke_twoway_().
95109
96TEST(Invocation, timeout)110TEST(Invocation, timeout)
97{111{
112 auto reg_rt = run_test_registry();
98 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");113 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");
99 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");114 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");
100 mw->start();115 mw->start();
@@ -108,7 +123,7 @@
108 receiver->wait_until_finished();123 receiver->wait_until_finished();
109124
110 EXPECT_EQ(ListenerBase::Error, receiver->reason());125 EXPECT_EQ(ListenerBase::Error, receiver->reason());
111 EXPECT_EQ("unity::scopes::TimeoutException: Request timed out after 3000 milliseconds", receiver->error_message());126 EXPECT_EQ("unity::scopes::TimeoutException: Request timed out after 500 milliseconds", receiver->error_message());
112127
113 // Wait another three seconds, so TestScope is finally able to receive another request.128 // Wait another three seconds, so TestScope is finally able to receive another request.
114 this_thread::sleep_for(chrono::seconds(3));129 this_thread::sleep_for(chrono::seconds(3));
@@ -180,7 +195,7 @@
180195
181 // Give threads some time to bind to endpoints, to avoid getting ObjectNotExistException196 // Give threads some time to bind to endpoints, to avoid getting ObjectNotExistException
182 // from a synchronous remote call.197 // from a synchronous remote call.
183 this_thread::sleep_for(chrono::milliseconds(200));198 this_thread::sleep_for(chrono::milliseconds(500));
184199
185 auto rc = RUN_ALL_TESTS();200 auto rc = RUN_ALL_TESTS();
186201
187202
=== modified file 'test/gtest/scopes/Invocation/Runtime.ini.in'
--- test/gtest/scopes/Invocation/Runtime.ini.in 2014-04-17 01:36:29 +0000
+++ test/gtest/scopes/Invocation/Runtime.ini.in 2014-07-24 15:00:51 +0000
@@ -1,5 +1,5 @@
1[Runtime]1[Runtime]
2Registry.Identity = Registry2Registry.Identity = TestRegistry
3Registry.ConfigFile = Registry.ini3Registry.ConfigFile = Registry.ini
4Default.Middleware = Zmq4Default.Middleware = Zmq
5Zmq.ConfigFile = Zmq.ini5Zmq.ConfigFile = Zmq.ini
66
=== modified file 'test/gtest/scopes/Invocation/TestScope.cpp'
--- test/gtest/scopes/Invocation/TestScope.cpp 2014-07-16 03:01:10 +0000
+++ test/gtest/scopes/Invocation/TestScope.cpp 2014-07-24 15:00:51 +0000
@@ -71,7 +71,7 @@
7171
72 if (count++ == 0)72 if (count++ == 0)
73 {73 {
74 this_thread::sleep_for(chrono::milliseconds(4000)); // Force timeout on first call74 this_thread::sleep_for(chrono::milliseconds(1000)); // Force timeout on first call
75 }75 }
76 return SearchQueryBase::UPtr(new TestQuery(query, metadata));76 return SearchQueryBase::UPtr(new TestQuery(query, metadata));
77}77}
7878
=== modified file 'test/gtest/scopes/Registry/CMakeLists.txt'
--- test/gtest/scopes/Registry/CMakeLists.txt 2014-07-15 05:50:10 +0000
+++ test/gtest/scopes/Registry/CMakeLists.txt 2014-07-24 15:00:51 +0000
@@ -8,6 +8,7 @@
8add_definitions(-DTEST_RUNTIME_PATH="${CMAKE_CURRENT_BINARY_DIR}")8add_definitions(-DTEST_RUNTIME_PATH="${CMAKE_CURRENT_BINARY_DIR}")
9add_definitions(-DTEST_RUNTIME_FILE="${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini")9add_definitions(-DTEST_RUNTIME_FILE="${CMAKE_CURRENT_BINARY_DIR}/Runtime.ini")
10add_definitions(-DTEST_REGISTRY_PATH="${PROJECT_BINARY_DIR}/scoperegistry")10add_definitions(-DTEST_REGISTRY_PATH="${PROJECT_BINARY_DIR}/scoperegistry")
11add_definitions(-DTEST_SCOPE_A_PATH="${CMAKE_CURRENT_BINARY_DIR}/scopes/testscopeA")
1112
12add_executable(Registry_test Registry_test.cpp)13add_executable(Registry_test Registry_test.cpp)
13target_link_libraries(Registry_test ${TESTLIBS})14target_link_libraries(Registry_test ${TESTLIBS})
1415
=== modified file 'test/gtest/scopes/Registry/Registry_test.cpp'
--- test/gtest/scopes/Registry/Registry_test.cpp 2014-07-23 14:12:45 +0000
+++ test/gtest/scopes/Registry/Registry_test.cpp 2014-07-24 15:00:51 +0000
@@ -86,7 +86,7 @@
86 EXPECT_EQ("scope-A.DisplayName", meta.display_name());86 EXPECT_EQ("scope-A.DisplayName", meta.display_name());
87 EXPECT_EQ("scope-A.Description", meta.description());87 EXPECT_EQ("scope-A.Description", meta.description());
88 EXPECT_EQ("/foo/scope-A.Art", meta.art());88 EXPECT_EQ("/foo/scope-A.Art", meta.art());
89 EXPECT_EQ("/foo/scope-A.Icon", meta.icon());89 EXPECT_EQ("file://scope-A.Icon", meta.icon());
90 EXPECT_EQ("scope-A.HotKey", meta.hot_key());90 EXPECT_EQ("scope-A.HotKey", meta.hot_key());
91 EXPECT_FALSE(meta.invisible());91 EXPECT_FALSE(meta.invisible());
92 EXPECT_EQ("scope-A.SearchHint", meta.search_hint());92 EXPECT_EQ("scope-A.SearchHint", meta.search_hint());
@@ -103,14 +103,14 @@
103 EXPECT_EQ("fg_color", attrs["foreground-color"].get_string());103 EXPECT_EQ("fg_color", attrs["foreground-color"].get_string());
104 EXPECT_EQ("bg_color", attrs["background-color"].get_string());104 EXPECT_EQ("bg_color", attrs["background-color"].get_string());
105 EXPECT_TRUE(attrs["shape-images"].get_bool());105 EXPECT_TRUE(attrs["shape-images"].get_bool());
106 EXPECT_EQ("cat_header_bg_scheme", attrs["category-header-background"].get_string());106 EXPECT_EQ(TEST_SCOPE_A_PATH "/cat_header_bg_scheme", attrs["category-header-background"].get_string());
107 EXPECT_EQ("preview_button_color", attrs["preview-button-color"].get_string());107 EXPECT_EQ("preview_button_color", attrs["preview-button-color"].get_string());
108 EXPECT_EQ("overlay_color", attrs["logo-overlay-color"].get_string());108 EXPECT_EQ("overlay_color", attrs["logo-overlay-color"].get_string());
109 auto page_hdr = attrs["page-header"].get_dict();109 auto page_hdr = attrs["page-header"].get_dict();
110 EXPECT_EQ("some_url", page_hdr["logo"].get_string());110 EXPECT_EQ(TEST_SCOPE_A_PATH "/some_url", page_hdr["logo"].get_string());
111 EXPECT_EQ("fg_color", page_hdr["foreground-color"].get_string());111 EXPECT_EQ("fg_color", page_hdr["foreground-color"].get_string());
112 EXPECT_EQ("div_color", page_hdr["divider-color"].get_string());112 EXPECT_EQ("div_color", page_hdr["divider-color"].get_string());
113 EXPECT_EQ("nav_background", page_hdr["navigation-background"].get_string());113 EXPECT_EQ("http://nav_background", page_hdr["navigation-background"].get_string());
114114
115 const char *bart = TEST_RUNTIME_PATH "/scopes/testscopeB/data/scope-B.Art";115 const char *bart = TEST_RUNTIME_PATH "/scopes/testscopeB/data/scope-B.Art";
116 const char *bicon = TEST_RUNTIME_PATH "/scopes/testscopeB/data/scope-B.Icon";116 const char *bicon = TEST_RUNTIME_PATH "/scopes/testscopeB/data/scope-B.Icon";
117117
=== modified file 'test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in'
--- test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-07-22 10:38:18 +0000
+++ test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-07-24 15:00:51 +0000
@@ -3,7 +3,7 @@
3Description = scope-A.Description3Description = scope-A.Description
4Art = /foo/scope-A.Art4Art = /foo/scope-A.Art
5Author = Canonical Ltd.5Author = Canonical Ltd.
6Icon = /foo/scope-A.Icon6Icon = file://scope-A.Icon
7SearchHint = scope-A.SearchHint7SearchHint = scope-A.SearchHint
8HotKey = scope-A.HotKey8HotKey = scope-A.HotKey
9LocationDataNeeded = true9LocationDataNeeded = true
@@ -19,4 +19,4 @@
19PageHeader.ForegroundColor = fg_color19PageHeader.ForegroundColor = fg_color
20PageHeader.Background = bg_scheme20PageHeader.Background = bg_scheme
21PageHeader.DividerColor = div_color21PageHeader.DividerColor = div_color
22PageHeader.NavigationBackground = nav_background22PageHeader.NavigationBackground = http://nav_background
2323
=== modified file 'test/gtest/scopes/Runtime/Runtime.ini.in'
--- test/gtest/scopes/Runtime/Runtime.ini.in 2013-12-13 11:25:44 +0000
+++ test/gtest/scopes/Runtime/Runtime.ini.in 2014-07-24 15:00:51 +0000
@@ -1,5 +1,5 @@
1[Runtime]1[Runtime]
2Registry.Identity = Registry2Registry.Identity = TestRegistry
3Registry.ConfigFile = Registry.ini3Registry.ConfigFile = Registry.ini
4Default.Middleware = Zmq4Default.Middleware = Zmq
5Zmq.ConfigFile = Zmq.ini5Zmq.ConfigFile = Zmq.ini
66
=== modified file 'test/gtest/scopes/Runtime/Runtime_test.cpp'
--- test/gtest/scopes/Runtime/Runtime_test.cpp 2014-07-17 05:02:03 +0000
+++ test/gtest/scopes/Runtime/Runtime_test.cpp 2014-07-24 15:00:51 +0000
@@ -25,6 +25,7 @@
25#include <unity/scopes/ActionMetadata.h>25#include <unity/scopes/ActionMetadata.h>
26#include <unity/scopes/CategorisedResult.h>26#include <unity/scopes/CategorisedResult.h>
27#include <unity/scopes/internal/MWScope.h>27#include <unity/scopes/internal/MWScope.h>
28#include <unity/scopes/internal/RegistryObject.h>
28#include <unity/scopes/internal/RuntimeImpl.h>29#include <unity/scopes/internal/RuntimeImpl.h>
29#include <unity/scopes/internal/ScopeImpl.h>30#include <unity/scopes/internal/ScopeImpl.h>
30#include <unity/scopes/ListenerBase.h>31#include <unity/scopes/ListenerBase.h>
@@ -41,6 +42,7 @@
4142
42using namespace std;43using namespace std;
43using namespace unity::scopes;44using namespace unity::scopes;
45using namespace unity::scopes::internal;
4446
45TEST(Runtime, basic)47TEST(Runtime, basic)
46{48{
@@ -221,8 +223,22 @@
221 atomic_int count_;223 atomic_int count_;
222};224};
223225
226std::shared_ptr<core::posix::SignalTrap> trap(core::posix::trap_signals_for_all_subsequent_threads({core::posix::Signal::sig_chld}));
227std::unique_ptr<core::posix::ChildProcess::DeathObserver> death_observer(core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap(trap));
228
229RuntimeImpl::SPtr run_test_registry()
230{
231 RuntimeImpl::SPtr runtime = RuntimeImpl::create("TestRegistry", "Runtime.ini");
232 MiddlewareBase::SPtr middleware = runtime->factory()->create("TestRegistry", "Zmq", "Zmq.ini");
233 RegistryObject::SPtr reg_obj(std::make_shared<RegistryObject>(*death_observer, std::make_shared<Executor>(), middleware));
234 middleware->add_registry_object("TestRegistry", reg_obj);
235 return runtime;
236}
237
224TEST(Runtime, search)238TEST(Runtime, search)
225{239{
240 auto reg_rt = run_test_registry();
241
226 // connect to scope and run a query242 // connect to scope and run a query
227 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");243 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");
228 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");244 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");
@@ -237,6 +253,7 @@
237253
238TEST(Runtime, consecutive_search)254TEST(Runtime, consecutive_search)
239{255{
256 auto reg_rt = run_test_registry();
240 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");257 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");
241 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");258 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");
242 mw->start();259 mw->start();
@@ -278,6 +295,8 @@
278295
279TEST(Runtime, preview)296TEST(Runtime, preview)
280{297{
298 auto reg_rt = run_test_registry();
299
281 // connect to scope and run a query300 // connect to scope and run a query
282 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");301 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");
283 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");302 auto mw = rt->factory()->create("TestScope", "Zmq", "Zmq.ini");
@@ -303,6 +322,8 @@
303322
304TEST(Runtime, cardinality)323TEST(Runtime, cardinality)
305{324{
325 auto reg_rt = run_test_registry();
326
306 // connect to scope and run a query327 // connect to scope and run a query
307 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");328 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");
308 auto mw = rt->factory()->create("PusherScope", "Zmq", "Zmq.ini");329 auto mw = rt->factory()->create("PusherScope", "Zmq", "Zmq.ini");
@@ -360,6 +381,7 @@
360381
361TEST(Runtime, early_cancel)382TEST(Runtime, early_cancel)
362{383{
384 auto reg_rt = run_test_registry();
363 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");385 auto rt = internal::RuntimeImpl::create("", "Runtime.ini");
364 auto mw = rt->factory()->create("SlowCreateScope", "Zmq", "Zmq.ini");386 auto mw = rt->factory()->create("SlowCreateScope", "Zmq", "Zmq.ini");
365 mw->start();387 mw->start();
366388
=== modified file 'test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp'
--- test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp 2014-07-07 23:53:36 +0000
+++ test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp 2014-07-24 15:00:51 +0000
@@ -108,8 +108,9 @@
108108
109TEST_F(smartscopesproxytest, ss_registry)109TEST_F(smartscopesproxytest, ss_registry)
110{110{
111 // locate should throw (direct)111 // non-existent scope (direct)
112 EXPECT_THROW(reg_->locate("dummy.scope"), RegistryException);112 EXPECT_THROW(reg_->get_metadata("dummy.scope.5"), NotFoundException);
113 EXPECT_THROW(reg_->locate("dummy.scope.5"), NotFoundException);
113114
114 // list scopes (direct)115 // list scopes (direct)
115 MetadataMap scopes = reg_->list();116 MetadataMap scopes = reg_->list();
@@ -139,12 +140,10 @@
139 EXPECT_EQ("Celsius", meta.settings_definitions()[1].get_dict()["values"].get_array()[0].get_string());140 EXPECT_EQ("Celsius", meta.settings_definitions()[1].get_dict()["values"].get_array()[0].get_string());
140 EXPECT_EQ("Fahrenheit", meta.settings_definitions()[1].get_dict()["values"].get_array()[1].get_string());141 EXPECT_EQ("Fahrenheit", meta.settings_definitions()[1].get_dict()["values"].get_array()[1].get_string());
141142
142 // non-existant scope (direct)143 // non-existent scope (via mw)
143 EXPECT_THROW(reg_->get_metadata("dummy.scope.5"), NotFoundException);
144
145 // locate should throw (via mw)
146 MWRegistryProxy mw_reg = mw_->registry_proxy();144 MWRegistryProxy mw_reg = mw_->registry_proxy();
147 EXPECT_THROW(mw_reg->locate("Dummy Demo Scope"), RegistryException);145 EXPECT_THROW(mw_reg->get_metadata("dummy.scope.5"), NotFoundException);
146 EXPECT_THROW(mw_reg->locate("dummy.scope.5"), NotFoundException);
148147
149 // list scopes (via mw)148 // list scopes (via mw)
150 scopes = mw_reg->list();149 scopes = mw_reg->list();
@@ -173,9 +172,6 @@
173 EXPECT_EQ(2, meta.settings_definitions()[1].get_dict()["values"].get_array().size());172 EXPECT_EQ(2, meta.settings_definitions()[1].get_dict()["values"].get_array().size());
174 EXPECT_EQ("Celsius", meta.settings_definitions()[1].get_dict()["values"].get_array()[0].get_string());173 EXPECT_EQ("Celsius", meta.settings_definitions()[1].get_dict()["values"].get_array()[0].get_string());
175 EXPECT_EQ("Fahrenheit", meta.settings_definitions()[1].get_dict()["values"].get_array()[1].get_string());174 EXPECT_EQ("Fahrenheit", meta.settings_definitions()[1].get_dict()["values"].get_array()[1].get_string());
176
177 // non-existant scope (via mw)
178 EXPECT_THROW(mw_reg->get_metadata("dummy.scope.5"), NotFoundException);
179}175}
180176
181TEST_F(smartscopesproxytest, ss_registry_locale)177TEST_F(smartscopesproxytest, ss_registry_locale)
182178
=== modified file 'test/gtest/scopes/internal/zmq_middleware/RegistryI/RegistryI_test.cpp'
--- test/gtest/scopes/internal/zmq_middleware/RegistryI/RegistryI_test.cpp 2014-07-22 04:46:56 +0000
+++ test/gtest/scopes/internal/zmq_middleware/RegistryI/RegistryI_test.cpp 2014-07-24 15:00:51 +0000
@@ -370,10 +370,10 @@
370 }370 }
371}371}
372372
373class RegistryTest : public Test373class RegistryITest : public Test
374{374{
375public:375public:
376 RegistryTest()376 RegistryITest()
377 {377 {
378 start_process_count = process_count();378 start_process_count = process_count();
379379
@@ -419,7 +419,7 @@
419 }419 }
420 }420 }
421421
422 ~RegistryTest()422 ~RegistryITest()
423 {423 {
424 // tear down the registry424 // tear down the registry
425 reg.reset();425 reg.reset();
@@ -506,7 +506,7 @@
506};506};
507507
508// test initial state508// test initial state
509TEST_F(RegistryTest, locate_init)509TEST_F(RegistryITest, locate_init)
510{510{
511 // check that no scope processes are running511 // check that no scope processes are running
512 for (auto const& scope_id : scope_ids)512 for (auto const& scope_id : scope_ids)
@@ -519,7 +519,7 @@
519}519}
520520
521// test locating the same scope multiple times521// test locating the same scope multiple times
522TEST_F(RegistryTest, locate_one)522TEST_F(RegistryITest, locate_one)
523{523{
524 // locate all scopes (hence starting all scope processes)524 // locate all scopes (hence starting all scope processes)
525 for (auto const& scope_id : scope_ids)525 for (auto const& scope_id : scope_ids)
@@ -541,7 +541,7 @@
541}541}
542542
543// test locating all scopes543// test locating all scopes
544TEST_F(RegistryTest, locate_all)544TEST_F(RegistryITest, locate_all)
545{545{
546 // locate all scopes (hence starting all scope processes)546 // locate all scopes (hence starting all scope processes)
547 for (auto const& scope_id : scope_ids)547 for (auto const& scope_id : scope_ids)
@@ -585,7 +585,7 @@
585};585};
586586
587// test scope death and rebinding587// test scope death and rebinding
588TEST_F(RegistryTest, locate_rebinding)588TEST_F(RegistryITest, locate_rebinding)
589{589{
590 // locate first scope590 // locate first scope
591 EXPECT_EQ(proxies[scope_ids[0]], reg->locate(scope_ids[0]));591 EXPECT_EQ(proxies[scope_ids[0]], reg->locate(scope_ids[0]));
@@ -622,7 +622,7 @@
622}622}
623623
624// test removing a scope624// test removing a scope
625TEST_F(RegistryTest, locate_remove)625TEST_F(RegistryITest, locate_remove)
626{626{
627 // locate all scopes (hence starting all scope processes)627 // locate all scopes (hence starting all scope processes)
628 for (auto const& scope_id : scope_ids)628 for (auto const& scope_id : scope_ids)
@@ -649,7 +649,7 @@
649}649}
650650
651// test custom scoperunner executable651// test custom scoperunner executable
652TEST_F(RegistryTest, locate_custom_exec)652TEST_F(RegistryITest, locate_custom_exec)
653{653{
654 ScopeProxy test_proxy = start_testscopeB();654 ScopeProxy test_proxy = start_testscopeB();
655655
@@ -680,7 +680,7 @@
680}680}
681681
682// test idle timeout of a scope682// test idle timeout of a scope
683TEST_F(RegistryTest, locate_idle_timeout)683TEST_F(RegistryITest, locate_idle_timeout)
684{684{
685 ScopeProxy test_proxy = start_testscopeB();685 ScopeProxy test_proxy = start_testscopeB();
686686

Subscribers

People subscribed via source and target branches

to all changes: