use of org.apache.felix.dm.diagnostics.MissingDependency in project felix by apache.
the class DiagnosticsTest method testMissingCustomDependencies.
public void testMissingCustomDependencies() {
DependencyManager dm = getDM();
Component component0 = dm.createComponent().setImplementation(C0.class).add(dm.createServiceDependency().setService(S1.class).setRequired(true)).add(dm.createServiceDependency().setService(S2.class).setRequired(true));
Component component1 = dm.createComponent().setImplementation(S1Impl1.class).setInterface(S1.class.getName(), null).add(ToggleDependency.create());
m_dm.add(component0);
m_dm.add(component1);
DependencyGraph graph = DependencyGraph.getGraph(ComponentState.UNREGISTERED, DependencyState.REQUIRED_UNAVAILABLE);
List<MissingDependency> missingCustomDependencies = graph.getMissingCustomDependencies();
assertEquals(1, missingCustomDependencies.size());
MissingDependency missingCustomeDependency = missingCustomDependencies.get(0);
assertTrue(missingCustomeDependency.getType().equals("toggle"));
assertTrue(missingCustomeDependency.getName().equals("false"));
List<MissingDependency> missingDependencies = graph.getMissingDependencies("service");
assertEquals(1, missingDependencies.size());
}
Aggregations