diff options
| author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-01-22 00:58:54 -0500 |
|---|---|---|
| committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-02-01 16:28:34 -0500 |
| commit | eb68a687575b31d5d69a8ed9a26a2a0877ebec57 (patch) | |
| tree | 72b3b071e737a6ab9adce5a83a42bf3ba01007d3 /test | |
| parent | db92c28ac9f354833753b451e4fba081c75d2564 (diff) | |
| download | phosphor-inventory-manager-eb68a687575b31d5d69a8ed9a26a2a0877ebec57.tar.gz phosphor-inventory-manager-eb68a687575b31d5d69a8ed9a26a2a0877ebec57.zip | |
Add support for createObjects action
Change-Id: I999a5e506a236eac8ca0944b0e2b003c57612e54
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/test.cpp | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/test/test.cpp b/test/test.cpp index 21f89e2..816d471 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -40,7 +40,8 @@ const auto trigger3 = sdbusplus::message::object_path(EXAMPLE_ROOT + "/trigger3"s); const auto trigger4 = sdbusplus::message::object_path(EXAMPLE_ROOT + "/trigger4"s); - +const auto trigger5 = sdbusplus::message::object_path(EXAMPLE_ROOT + + "/trigger5"s); const sdbusplus::message::object_path relDeleteMeOne{"/deleteme1"}; const sdbusplus::message::object_path relDeleteMeTwo{"/deleteme2"}; @@ -78,6 +79,8 @@ struct ExampleService ExampleIface1, ExampleIface2 > t3(bus, trigger3.str.c_str()); sdbusplus::server::object::object < ExampleIface1, ExampleIface2 > t4(bus, trigger4.str.c_str()); + sdbusplus::server::object::object < + ExampleIface1, ExampleIface2 > t5(bus, trigger5.str.c_str()); while (!shutdown) { @@ -456,6 +459,46 @@ void runTests() } } } + + // Validate the create object action. + { + sdbusplus::message::object_path relCreateMe1{"/createme1"}; + sdbusplus::message::object_path relCreateMe2{"/createme2"}; + std::string createMe1{root + relCreateMe1.str}; + std::string createMe2{root + relCreateMe2.str}; + + // Trigger the action. + { + sdbusplus::message::object_path signalPath; + Object signalObject; + + SignalQueue queue( + "path='" + root + "',member='InterfacesAdded'"); + + auto m = set(trigger5.str); + m.append("xyz.openbmc_project.Example.Iface2"); + m.append("ExampleProperty2"); + m.append(sdbusplus::message::variant<std::string>("abc123")); + b.call(m); + { + auto sig{queue.pop()}; + assert(sig); + sig.read(signalPath); + assert(createMe1 == signalPath.str); + sig.read(signalObject); + } + { + auto sig{queue.pop()}; + assert(sig); + sig.read(signalPath); + assert(createMe2 == signalPath.str); + sig.read(signalObject); + } + + auto moreSignals{queue.pop()}; + assert(!moreSignals); + } + } } int main() |

