entitymap: move accessor to separate module

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I8c80acb694d067043b77d81dbb9a7ba0057fef56
diff --git a/entity_map_json.cpp b/entity_map_json.cpp
index b6fc6d6..96ef61c 100644
--- a/entity_map_json.cpp
+++ b/entity_map_json.cpp
@@ -12,6 +12,13 @@
 namespace sensor
 {
 
+extern const EntityInfoMap entities;
+
+const EntityInfoMap& getIpmiEntityRecords()
+{
+    return entities;
+}
+
 EntityInfoMap buildEntityMapFromFile()
 {
     const char* entityMapJsonFilename =
diff --git a/entity_map_json.hpp b/entity_map_json.hpp
index 11530bf..54884ee 100644
--- a/entity_map_json.hpp
+++ b/entity_map_json.hpp
@@ -9,6 +9,11 @@
 {
 
 /**
+ * @brief Grab a handle to the entity map.
+ */
+const EntityInfoMap& getIpmiEntityRecords();
+
+/**
  * @brief Open the default entity map json file, and if present and valid json,
  * return a built entity map.
  *
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 28b04c1..b5e2f2f 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -2,6 +2,7 @@
 
 #include "sensorhandler.hpp"
 
+#include "entity_map_json.hpp"
 #include "fruread.hpp"
 
 #include <mapper.h>
@@ -85,20 +86,6 @@
     uint8_t indication[2];
 } __attribute__((packed));
 
-namespace ipmi
-{
-namespace sensor
-{
-extern const EntityInfoMap entities;
-
-const EntityInfoMap& getIpmiEntityRecords()
-{
-    return entities;
-}
-
-} // namespace sensor
-} // namespace ipmi
-
 int get_bus_for_path(const char* path, char** busname)
 {
     return mapper_get_service(bus, path, busname);
diff --git a/test/Makefile.am b/test/Makefile.am
index e4ff261..7d3d6fc 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -27,7 +27,7 @@
 TESTS = $(check_PROGRAMS)
 
 entitymap_json_unittest_SOURCES = entitymap_json_unittest.cpp
-entitymap_json_unittest_LDADD = $(top_builddir)/entity_map_json.o -lgmock
+entitymap_json_unittest_LDADD = $(top_builddir)/entity_map_json.o -lgmock $(top_builddir)/entity-gen.o
 
 check_PROGRAMS += entitymap_json_unittest