summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/dbus/test-tpl-log-store-xml.c96
-rw-r--r--tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/chatrooms/meego@conference.collabora.co.uk/20110112.log5
2 files changed, 101 insertions, 0 deletions
diff --git a/tests/dbus/test-tpl-log-store-xml.c b/tests/dbus/test-tpl-log-store-xml.c
index fa9faf5..5069ecd 100644
--- a/tests/dbus/test-tpl-log-store-xml.c
+++ b/tests/dbus/test-tpl-log-store-xml.c
@@ -154,6 +154,94 @@ test_clear_account (XmlTestCaseFixture *fixture,
}
+static void
+test_clear_entity (XmlTestCaseFixture *fixture,
+ gconstpointer user_data)
+{
+ gboolean is_room = GPOINTER_TO_INT (user_data);
+ GList *hits;
+ TpAccount *account;
+ TplEntity *entity;
+ GError *error = NULL;
+ const gchar *always_kept, *kept, *cleared;
+
+ always_kept = "1263405203";
+
+ if (is_room)
+ {
+ kept = "f95e605a3ae97c463b626a3538567bc90fc58730";
+ cleared = "8957fb4064049e7a1f9d8f84234d3bf09fb6778c";
+ }
+ else
+ {
+ kept = "8957fb4064049e7a1f9d8f84234d3bf09fb6778c";
+ cleared = "f95e605a3ae97c463b626a3538567bc90fc58730";
+ }
+
+ hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store),
+ always_kept);
+
+ g_assert_cmpint (g_list_length (hits), ==, 1);
+
+ tpl_log_manager_search_free (hits);
+
+ hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store),
+ kept);
+
+ g_assert_cmpint (g_list_length (hits), ==, 1);
+
+ tpl_log_manager_search_free (hits);
+
+ hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store),
+ cleared);
+
+ g_assert_cmpint (g_list_length (hits), ==, 1);
+
+ tpl_log_manager_search_free (hits);
+
+ account = tp_account_new (fixture->bus,
+ TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/test2_40collabora_2eco_2euk0",
+ &error);
+
+ g_assert_no_error (error);
+ g_assert (account != NULL);
+
+ if (is_room)
+ entity = g_object_new (TPL_TYPE_ENTITY,
+ "type", TPL_ENTITY_ROOM,
+ "identifier", "meego@conference.collabora.co.uk",
+ NULL);
+ else
+ entity = g_object_new (TPL_TYPE_ENTITY,
+ "type", TPL_ENTITY_CONTACT,
+ "identifier", "derek.foreman@collabora.co.uk",
+ NULL);
+
+ _tpl_log_store_clear_entity (TPL_LOG_STORE (fixture->store), account, entity);
+ g_object_unref (account);
+ g_object_unref (entity);
+
+ hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store),
+ always_kept);
+
+ g_assert_cmpint (g_list_length (hits), ==, 1);
+
+ tpl_log_manager_search_free (hits);
+
+ hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store),
+ kept);
+
+ g_assert_cmpint (g_list_length (hits), ==, 1);
+
+ tpl_log_manager_search_free (hits);
+
+ hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store),
+ cleared);
+
+ g_assert_cmpint (g_list_length (hits), ==, 0);
+}
+
+
gint main (gint argc, gchar **argv)
{
g_type_init ();
@@ -169,5 +257,13 @@ gint main (gint argc, gchar **argv)
XmlTestCaseFixture, NULL,
setup_for_writing, test_clear_account, teardown);
+ g_test_add ("/log-store-xml/clear-entity",
+ XmlTestCaseFixture, GINT_TO_POINTER (FALSE),
+ setup_for_writing, test_clear_entity, teardown);
+
+ g_test_add ("/log-store-xml/clear-entity-room",
+ XmlTestCaseFixture, GINT_TO_POINTER (TRUE),
+ setup_for_writing, test_clear_entity, teardown);
+
return g_test_run ();
}
diff --git a/tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/chatrooms/meego@conference.collabora.co.uk/20110112.log b/tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/chatrooms/meego@conference.collabora.co.uk/20110112.log
new file mode 100644
index 0000000..b4b2a3b
--- /dev/null
+++ b/tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/chatrooms/meego@conference.collabora.co.uk/20110112.log
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8'?>
+<?xml-stylesheet type="text/xsl" href="log-store-xml.xsl"?>
+<log>
+<message time='20110112T22:11:04' cm_id='8957fb4064049e7a1f9d8f84234d3bf09fb6778c' id='meego@conference.collabora.co.uk/test2@collabora.co.uk' name='test2@collabora.co.uk' token='' isuser='true' type='normal'>test</message>
+</log>