summaryrefslogtreecommitdiff
path: root/common/elapi/elapi_test
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-09-27 22:16:17 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-10-05 10:32:08 -0400
commita78d04984240a3d04045402c964d9d8c5be463ef (patch)
tree0353869fca520c545daea46deb43069d2a172e9a /common/elapi/elapi_test
parent8140cea7b4e3d3c9c6003eb6ae30e5e0fdd7c1ae (diff)
downloadsssd-a78d04984240a3d04045402c964d9d8c5be463ef.tar.gz
sssd-a78d04984240a3d04045402c964d9d8c5be463ef.tar.bz2
sssd-a78d04984240a3d04045402c964d9d8c5be463ef.zip
ELAPI Resolving message attribute
This patch continues work started with the previous patch. It resolves message attribute. Message attribute is a special attribute in the event that may contain references to other attributes in the event. When message is resolved the references are replaced with actual values of the referenced attributes.
Diffstat (limited to 'common/elapi/elapi_test')
-rw-r--r--common/elapi/elapi_test/Makefile.am1
-rw-r--r--common/elapi/elapi_test/elapi_ut.c30
2 files changed, 30 insertions, 1 deletions
diff --git a/common/elapi/elapi_test/Makefile.am b/common/elapi/elapi_test/Makefile.am
index dcf1707c..c0eac8a5 100644
--- a/common/elapi/elapi_test/Makefile.am
+++ b/common/elapi/elapi_test/Makefile.am
@@ -32,6 +32,7 @@ libelapi_test_la_SOURCES = \
../elapi_basic.h \
../elapi_resolve.c \
../elapi_async.c \
+ ../elapi_subst.c \
../elapi_event.h \
../elapi_priv.h \
../elapi_sink.h \
diff --git a/common/elapi/elapi_test/elapi_ut.c b/common/elapi/elapi_test/elapi_ut.c
index 1046ed0e..ab0f88d1 100644
--- a/common/elapi/elapi_test/elapi_ut.c
+++ b/common/elapi/elapi_test/elapi_ut.c
@@ -76,7 +76,7 @@ int simple_event_test(void)
printf("Simple test START:\n");
error = elapi_set_default_template(
- E_BASE_DEFV1 | E_BASE_HOSTEXT,
+ E_BASE_DEFV1 | E_BASE_HOSTEXT /* FIXME Ticket #207 */,
"%n( bin )", bin, 8,
" %sb( logical1 )", "false",
"%sb( logical2 )", "YES",
@@ -391,6 +391,34 @@ int complex_event_test(void)
return error;
}
+ error = elapi_dsp_msg(E_TARGET_DEBUG,
+ dispatcher,
+ template,
+ E_MESSAGE,
+ "date = %(R_stamp__), pid = %(__pid__), "
+ "hostname = %(__host__), %(__halias__), "
+ "ip = %(__ip__), [%(__iplist__);%(!__iplist__);%(__iplist__)]" ,
+ E_EOARG);
+ if (error) {
+ elapi_destroy_event_template(template);
+ printf("Failed to log event! %d\n", error);
+ return error;
+ }
+
+ error = elapi_dsp_msg(E_TARGET_DEBUG,
+ dispatcher,
+ template,
+ E_MESSAGE,
+ "date = %(R_stamp__), pid = %(__pid__), "
+ "hostname = %(__host__), %(__halias__), "
+ "ip = %(__ip__), [%(__iplist__);%(__iplist__);%(__iplist__)]" ,
+ E_EOARG);
+ if (error) {
+ elapi_destroy_event_template(template);
+ printf("Failed to log event! %d\n", error);
+ return error;
+ }
+
elapi_destroy_event_template(template);
elapi_print_dispatcher(dispatcher);