entitymap: add json parsing support
Add a json parsing method that given an entity map in the format:
[
{
"id" : 1,
"containerEntityId" : 2,
"containerEntityInstance" : 3,
"isList" : false,
"isLinked" : false,
"entities" : [
{"id" : 1, "instance" : 2},
{"id" : 1, "instance" : 3},
{"id" : 1, "instance" : 4},
{"id" : 1, "instance" : 5}
]
}
]
is constructed into the entity map used by sensorhandler. This is meant
as part of the transition from the entity map in YAML to JSON.
This is step 2. Step 1 moved access to the object behind a method.
This adds JSON validation and parsing. Step 3 will add a file path to
check and parse. Step 4 will provide a call to parse that file if
present and use its data if non-empty.
Tested: The method added has not been tested beyond unit-test validation.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ic29f022d3812fa9e3af775d542ad055629fd5a01
diff --git a/test/Makefile.am b/test/Makefile.am
index e510230..e4ff261 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -26,6 +26,11 @@
check_PROGRAMS =
TESTS = $(check_PROGRAMS)
+entitymap_json_unittest_SOURCES = entitymap_json_unittest.cpp
+entitymap_json_unittest_LDADD = $(top_builddir)/entity_map_json.o -lgmock
+
+check_PROGRAMS += entitymap_json_unittest
+
# Build/add sample_unittest to test suite
sample_unittest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS)
sample_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(CODE_COVERAGE_CXXFLAGS) \