use of org.apache.felix.scr.impl.inject.BindParameters in project felix by apache.
the class DependencyManager method doInvokeBindMethod.
private boolean doInvokeBindMethod(ComponentContextImpl<S> componentContext, final ReferenceMethod bindMethod, RefPair<S, T> refPair, int trackingCount) {
if (!getServiceObject(componentContext, bindMethod, refPair)) {
m_componentManager.getLogger().log(LogService.LOG_WARNING, "DependencyManager : invokeBindMethod : Service not available from service registry for ServiceReference {0} for reference {1}", null, refPair.getRef(), getName());
return false;
}
MethodResult result = bindMethod.invoke(componentContext.getImplementationObject(false), new BindParameters(componentContext, refPair), MethodResult.VOID);
if (result == null) {
return false;
}
m_componentManager.setServiceProperties(result, trackingCount);
return true;
}
use of org.apache.felix.scr.impl.inject.BindParameters in project felix by apache.
the class BindMethodTest method testMethod.
private void testMethod(final String methodName, final T1 component, final DSVersion dsVersion, final String expectCallPerformed) {
ComponentContainer container = newContainer();
SingleComponentManager icm = new SingleComponentManager(container, new ComponentMethodsImpl());
BindMethod bm = new BindMethod(methodName, component.getClass(), FakeService.class.getName(), dsVersion, false);
RefPair refPair = new SingleRefPair(m_serviceReference);
ComponentContextImpl<T1> cc = new ComponentContextImpl(icm, new MockBundle(), null);
assertTrue(bm.getServiceObject(cc, refPair, m_context, icm));
BindParameters bp = new BindParameters(cc, refPair);
bm.invoke(component, bp, null, icm);
assertEquals(expectCallPerformed, component.callPerformed);
}
Aggregations