Dictionary headers = new Hashtable();
headers.put(Constants.BUNDLE_NAME, "Extender mock bundle");
final EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(headers);
aBundle.setEntryReturnOnNextCallToGetEntry(new ClassPathResource("META-INF/spring/moved-extender.xml").getURL());
MockBundleContext ctx = new MockBundleContext() {
public Bundle getBundle() {
return aBundle;
}
};
this.listener.start(ctx);
Dictionary hdrs = new Hashtable();
hdrs.put(ConfigUtils.SPRING_CONTEXT_HEADER, "bla bla");
MockBundle anotherBundle = new MockBundle(hdrs);
anotherBundle.setBundleId(1);
BundleEvent event = new BundleEvent(BundleEvent.STARTED, anotherBundle);
BundleListener listener = (BundleListener) ctx.getBundleListeners().iterator().next();
TestTaskExecutor.called = false;
listener.bundleChanged(event);
assertTrue("task executor should have been called if configured properly", TestTaskExecutor.called);