diff --git a/t-tap/test_events.c b/t-tap/test_events.c
new file mode 100644
index 00000000..76ea8317
--- /dev/null
+++ b/t-tap/test_events.c
@@ -0,0 +1,129 @@
+/*****************************************************************************
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+*
+*****************************************************************************/
+#include
+#include
+#include "tap.h"
+#include "naemon/objects.h"
+#include "naemon/commands.h"
+#include "naemon/downtime.h"
+#include "naemon/comments.h"
+#include "naemon/globals.h"
+#include "naemon/utils.h"
+#include "naemon/configuration.h"
+#include "naemon/defaults.h"
+#include "naemon/sretention.h"
+#include "naemon/events.h"
+
+static int *received_persistent;
+static char *received_host;
+static time_t received_entry_time;
+char *addresses[2];
+timeperiod *registered_timeperiod = NULL;
+int b_val;
+int i_val;
+time_t t_val;
+GError *error = NULL;
+char *s_val;
+
+
+int test__add_host_comment_handler(const struct external_command *ext_command, time_t entry_time)
+{
+ command_argument_value_copy((void **) &received_host, command_argument_get_value(ext_command, "host"), STRING);
+ command_argument_value_copy((void **) &received_persistent, command_argument_get_value(ext_command, "persistent"), BOOL);
+ received_entry_time = entry_time;
+ return 0;
+}
+int test__add_service_comment_handler(const struct external_command *ext_command, time_t entry_time)
+{
+ return 0;
+}
+
+int test__del_host_comment_handler(const struct external_command *ext_command, time_t entry_time)
+{
+ return 0;
+}
+
+int test__disable_notifications_handler(const struct external_command *ext_command, time_t entry_time)
+{
+ return 0;
+}
+
+int test__do_thing_with_timeperiod_handler(const struct external_command *ext_command, time_t entry_time)
+{
+ return 0;
+}
+
+
+int test__do_thing_with_contact_handler(const struct external_command *ext_command, time_t entry_time)
+{
+ return 0;
+}
+int custom_service_validator(void *value)
+{
+ return 1;
+}
+
+void test_host_commands(void)
+{
+ char *host_name = "host1";
+ host *target_host = NULL;
+ time_t current_time = 0;
+ char *cmdstr = NULL;
+ target_host = find_host(host_name);
+ target_host->obsess = FALSE;
+
+ target_host->current_state = STATE_DOWN;
+ time(¤t_time);
+ nm_asprintf(&cmdstr, "[1234567890] ACKNOWLEDGE_HOST_PROBLEM_EXPIRE;host1;2;0;0;%llu;myself;expire in two seconds", (unsigned long long int)current_time+2);
+ ok(CMD_ERROR_OK == process_external_command1(cmdstr), "core command: ACKNOWLEDGE_HOST_PROBLEM_EXPIRE");
+ ok(target_host->problem_has_been_acknowledged, "ACKNOWLEDGE_HOST_PROBLEM_EXPIRE acknowledgement present before event");
+ sleep(3);
+ /* This should be done better. How do we know how many
+ events we have to process? */
+ event_poll();
+ event_poll();
+ ok(!target_host->problem_has_been_acknowledged, "ACKNOWLEDGE_HOST_PROBLEM_EXPIRE acknowledgement gone after event");
+ free(cmdstr);
+}
+
+void test_core_commands(void)
+{
+ /*setup configuration*/
+ pre_flight_check(); /*without this, child_host links are not created and *_BEYOND_HOST test cases fail...*/
+ registered_commands_init(200);
+ register_core_commands();
+ test_host_commands();
+ registered_commands_deinit();
+ free(config_file);
+}
+
+int main(int /*@unused@*/ argc, char /*@unused@*/ **arv)
+{
+ const char *test_config_file = TESTDIR "naemon.cfg";
+ plan_tests(3);
+ init_event_queue();
+
+ config_file_dir = nspath_absolute_dirname(test_config_file, NULL);
+ assert(OK == read_main_config_file(test_config_file));
+ assert(OK == read_all_object_data(test_config_file));
+ assert(OK == initialize_downtime_data());
+ assert(OK == initialize_retention_data());
+ nagios_iobs = iobroker_create();
+ test_core_commands();
+ return exit_status();
+}
diff --git a/tests.mk b/tests.mk
index 947b576e..32668a69 100644
--- a/tests.mk
+++ b/tests.mk
@@ -28,9 +28,14 @@ t_tap_test_downtime_SOURCES = t-tap/test_downtime.c
t_tap_test_downtime_CPPFLAGS = $(T_TAP_AM_CPPFLAGS)
t_tap_test_downtime_LDADD = $(TAPLDADD)
+t_tap_test_events_SOURCES = t-tap/test_events.c
+t_tap_test_events_CPPFLAGS = $(T_TAP_AM_CPPFLAGS)
+t_tap_test_events_LDADD = $(TAPLDADD)
+
dist_check_SCRIPTS = t/705naemonstats.t t/900-configparsing.t
check_PROGRAMS += t-tap/test_macros t-tap/test_timeperiods t-tap/test_checks \
- t-tap/test_config t-tap/test_commands t-tap/test_downtime
+ t-tap/test_config t-tap/test_commands t-tap/test_downtime \
+ t-tap/test_events
distclean-local:
if test "${abs_srcdir}" != "${abs_builddir}"; then \
rm -r t; \