use of org.apache.felix.scr.impl.MockBundle 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);
}
use of org.apache.felix.scr.impl.MockBundle in project felix by apache.
the class XmlHandlerTest method readMetadata.
// ---------- helper
private List readMetadata(final Reader reader) throws IOException, ComponentException, XmlPullParserException, Exception {
try {
final KXml2SAXParser parser = new KXml2SAXParser(reader);
XmlHandler handler = new XmlHandler(new MockBundle(), logger, false, false);
parser.parseXML(handler);
return handler.getComponentMetadataList();
} finally {
try {
reader.close();
} catch (IOException ignore) {
}
}
}
Aggregations