public void testMultipleExtraDependencies()
{
DependencyManager m = new DependencyManager(context);
Ensure e = new Ensure();
Component sp2 = m.createComponent()
.setImplementation(ServiceProvider2.class).setInterface(ServiceProvider2.class.getName(), null)
.add(m.createServiceDependency()
.setService(Runnable.class, "(foo=bar)")
.setRequired(false)
.setAutoConfig("m_runnable"))
.add(m.createServiceDependency()
.setService(Sequencer.class)
.setRequired(true)
.setCallbacks("bind", null))
.setCallbacks(null, "start", "stop", null)
.setComposition("getComposition");
Component sp = m.createComponent()
.setImplementation(ServiceProvider.class)
.setInterface(ServiceInterface.class.getName(),
new Hashtable() {{ put("foo", "bar"); }})
.add(m.createServiceDependency()
.setService(Sequencer.class)
.setRequired(true)
.setAutoConfig("m_sequencer"))
.add(m.createServiceDependency()
.setService(ServiceProvider2.class)
.setRequired(true)
.setCallbacks("bind", "unbind"))
.setCallbacks(null, "start", "stop", null);
Component sc = m.createComponent()
.setImplementation(ServiceConsumer.class)
.add(m.createServiceDependency()
.setService(Sequencer.class)
.setRequired(true)
.setAutoConfig("m_sequencer"))
.add(m.createServiceDependency()
.setService(ServiceInterface.class, "(foo=bar)")
.setRequired(true)
.setAutoConfig("m_service"))
.setCallbacks(null, "start", "stop", null);
// Provide the Sequencer service to the MultipleAnnotationsTest class.
Component sequencer =
m.createComponent().setImplementation(new SequencerImpl(e))
.setInterface(Sequencer.class.getName(), null);
m.add(sp2);
m.add(sp);
m.add(sc);