use of org.apache.felix.ipojo.handlers.dependency.DependencyCallback in project felix by apache.
the class TestDependencyIdDetection method testAddAndRemoveMethods.
@Test
public void testAddAndRemoveMethods() {
ComponentInstance instance = ipojoHelper.createComponentInstance(factory);
DependencyHandlerDescription dh = (DependencyHandlerDescription) instance.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:requires");
DependencyDescription dd = findDependencyById(dh, "MyService");
assertThat(dd).isNotNull();
DependencyCallback[] callbacks = dd.getDependency().getDependencyCallbacks();
assertThat(callbacks).isNotNull();
DependencyCallback bind = getBindCallback(callbacks);
DependencyCallback unbind = getUnbindCallback(callbacks);
assertThat(bind).isNotNull();
assertThat(unbind).isNotNull();
assertThat(bind.getMethodName()).isEqualTo("addMyService");
assertThat(unbind.getMethodName()).isEqualTo("removeMyService");
}
use of org.apache.felix.ipojo.handlers.dependency.DependencyCallback in project felix by apache.
the class TestDependencyIdDetection method testSetAndUnSetMethods.
@Test
public void testSetAndUnSetMethods() {
ComponentInstance instance = ipojoHelper.createComponentInstance(factory);
DependencyHandlerDescription dh = (DependencyHandlerDescription) instance.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:requires");
DependencyDescription dd = findDependencyById(dh, "MyOtherService");
assertThat(dd).isNotNull();
DependencyCallback[] callbacks = dd.getDependency().getDependencyCallbacks();
assertThat(callbacks).isNotNull();
DependencyCallback bind = getBindCallback(callbacks);
DependencyCallback unbind = getUnbindCallback(callbacks);
assertThat(bind).isNotNull();
assertThat(unbind).isNotNull();
assertThat(bind.getMethodName()).isEqualTo("setMyOtherService");
assertThat(unbind.getMethodName()).isEqualTo("unsetMyOtherService");
}
Aggregations