Hide private event info using interface 21/201821/3
authorhyunho <hhstark.kang@samsung.com>
Wed, 20 Mar 2019 02:21:34 +0000 (11:21 +0900)
committerhyunho <hhstark.kang@samsung.com>
Wed, 20 Mar 2019 04:31:21 +0000 (13:31 +0900)
Change-Id: I314475eb35498358cceb4141672cfcc08aaf3b2f
Signed-off-by: hyunho <hhstark.kang@samsung.com>
19 files changed:
notification-ex/dbus_event_listener.cc
notification-ex/dbus_event_listener.h
notification-ex/dbus_sender.cc
notification-ex/dbus_sender.h
notification-ex/event_info.cc
notification-ex/event_info_implementation.h
notification-ex/event_info_internal.h [moved from notification-ex/event_info.h with 62% similarity]
notification-ex/event_listener_interface.h
notification-ex/event_observer_interface.h
notification-ex/event_sender_interface.h
notification-ex/ievent_info.h [new file with mode: 0644]
notification-ex/ievent_info_internal.h [new file with mode: 0644]
notification-ex/manager.cc
notification-ex/manager.h
notification-ex/manager_implementation.h
notification-ex/reporter.cc
notification-ex/reporter.h
notification-ex/reporter_implementation.h
unittest/src/test_event_info.cc

index 2346b59..0ff42d1 100644 (file)
@@ -23,6 +23,7 @@
 #include "notification-ex/dbus_event_listener_implementation.h"
 #include "notification-ex/exception.h"
 #include "notification-ex/ex_util.h"
+#include "notification-ex/event_info_internal.h"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
@@ -206,11 +207,11 @@ void DBusEventListener::UnRegisterObserver(IEventObserver* observer) {
 }
 
 void DBusEventListener::NotifyObserver(
-    const EventInfo& info, list<Bundle> serialized) {
+    const IEventInfo& info, list<Bundle> serialized) {
   impl_->observer_->OnEvent(info, serialized);
 }
 
