monitor: Create PowerOffRules class
This class contains a PowerOffCause and a PowerOffAction. It provides a
check() method that takes the FanHealth map which it then checks against
the cause. If the cause is satisfied, it then starts the power off
action. It provides a cancel method that will force cancel a running
action in the case that the object owner detects a system power off and
so doesn't need to run this power off anymore.
The class's configuration data is read from the JSON config file.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I5c0c168591d6d62c894c4d036ec762797fd759af
diff --git a/monitor/test/Makefile.am b/monitor/test/Makefile.am
index 32b8c3b..e6d0f9b 100644
--- a/monitor/test/Makefile.am
+++ b/monitor/test/Makefile.am
@@ -7,7 +7,8 @@
TESTS = $(check_PROGRAMS)
check_PROGRAMS += \
- power_off_cause_test
+ power_off_cause_test \
+ power_off_rule_test
power_off_cause_test_SOURCES = \
power_off_cause_test.cpp
@@ -17,3 +18,18 @@
$(OESDK_TESTCASE_FLAGS)
power_off_cause_test_LDADD = \
$(gtest_ldadd)
+
+power_off_rule_test_SOURCES = \
+ power_off_rule_test.cpp \
+ ../conditions.cpp \
+ ../json_parser.cpp \
+ ../logging.cpp
+power_off_rule_test_CXXFLAGS = \
+ $(gtest_cflags)
+power_off_rule_test_LDFLAGS = \
+ $(OESDK_TESTCASE_FLAGS)
+power_off_rule_test_LDADD = \
+ $(gtest_ldadd) \
+ $(FMT_LIBS) \
+ $(SDBUSPLUS_LIBS) \
+ $(SDEVENTPLUS_LIBS)