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

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Michi Henning
Approved revision: 568
Merged at revision: 555
Proposed branch: lp:~marcustomlinson/unity-scopes-api/metadata_isaggregator_attr
Merge into: lp:unity-scopes-api/devel
Prerequisite: lp:~marcustomlinson/unity-scopes-api/rename_tags_to_keywords
Diff against target: 565 lines (+114/-6)
20 files modified
CONFIGFILES (+4/-0)
RELEASE_NOTES.md (+2/-1)
STRUCTS (+1/-0)
debian/changelog (+3/-2)
debian/libunity-scopes3.symbols (+5/-0)
include/unity/scopes/ScopeMetadata.h (+6/-0)
include/unity/scopes/internal/ScopeConfig.h (+2/-0)
include/unity/scopes/internal/ScopeMetadataImpl.h (+3/-0)
include/unity/scopes/testing/ScopeMetadataBuilder.h (+1/-0)
scoperegistry/scoperegistry.cpp (+1/-0)
src/scopes/ScopeMetadata.cpp (+5/-0)
src/scopes/internal/ScopeConfig.cpp (+17/-1)
src/scopes/internal/ScopeMetadataImpl.cpp (+29/-0)
src/scopes/testing/ScopeMetadataBuilder.cpp (+9/-0)
test/gtest/scopes/Registry/Registry_test.cpp (+2/-0)
test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in (+1/-0)
test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp (+3/-0)
test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in (+1/-0)
test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp (+16/-1)
test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp (+3/-1)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/metadata_isaggregator_attr
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michi Henning (community) Approve
Review via email: mp+243518@code.launchpad.net

Commit message

Added support for IsAggregator scope .ini option.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote :

Looks fine, but don't we need to distinguish SAs from GAs in the shell? In particular, how do we prevent the creation of loops with GAs? My suggestion was to never allow a GA to aggregate another GA. That way, loops are not possible, assuming that SAs won't ever aggregate from a GA. I suspect we may need to put some special magic in place to guarantee this can't happen.

But, to me, it looks like we really need and enum for this attribute, not a boolean?

review: Needs Information
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

> Looks fine, but don't we need to distinguish SAs from GAs in the shell? In
> particular, how do we prevent the creation of loops with GAs? My suggestion
> was to never allow a GA to aggregate another GA. That way, loops are not
> possible, assuming that SAs won't ever aggregate from a GA. I suspect we may
> need to put some special magic in place to guarantee this can't happen.
>
> But, to me, it looks like we really need and enum for this attribute, not a
> boolean?

Had a chat with the others in the standup this morning and there is a majority vote not to differentiate between GAs and SAs (at least not via this attribute). The general consensus is that we should keep the interface as generic as possible without introducing a concept of different kinds of aggregators. I think if there is any way to avoid this, we should. Our current design allows for the aggregator type to be transparent.

About the infinite loop thing. I don't see a way we can entirely avoid this as an SA may aggregate another SA that aggregates its parent again. Now that we're intruding aggregation via tags, this becomes quite possible unfortunately. I think this problem really doesn't have anything to do with what type of aggregator is involved. Its really a separate issue we need to address. The consensus of the team is to implement a simple hop count with a limit. I do believe we still have the problem whereby too many layers of aggregation will cause a deadlock from thread starvation, so we should probably implement this anyway (https://bugs.launchpad.net/ubuntu/+source/unity-scopes-api/+bug/1360281)

Revision history for this message
Michi Henning (michihenning) wrote :

For SA's, we are probably a lot safer, because these aren't constructed willy-nilly on the fly.

For GA's, I think that's a real problem. What is this going to look like to the user? They make an aggregator that introduces a loop, and the queries will time out, without producing results, most likely. The user gets to see something that simply doesn't work, with no real idea of how to diagnose or remedy the problem.

Too many layers cannot cause deadlock. Rather, they'll cause queries to time out.

Even if we have loop detection of some kind, how should it behave? Detecting the loop doesn't solve the problem because, when we detect a loop, the user is still presented with a query that doesn't work. What we would need isn't loop detection, but "loop repair". The only way to fix this that I can see would be to track all scopes that are currently involved in a query and, if a subquery() goes to a scope that is already in the loop, not forward that subquery.

Doing this will be somewhat intrusive. At the very least, we would need a change at the protocol level that adds the IDs of all scopes involved so far to the search request on the wire.

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

> For SA's, we are probably a lot safer, because these aren't constructed willy-
> nilly on the fly.
>
> For GA's, I think that's a real problem. What is this going to look like to
> the user? They make an aggregator that introduces a loop, and the queries will
> time out, without producing results, most likely. The user gets to see
> something that simply doesn't work, with no real idea of how to diagnose or
> remedy the problem.
>
> Too many layers cannot cause deadlock. Rather, they'll cause queries to time
> out.
>
> Even if we have loop detection of some kind, how should it behave? Detecting
> the loop doesn't solve the problem because, when we detect a loop, the user is
> still presented with a query that doesn't work. What we would need isn't loop
> detection, but "loop repair". The only way to fix this that I can see would be
> to track all scopes that are currently involved in a query and, if a
> subquery() goes to a scope that is already in the loop, not forward that
> subquery.
>
> Doing this will be somewhat intrusive. At the very least, we would need a
> change at the protocol level that adds the IDs of all scopes involved so far
> to the search request on the wire.

So the issue here is that aggregators can cause loops. I don't see that its really a problem specific to GAs or SAs. Now that we're introducing the concept of aggregation by keywords, SAs too become vulnerable to loops created on the fly.

Consider a News SA that aggregates all scopes with the keyword "news". Then we create a Ubuntu News SA (tagged "news") that also aggregates all scope with the keyword "news" but forwards the query "Ubuntu" to each. Perhaps the Ubuntu News scope also pushes some of its own unique results.

With the "loop repair" approach we will end up with the News scope showing only the unique results from Ubuntu News, and we won't see the Ubuntu News scope appearing under the Ubuntu News itself. That sounds like a pretty cool result.

