Examples of MockBundleContext


Examples of org.apache.sling.installer.core.impl.MockBundleContext

class MockBundleTaskCreator extends BundleTaskCreator {

    private final Map<String, BundleInfo> fakeBundleInfo = new HashMap<String, BundleInfo>();

    public MockBundleTaskCreator() throws IOException {
        this.init(new MockBundleContext(), null, null);
    }
View Full Code Here

Examples of org.springframework.osgi.mock.MockBundleContext

    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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.