64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
1 |
/*
|
2 |
* Copyright (C) 2013 Canonical Ltd
|
|
3 |
*
|
|
4 |
* This program is free software: you can redistribute it and/or modify
|
|
5 |
* it under the terms of the GNU Lesser General Public License version 3 as
|
|
6 |
* published by the Free Software Foundation.
|
|
7 |
*
|
|
8 |
* This program is distributed in the hope that it will be useful,
|
|
9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
* GNU Lesser General Public License for more details.
|
|
12 |
*
|
|
13 |
* You should have received a copy of the GNU Lesser General Public License
|
|
14 |
* along with this program. If not, see <http://www.gnu.org/lzmqnses/>.
|
|
15 |
*
|
|
16 |
* Authored by: Michi Henning <michi.henning@canonical.com>
|
|
17 |
*/
|
|
18 |
||
89.5.10
by Jussi Pakkanen
Changed include directives to match what our users will use. |
19 |
#include <unity/scopes/internal/ScopeMetadataImpl.h> |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
20 |
|
163.138.5
by Marcus Tomlinson
Fixing tests (can't contruct a ZmqObjectProxy with an invalid runtime pointer) |
21 |
#include <unity/scopes/internal/RuntimeImpl.h> |
89.5.10
by Jussi Pakkanen
Changed include directives to match what our users will use. |
22 |
#include <unity/scopes/internal/ScopeImpl.h> |
23 |
#include <unity/scopes/internal/zmq_middleware/ZmqMiddleware.h> |
|
24 |
#include <unity/scopes/ScopeExceptions.h> |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
25 |
#include <unity/UnityExceptions.h> |
26 |
||
27 |
#include <boost/regex.hpp> // Use Boost implementation until http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631 is fixed. |
|
28 |
#include <gtest/gtest.h> |
|
29 |
||
30 |
using namespace std; |
|
31 |
using namespace unity; |
|
89.5.3
by Jussi Pakkanen
Finished namespace peeling. |
32 |
using namespace unity::scopes; |
33 |
using namespace unity::scopes::internal; |
|
34 |
using namespace unity::scopes::internal::zmq_middleware; |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
35 |
|
163.238.1
by Michi Henning
Removed generated header scope-api-testconfig.h. This avoids |
36 |
string const runtime_ini = TEST_DIR "/Runtime.ini"; |
37 |
string const zmq_ini = TEST_DIR "/Zmq.ini"; |
|
38 |
||
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
39 |
TEST(ScopeMetadataImpl, basic) |
40 |
{
|
|
163.238.1
by Michi Henning
Removed generated header scope-api-testconfig.h. This avoids |
41 |
auto rt = RuntimeImpl::create("testscope", runtime_ini); |
42 |
ZmqMiddleware mw("testscope", rt.get(), zmq_ini); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
43 |
|
44 |
unique_ptr<ScopeMetadataImpl> mi(new ScopeMetadataImpl(&mw)); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
45 |
mi->set_scope_id("scope_id"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
46 |
auto mw_proxy = mw.create_scope_proxy("identity", "endpoint"); |
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
47 |
mi->set_proxy(ScopeImpl::create(mw_proxy, mw.runtime(), "scope_id")); |
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
48 |
mi->set_display_name("display_name"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
49 |
mi->set_description("description"); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
50 |
mi->set_author("author"); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
51 |
mi->set_results_ttl_type(ScopeMetadata::ResultsTtlType::Medium); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
52 |
|
53 |
// Keep a copy for tests below
|
|
54 |
unique_ptr<ScopeMetadataImpl> mi2(new ScopeMetadataImpl(*mi)); |
|
55 |
||
56 |
// Create the public instance and check that the values match
|
|
57 |
auto m = ScopeMetadataImpl::create(move(mi)); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
58 |
EXPECT_EQ("scope_id", m.scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
59 |
EXPECT_EQ("identity", m.proxy()->identity()); |
60 |
EXPECT_EQ("endpoint", m.proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
61 |
EXPECT_EQ("display_name", m.display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
62 |
EXPECT_EQ("description", m.description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
63 |
EXPECT_EQ("author", m.author()); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
64 |
EXPECT_EQ(0, m.appearance_attributes().size()); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
65 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Medium, m.results_ttl_type()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
66 |
|
67 |
// Check that optional fields that are not set throw
|
|
68 |
try
|
|
69 |
{
|
|
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
70 |
m.art(); |
71 |
FAIL(); |
|
72 |
}
|
|
73 |
catch (NotFoundException const& e) |
|
74 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
75 |
EXPECT_STREQ("unity::scopes::NotFoundException: attribute not set (name = art)", e.what()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
76 |
}
|
77 |
||
78 |
try
|
|
79 |
{
|
|
80 |
m.icon(); |
|
81 |
FAIL(); |
|
82 |
}
|
|
83 |
catch (NotFoundException const& e) |
|
84 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
85 |
EXPECT_STREQ("unity::scopes::NotFoundException: attribute not set (name = icon)", e.what()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
86 |
}
|
87 |
||
88 |
try
|
|
89 |
{
|
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
90 |
m.search_hint(); |
91 |
FAIL(); |
|
92 |
}
|
|
93 |
catch (NotFoundException const& e) |
|
94 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
95 |
EXPECT_STREQ("unity::scopes::NotFoundException: attribute not set (name = search_hint)", e.what()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
96 |
}
|
97 |
||
98 |
try
|
|
99 |
{
|
|
100 |
m.hot_key(); |
|
101 |
FAIL(); |
|
102 |
}
|
|
103 |
catch (NotFoundException const& e) |
|
104 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
105 |
EXPECT_STREQ("unity::scopes::NotFoundException: attribute not set (name = hot_key)", e.what()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
106 |
}
|
107 |
||
163.118.15
by Pawel Stolowski
Expose scope directory with ScopeMetadata. |
108 |
try
|
109 |
{
|
|
110 |
m.scope_directory(); |
|
111 |
FAIL(); |
|
112 |
}
|
|
113 |
catch (NotFoundException const& e) |
|
114 |
{
|
|
115 |
EXPECT_STREQ("unity::scopes::NotFoundException: attribute not set (name = scope_directory)", e.what()); |
|
116 |
}
|
|
117 |
||
163.229.1
by Pete Woods
Add settings_json property to ScopeMetadata |
118 |
try
|
119 |
{
|
|
163.228.14
by Michi Henning
Added support for display name (not localized yet). |
120 |
m.settings_definitions(); |
163.229.1
by Pete Woods
Add settings_json property to ScopeMetadata |
121 |
FAIL(); |
122 |
}
|
|
123 |
catch (NotFoundException const& e) |
|
124 |
{
|
|
163.228.14
by Michi Henning
Added support for display name (not localized yet). |
125 |
EXPECT_STREQ("unity::scopes::NotFoundException: attribute not set (name = settings_definitions)", e.what()); |
163.229.1
by Pete Woods
Add settings_json property to ScopeMetadata |
126 |
}
|
127 |
||
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
128 |
// when "invisible" is not set, false is returned
|
129 |
EXPECT_FALSE(m.invisible()); |
|
130 |
||
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
131 |
// when "location_data_needed" is not set, false is returned
|
132 |
EXPECT_FALSE(m.location_data_needed()); |
|
133 |
||
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
134 |
// Check that the copy has the same values as the original
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
135 |
EXPECT_EQ("scope_id", mi2->scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
136 |
EXPECT_EQ("identity", mi2->proxy()->identity()); |
137 |
EXPECT_EQ("endpoint", mi2->proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
138 |
EXPECT_EQ("display_name", mi2->display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
139 |
EXPECT_EQ("description", mi2->description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
140 |
EXPECT_EQ("author", mi2->author()); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
141 |
EXPECT_EQ(0, mi2->appearance_attributes().size()); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
142 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Medium, mi2->results_ttl_type()); |
163.104.1
by Pawel Stolowski
Added support for config group with customization attributes. |
143 |
|
144 |
VariantMap attrs; |
|
145 |
attrs["foo"] = "bar"; |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
146 |
|
147 |
// Set optional fields on copy.
|
|
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
148 |
mi2->set_art("art"); |
149 |
mi2->set_icon("icon"); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
150 |
mi2->set_search_hint("search_hint"); |
151 |
mi2->set_hot_key("hot_key"); |
|
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
152 |
mi2->set_invisible(true); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
153 |
mi2->set_appearance_attributes(attrs); |
163.118.15
by Pawel Stolowski
Expose scope directory with ScopeMetadata. |
154 |
mi2->set_scope_directory("/foo"); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
155 |
mi2->set_results_ttl_type(ScopeMetadata::ResultsTtlType::Large); |
163.228.19
by Michi Henning
Made change suggested by Pete: |
156 |
VariantArray va; |
157 |
va.push_back(Variant("hello")); |
|
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
158 |
mi2->set_settings_definitions(va); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
159 |
mi2->set_location_data_needed(true); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
160 |
|
161 |
// Make another copy, so we get coverage on the entire copy constructor
|
|
162 |
unique_ptr<ScopeMetadataImpl> mi3(new ScopeMetadataImpl(*mi2)); |
|
163 |
||
164 |
// Check that optional fields are set correctly
|
|
165 |
m = ScopeMetadataImpl::create(move(mi2)); |
|
166 |
EXPECT_EQ("search_hint", m.search_hint()); |
|
167 |
EXPECT_EQ("hot_key", m.hot_key()); |
|
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
168 |
EXPECT_TRUE(m.invisible()); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
169 |
EXPECT_EQ("bar", m.appearance_attributes()["foo"].get_string()); |
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
170 |
EXPECT_EQ(va, m.settings_definitions()); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
171 |
EXPECT_TRUE(m.location_data_needed()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
172 |
|
173 |
// Make another value
|
|
174 |
unique_ptr<ScopeMetadataImpl> ti(new ScopeMetadataImpl(&mw)); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
175 |
ti->set_scope_id("tmp scope_id"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
176 |
mw_proxy = mw.create_scope_proxy("tmp identity", "tmp endpoint"); |
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
177 |
ti->set_proxy(ScopeImpl::create(mw_proxy, mw.runtime(), "tmp scope_id")); |
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
178 |
ti->set_display_name("tmp display_name"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
179 |
ti->set_description("tmp description"); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
180 |
ti->set_author("tmp author"); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
181 |
ti->set_art("tmp art"); |
182 |
ti->set_icon("tmp icon"); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
183 |
ti->set_search_hint("tmp search_hint"); |
184 |
ti->set_hot_key("tmp hot_key"); |
|
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
185 |
ti->set_invisible(true); |
163.118.14
by Pawel Stolowski
Expose scope directory path via ScopeMetadata attribute. |
186 |
ti->set_scope_directory("/foo"); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
187 |
ti->set_appearance_attributes(attrs); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
188 |
ti->set_results_ttl_type(ScopeMetadata::ResultsTtlType::Small); |
163.228.19
by Michi Henning
Made change suggested by Pete: |
189 |
VariantArray tmp_va; |
190 |
tmp_va.push_back(Variant("tmp hello")); |
|
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
191 |
ti->set_settings_definitions(tmp_va); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
192 |
ti->set_location_data_needed(true); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
193 |
|
194 |
// Check impl assignment operator
|
|
195 |
ScopeMetadataImpl ci(&mw); |
|
196 |
ci = *ti; |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
197 |
EXPECT_EQ("tmp scope_id", ci.scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
198 |
EXPECT_EQ("tmp identity", ci.proxy()->identity()); |
199 |
EXPECT_EQ("tmp endpoint", ci.proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
200 |
EXPECT_EQ("tmp display_name", ci.display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
201 |
EXPECT_EQ("tmp description", ci.description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
202 |
EXPECT_EQ("tmp author", ci.author()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
203 |
EXPECT_EQ("tmp art", ci.art()); |
204 |
EXPECT_EQ("tmp icon", ci.icon()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
205 |
EXPECT_EQ("tmp search_hint", ci.search_hint()); |
206 |
EXPECT_EQ("tmp hot_key", ci.hot_key()); |
|
163.118.14
by Pawel Stolowski
Expose scope directory path via ScopeMetadata attribute. |
207 |
EXPECT_EQ("/foo", ci.scope_directory()); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
208 |
EXPECT_EQ("bar", ci.appearance_attributes()["foo"].get_string()); |
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
209 |
EXPECT_TRUE(ci.invisible()); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
210 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Small, ci.results_ttl_type()); |
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
211 |
EXPECT_EQ(tmp_va, ci.settings_definitions()); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
212 |
EXPECT_TRUE(ci.location_data_needed()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
213 |
|
214 |
// Check public assignment operator
|
|
215 |
auto tmp = ScopeMetadataImpl::create(move(ti)); |
|
216 |
m = tmp; |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
217 |
EXPECT_EQ("tmp scope_id", m.scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
218 |
EXPECT_EQ("tmp identity", m.proxy()->identity()); |
219 |
EXPECT_EQ("tmp endpoint", m.proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
220 |
EXPECT_EQ("tmp display_name", m.display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
221 |
EXPECT_EQ("tmp description", m.description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
222 |
EXPECT_EQ("tmp author", m.author()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
223 |
EXPECT_EQ("tmp art", m.art()); |
224 |
EXPECT_EQ("tmp icon", m.icon()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
225 |
EXPECT_EQ("tmp search_hint", m.search_hint()); |
226 |
EXPECT_EQ("tmp hot_key", m.hot_key()); |
|
163.118.14
by Pawel Stolowski
Expose scope directory path via ScopeMetadata attribute. |
227 |
EXPECT_EQ("/foo", m.scope_directory()); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
228 |
EXPECT_EQ("bar", m.appearance_attributes()["foo"].get_string()); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
229 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Small, m.results_ttl_type()); |
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
230 |
EXPECT_TRUE(m.invisible()); |
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
231 |
EXPECT_EQ(tmp_va, m.settings_definitions()); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
232 |
EXPECT_TRUE(m.location_data_needed()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
233 |
|
234 |
// Self-assignment
|
|
235 |
tmp = tmp; |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
236 |
EXPECT_EQ("tmp scope_id", tmp.scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
237 |
EXPECT_EQ("tmp identity", tmp.proxy()->identity()); |
238 |
EXPECT_EQ("tmp endpoint", tmp.proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
239 |
EXPECT_EQ("tmp display_name", tmp.display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
240 |
EXPECT_EQ("tmp description", tmp.description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
241 |
EXPECT_EQ("tmp author", tmp.author()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
242 |
EXPECT_EQ("tmp art", tmp.art()); |
243 |
EXPECT_EQ("tmp icon", tmp.icon()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
244 |
EXPECT_EQ("tmp search_hint", tmp.search_hint()); |
245 |
EXPECT_EQ("tmp hot_key", tmp.hot_key()); |
|
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
246 |
EXPECT_EQ("bar", tmp.appearance_attributes()["foo"].get_string()); |
163.118.14
by Pawel Stolowski
Expose scope directory path via ScopeMetadata attribute. |
247 |
EXPECT_EQ("/foo", tmp.scope_directory()); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
248 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Small, tmp.results_ttl_type()); |
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
249 |
EXPECT_TRUE(tmp.invisible()); |
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
250 |
EXPECT_EQ(tmp_va, tmp.settings_definitions()); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
251 |
EXPECT_TRUE(tmp.location_data_needed()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
252 |
|
253 |
// Copy constructor
|
|
254 |
ScopeMetadata tmp2(tmp); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
255 |
EXPECT_EQ("tmp scope_id", tmp2.scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
256 |
EXPECT_EQ("tmp identity", tmp2.proxy()->identity()); |
257 |
EXPECT_EQ("tmp endpoint", tmp2.proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
258 |
EXPECT_EQ("tmp display_name", tmp2.display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
259 |
EXPECT_EQ("tmp description", tmp2.description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
260 |
EXPECT_EQ("tmp author", tmp2.author()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
261 |
EXPECT_EQ("tmp art", tmp2.art()); |
262 |
EXPECT_EQ("tmp icon", tmp2.icon()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
263 |
EXPECT_EQ("tmp search_hint", tmp2.search_hint()); |
264 |
EXPECT_EQ("tmp hot_key", tmp2.hot_key()); |
|
163.118.14
by Pawel Stolowski
Expose scope directory path via ScopeMetadata attribute. |
265 |
EXPECT_EQ("/foo", tmp2.scope_directory()); |
163.104.6
by Pawel Stolowski
Renamed 'Display' to 'Appearance'. |
266 |
EXPECT_EQ("bar", tmp2.appearance_attributes()["foo"].get_string()); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
267 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Small, tmp2.results_ttl_type()); |
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
268 |
EXPECT_TRUE(tmp2.invisible()); |
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
269 |
EXPECT_EQ(tmp_va, tmp2.settings_definitions()); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
270 |
EXPECT_TRUE(tmp2.location_data_needed()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
271 |
}
|
272 |
||
273 |
TEST(ScopeMetadataImpl, serialize) |
|
274 |
{
|
|
163.238.1
by Michi Henning
Removed generated header scope-api-testconfig.h. This avoids |
275 |
auto rt = RuntimeImpl::create("testscope", runtime_ini); |
276 |
ZmqMiddleware mw("testscope", rt.get(), zmq_ini); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
277 |
|
278 |
unique_ptr<ScopeMetadataImpl> mi(new ScopeMetadataImpl(&mw)); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
279 |
mi->set_scope_id("scope_id"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
280 |
auto mw_proxy = mw.create_scope_proxy("identity", "endpoint"); |
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
281 |
mi->set_proxy(ScopeImpl::create(mw_proxy, mw.runtime(), "scope_id")); |
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
282 |
mi->set_display_name("display_name"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
283 |
mi->set_description("description"); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
284 |
mi->set_author("author"); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
285 |
mi->set_art("art"); |
286 |
mi->set_icon("icon"); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
287 |
mi->set_search_hint("search_hint"); |
288 |
mi->set_hot_key("hot_key"); |
|
163.118.14
by Pawel Stolowski
Expose scope directory path via ScopeMetadata attribute. |
289 |
mi->set_scope_directory("/foo"); |
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
290 |
mi->set_invisible(false); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
291 |
mi->set_results_ttl_type(ScopeMetadata::ResultsTtlType::Large); |
163.228.19
by Michi Henning
Made change suggested by Pete: |
292 |
VariantArray va; |
293 |
va.push_back(Variant("hello")); |
|
294 |
va.push_back(Variant("world")); |
|
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
295 |
mi->set_settings_definitions(va); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
296 |
mi->set_location_data_needed(false); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
297 |
|
298 |
// Check that serialize() sets the map values correctly
|
|
299 |
auto m = ScopeMetadataImpl::create(move(mi)); |
|
300 |
auto var = m.serialize(); |
|
163.281.15
by Marcus Tomlinson
Removed debug_mode from ScopeMetadata |
301 |
EXPECT_EQ(14u, var.size()); |
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
302 |
EXPECT_EQ("scope_id", var["scope_id"].get_string()); |
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
303 |
EXPECT_EQ("display_name", var["display_name"].get_string()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
304 |
EXPECT_EQ("description", var["description"].get_string()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
305 |
EXPECT_EQ("author", var["author"].get_string()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
306 |
EXPECT_EQ("art", var["art"].get_string()); |
307 |
EXPECT_EQ("icon", var["icon"].get_string()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
308 |
EXPECT_EQ("search_hint", var["search_hint"].get_string()); |
309 |
EXPECT_EQ("hot_key", var["hot_key"].get_string()); |
|
163.118.14
by Pawel Stolowski
Expose scope directory path via ScopeMetadata attribute. |
310 |
EXPECT_EQ("/foo", var["scope_dir"].get_string()); |
163.211.1
by Michi Henning
Fixed broken message in ttl value exception and added test. |
311 |
EXPECT_FALSE(var["invisible"].get_bool()); |
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
312 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Large, |
163.173.7
by Pete Woods
Missed an instance of the old value |
313 |
(ScopeMetadata::ResultsTtlType ) var["results_ttl_type"].get_int()); |
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
314 |
EXPECT_FALSE(var["invisible"].get_bool()); |
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
315 |
EXPECT_EQ(va, var["settings_definitions"].get_array()); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
316 |
EXPECT_FALSE(var["location_data_needed"].get_bool()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
317 |
|
318 |
// Make another instance from the VariantMap and check its fields
|
|
319 |
ScopeMetadataImpl c(var, &mw); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
320 |
EXPECT_EQ("scope_id", c.scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
321 |
EXPECT_EQ("identity", c.proxy()->identity()); |
322 |
EXPECT_EQ("endpoint", c.proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
323 |
EXPECT_EQ("display_name", c.display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
324 |
EXPECT_EQ("description", c.description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
325 |
EXPECT_EQ("author", c.author()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
326 |
EXPECT_EQ("art", c.art()); |
327 |
EXPECT_EQ("icon", c.icon()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
328 |
EXPECT_EQ("search_hint", c.search_hint()); |
329 |
EXPECT_EQ("hot_key", c.hot_key()); |
|
163.211.1
by Michi Henning
Fixed broken message in ttl value exception and added test. |
330 |
EXPECT_EQ("/foo", c.scope_directory()); |
331 |
EXPECT_FALSE(c.invisible()); |
|
163.173.6
by Pete Woods
Rename the results ttl API to be the same as in the config files |
332 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::Large, c.results_ttl_type()); |
163.22.1
by Marcus Tomlinson
Added "invisible" attribute to ScopeMetadata |
333 |
EXPECT_FALSE(c.invisible()); |
163.228.40
by Michi Henning
Changed settings_definitions() and set_settings_definitions() to use |
334 |
EXPECT_EQ(va, c.settings_definitions()); |
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
335 |
EXPECT_FALSE(c.location_data_needed()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
336 |
}
|
337 |
||
338 |
TEST(ScopeMetadataImpl, serialize_exceptions) |
|
339 |
{
|
|
163.238.1
by Michi Henning
Removed generated header scope-api-testconfig.h. This avoids |
340 |
auto rt = RuntimeImpl::create("testscope", runtime_ini); |
341 |
ZmqMiddleware mw("testscope", rt.get(), zmq_ini); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
342 |
|
343 |
ScopeMetadataImpl mi(&mw); |
|
344 |
try
|
|
345 |
{
|
|
346 |
mi.serialize(); |
|
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
347 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
348 |
}
|
349 |
catch (InvalidArgumentException const&e) |
|
350 |
{
|
|
163.77.17
by Pawel Stolowski
ScopeMetadata and Registry: renamed scope_name to scope_id. |
351 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata: required attribute 'scope_id' is empty", |
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
352 |
e.what()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
353 |
}
|
354 |
||
355 |
try
|
|
356 |
{
|
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
357 |
mi.set_scope_id("scope_id"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
358 |
mi.serialize(); |
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
359 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
360 |
}
|
361 |
catch (InvalidArgumentException const&e) |
|
362 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
363 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadataImpl::serialize(): required attribute 'proxy' is null", |
364 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
365 |
}
|
366 |
||
367 |
try
|
|
368 |
{
|
|
369 |
auto mw_proxy = mw.create_scope_proxy("identity", "endpoint"); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
370 |
mi.set_proxy(ScopeImpl::create(mw_proxy, mw.runtime(), "scope_id")); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
371 |
mi.serialize(); |
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
372 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
373 |
}
|
374 |
catch (InvalidArgumentException const&e) |
|
375 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
376 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata: required attribute 'display_name' is empty", |
377 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
378 |
}
|
379 |
||
380 |
try
|
|
381 |
{
|
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
382 |
mi.set_display_name("display_name"); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
383 |
mi.serialize(); |
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
384 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
385 |
}
|
386 |
catch (InvalidArgumentException const&e) |
|
387 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
388 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata: required attribute 'description' is empty", |
389 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
390 |
}
|
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
391 |
|
392 |
try
|
|
393 |
{
|
|
394 |
mi.set_description("description"); |
|
395 |
mi.serialize(); |
|
396 |
FAIL(); |
|
397 |
}
|
|
398 |
catch (InvalidArgumentException const&e) |
|
399 |
{
|
|
400 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata: required attribute 'author' is empty", |
|
401 |
e.what()); |
|
402 |
}
|
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
403 |
}
|
404 |
||
405 |
TEST(ScopeMetadataImpl, deserialize_exceptions) |
|
406 |
{
|
|
163.238.1
by Michi Henning
Removed generated header scope-api-testconfig.h. This avoids |
407 |
auto rt = RuntimeImpl::create("testscope", runtime_ini); |
408 |
ZmqMiddleware mw("testscope", rt.get(), zmq_ini); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
409 |
|
410 |
VariantMap m; |
|
411 |
try
|
|
412 |
{
|
|
413 |
ScopeMetadataImpl mi(m, &mw); |
|
414 |
mi.deserialize(m); |
|
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
415 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
416 |
}
|
417 |
catch (InvalidArgumentException const&e) |
|
418 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
419 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata::deserialize(): required attribute " |
163.77.17
by Pawel Stolowski
ScopeMetadata and Registry: renamed scope_name to scope_id. |
420 |
"'scope_id' is missing", |
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
421 |
e.what()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
422 |
}
|
423 |
||
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
424 |
m["scope_id"] = "scope_id"; |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
425 |
try
|
426 |
{
|
|
427 |
ScopeMetadataImpl mi(m, &mw); |
|
428 |
mi.deserialize(m); |
|
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
429 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
430 |
}
|
431 |
catch (InvalidArgumentException const&e) |
|
432 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
433 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata::deserialize(): required attribute " |
434 |
"'proxy' is missing", |
|
435 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
436 |
}
|
437 |
||
438 |
VariantMap proxy; |
|
439 |
m["proxy"] = proxy; |
|
440 |
try
|
|
441 |
{
|
|
442 |
ScopeMetadataImpl mi(m, &mw); |
|
443 |
mi.deserialize(m); |
|
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
444 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
445 |
}
|
446 |
catch (InvalidArgumentException const&e) |
|
447 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
448 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadataImpl::deserialize(): missing 'proxy.identity'", |
449 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
450 |
}
|
451 |
||
452 |
proxy["identity"] = "identity"; |
|
453 |
m["proxy"] = proxy; |
|
454 |
try
|
|
455 |
{
|
|
456 |
ScopeMetadataImpl mi(m, &mw); |
|
457 |
mi.deserialize(m); |
|
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
458 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
459 |
}
|
460 |
catch (InvalidArgumentException const&e) |
|
461 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
462 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadataImpl::deserialize(): missing 'proxy.endpoint'", |
463 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
464 |
}
|
465 |
||
466 |
proxy["endpoint"] = "endpoint"; |
|
467 |
m["proxy"] = proxy; |
|
468 |
try
|
|
469 |
{
|
|
470 |
ScopeMetadataImpl mi(m, &mw); |
|
471 |
mi.deserialize(m); |
|
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
472 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
473 |
}
|
474 |
catch (InvalidArgumentException const&e) |
|
475 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
476 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata::deserialize(): required attribute " |
477 |
"'display_name' is missing", |
|
478 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
479 |
}
|
480 |
||
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
481 |
m["display_name"] = "display_name"; |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
482 |
try
|
483 |
{
|
|
484 |
ScopeMetadataImpl mi(m, &mw); |
|
485 |
mi.deserialize(m); |
|
64.2.13
by Michi Henning
Addming missing FAIL() calls for tests that expect an exception when no exception is in fact thrown. |
486 |
FAIL(); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
487 |
}
|
488 |
catch (InvalidArgumentException const&e) |
|
489 |
{
|
|
149.1.1
by Michi Henning
Replaced calls to to_string() with calls to what() for all |
490 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata::deserialize(): required attribute " |
491 |
"'description' is missing", |
|
492 |
e.what()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
493 |
}
|
163.211.1
by Michi Henning
Fixed broken message in ttl value exception and added test. |
494 |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
495 |
m["description"] = "description"; |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
496 |
try
|
497 |
{
|
|
498 |
ScopeMetadataImpl mi(m, &mw); |
|
499 |
mi.deserialize(m); |
|
500 |
FAIL(); |
|
501 |
}
|
|
502 |
catch (InvalidArgumentException const&e) |
|
503 |
{
|
|
504 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata::deserialize(): required attribute " |
|
505 |
"'author' is missing", |
|
506 |
e.what()); |
|
507 |
}
|
|
163.211.1
by Michi Henning
Fixed broken message in ttl value exception and added test. |
508 |
|
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
509 |
m["author"] = "author"; |
163.211.1
by Michi Henning
Fixed broken message in ttl value exception and added test. |
510 |
m["results_ttl_type"] = -1; |
511 |
try
|
|
512 |
{
|
|
513 |
ScopeMetadataImpl mi(m, &mw); |
|
514 |
mi.deserialize(m); |
|
515 |
FAIL(); |
|
516 |
}
|
|
517 |
catch (InvalidArgumentException const&e) |
|
518 |
{
|
|
519 |
EXPECT_STREQ("unity::InvalidArgumentException: ScopeMetadata::deserialize(): " |
|
520 |
"invalid attribute 'results_ttl_type' with value -1", |
|
521 |
e.what()); |
|
522 |
}
|
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
523 |
|
524 |
// Optional attributes
|
|
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
525 |
m["art"] = "art"; |
526 |
m["icon"] = "icon"; |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
527 |
m["search_hint"] = "search_hint"; |
528 |
m["hot_key"] = "hot_key"; |
|
163.211.1
by Michi Henning
Fixed broken message in ttl value exception and added test. |
529 |
m["scope_dir"] = "scope_dir"; |
530 |
m["invisible"] = true; |
|
531 |
VariantMap appearance; |
|
532 |
appearance["a1"] = "a1"; |
|
533 |
m["appearance_attributes"] = appearance; |
|
534 |
m["results_ttl_type"] = 0; |
|
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
535 |
m["location_data_needed"] = true; |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
536 |
|
537 |
ScopeMetadataImpl mi(m, &mw); |
|
538 |
mi.deserialize(m); |
|
163.120.1
by Marcus Tomlinson
Updated locate() to return ObjectProxy rather than ScopeProxy, and rename numerous incorrect references to "scope name" to "scope id". |
539 |
EXPECT_EQ("scope_id", mi.scope_id()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
540 |
EXPECT_EQ("identity", mi.proxy()->identity()); |
541 |
EXPECT_EQ("endpoint", mi.proxy()->endpoint()); |
|
64.2.14
by Michi Henning
Changed localized_name to display_name. Improved comment for catching exceptions for optional attributes. |
542 |
EXPECT_EQ("display_name", mi.display_name()); |
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
543 |
EXPECT_EQ("description", mi.description()); |
163.78.1
by Marcus Tomlinson
Added "author" to scope metadata. |
544 |
EXPECT_EQ("author", mi.author()); |
64.2.12
by Michi Henning
Added icon attribute to ScopeMetadata and made art attribute optional. |
545 |
EXPECT_EQ("art", mi.art()); |
546 |
EXPECT_EQ("icon", mi.icon()); |
|
64.2.5
by Michi Henning
Simplified configuration. Factory.ini no longer exists. |
547 |
EXPECT_EQ("search_hint", mi.search_hint()); |
548 |
EXPECT_EQ("hot_key", mi.hot_key()); |
|
163.211.1
by Michi Henning
Fixed broken message in ttl value exception and added test. |
549 |
EXPECT_EQ("scope_dir", mi.scope_directory()); |
550 |
EXPECT_TRUE(mi.invisible()); |
|
551 |
EXPECT_EQ(appearance, mi.appearance_attributes()); |
|
552 |
EXPECT_EQ(ScopeMetadata::ResultsTtlType::None, mi.results_ttl_type()); |
|
163.228.23
by Michi Henning
Added location_data_needed to ScopeMetadataImpl. |
553 |
EXPECT_TRUE(mi.location_data_needed()); |
163.122.17
by Pete Woods
Address conflicts from trunk rebase |
554 |
}
|