MCPcopy Create free account
hub / github.com/MITK/MITK / frame030b

Function frame030b

Modules/CppMicroServices/test/usModuleTest.cpp:211–238  ·  view source on GitHub ↗

Unload libA and check for correct events

Source from the content-addressed store, hash-verified

209
210// Unload libA and check for correct events
211void frame030b(ModuleContext* mc, TestModuleListener& listener, SharedLibrary& libA)
212{
213 Module* moduleA = ModuleRegistry::GetModule("TestModuleA");
214 US_TEST_CONDITION_REQUIRED(moduleA != nullptr, "Test for non-null module")
215
216 ServiceReferenceU sr1
217 = mc->GetServiceReference("us::TestModuleAService");
218 US_TEST_CONDITION(sr1, "Test for valid service reference")
219
220 try
221 {
222 libA.Unload();
223 US_TEST_CONDITION(moduleA->IsLoaded() == false, "Test for unloaded state")
224 }
225 catch (const std::exception& e)
226 {
227 US_TEST_FAILED_MSG(<< "UnLoad module exception: " << e.what())
228 }
229
230 std::vector<ModuleEvent> pEvts;
231 pEvts.push_back(ModuleEvent(ModuleEvent::UNLOADING, moduleA));
232 pEvts.push_back(ModuleEvent(ModuleEvent::UNLOADED, moduleA));
233
234 std::vector<ServiceEvent> seEvts;
235 seEvts.push_back(ServiceEvent(ServiceEvent::UNREGISTERING, sr1));
236
237 US_TEST_CONDITION(listener.CheckListenerEvents(pEvts, seEvts), "Test for unexpected events");
238}
239
240
241struct LocalListener {

Callers 1

usModuleTestFunction · 0.70

Calls 7

ServiceEventClass · 0.85
whatMethod · 0.80
CheckListenerEventsMethod · 0.80
ModuleEventClass · 0.50
GetServiceReferenceMethod · 0.45
UnloadMethod · 0.45
IsLoadedMethod · 0.45

Tested by

no test coverage detected