diff --git a/tester/main-db-tester.cpp b/tester/main-db-tester.cpp
index 31d3c3114..714ce9e2c 100644
--- a/tester/main-db-tester.cpp
+++ b/tester/main-db-tester.cpp
@@ -16,7 +16,9 @@
* along with this program. If not, see .
*/
+#include "address/address.h"
#include "db/main-db.h"
+#include "event-log/events.h"
#include "liblinphone_tester.h"
@@ -93,12 +95,58 @@ static void get_history () {
);
}
+static void get_conference_notified_events () {
+ MainDb mainDb(nullptr);
+ BC_ASSERT_TRUE(mainDb.connect(MainDb::Sqlite3, getDatabasePath()));
+ list> events = mainDb.getConferenceNotifiedEvents("sip:fake-group-2@sip.linphone.org", 1);
+ BC_ASSERT_EQUAL(events.size(), 3, int, "%d");
+ if (events.size() != 3)
+ return;
+
+ shared_ptr event;
+ auto it = events.cbegin();
+
+ event = *it;
+ if (!BC_ASSERT_TRUE(event->getType() == EventLog::Type::ConferenceParticipantRemoved)) return;
+ {
+ shared_ptr participantEvent = static_pointer_cast(event);
+ BC_ASSERT_TRUE(participantEvent->getConferenceAddress().asStringUriOnly() == "sip:fake-group-2@sip.linphone.org");
+ BC_ASSERT_TRUE(participantEvent->getParticipantAddress().asStringUriOnly() == "sip:test-11@sip.linphone.org");
+ BC_ASSERT_TRUE(participantEvent->getNotifyId() == 2);
+ }
+
+ event = *++it;
+ if (!BC_ASSERT_TRUE(event->getType() == EventLog::Type::ConferenceParticipantDeviceAdded)) return;
+ {
+ shared_ptr deviceEvent = static_pointer_cast<
+ ConferenceParticipantDeviceEvent
+ >(event);
+ BC_ASSERT_TRUE(deviceEvent->getConferenceAddress().asStringUriOnly() == "sip:fake-group-2@sip.linphone.org");
+ BC_ASSERT_TRUE(deviceEvent->getParticipantAddress().asStringUriOnly() == "sip:test-11@sip.linphone.org");
+ BC_ASSERT_TRUE(deviceEvent->getNotifyId() == 3);
+ BC_ASSERT_TRUE(deviceEvent->getGruuAddress().asStringUriOnly() == "sip:gruu-address-1@sip.linphone.org");
+ }
+
+ event = *++it;
+ if (!BC_ASSERT_TRUE(event->getType() == EventLog::Type::ConferenceParticipantDeviceRemoved)) return;
+ {
+ shared_ptr deviceEvent = static_pointer_cast<
+ ConferenceParticipantDeviceEvent
+ >(event);
+ BC_ASSERT_TRUE(deviceEvent->getConferenceAddress().asStringUriOnly() == "sip:fake-group-2@sip.linphone.org");
+ BC_ASSERT_TRUE(deviceEvent->getParticipantAddress().asStringUriOnly() == "sip:test-11@sip.linphone.org");
+ BC_ASSERT_TRUE(deviceEvent->getNotifyId() == 4);
+ BC_ASSERT_TRUE(deviceEvent->getGruuAddress().asStringUriOnly() == "sip:gruu-address-1@sip.linphone.org");
+ }
+}
+
test_t main_db_tests[] = {
TEST_NO_TAG("Open database", open_database),
TEST_NO_TAG("Get events count", get_events_count),
TEST_NO_TAG("Get messages count", get_messages_count),
TEST_NO_TAG("Get unread messages count", get_unread_messages_count),
- TEST_NO_TAG("Get history", get_history)
+ TEST_NO_TAG("Get history", get_history),
+ TEST_NO_TAG("Get conference events", get_conference_notified_events)
};
test_suite_t main_db_test_suite = {