00001
00020 #include "canned-data.h"
00021
00022 #include "rtcom-eventlogger/eventlogger.h"
00023
00024 #include <check.h>
00025
00026 #define SERVICE "RTCOM_EL_SERVICE_TEST"
00027 #define EVENT_TYPE "RTCOM_EL_EVENTTYPE_TEST_ET1"
00028
00029 static struct {
00030 const gchar *local_uid;
00031 const gchar *remote_uid;
00032 const gchar *remote_name;
00033 const gchar *free_text;
00034 const gchar *remote_ebook_uid;
00035 const gchar *group_uid;
00036 } events[] = {
00037
00038
00039 { "gabble/jabber/alice", "bob@example.com", "Bob", "Hi Alice", NULL },
00040 { "gabble/jabber/alice", "chris@example.com", "Chris",
00041 "Hello from Chris", "abook-chris" },
00042 { "gabble/jabber/alice", "dave@example.com", "Dave", "Hello from Dave",
00043 "abook-dave" },
00044 { "gabble/jabber/alice", "bob@example.com", "Bob", "Are you there?",
00045 NULL},
00046 { "gabble/jabber/alice", "eve@example.com", "Eve", "I am online", NULL },
00047
00048
00049
00050 { "butterfly/msn/alice", "christine@msn.invalid", "Christine",
00051 "Hello again from Chris (under a different name)", "abook-chris",
00052 "group(chris+frank)" },
00053 { "butterfly/msn/alice", "christine@msn.invalid", "Christine",
00054 "Shall we go to the pub tonight?", "abook-chris",
00055 "group(chris+frank)" },
00056 { "butterfly/msn/alice", "frank@msn.invalid", "Frank",
00057 "Yes!", NULL, "group(chris+frank)" },
00058
00059
00060 { "butterfly/msn/alice", "bob@example.com", "Bob",
00061 "Or are you using this account?", NULL, "group(bob)" },
00062
00063 { NULL }
00064 };
00065
00066 void
00067 add_canned_events (RTComEl *el)
00068 {
00069 RTComElEvent *ev = rtcom_el_event_new ();
00070 gint i;
00071
00072 for (i = 0; i < num_canned_events (); i++)
00073 {
00074 RTCOM_EL_EVENT_SET_FIELD (ev, service, g_strdup (SERVICE));
00075 RTCOM_EL_EVENT_SET_FIELD (ev, event_type, g_strdup (EVENT_TYPE));
00076 RTCOM_EL_EVENT_SET_FIELD (ev, start_time, (i + 1) * 1000);
00077 RTCOM_EL_EVENT_SET_FIELD (ev, end_time, 0);
00078 RTCOM_EL_EVENT_SET_FIELD (ev, local_uid,
00079 g_strdup (events[i].local_uid));
00080 RTCOM_EL_EVENT_SET_FIELD (ev, local_name, g_strdup ("Alice"));
00081 RTCOM_EL_EVENT_SET_FIELD (ev, remote_uid,
00082 g_strdup (events[i].remote_uid));
00083 RTCOM_EL_EVENT_SET_FIELD (ev, remote_name,
00084 g_strdup (events[i].remote_name));
00085 RTCOM_EL_EVENT_SET_FIELD (ev, free_text,
00086 g_strdup (events[i].free_text));
00087 RTCOM_EL_EVENT_SET_FIELD (ev, remote_ebook_uid,
00088 g_strdup (events[i].remote_ebook_uid));
00089 RTCOM_EL_EVENT_SET_FIELD (ev, group_uid,
00090 g_strdup (events[i].group_uid));
00091
00092 fail_unless (rtcom_el_add_event (el, ev, NULL) >= 0);
00093 rtcom_el_event_free_contents (ev);
00094 }
00095
00096 rtcom_el_event_free (ev);
00097 }
00098
00099 gint
00100 num_canned_events (void)
00101 {
00102 return G_N_ELEMENTS (events) - 1;
00103 }