So yeah, I'm leaning towards us implementing loop repair.

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Actually, its only the aggregators (identified by this config key) that we need to keep in the list of visited scopes. Looking back at my previous example, I think its totally valid that the Ubuntu News scope shows its "Ubuntu" specific results of the same leaf scopes its parent (News) has.

So the second-to-last paragraph of my last comment will change to:

With the "loop repair" approach we will end up with the News scope showing all of its regular child scopes' results, along with an "Ubuntu News" category under which all the "Ubuntu" specific results for the same children are shown. We also won't see the Ubuntu News scope appearing under Ubuntu News itself, nor the News scope showing under News either.

Revision history for this message
Michi Henning (michihenning) wrote :

OK, sounds like a boolean will do in conjunction with detecting and axing off cycles.

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

Merged devel and resolved conflicts

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote :

OK, tests pass, so I assume the conflict resolution didn't break anything :-)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
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-12-03 07:31:22 +0000
+++ CONFIGFILES 2014-12-08 08:09:05 +0000
@@ -411,6 +411,10 @@
411411
412 Note: make sure there are no trailing spaces following the keywords, as they will be preserved.412 Note: make sure there are no trailing spaces following the keywords, as they will be preserved.
413413
414- IsAggregator
415
416 Whether the scope is an aggregator. The default value is false.
417
414418
415The following keys are recognized in the Appearance group:419The following keys are recognized in the Appearance group:
416420
417421
=== modified file 'RELEASE_NOTES.md'
--- RELEASE_NOTES.md 2014-12-03 06:53:40 +0000
+++ RELEASE_NOTES.md 2014-12-08 08:09:05 +0000
@@ -3,7 +3,8 @@
33
4Changes in version 0.6.104Changes in version 0.6.10
5=========================5=========================
6 - Renamed "Tags" scope .ini option to "Keywords"6 - Renamed "Tags" scope .ini option to "Keywords".
7 - Added support for IsAggregator scope .ini option.
78
8Changes in version 0.6.99Changes in version 0.6.9
9========================10========================
1011
=== modified file 'STRUCTS'
--- STRUCTS 2014-12-03 07:31:22 +0000
+++ STRUCTS 2014-12-08 08:09:05 +0000
@@ -80,6 +80,7 @@
80 'child_scopes' : array of strings, optional80 'child_scopes' : array of strings, optional
81 'version' : int, optional81 'version' : int, optional
82 'keywords' : array of strings, optional82 'keywords' : array of strings, optional
83 'is_aggregator' : bool, optional
8384
84Query (returned by serialize())85Query (returned by serialize())
85===============================86===============================
8687
=== modified file 'debian/changelog'
--- debian/changelog 2014-12-03 06:53:40 +0000
+++ debian/changelog 2014-12-08 08:09:05 +0000
@@ -1,8 +1,9 @@
1unity-scopes-api (0.6.10-0ubuntu1) UNRELEASED; urgency=medium1unity-scopes-api (0.6.10-0ubuntu1) UNRELEASED; urgency=medium
22
3 * Renamed "Tags" scope .ini option to "Keywords"3 * Renamed "Tags" scope .ini option to "Keywords".
4 * Added support for IsAggregator scope .ini option.
45
5 -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Wed, 03 Dec 2014 08:32:29 +02006 -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Wed, 03 Dec 2014 09:47:07 +0200
67
7unity-scopes-api (0.6.9+15.04.20141129-0ubuntu1) vivid; urgency=medium8unity-scopes-api (0.6.9+15.04.20141129-0ubuntu1) vivid; urgency=medium
89
910
=== modified file 'debian/libunity-scopes3.symbols'
--- debian/libunity-scopes3.symbols 2014-12-05 08:11:13 +0000
+++ debian/libunity-scopes3.symbols 2014-12-08 08:09:05 +0000
@@ -450,6 +450,7 @@
450 (c++)"unity::scopes::internal::ScopeConfig::icon() const@Base" 0.4.0+14.04.20140312.1450 (c++)"unity::scopes::internal::ScopeConfig::icon() const@Base" 0.4.0+14.04.20140312.1
451 (c++)"unity::scopes::internal::ScopeConfig::idle_timeout() const@Base" 0.4.5+14.10.20140513451 (c++)"unity::scopes::internal::ScopeConfig::idle_timeout() const@Base" 0.4.5+14.10.20140513
452 (c++)"unity::scopes::internal::ScopeConfig::invisible() const@Base" 0.4.0+14.04.20140312.1452 (c++)"unity::scopes::internal::ScopeConfig::invisible() const@Base" 0.4.0+14.04.20140312.1
453 (c++)"unity::scopes::internal::ScopeConfig::is_aggregator() const@Base" 0replaceme
453 (c++)"unity::scopes::internal::ScopeConfig::keywords() const@Base" 0.6.9+15.04.20141129454 (c++)"unity::scopes::internal::ScopeConfig::keywords() const@Base" 0.6.9+15.04.20141129
454 (c++)"unity::scopes::internal::ScopeConfig::location_data_needed() const@Base" 0.5.2+14.10.20140709.2455 (c++)"unity::scopes::internal::ScopeConfig::location_data_needed() const@Base" 0.5.2+14.10.20140709.2
455 (c++)"unity::scopes::internal::ScopeConfig::overrideable() const@Base" 0.4.0+14.04.20140312.1456 (c++)"unity::scopes::internal::ScopeConfig::overrideable() const@Base" 0.4.0+14.04.20140312.1
@@ -491,6 +492,7 @@
491 (c++)"unity::scopes::internal::ScopeMetadataImpl::hot_key() const@Base" 0.4.0+14.04.20140312.1492 (c++)"unity::scopes::internal::ScopeMetadataImpl::hot_key() const@Base" 0.4.0+14.04.20140312.1
492 (c++)"unity::scopes::internal::ScopeMetadataImpl::icon() const@Base" 0.4.0+14.04.20140312.1493 (c++)"unity::scopes::internal::ScopeMetadataImpl::icon() const@Base" 0.4.0+14.04.20140312.1
493 (c++)"unity::scopes::internal::ScopeMetadataImpl::invisible() const@Base" 0.4.0+14.04.20140312.1494 (c++)"unity::scopes::internal::ScopeMetadataImpl::invisible() const@Base" 0.4.0+14.04.20140312.1
495 (c++)"unity::scopes::internal::ScopeMetadataImpl::is_aggregator() const@Base" 0replaceme
494 (c++)"unity::scopes::internal::ScopeMetadataImpl::keywords() const@Base" 0.6.9+15.04.20141129496 (c++)"unity::scopes::internal::ScopeMetadataImpl::keywords() const@Base" 0.6.9+15.04.20141129
495 (c++)"unity::scopes::internal::ScopeMetadataImpl::location_data_needed() const@Base" 0.5.2+14.10.20140709.2497 (c++)"unity::scopes::internal::ScopeMetadataImpl::location_data_needed() const@Base" 0.5.2+14.10.20140709.2
496 (c++)"unity::scopes::internal::ScopeMetadataImpl::operator=(unity::scopes::internal::ScopeMetadataImpl const&)@Base" 0.4.0+14.04.20140312.1498 (c++)"unity::scopes::internal::ScopeMetadataImpl::operator=(unity::scopes::internal::ScopeMetadataImpl const&)@Base" 0.4.0+14.04.20140312.1
@@ -512,6 +514,7 @@
512 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_hot_key(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1514 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_hot_key(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
513 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_icon(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1515 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_icon(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.4.0+14.04.20140312.1
514 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_invisible(bool)@Base" 0.4.0+14.04.20140312.1516 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_invisible(bool)@Base" 0.4.0+14.04.20140312.1
517 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_is_aggregator(bool)@Base" 0replaceme
515 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_keywords(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)@Base" 0.6.9+15.04.20141129518 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_keywords(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)@Base" 0.6.9+15.04.20141129
516 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_location_data_needed(bool)@Base" 0.5.2+14.10.20140709.2519 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_location_data_needed(bool)@Base" 0.5.2+14.10.20140709.2
517 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_proxy(std::shared_ptr<unity::scopes::Scope> const&)@Base" 0.4.0+14.04.20140312.1520 (c++)"unity::scopes::internal::ScopeMetadataImpl::set_proxy(std::shared_ptr<unity::scopes::Scope> const&)@Base" 0.4.0+14.04.20140312.1
@@ -777,6 +780,7 @@
777 (c++)"unity::scopes::ScopeMetadata::hot_key() const@Base" 0.4.0+14.04.20140312.1780 (c++)"unity::scopes::ScopeMetadata::hot_key() const@Base" 0.4.0+14.04.20140312.1
778 (c++)"unity::scopes::ScopeMetadata::icon() const@Base" 0.4.0+14.04.20140312.1781 (c++)"unity::scopes::ScopeMetadata::icon() const@Base" 0.4.0+14.04.20140312.1
779 (c++)"unity::scopes::ScopeMetadata::invisible() const@Base" 0.4.0+14.04.20140312.1782 (c++)"unity::scopes::ScopeMetadata::invisible() const@Base" 0.4.0+14.04.20140312.1
783 (c++)"unity::scopes::ScopeMetadata::is_aggregator() const@Base" 0replaceme
780 (c++)"unity::scopes::ScopeMetadata::keywords() const@Base" 0.6.9+15.04.20141129784 (c++)"unity::scopes::ScopeMetadata::keywords() const@Base" 0.6.9+15.04.20141129
781 (c++)"unity::scopes::ScopeMetadata::location_data_needed() const@Base" 0.5.2+14.10.20140709.2785 (c++)"unity::scopes::ScopeMetadata::location_data_needed() const@Base" 0.5.2+14.10.20140709.2
782 (c++)"unity::scopes::ScopeMetadata::operator=(unity::scopes::ScopeMetadata&&)@Base" 0.4.0+14.04.20140312.1786 (c++)"unity::scopes::ScopeMetadata::operator=(unity::scopes::ScopeMetadata&&)@Base" 0.4.0+14.04.20140312.1
@@ -870,6 +874,7 @@
870 (c++)"unity::scopes::testing::ScopeMetadataBuilder::hot_key(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)@Base" 0.4.0+14.04.20140312.1874 (c++)"unity::scopes::testing::ScopeMetadataBuilder::hot_key(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)@Base" 0.4.0+14.04.20140312.1
871 (c++)"unity::scopes::testing::ScopeMetadataBuilder::icon(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)@Base" 0.4.0+14.04.20140312.1875 (c++)"unity::scopes::testing::ScopeMetadataBuilder::icon(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)@Base" 0.4.0+14.04.20140312.1
872 (c++)"unity::scopes::testing::ScopeMetadataBuilder::invisible(unity::scopes::testing::ScopeMetadataBuilder::Optional<bool> const&)@Base" 0.5.0+14.10.20140619876 (c++)"unity::scopes::testing::ScopeMetadataBuilder::invisible(unity::scopes::testing::ScopeMetadataBuilder::Optional<bool> const&)@Base" 0.5.0+14.10.20140619
877 (c++)"unity::scopes::testing::ScopeMetadataBuilder::is_aggregator(unity::scopes::testing::ScopeMetadataBuilder::Optional<bool> const&)@Base" 0replaceme
873 (c++)"unity::scopes::testing::ScopeMetadataBuilder::keywords(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)@Base" 0.6.9+15.04.20141129878 (c++)"unity::scopes::testing::ScopeMetadataBuilder::keywords(unity::scopes::testing::ScopeMetadataBuilder::Optional<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)@Base" 0.6.9+15.04.20141129
874 (c++)"unity::scopes::testing::ScopeMetadataBuilder::location_data_needed(unity::scopes::testing::ScopeMetadataBuilder::Optional<bool> const&)@Base" 0.6.9+15.04.20141129879 (c++)"unity::scopes::testing::ScopeMetadataBuilder::location_data_needed(unity::scopes::testing::ScopeMetadataBuilder::Optional<bool> const&)@Base" 0.6.9+15.04.20141129
875 (c++)"unity::scopes::testing::ScopeMetadataBuilder::operator()() const@Base" 0.4.0+14.04.20140312.1880 (c++)"unity::scopes::testing::ScopeMetadataBuilder::operator()() const@Base" 0.4.0+14.04.20140312.1
876881
=== modified file 'include/unity/scopes/ScopeMetadata.h'
--- include/unity/scopes/ScopeMetadata.h 2014-12-03 06:53:40 +0000
+++ include/unity/scopes/ScopeMetadata.h 2014-12-08 08:09:05 +0000
@@ -213,6 +213,12 @@
213 */213 */
214 std::vector<std::string> keywords() const;214 std::vector<std::string> keywords() const;
215215
216 /**
217 \brief Check if this scope is an aggregator.
218 \return True if this scope is an aggregator.
219 */
220 bool is_aggregator() const; // optional (default = false)
221
216private:222private:
217 ScopeMetadata(std::unique_ptr<internal::ScopeMetadataImpl>); // Instantiable only by ScopeMetadataImpl223 ScopeMetadata(std::unique_ptr<internal::ScopeMetadataImpl>); // Instantiable only by ScopeMetadataImpl
218 std::unique_ptr<internal::ScopeMetadataImpl> p;224 std::unique_ptr<internal::ScopeMetadataImpl> p;
219225
=== modified file 'include/unity/scopes/internal/ScopeConfig.h'
--- include/unity/scopes/internal/ScopeConfig.h 2014-12-03 06:53:40 +0000
+++ include/unity/scopes/internal/ScopeConfig.h 2014-12-08 08:09:05 +0000
@@ -55,6 +55,7 @@
55 std::vector<std::string> child_scope_ids() const; // Optional, returns an empty vector if no ids are present55 std::vector<std::string> child_scope_ids() const; // Optional, returns an empty vector if no ids are present
56 int version() const; // Optional, returns 0 if not present56 int version() const; // Optional, returns 0 if not present
57 std::vector<std::string> keywords() const; // Optional, returns an empty vector if no keywords are present57 std::vector<std::string> keywords() const; // Optional, returns an empty vector if no keywords are present
58 bool is_aggregator() const; // Optional, returns false if not present
5859
59 VariantMap appearance_attributes() const; // Optional, returns empty map if no attributes are present60 VariantMap appearance_attributes() const; // Optional, returns empty map if no attributes are present
6061
@@ -78,6 +79,7 @@
78 std::vector<std::string> child_scope_ids_;79 std::vector<std::string> child_scope_ids_;
79 int version_;80 int version_;
80 std::vector<std::string> keywords_;81 std::vector<std::string> keywords_;
82 bool is_aggregator_;
8183
82 VariantMap appearance_attributes_;84 VariantMap appearance_attributes_;
83};85};
8486
=== modified file 'include/unity/scopes/internal/ScopeMetadataImpl.h'
--- include/unity/scopes/internal/ScopeMetadataImpl.h 2014-12-03 06:53:40 +0000
+++ include/unity/scopes/internal/ScopeMetadataImpl.h 2014-12-08 08:09:05 +0000
@@ -60,6 +60,7 @@
60 std::vector<std::string> child_scope_ids() const; // optional (default: empty array)60 std::vector<std::string> child_scope_ids() const; // optional (default: empty array)
61 int version() const; // optional (default: 0)61 int version() const; // optional (default: 0)
62 std::vector<std::string> keywords() const; // optional (default: empty array)62 std::vector<std::string> keywords() const; // optional (default: empty array)
63 bool is_aggregator() const; // optional (default: false)
6364
64 void set_scope_id(std::string const& scope_id);65 void set_scope_id(std::string const& scope_id);
65 void set_proxy(ScopeProxy const& proxy);66 void set_proxy(ScopeProxy const& proxy);
@@ -79,6 +80,7 @@
79 void set_child_scope_ids(std::vector<std::string> const& ids);80 void set_child_scope_ids(std::vector<std::string> const& ids);
80 void set_version(int v);81 void set_version(int v);
81 void set_keywords(std::vector<std::string> const& keywords);82 void set_keywords(std::vector<std::string> const& keywords);
83 void set_is_aggregator(bool is_aggregator);
8284
83 VariantMap serialize() const;85 VariantMap serialize() const;
84 void deserialize(VariantMap const& var);86 void deserialize(VariantMap const& var);
@@ -106,6 +108,7 @@
106 std::vector<std::string> child_scope_ids_;108 std::vector<std::string> child_scope_ids_;
107 int version_;109 int version_;
108 std::vector<std::string> keywords_;110 std::vector<std::string> keywords_;
111 std::unique_ptr<bool> is_aggregator_; // Optional, hence a pointer
109};112};
110113
111} // namespace internal114} // namespace internal
112115
=== modified file 'include/unity/scopes/testing/ScopeMetadataBuilder.h'
--- include/unity/scopes/testing/ScopeMetadataBuilder.h 2014-12-03 06:53:40 +0000
+++ include/unity/scopes/testing/ScopeMetadataBuilder.h 2014-12-08 08:09:05 +0000
@@ -98,6 +98,7 @@
98 ScopeMetadataBuilder& child_scope_ids(Optional<std::vector<std::string>> const& value);98 ScopeMetadataBuilder& child_scope_ids(Optional<std::vector<std::string>> const& value);
99 ScopeMetadataBuilder& version(Optional<int> const& value);99 ScopeMetadataBuilder& version(Optional<int> const& value);
100 ScopeMetadataBuilder& keywords(Optional<std::vector<std::string>> const& value);100 ScopeMetadataBuilder& keywords(Optional<std::vector<std::string>> const& value);
101 ScopeMetadataBuilder& is_aggregator(Optional<bool> const& value);
101102
102 ScopeMetadata operator()() const;103 ScopeMetadata operator()() const;
103104
104105
=== modified file 'scoperegistry/scoperegistry.cpp'
--- scoperegistry/scoperegistry.cpp 2014-12-03 06:53:40 +0000
+++ scoperegistry/scoperegistry.cpp 2014-12-08 08:09:05 +0000
@@ -320,6 +320,7 @@
320 mi->set_child_scope_ids(sc.child_scope_ids());320 mi->set_child_scope_ids(sc.child_scope_ids());
321 mi->set_version(sc.version());321 mi->set_version(sc.version());
322 mi->set_keywords(sc.keywords());322 mi->set_keywords(sc.keywords());
323 mi->set_is_aggregator(sc.is_aggregator());
323324
324 // Prepend scope_dir to pageheader logo path if logo path is relative.325 // Prepend scope_dir to pageheader logo path if logo path is relative.
325 // TODO: Once we have type-safe parsing in the config files, remove326 // TODO: Once we have type-safe parsing in the config files, remove
326327
=== modified file 'src/scopes/ScopeMetadata.cpp'
--- src/scopes/ScopeMetadata.cpp 2014-12-03 06:53:40 +0000
+++ src/scopes/ScopeMetadata.cpp 2014-12-08 08:09:05 +0000
@@ -162,6 +162,11 @@
162 return p->keywords();162 return p->keywords();
163}163}
164164
165bool ScopeMetadata::is_aggregator() const
166{
167 return p->is_aggregator();
168}
169
165//! @endcond170//! @endcond
166171
167} // namespace scopes172} // namespace scopes
168173
=== modified file 'src/scopes/internal/ScopeConfig.cpp'
--- src/scopes/internal/ScopeConfig.cpp 2014-12-03 06:53:40 +0000
+++ src/scopes/internal/ScopeConfig.cpp 2014-12-08 08:09:05 +0000
@@ -58,6 +58,7 @@
58 const string child_scope_ids_key = "ChildScopes";58 const string child_scope_ids_key = "ChildScopes";
59 const string version_key = "Version";59 const string version_key = "Version";
60 const string keywords_key = "Keywords";60 const string keywords_key = "Keywords";
61 const string is_aggregator_key = "IsAggregator";
6162
62 const string scope_appearance_group = "Appearance";63 const string scope_appearance_group = "Appearance";
63 const string fg_color_key = "ForegroundColor";64 const string fg_color_key = "ForegroundColor";
@@ -239,6 +240,15 @@
239240
240 try241 try
241 {242 {
243 is_aggregator_ = parser()->get_boolean(scope_config_group, is_aggregator_key);
244 }
245 catch (LogicException const&)
246 {
247 is_aggregator_ = false;
248 }
249
250 try
251 {
242 debug_mode_ = parser()->get_boolean(scope_config_group, debug_mode_key);252 debug_mode_ = parser()->get_boolean(scope_config_group, debug_mode_key);
243 }253 }
244 catch (LogicException const&)254 catch (LogicException const&)
@@ -277,7 +287,8 @@
277 debug_mode_key,287 debug_mode_key,
278 child_scope_ids_key,288 child_scope_ids_key,
279 version_key,289 version_key,
280 keywords_key290 keywords_key,
291 is_aggregator_key
281 }292 }
282 },293 },
283 { scope_appearance_group,294 { scope_appearance_group,
@@ -466,6 +477,11 @@
466 return keywords_;477 return keywords_;
467}478}
468479
480bool ScopeConfig::is_aggregator() const
481{
482 return is_aggregator_;
483}
484
469} // namespace internal485} // namespace internal
470486
471} // namespace scopes487} // namespace scopes
472488
=== modified file 'src/scopes/internal/ScopeMetadataImpl.cpp'
--- src/scopes/internal/ScopeMetadataImpl.cpp 2014-12-03 06:53:40 +0000
+++ src/scopes/internal/ScopeMetadataImpl.cpp 2014-12-08 08:09:05 +0000
@@ -95,6 +95,10 @@
95 {95 {
96 location_data_needed_.reset(new bool(*other.location_data_needed_));96 location_data_needed_.reset(new bool(*other.location_data_needed_));
97 }97 }
98 if (other.is_aggregator_)
99 {
100 is_aggregator_.reset(new bool(*other.is_aggregator_));
101 }
98}102}
99103
100ScopeMetadataImpl& ScopeMetadataImpl::operator=(ScopeMetadataImpl const& rhs)104ScopeMetadataImpl& ScopeMetadataImpl::operator=(ScopeMetadataImpl const& rhs)
@@ -120,6 +124,7 @@
120 child_scope_ids_ = rhs.child_scope_ids_;124 child_scope_ids_ = rhs.child_scope_ids_;
121 version_ = rhs.version_;125 version_ = rhs.version_;
122 keywords_ = rhs.keywords_;126 keywords_ = rhs.keywords_;
127 is_aggregator_.reset(rhs.is_aggregator_ ? new bool(*rhs.is_aggregator_) : nullptr);
123 }128 }
124 return *this;129 return *this;
125}130}
@@ -246,6 +251,15 @@
246 return keywords_;251 return keywords_;
247}252}
248253
254bool ScopeMetadataImpl::is_aggregator() const
255{
256 if (is_aggregator_)
257 {
258 return *is_aggregator_;
259 }
260 return false;
261}
262
249void ScopeMetadataImpl::set_scope_id(std::string const& scope_id)263void ScopeMetadataImpl::set_scope_id(std::string const& scope_id)
250{264{
251 scope_id_ = scope_id;265 scope_id_ = scope_id;
@@ -321,6 +335,11 @@
321 location_data_needed_.reset(new bool(location_data_needed));335 location_data_needed_.reset(new bool(location_data_needed));
322}336}
323337
338void ScopeMetadataImpl::set_is_aggregator(bool is_aggregator)
339{
340 is_aggregator_.reset(new bool(is_aggregator));
341}
342
324void ScopeMetadataImpl::set_child_scope_ids(std::vector<std::string> const& ids)343void ScopeMetadataImpl::set_child_scope_ids(std::vector<std::string> const& ids)
325{344{
326 child_scope_ids_ = ids;345 child_scope_ids_ = ids;
@@ -434,6 +453,10 @@
434 }453 }
435 var["keywords"] = Variant(va);454 var["keywords"] = Variant(va);
436 }455 }
456 if (is_aggregator_)
457 {
458 var["is_aggregator"] = *is_aggregator_;
459 }
437460
438 return var;461 return var;
439}462}
@@ -588,6 +611,12 @@
588 keywords_.push_back(v.get_string());611 keywords_.push_back(v.get_string());
589 }612 }
590 }613 }
614
615 it = var.find("is_aggregator");
616 if (it != var.end())
617 {
618 is_aggregator_.reset(new bool(it->second.get_bool()));
619 }
591}620}
592621
593ScopeMetadata ScopeMetadataImpl::create(unique_ptr<ScopeMetadataImpl> impl)622ScopeMetadata ScopeMetadataImpl::create(unique_ptr<ScopeMetadataImpl> impl)
594623
=== modified file 'src/scopes/testing/ScopeMetadataBuilder.cpp'
--- src/scopes/testing/ScopeMetadataBuilder.cpp 2014-12-03 06:53:40 +0000
+++ src/scopes/testing/ScopeMetadataBuilder.cpp 2014-12-08 08:09:05 +0000
@@ -49,6 +49,7 @@
49 Optional<std::vector<std::string>> child_scope_ids;49 Optional<std::vector<std::string>> child_scope_ids;
50 Optional<int> version;50 Optional<int> version;
51 Optional<std::vector<std::string>> keywords;51 Optional<std::vector<std::string>> keywords;
52 Optional<bool> is_aggregator;
52};53};
5354
54testing::ScopeMetadataBuilder::ScopeMetadataBuilder() : p(new Private())55testing::ScopeMetadataBuilder::ScopeMetadataBuilder() : p(new Private())
@@ -167,6 +168,12 @@
167 return *this;168 return *this;
168}169}
169170
171testing::ScopeMetadataBuilder& testing::ScopeMetadataBuilder::is_aggregator(Optional<bool> const& value)
172{
173 p->is_aggregator = value;
174 return *this;
175}
176
170unity::scopes::ScopeMetadata testing::ScopeMetadataBuilder::operator()() const177unity::scopes::ScopeMetadata testing::ScopeMetadataBuilder::operator()() const
171{178{
172 auto impl = new unity::scopes::internal::ScopeMetadataImpl(Private::invalid_middleware);179 auto impl = new unity::scopes::internal::ScopeMetadataImpl(Private::invalid_middleware);
@@ -202,6 +209,8 @@
202 impl->set_version(*p->version);209 impl->set_version(*p->version);
203 if (p->keywords)210 if (p->keywords)
204 impl->set_keywords(*p->keywords);211 impl->set_keywords(*p->keywords);
212 if (p->is_aggregator)
213 impl->set_is_aggregator(*p->is_aggregator);
205214
206 return unity::scopes::internal::ScopeMetadataImpl::create(215 return unity::scopes::internal::ScopeMetadataImpl::create(
207 std::move(216 std::move(
208217
=== modified file 'test/gtest/scopes/Registry/Registry_test.cpp'
--- test/gtest/scopes/Registry/Registry_test.cpp 2014-12-03 06:53:40 +0000
+++ test/gtest/scopes/Registry/Registry_test.cpp 2014-12-08 08:09:05 +0000
@@ -116,6 +116,7 @@
116 EXPECT_EQ("music", keywords[0]);116 EXPECT_EQ("music", keywords[0]);
117 EXPECT_EQ("news", keywords[1]);117 EXPECT_EQ("news", keywords[1]);
118 EXPECT_EQ("foo", keywords[2]);118 EXPECT_EQ("foo", keywords[2]);
119 EXPECT_FALSE(meta.is_aggregator());
119120
120 auto attrs = meta.appearance_attributes();121 auto attrs = meta.appearance_attributes();
121 EXPECT_EQ("fg_color", attrs["foreground-color"].get_string());122 EXPECT_EQ("fg_color", attrs["foreground-color"].get_string());
@@ -149,6 +150,7 @@
149 EXPECT_EQ(0, meta.child_scope_ids().size());150 EXPECT_EQ(0, meta.child_scope_ids().size());
150 EXPECT_EQ(0, meta.keywords().size());151 EXPECT_EQ(0, meta.keywords().size());
151 EXPECT_EQ(0, meta.version());152 EXPECT_EQ(0, meta.version());
153 EXPECT_FALSE(meta.is_aggregator());
152}154}
153155
154auto const wait_for_update_time = std::chrono::milliseconds(5000);156auto const wait_for_update_time = std::chrono::milliseconds(5000);
155157
=== modified file 'test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in'
--- test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-12-03 06:53:40 +0000
+++ test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.ini.in 2014-12-08 08:09:05 +0000
@@ -10,6 +10,7 @@
10ChildScopes = com.foo.bar;com.foo.baz10ChildScopes = com.foo.bar;com.foo.baz
11Version = 111Version = 1
12Keywords = music;news;foo12Keywords = music;news;foo
13IsAggregator = false
1314
14[Appearance]15[Appearance]
15ForegroundColor = fg_color16ForegroundColor = fg_color
1617
=== modified file 'test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp'
--- test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp 2014-12-03 06:53:40 +0000
+++ test/gtest/scopes/internal/ScopeConfig/ScopeConfig_test.cpp 2014-12-08 08:09:05 +0000
@@ -62,6 +62,8 @@
62 EXPECT_EQ("foo", keywords[0]);62 EXPECT_EQ("foo", keywords[0]);
63 EXPECT_EQ("bar", keywords[1]);63 EXPECT_EQ("bar", keywords[1]);
6464
65 EXPECT_TRUE(cfg.is_aggregator());
66
65 auto attrs = cfg.appearance_attributes();67 auto attrs = cfg.appearance_attributes();
66 EXPECT_EQ(5, attrs.size());68 EXPECT_EQ(5, attrs.size());
67 EXPECT_TRUE(attrs["arbitrary_key"].get_bool());69 EXPECT_TRUE(attrs["arbitrary_key"].get_bool());
@@ -93,6 +95,7 @@
93 EXPECT_FALSE(cfg.location_data_needed());95 EXPECT_FALSE(cfg.location_data_needed());
94 EXPECT_FALSE(cfg.debug_mode());96 EXPECT_FALSE(cfg.debug_mode());
95 EXPECT_EQ(0, cfg.version());97 EXPECT_EQ(0, cfg.version());
98 EXPECT_FALSE(cfg.is_aggregator());
9699
97 EXPECT_EQ(0, cfg.appearance_attributes().size());100 EXPECT_EQ(0, cfg.appearance_attributes().size());
98101
99102
=== modified file 'test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in'
--- test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in 2014-12-03 06:53:40 +0000
+++ test/gtest/scopes/internal/ScopeConfig/complete_config.ini.in 2014-12-08 08:09:05 +0000
@@ -20,6 +20,7 @@
20Version = 120Version = 1
21ChildScopes = com.foo.bar;com.foo.bar2;com.foo.boo21ChildScopes = com.foo.bar;com.foo.bar2;com.foo.boo
22Keywords = foo;bar22Keywords = foo;bar
23IsAggregator = true
2324
24[Appearance]25[Appearance]
25arbitrary_key = true26arbitrary_key = true
2627
=== modified file 'test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp'
--- test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp 2014-12-03 06:53:40 +0000
+++ test/gtest/scopes/internal/ScopeMetadataImpl/ScopeMetadataImpl_test.cpp 2014-12-08 08:09:05 +0000
@@ -134,6 +134,9 @@
134 // when "version" is not set, 0 is returned134 // when "version" is not set, 0 is returned
135 EXPECT_EQ(0, m.version());135 EXPECT_EQ(0, m.version());
136136
137 // when "is_aggregator" is not set, false is returned
138 EXPECT_FALSE(m.is_aggregator());
139
137 // Check that the copy has the same values as the original140 // Check that the copy has the same values as the original
138 EXPECT_EQ("scope_id", mi2->scope_id());141 EXPECT_EQ("scope_id", mi2->scope_id());
139 EXPECT_EQ("identity", mi2->proxy()->identity());142 EXPECT_EQ("identity", mi2->proxy()->identity());
@@ -163,6 +166,7 @@
163 mi2->set_location_data_needed(true);166 mi2->set_location_data_needed(true);
164 mi2->set_child_scope_ids(vector<string>{"abc", "def"});167 mi2->set_child_scope_ids(vector<string>{"abc", "def"});
165 mi2->set_keywords(vector<string>{"music", "video", "news"});168 mi2->set_keywords(vector<string>{"music", "video", "news"});
169 mi2->set_is_aggregator(true);
166170
167 // Make another copy, so we get coverage on the entire copy constructor171 // Make another copy, so we get coverage on the entire copy constructor
168 unique_ptr<ScopeMetadataImpl> mi3(new ScopeMetadataImpl(*mi2));172 unique_ptr<ScopeMetadataImpl> mi3(new ScopeMetadataImpl(*mi2));
@@ -177,6 +181,7 @@
177 EXPECT_TRUE(m.location_data_needed());181 EXPECT_TRUE(m.location_data_needed());
178 EXPECT_EQ((vector<string>{"abc", "def"}), m.child_scope_ids());182 EXPECT_EQ((vector<string>{"abc", "def"}), m.child_scope_ids());
179 EXPECT_EQ((vector<string>{"music", "video", "news"}), m.keywords());183 EXPECT_EQ((vector<string>{"music", "video", "news"}), m.keywords());
184 EXPECT_TRUE(m.is_aggregator());
180185
181 // Make another value186 // Make another value
182 unique_ptr<ScopeMetadataImpl> ti(new ScopeMetadataImpl(&mw));187 unique_ptr<ScopeMetadataImpl> ti(new ScopeMetadataImpl(&mw));
@@ -201,6 +206,7 @@
201 ti->set_location_data_needed(true);206 ti->set_location_data_needed(true);
202 ti->set_child_scope_ids(vector<string>{"tmp abc", "tmp def"});207 ti->set_child_scope_ids(vector<string>{"tmp abc", "tmp def"});
203 ti->set_keywords(vector<string>{"music", "video"});208 ti->set_keywords(vector<string>{"music", "video"});
209 ti->set_is_aggregator(true);
204210
205 // Check impl assignment operator211 // Check impl assignment operator
206 ScopeMetadataImpl ci(&mw);212 ScopeMetadataImpl ci(&mw);
@@ -224,6 +230,7 @@
224 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), ci.child_scope_ids());230 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), ci.child_scope_ids());
225 EXPECT_EQ(99, ci.version());231 EXPECT_EQ(99, ci.version());
226 EXPECT_EQ((vector<string>{"music", "video"}), ci.keywords());232 EXPECT_EQ((vector<string>{"music", "video"}), ci.keywords());
233 EXPECT_TRUE(ci.is_aggregator());
227234
228 // Check public assignment operator235 // Check public assignment operator
229 auto tmp = ScopeMetadataImpl::create(move(ti));236 auto tmp = ScopeMetadataImpl::create(move(ti));
@@ -247,6 +254,7 @@
247 EXPECT_TRUE(m.location_data_needed());254 EXPECT_TRUE(m.location_data_needed());
248 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), m.child_scope_ids());255 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), m.child_scope_ids());
249 EXPECT_EQ((vector<string>{"music", "video"}), m.keywords());256 EXPECT_EQ((vector<string>{"music", "video"}), m.keywords());
257 EXPECT_TRUE(m.is_aggregator());
250258
251 // Self-assignment259 // Self-assignment
252 tmp = tmp;260 tmp = tmp;
@@ -269,6 +277,7 @@
269 EXPECT_TRUE(tmp.location_data_needed());277 EXPECT_TRUE(tmp.location_data_needed());
270 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp.child_scope_ids());278 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp.child_scope_ids());
271 EXPECT_EQ((vector<string>{"music", "video"}), tmp.keywords());279 EXPECT_EQ((vector<string>{"music", "video"}), tmp.keywords());
280 EXPECT_TRUE(tmp.is_aggregator());
272281
273 // Copy constructor282 // Copy constructor
274 ScopeMetadata tmp2(tmp);283 ScopeMetadata tmp2(tmp);
@@ -291,6 +300,7 @@
291 EXPECT_TRUE(tmp2.location_data_needed());300 EXPECT_TRUE(tmp2.location_data_needed());
292 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp2.child_scope_ids());301 EXPECT_EQ((vector<string>{"tmp abc", "tmp def"}), tmp2.child_scope_ids());
293 EXPECT_EQ((vector<string>{"music", "video"}), tmp2.keywords());302 EXPECT_EQ((vector<string>{"music", "video"}), tmp2.keywords());
303 EXPECT_TRUE(tmp2.is_aggregator());
294}304}
295305
296TEST(ScopeMetadataImpl, serialize)306TEST(ScopeMetadataImpl, serialize)
@@ -323,11 +333,12 @@
323 mi->set_location_data_needed(false);333 mi->set_location_data_needed(false);
324 mi->set_child_scope_ids({"com.foo.bar", "com.foo.baz"});334 mi->set_child_scope_ids({"com.foo.bar", "com.foo.baz"});
325 mi->set_keywords({"news", "games"});335 mi->set_keywords({"news", "games"});
336 mi->set_is_aggregator(false);
326337
327 // Check that serialize() sets the map values correctly338 // Check that serialize() sets the map values correctly
328 auto m = ScopeMetadataImpl::create(move(mi));339 auto m = ScopeMetadataImpl::create(move(mi));
329 auto var = m.serialize();340 auto var = m.serialize();
330 EXPECT_EQ(18u, var.size());341 EXPECT_EQ(19u, var.size());
331 EXPECT_EQ("scope_id", var["scope_id"].get_string());342 EXPECT_EQ("scope_id", var["scope_id"].get_string());
332 EXPECT_EQ("display_name", var["display_name"].get_string());343 EXPECT_EQ("display_name", var["display_name"].get_string());
333 EXPECT_EQ("description", var["description"].get_string());344 EXPECT_EQ("description", var["description"].get_string());
@@ -351,6 +362,7 @@
351 EXPECT_EQ(2u, var["keywords"].get_array().size());362 EXPECT_EQ(2u, var["keywords"].get_array().size());
352 EXPECT_EQ("news", var["keywords"].get_array()[0].get_string());363 EXPECT_EQ("news", var["keywords"].get_array()[0].get_string());
353 EXPECT_EQ("games", var["keywords"].get_array()[1].get_string());364 EXPECT_EQ("games", var["keywords"].get_array()[1].get_string());
365 EXPECT_FALSE(var["is_aggregator"].get_bool());
354366
355 // Make another instance from the VariantMap and check its fields367 // Make another instance from the VariantMap and check its fields
356 ScopeMetadataImpl c(var, &mw);368 ScopeMetadataImpl c(var, &mw);
@@ -378,6 +390,7 @@
378 EXPECT_EQ(2u, c.keywords().size());390 EXPECT_EQ(2u, c.keywords().size());
379 EXPECT_EQ("news", c.keywords()[0]);391 EXPECT_EQ("news", c.keywords()[0]);
380 EXPECT_EQ("games", c.keywords()[1]);392 EXPECT_EQ("games", c.keywords()[1]);
393 EXPECT_FALSE(c.is_aggregator());
381}394}
382395
383TEST(ScopeMetadataImpl, serialize_exceptions)396TEST(ScopeMetadataImpl, serialize_exceptions)
@@ -594,6 +607,7 @@
594 m["appearance_attributes"] = appearance;607 m["appearance_attributes"] = appearance;
595 m["results_ttl_type"] = 0;608 m["results_ttl_type"] = 0;
596 m["location_data_needed"] = true;609 m["location_data_needed"] = true;
610 m["is_aggregator"] = true;
597611
598 ScopeMetadataImpl mi(m, &mw);612 ScopeMetadataImpl mi(m, &mw);
599 mi.deserialize(m);613 mi.deserialize(m);
@@ -612,4 +626,5 @@
612 EXPECT_EQ(appearance, mi.appearance_attributes());626 EXPECT_EQ(appearance, mi.appearance_attributes());
613 EXPECT_EQ(ScopeMetadata::ResultsTtlType::None, mi.results_ttl_type());627 EXPECT_EQ(ScopeMetadata::ResultsTtlType::None, mi.results_ttl_type());
614 EXPECT_TRUE(mi.location_data_needed());628 EXPECT_TRUE(mi.location_data_needed());
629 EXPECT_TRUE(mi.is_aggregator());
615}630}
616631
=== modified file 'test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp'
--- test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp 2014-12-03 06:53:40 +0000
+++ test/gtest/scopes/testing/IsolatedScope/IsolatedScope_test.cpp 2014-12-08 08:09:05 +0000
@@ -114,7 +114,8 @@
114 .location_data_needed(true)114 .location_data_needed(true)
115 .child_scope_ids(child_scope_ids)115 .child_scope_ids(child_scope_ids)
116 .version(42)116 .version(42)
117 .keywords(keywords);117 .keywords(keywords)
118 .is_aggregator(true);
118 unity::scopes::ScopeMetadata metadata = builder();119 unity::scopes::ScopeMetadata metadata = builder();
119 EXPECT_EQ(scope_id, metadata.scope_id());120 EXPECT_EQ(scope_id, metadata.scope_id());
120 EXPECT_EQ("display_name", metadata.display_name());121 EXPECT_EQ("display_name", metadata.display_name());
@@ -133,6 +134,7 @@
133 EXPECT_EQ(child_scope_ids, metadata.child_scope_ids());134 EXPECT_EQ(child_scope_ids, metadata.child_scope_ids());
134 EXPECT_EQ(42, metadata.version());135 EXPECT_EQ(42, metadata.version());
135 EXPECT_EQ(keywords, metadata.keywords());136 EXPECT_EQ(keywords, metadata.keywords());
137 EXPECT_TRUE(metadata.is_aggregator());
136}138}
137139
138TEST(ScopeMetadataBuilder, construction_in_case_of_missing_mandatory_arguments_aborts)140TEST(ScopeMetadataBuilder, construction_in_case_of_missing_mandatory_arguments_aborts)

Subscribers

People subscribed via source and target branches

to all changes: