summaryrefslogtreecommitdiffstats
path: root/src/lib/config
diff options
context:
space:
mode:
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>2013-07-09 14:48:11 +0200
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>2013-07-12 11:43:00 +0200
commit87c3781cf964f63b044153a39b05518f72d8b80e (patch)
tree743adbe244bd0e669cdde35270a8f2d10f65f613 /src/lib/config
parent[2862] Auxiliary function to get list of classes (diff)
downloadkea-87c3781cf964f63b044153a39b05518f72d8b80e.tar.xz
kea-87c3781cf964f63b044153a39b05518f72d8b80e.zip
[2862] Subscribe and unsubscribe on MCCS
Diffstat (limited to 'src/lib/config')
-rw-r--r--src/lib/config/ccsession.h14
-rw-r--r--src/lib/config/tests/ccsession_unittests.cc11
2 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/config/ccsession.h b/src/lib/config/ccsession.h
index 04e3046af6..5c614e6aa7 100644
--- a/src/lib/config/ccsession.h
+++ b/src/lib/config/ccsession.h
@@ -575,6 +575,20 @@ public:
/// \param id The id of request as returned by groupRecvMsgAsync.
void cancelAsyncRecv(const AsyncRecvRequestID& id);
+ /// \brief Subscribe to a group
+ ///
+ /// Wrapper around the CCSession::subscribe.
+ void subscribe(const std::string& group) {
+ session_.subscribe(group, isc::cc::CC_INSTANCE_WILDCARD);
+ }
+
+ /// \brief Unsubscribe from a group.
+ ///
+ /// Wrapper around the CCSession::unsubscribe.
+ void unsubscribe(const std::string& group) {
+ session_.unsubscribe(group, isc::cc::CC_INSTANCE_WILDCARD);
+ }
+
private:
ModuleSpec readModuleSpecification(const std::string& filename);
void startCheck();
diff --git a/src/lib/config/tests/ccsession_unittests.cc b/src/lib/config/tests/ccsession_unittests.cc
index 700ffe4d36..d958529599 100644
--- a/src/lib/config/tests/ccsession_unittests.cc
+++ b/src/lib/config/tests/ccsession_unittests.cc
@@ -157,6 +157,17 @@ TEST_F(CCSessionTest, notifyNoParams) {
session.getMsgQueue()->get(1)->toWire();
}
+// Try to subscribe and unsubscribe once again
+TEST_F(CCSessionTest, subscribe) {
+ ModuleCCSession mccs(ccspecfile("spec1.spec"), session, NULL, NULL, false,
+ false);
+ EXPECT_FALSE(session.haveSubscription("A group", "*"));
+ mccs.subscribe("A group");
+ EXPECT_TRUE(session.haveSubscription("A group", "*"));
+ mccs.unsubscribe("A group");
+ EXPECT_FALSE(session.haveSubscription("A group", "*"));
+}
+
TEST_F(CCSessionTest, createAnswer) {
ConstElementPtr answer;
answer = createAnswer();