-list<Bundle> DBusEventListener::NotifyObserver(const EventInfo& info) {
+list<Bundle> DBusEventListener::NotifyObserver(const IEventInfo& info) {
   return impl_->observer_->OnRequest(info);
 }
 
index ea1452b..15b1fde 100644 (file)
@@ -29,8 +29,8 @@ class EXPORT_API DBusEventListener : public IEventListener {
   void RegisterObserver(IEventObserver* observer) override;
   void UnRegisterObserver(IEventObserver* observer) override;
   void NotifyObserver(
-      const EventInfo& info, std::list<Bundle> serialized) override;
-  std::list<Bundle> NotifyObserver(const EventInfo& info) override;
+      const IEventInfo& info, std::list<Bundle> serialized) override;
+  std::list<Bundle> NotifyObserver(const IEventInfo& info) override;
 
  private:
   class Impl;
index 760a5a0..1e43ac7 100644 (file)
@@ -23,7 +23,7 @@
 #include "notification-ex/dbus_connection_manager.h"
 #include "notification-ex/dbus_sender.h"
 #include "notification-ex/dbus_sender_implementation.h"
-#include "notification-ex/event_info.h"
+#include "notification-ex/event_info_internal.h"
 #include "notification-ex/ex_util.h"
 
 #ifdef LOG_TAG
@@ -76,7 +76,7 @@ bool DBusSender::Impl::EmitSignal(string bus_name, string signal_name,
   return result;
 }
 
-void DBusSender::Notify(const EventInfo& info, list<Bundle> serialized,
+void DBusSender::Notify(const IEventInfo& info, list<Bundle> serialized,
     string dest_appid) {
   string signal_name = EventInfo::GetString(info.GetEventType());
   string appid = util::GetAppId();
@@ -131,7 +131,7 @@ GDBusMessage* DBusSender::Impl::MethodCall(string appid, string method_name,
   return reply;
 }
 
-std::list<Bundle> DBusSender::Request(const EventInfo& info) {
+std::list<Bundle> DBusSender::Request(const IEventInfo& info) {
   string appid = util::GetAppId();
   string method_name = EventInfo::GetString(info.GetEventType());
   Bundle serialized = info.Serialize();
index b9c9659..7e86e8e 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "notification-ex/ex_bundle.h"
 #include "notification-ex/event_sender_interface.h"
-#include "notification-ex/event_info.h"
+#include "notification-ex/ievent_info.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
@@ -32,9 +32,9 @@ class EXPORT_API DBusSender : public IEventSender {
   DBusSender(std::string path);
   virtual ~DBusSender();
 
-  void Notify(const EventInfo& info, std::list<Bundle> serialized,
+  void Notify(const IEventInfo& info, std::list<Bundle> serialized,
       std::string dest_appid = "") override;
-  std::list<Bundle> Request(const EventInfo& info) override;
+  std::list<Bundle> Request(const IEventInfo& info) override;
 
  private:
   class Impl;
index 552159a..d6562fb 100644 (file)
  */
 
 #include <dlog.h>
+#include <unistd.h>
 
 #include <memory>
 
-#include "notification-ex/event_info.h"
+#include "notification-ex/event_info_internal.h"
 #include "notification-ex/event_info_implementation.h"
 
 #ifdef LOG_TAG
 #define NOTIFICATION_EX_EVENT_CHANNEL_KEY "__NOTIFICATION_EX_EVENT_CHANNEL_KEY__"
 #define NOTIFICATION_EX_EVENT_ITEM_ID_KEY "__NOTIFICATION_EX_EVENT_ITEM_ID_KEY__"
 #define NOTIFICATION_EX_EVENT_TAG_KEY "__NOTIFICATION_EX_EVENT_TAG_KEY__"
+#define NOTIFICATION_EX_EVENT_UID_KEY "__NOTIFICATION_EX_EVENT_UID_KEY__"
 
 using namespace std;
 namespace notification {
 
-EventInfo::EventInfo(EventInfo::EventType type, std::string owner,
+EventInfo::EventInfo(IEventInfo::EventType type, std::string owner,
     std::string channel, std::string item_id, std::string tag)
     : impl_(new Impl(this, type, owner, channel, item_id, tag)) {
 }
 EventInfo::~EventInfo() = default;
 EventInfo::Impl::~Impl() = default;
 
-EventInfo::Impl::Impl(EventInfo* parent, EventInfo::EventType type, std::string owner,
+EventInfo::Impl::Impl(EventInfo* parent, IEventInfo::EventType type, std::string owner,
     std::string channel, std::string item_id, std::string tag)
     : type_(type), owner_(owner), channel_(channel), item_id_(item_id),
     tag_(tag), parent_(parent) {
+  uid_ = getuid();
   LOGI("EventInfo impl created");
 }
 
 EventInfo::EventInfo(Bundle serialized)
   : impl_(new Impl(this, EventInfo::Post, "", "", "", "")) {
   string event_str = serialized.GetString(NOTIFICATION_EX_EVENT_TYPE_KEY);
-  impl_->type_ = (EventInfo::EventType)(int)strtol(event_str.c_str(), NULL, 10);
+  impl_->type_ = (IEventInfo::EventType)(int)strtol(event_str.c_str(), NULL, 10);
   impl_->owner_ = serialized.GetString(NOTIFICATION_EX_EVENT_OWNER_KEY);
   impl_->channel_ = serialized.GetString(NOTIFICATION_EX_EVENT_CHANNEL_KEY);
   impl_->item_id_ = serialized.GetString(NOTIFICATION_EX_EVENT_ITEM_ID_KEY);
   impl_->tag_ = serialized.GetString(NOTIFICATION_EX_EVENT_TAG_KEY);
+  string uid_str = serialized.GetString(NOTIFICATION_EX_EVENT_UID_KEY);
+  impl_->uid_ = (uid_t)strtol(uid_str.c_str(), NULL, 10);
 }
 
-string EventInfo::GetString(EventInfo::EventType type) {
+string EventInfo::GetString(IEventInfo::EventType type) {
   switch(type) {
     case Post:
       return "Post";
@@ -84,11 +89,12 @@ Bundle EventInfo::Serialize() const {
   serialized.Add(NOTIFICATION_EX_EVENT_CHANNEL_KEY, impl_->channel_);
   serialized.Add(NOTIFICATION_EX_EVENT_ITEM_ID_KEY, impl_->item_id_);
   serialized.Add(NOTIFICATION_EX_EVENT_TAG_KEY, impl_->tag_);
+  serialized.Add(NOTIFICATION_EX_EVENT_UID_KEY, to_string((int)impl_->uid_));
 
   return serialized;
 }
 
-EventInfo::EventType EventInfo::GetEventType() const {
+IEventInfo::EventType EventInfo::GetEventType() const {
   return impl_->type_;
 }
 
@@ -108,4 +114,12 @@ string EventInfo::GetTag() const {
   return impl_->tag_;
 }
 
+uid_t EventInfo::GetUid() const {
+  return impl_->uid_;
+}
+
+void EventInfo::SetUid(uid_t uid) {
+  impl_->uid_ = uid;
+}
+
 }  // namespace notification
index 9ec2fb6..5eeec29 100644 (file)
 #include <memory>
 #include <list>
 
+#include <sys/types.h>
+
 #include "notification-ex/dbus_sender.h"
+#include "notification-ex/ievent_info.h"
 
 namespace notification {
 
@@ -31,7 +34,7 @@ class EventInfo::Impl {
 
  private:
   friend class EventInfo;
-  Impl(EventInfo* parent, EventInfo::EventType type, std::string owner,
+  Impl(EventInfo* parent, IEventInfo::EventType type, std::string owner,
     std::string channel, std::string item_id, std::string tag);
 
  private:
@@ -40,6 +43,7 @@ class EventInfo::Impl {
   std::string channel_;
   std::string item_id_;
   std::string tag_;
+  uid_t uid_;
   EventInfo* parent_;
 };
 
similarity index 62%
rename from notification-ex/event_info.h
rename to notification-ex/event_info_internal.h
index 5b998b3..6cf8bbf 100644 (file)
  * limitations under the License.
  */
 
-#ifndef NOTIFICATION_EX_EVENT_INFO_H_
-#define NOTIFICATION_EX_EVENT_INFO_H_
+#ifndef NOTIFICATION_EX_EVENT_INFO_INTERNAL_H_
+#define NOTIFICATION_EX_EVENT_INFO_INTERNAL_H_
 
 #include <string>
 #include <list>
 
 #include "notification-ex/ex_bundle.h"
+#include "notification-ex/ievent_info_internal.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
 
 namespace notification {
 
-class EXPORT_API EventInfo {
+class EventInfo : public IEventInfoInternal {
  public:
-  enum EventType {
-    Post,
-    Update,
-    Delete,
-    Get,
-  };
-  EventInfo(EventType type, std::string owner,
+  EventInfo(IEventInfo::EventType type, std::string owner,
       std::string channel = "",
       std::string item_id = "",
       std::string tag = "");
   EventInfo(Bundle serialized);
-  ~EventInfo();
-
+  virtual ~EventInfo();
+  uid_t GetUid() const override;
+  void SetUid(uid_t uid) override;
+  EventType GetEventType() const override;
+  std::string GetOwner() const override;
+  std::string GetChannel() const override;
+  std::string GetItemId() const override;
+  std::string GetTag() const override;
+  Bundle Serialize() const override;
   static std::string GetString(EventType type);
-  EventType GetEventType() const;
-  std::string GetOwner() const;
-  std::string GetChannel() const;
-  std::string GetItemId() const;
-  std::string GetTag() const;
-  Bundle Serialize() const;
 
  private:
   class Impl;
@@ -58,4 +54,4 @@ class EXPORT_API EventInfo {
 
 }  // namespace notification
 
-#endif  // NOTIFICATION_EX_EVENT_INFO_H_
+#endif  // NOTIFICATION_EX_EVENT_INFO_INTERNAL_H_
index 7d95807..c59908b 100644 (file)
 #ifndef NOTIFICATION_EX_EVENT_LISTENER_INTERFACE_H_
 #define NOTIFICATION_EX_EVENT_LISTENER_INTERFACE_H_
 
+#include <list>
+
 #include "notification-ex/event_observer_interface.h"
-#include "notification-ex/event_info.h"
+#include "notification-ex/ievent_info.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
@@ -31,8 +33,8 @@ class EXPORT_API IEventListener {
   virtual ~IEventListener() = default;
   virtual void RegisterObserver(IEventObserver* observer) = 0;
   virtual void UnRegisterObserver(IEventObserver* observer) = 0;
-  virtual void NotifyObserver(const EventInfo& info, std::list<Bundle> serialized) = 0;
-  virtual std::list<Bundle> NotifyObserver(const EventInfo& info) = 0;
+  virtual void NotifyObserver(const IEventInfo& info, std::list<Bundle> serialized) = 0;
+  virtual std::list<Bundle> NotifyObserver(const IEventInfo& info) = 0;
 };
 
 }  // namespace notification
index a94abe8..e3192a5 100644 (file)
 #ifndef NOTIFICATION_EX_OBSERVER_INTERFACE_H_
 #define NOTIFICATION_EX_OBSERVER_INTERFACE_H_
 
+#include <list>
+
 #include "notification-ex/ex_bundle.h"
-#include "notification-ex/event_info.h"
+#include "notification-ex/ievent_info.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
@@ -29,8 +31,8 @@ namespace notification {
 class EXPORT_API IEventObserver {
  public:
   virtual ~IEventObserver() = default;
-  virtual void OnEvent(const EventInfo& info, std::list<Bundle> serialized) = 0;
-  virtual std::list<Bundle> OnRequest(const EventInfo& info) = 0;
+  virtual void OnEvent(const IEventInfo& info, std::list<Bundle> serialized) = 0;
+  virtual std::list<Bundle> OnRequest(const IEventInfo& info) = 0;
 };
 
 }  // namespace notification
index fcefaec..8b8bb1f 100644 (file)
 #ifndef NOTIFICATION_EX_EVENT_SENDER_INTERFACE_H_
 #define NOTIFICATION_EX_EVENT_SENDER_INTERFACE_H_
 
+#include <list>
+
 #include "notification-ex/ex_bundle.h"
-#include "notification-ex/event_info.h"
+#include "notification-ex/ievent_info.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
@@ -28,9 +30,9 @@ namespace notification {
 
 class EXPORT_API IEventSender {
  public:
-  virtual void Notify(const EventInfo& info, std::list<Bundle> serialized,
+  virtual void Notify(const IEventInfo& info, std::list<Bundle> serialized,
       std::string dest_appid = "") = 0;
-  virtual std::list<Bundle> Request(const EventInfo &info) = 0;
+  virtual std::list<Bundle> Request(const IEventInfo &info) = 0;
 };
 
 }  // namespace notification
diff --git a/notification-ex/ievent_info.h b/notification-ex/ievent_info.h
new file mode 100644 (file)
index 0000000..f7847ef
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NOTIFICATION_EX_IEVENT_INFO_H_
+#define NOTIFICATION_EX_IEVENT_INFO_H_
+
+#include "notification-ex/ex_bundle.h"
+
+namespace notification {
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+class EXPORT_API IEventInfo {
+ public:
+  enum EventType {
+    Post,
+    Update,
+    Delete,
+    Get,
+  };
+  virtual ~IEventInfo() = default;
+  virtual EventType GetEventType() const = 0;
+  virtual std::string GetOwner() const = 0;
+  virtual std::string GetChannel() const = 0;
+  virtual std::string GetItemId() const = 0;
+  virtual std::string GetTag() const = 0;
+  virtual Bundle Serialize() const = 0;
+};
+
+}  // nampace notification
+#endif  // NOTIFICATION_EX_IEVENT_INFO_H_
diff --git a/notification-ex/ievent_info_internal.h b/notification-ex/ievent_info_internal.h
new file mode 100644 (file)
index 0000000..7ed5f3b
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NOTIFICATION_EX_IEVENT_INFO_INTERNAL_H_
+#define NOTIFICATION_EX_IEVENT_INFO_INTERNAL_H_
+
+#include "notification-ex/ievent_info.h"
+
+namespace notification {
+
+class IEventInfoInternal : public IEventInfo {
+ public:
+  virtual ~IEventInfoInternal() = default;
+  virtual uid_t GetUid() const = 0;
+  virtual void SetUid(uid_t uid) = 0;
+};
+
+}  // nampace notification
+#endif  // NOTIFICATION_EX_IEVENT_INFO_INTERNAL_H_
index e0cd39b..8ad885b 100644 (file)
@@ -23,7 +23,7 @@
 #include "notification-ex/item_inflator.h"
 #include "notification-ex/manager.h"
 #include "notification-ex/manager_implementation.h"
-#include "notification-ex/event_info.h"
+#include "notification-ex/event_info_internal.h"
 #include "notification-ex/dbus_connection_manager.h"
 #include "notification-ex/ex_util.h"
 #include "notification-ex/item_info_internal.h"
@@ -61,7 +61,7 @@ Manager::Impl::Impl(Manager* parent,
 }
 
 void Manager::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
-    EventInfo::EventType type) {
+    IEventInfo::EventType type) {
   Bundle serialized = noti->Serialize();
   EventInfo info(type, util::GetAppId(), noti->GetChannel());
   list<Bundle> serialized_list {serialized};
@@ -106,7 +106,7 @@ list<shared_ptr<item::AbstractItem>> Manager::Get() {
   return gen_list;
 }
 
-void Manager::SendEvent(const EventInfo& info,
+void Manager::SendEvent(const IEventInfo& info,
     shared_ptr<item::AbstractItem> noti) {
   Bundle serialized = noti->Serialize();
   Bundle serialized_info = info.Serialize();
@@ -114,7 +114,7 @@ void Manager::SendEvent(const EventInfo& info,
   impl_->sender_->Notify(info, serialized_list, noti->GetSenderAppId());
 }
 
-list<Bundle> Manager::OnRequest(const EventInfo& info) {
+list<Bundle> Manager::OnRequest(const IEventInfo& info) {
   list<shared_ptr<item::AbstractItem>> item_list = OnRequestEvent(info);
   list<Bundle> serialized_list;
   for (auto& i : item_list) {
@@ -123,9 +123,9 @@ list<Bundle> Manager::OnRequest(const EventInfo& info) {
   return serialized_list;
 }
 
-void Manager::OnEvent(const EventInfo& info, list<Bundle> serialized) {
+void Manager::OnEvent(const IEventInfo& info, list<Bundle> serialized) {
   shared_ptr<AbstractItem> gen_item;
-  const EventInfo::EventType type = info.GetEventType();
+  const IEventInfo::EventType type = info.GetEventType();
   switch(type) {
     case EventInfo::Post: {
       list<shared_ptr<item::AbstractItem>> added;
@@ -159,19 +159,19 @@ void Manager::OnEvent(const EventInfo& info, list<Bundle> serialized) {
   }
 }
 
-void Manager::OnAdd(const EventInfo& info,
+void Manager::OnAdd(const IEventInfo& info,
       list<shared_ptr<item::AbstractItem>> addedItem) {
 }
 
-void Manager::OnUpdate(const EventInfo& info,
+void Manager::OnUpdate(const IEventInfo& info,
       shared_ptr<item::AbstractItem> updatedItem) {
 }
 
-void Manager::OnDelete(const EventInfo& info,
+void Manager::OnDelete(const IEventInfo& info,
       shared_ptr<item::AbstractItem> deletedItem) {
 }
 
-list<shared_ptr<item::AbstractItem>> Manager::OnRequestEvent(const EventInfo& info) {
+list<shared_ptr<item::AbstractItem>> Manager::OnRequestEvent(const IEventInfo& info) {
   return list<shared_ptr<item::AbstractItem>>({});
 }
 
index 7168b2c..65e802a 100644 (file)
@@ -43,17 +43,17 @@ class EXPORT_API Manager : public IEventObserver {
   void Remove(std::shared_ptr<item::AbstractItem> noti);
   void Hide(std::shared_ptr<item::AbstractItem> noti);
   std::shared_ptr<item::AbstractItem> FindByRootID(std::string id);
-  void SendEvent(const EventInfo& info, std::shared_ptr<item::AbstractItem> noti);
-  void OnEvent(const EventInfo& info, std::list<Bundle> serialized) override;
-  std::list<Bundle> OnRequest(const EventInfo& info) override;
+  void SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
+  void OnEvent(const IEventInfo& info, std::list<Bundle> serialized) override;
+  std::list<Bundle> OnRequest(const IEventInfo& info) override;
   static std::string GetPath();
 
  protected:
-  virtual void OnAdd(const EventInfo& info, std::list<std::shared_ptr<item::AbstractItem>> addedItem);
-  virtual void OnUpdate(const EventInfo& info, std::shared_ptr<item::AbstractItem> updatedItem);
-  virtual void OnDelete(const EventInfo& info, std::shared_ptr<item::AbstractItem> deletedItem);
+  virtual void OnAdd(const IEventInfo& info, std::list<std::shared_ptr<item::AbstractItem>> addedItem);
+  virtual void OnUpdate(const IEventInfo& info, std::shared_ptr<item::AbstractItem> updatedItem);
+  virtual void OnDelete(const IEventInfo& info, std::shared_ptr<item::AbstractItem> deletedItem);
   virtual std::list<std::shared_ptr<item::AbstractItem>> OnRequestEvent(
-      const EventInfo& info);
+      const IEventInfo& info);
 
  private:
   class Impl;
index 667cff7..4b76ca6 100644 (file)
@@ -36,7 +36,7 @@ class Manager::Impl {
  private:
   friend class Manager;
   void SendNotify(std::shared_ptr<item::AbstractItem> noti,
-      EventInfo::EventType type);
+      IEventInfo::EventType type);
   std::unique_ptr<IEventSender> sender_;
   std::unique_ptr<IEventListener> listener_;
   std::string receiver_group_;
index 2c9a4a2..cfe5097 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "notification-ex/reporter.h"
 #include "notification-ex/reporter_implementation.h"
-#include "notification-ex/event_info.h"
+#include "notification-ex/event_info_internal.h"
 #include "notification-ex/item_inflator.h"
 #include "notification-ex/dbus_connection_manager.h"
 #include "notification-ex/ex_util.h"
@@ -56,7 +56,7 @@ Reporter::Impl::Impl(Reporter* parent,
 }
 
 void Reporter::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
-    EventInfo::EventType type) {
+    IEventInfo::EventType type) {
   Bundle serialized = noti->Serialize();
   EventInfo info(type, util::GetAppId(), noti->GetChannel());
   list<Bundle> serialized_list {serialized};
@@ -99,14 +99,14 @@ std::shared_ptr<AbstractItem> Reporter::FindByRootID(std::string id) {
   return gen_item;
 }
 
-void Reporter::SendEvent(const EventInfo& info,
+void Reporter::SendEvent(const IEventInfo& info,
     shared_ptr<item::AbstractItem> noti) {
   Bundle serialized = noti->Serialize();
   list<Bundle> serialized_list {serialized};
   impl_->sender_->Notify(info, serialized_list);
 }
 
-void Reporter::OnEvent(const EventInfo& info, list<Bundle> serialized) {
+void Reporter::OnEvent(const IEventInfo& info, list<Bundle> serialized) {
   list<shared_ptr<item::AbstractItem>> item_list;
   for (auto& i : serialized) {
     shared_ptr<AbstractItem> gen_item = ItemInflator::Create(i);
@@ -115,11 +115,11 @@ void Reporter::OnEvent(const EventInfo& info, list<Bundle> serialized) {
   OnEvent(info, item_list);
 }
 
-list<shared_ptr<item::AbstractItem>> Reporter::OnRequestEvent(const EventInfo& info) {
+list<shared_ptr<item::AbstractItem>> Reporter::OnRequestEvent(const IEventInfo& info) {
   return list<shared_ptr<item::AbstractItem>>({});
 }
 
-list<Bundle> Reporter::OnRequest(const EventInfo& info) {
+list<Bundle> Reporter::OnRequest(const IEventInfo& info) {
   list<shared_ptr<item::AbstractItem>> item_list = OnRequestEvent(info);
   list<Bundle> serialized_list;
   for (auto& i : item_list) {
@@ -129,7 +129,7 @@ list<Bundle> Reporter::OnRequest(const EventInfo& info) {
 }
 
 void Reporter::OnEvent(
-    const EventInfo& info, list<shared_ptr<item::AbstractItem>> notiList) {
+    const IEventInfo& info, list<shared_ptr<item::AbstractItem>> notiList) {
 }
 
 string Reporter::GetPath() {
index 3b5fd96..d416aba 100644 (file)
@@ -21,7 +21,7 @@
 #include <list>
 #include <memory>
 
-#include "notification-ex/event_info.h"
+#include "notification-ex/ievent_info.h"
 #include "notification-ex/event_observer_interface.h"
 #include "notification-ex/event_sender_interface.h"
 #include "notification-ex/event_listener_interface.h"
@@ -39,18 +39,18 @@ class EXPORT_API Reporter : public IEventObserver {
         std::unique_ptr<IEventListener> listener);
   virtual ~Reporter();
 
-  void SendEvent(const EventInfo& info, std::shared_ptr<item::AbstractItem> noti);
+  void SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
   void Post(std::shared_ptr<item::AbstractItem> noti);
   void Post(std::list<std::shared_ptr<item::AbstractItem>> notiList);
   void Update(std::shared_ptr<item::AbstractItem> noti);
   void Remove(std::shared_ptr<item::AbstractItem> noti);
   std::shared_ptr<item::AbstractItem> FindByRootID(std::string id);
-  virtual void OnEvent(const EventInfo& info,
+  virtual void OnEvent(const IEventInfo& info,
       std::list<std::shared_ptr<item::AbstractItem>> notiList);
   virtual std::list<std::shared_ptr<item::AbstractItem>> OnRequestEvent(
-      const EventInfo& info);
-  void OnEvent(const EventInfo& info, std::list<Bundle> serialized) override;
-  std::list<Bundle> OnRequest(const EventInfo& info) override;
+      const IEventInfo& info);
+  void OnEvent(const IEventInfo& info, std::list<Bundle> serialized) override;
+  std::list<Bundle> OnRequest(const IEventInfo& info) override;
   static std::string GetPath();
 
  private:
index dc63b88..4a0c41d 100644 (file)
@@ -36,7 +36,7 @@ class Reporter::Impl {
  private:
   friend class Reporter;
   void SendNotify(std::shared_ptr<item::AbstractItem> noti,
-      EventInfo::EventType type);
+      IEventInfo::EventType type);
   std::unique_ptr<IEventSender> sender_;
   std::unique_ptr<IEventListener> listener_;
   Reporter* parent_;
index b1f20dc..7daafa6 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <gmock/gmock.h>
 
-#include "notification-ex/event_info.h"
+#include "notification-ex/event_info_internal.h"
 
 using namespace notification;
 using namespace std;
@@ -26,6 +26,7 @@ TEST_F(EventInfoTest, SerializeDeserialize) {
   ASSERT_EQ(serialized.GetChannel(), info.GetChannel());
   ASSERT_EQ(serialized.GetItemId(), info.GetItemId());
   ASSERT_EQ(serialized.GetTag(), info.GetTag());
+  ASSERT_EQ(serialized.GetUid(), info.GetUid());
 }
 
 TEST_F(EventInfoTest, GetString) {