Check for missing endpoints when adding assocs

An association links 2 D-Bus object paths together, one
which is the path that has the original associations
property, and another endpoint path.  It's possible that
that endpoint path doesn't exist on D-Bus when that
associations property is created.

This commit, along with upcoming ones, adds support to not
create the actual association object paths until that
endpoint path shows up on D-Bus.  In addition, if that
endpoint path were to get removed from D-Bus in the future,
then the association paths should be removed until that
path is back again.

This particular commit introduces the PendingAssociations map
to track these cases, and adds support in the associationChanged
path to add associations to this map if the endpoint path isn't
on D-Bus instead of just blindly creating the association objects.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I1f4bf0e02bf7a350d9e3f18c3591737289a51a39
diff --git a/src/test/interfaces_added.cpp b/src/test/interfaces_added.cpp
index 4f0d2c4..bee978f 100644
--- a/src/test/interfaces_added.cpp
+++ b/src/test/interfaces_added.cpp
@@ -34,7 +34,7 @@
 // Verify good path of interfaces added function
 TEST_F(TestInterfacesAdded, InterfacesAddedGoodPath)
 {
-    interface_map_type interfaceMap;
+    auto interfaceMap = createDefaultInterfaceMap();
     AssociationMaps assocMaps;
 
     auto intfAdded = createInterfacesAdded(
@@ -44,9 +44,9 @@
                           DEFAULT_DBUS_SVC, assocMaps, *server);
 
     // Interface map will get the following:
-    // /logging/entry/1 /logging/entry /logging/ /
+    // /logging/entry/1 /logging/entry /logging/ / system/chassis
     // dump_InterfaceMapType(interfaceMap);
-    EXPECT_EQ(interfaceMap.size(), 4);
+    EXPECT_EQ(interfaceMap.size(), 5);
 
     // New association ower created so ensure it now contains a single entry
     // dump_AssociationOwnersType(assocOwners);
@@ -55,11 +55,14 @@
     // Ensure the 2 association interfaces were created
     // dump_AssociationInterfaces(assocInterfaces);
     EXPECT_EQ(assocMaps.ifaces.size(), 2);
+
+    // No pending associations
+    EXPECT_EQ(assocMaps.pending.size(), 0);
 }
 
 TEST_F(TestInterfacesAdded, OrgOpenBmcInterfacesAddedGoodPath)
 {
-    interface_map_type interfaceMap;
+    auto interfaceMap = createDefaultInterfaceMap();
     AssociationMaps assocMaps;
 
     auto intfAdded = createInterfacesAdded(
@@ -70,9 +73,8 @@
                           DEFAULT_DBUS_SVC, assocMaps, *server);
 
     // Interface map will get the following:
-    // /logging/entry/1 /logging/entry /logging/ /
-    // dump_InterfaceMapType(interfaceMap);
-    EXPECT_EQ(interfaceMap.size(), 4);
+    // /logging/entry/1 /logging/entry /logging/ /  system/chassis
+    EXPECT_EQ(interfaceMap.size(), 5);
 
     // New association ower created so ensure it now contains a single entry
     // dump_AssociationOwnersType(assocOwners);
@@ -81,4 +83,7 @@
     // Ensure the 2 association interfaces were created
     // dump_AssociationInterfaces(assocInterfaces);
     EXPECT_EQ(assocMaps.ifaces.size(), 2);
+
+    // No pending associations
+    EXPECT_EQ(assocMaps.pending.size(), 0);
 }