diff options
| author | Andrew Geissler <geissonator@yahoo.com> | 2019-02-21 12:59:09 -0600 |
|---|---|---|
| committer | Matt Spinler <spinler@us.ibm.com> | 2019-04-05 15:05:32 +0000 |
| commit | 5629ae8da6df980b93161ad950cf28fcfc96ff9a (patch) | |
| tree | 6fdc3ee566f81c48d29efd3d170236ef258bbc14 /src | |
| parent | ff5ce9247fd2e55793c6afcdf0bd9b86ed9b0e36 (diff) | |
| download | phosphor-objmgr-5629ae8da6df980b93161ad950cf28fcfc96ff9a.tar.gz phosphor-objmgr-5629ae8da6df980b93161ad950cf28fcfc96ff9a.zip | |
unit-test: Utilize common code for endpoint remove
Testing: Previous test cases get us 100% coverage here
Change-Id: I3b96872bf25ce7ddcc96422f1d453f153f9dd39c
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/associations.cpp | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/associations.cpp b/src/associations.cpp index 9bb7a34..181f510 100644 --- a/src/associations.cpp +++ b/src/associations.cpp @@ -31,40 +31,8 @@ void removeAssociation(const std::string& sourcePath, const std::string& owner, for (const auto& [assocPath, endpointsToRemove] : assocs->second) { - // Get the association D-Bus object for this assocPath - auto target = assocInterfaces.find(assocPath); - if (target == assocInterfaces.end()) - { - continue; - } - - // Remove the entries in the endpoints D-Bus property for this - // path/owner/association-path. - auto& existingEndpoints = std::get<endpointsPos>(target->second); - for (const auto& endpointToRemove : endpointsToRemove) - { - auto e = std::find(existingEndpoints.begin(), - existingEndpoints.end(), endpointToRemove); - - if (e != existingEndpoints.end()) - { - existingEndpoints.erase(e); - } - } - - // Remove the association from D-Bus if there are no more endpoints, - // otherwise just update the endpoints property. - if (existingEndpoints.empty()) - { - server.remove_interface(std::get<ifacePos>(target->second)); - std::get<ifacePos>(target->second) = nullptr; - std::get<endpointsPos>(target->second).clear(); - } - else - { - std::get<ifacePos>(target->second) - ->set_property("endpoints", existingEndpoints); - } + removeAssociationEndpoints(server, assocPath, endpointsToRemove, + assocInterfaces); } // Remove the associationOwners entries for this owning path/service. |

