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

Function TestFilterString

Modules/CppMicroServices/test/usServiceTrackerTest.cpp:93–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91};
92
93void TestFilterString()
94{
95 us::ModuleContext* context = us::GetModuleContext();
96 MyCustomizer customizer(context);
97
98 us::LDAPFilter filter("(" + us::ServiceConstants::SERVICE_ID() + ">=0)");
99 us::ServiceTracker<MyInterfaceOne> tracker(context, filter, &customizer);
100 tracker.Open();
101
102 struct MyServiceOne : public MyInterfaceOne {};
103 struct MyServiceTwo : public MyInterfaceTwo {};
104
105 MyServiceOne serviceOne;
106 MyServiceTwo serviceTwo;
107
108 ServiceRegistration<MyInterfaceOne> reg1 = context->RegisterService<MyInterfaceOne>(&serviceOne);
109 ServiceRegistration<MyInterfaceTwo> reg2 = context->RegisterService<MyInterfaceTwo>(&serviceTwo);
110
111 US_TEST_CONDITION(tracker.GetServiceReferences().size() == 1, "tracking count")
112
113 reg1.Unregister();
114 reg2.Unregister();
115}
116
117void TestServiceTracker()
118{

Callers 1

usServiceTrackerTestFunction · 0.85

Calls 5

GetModuleContextFunction · 0.85
GetServiceReferencesMethod · 0.80
OpenMethod · 0.45
UnregisterMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected