Package org.springframework.osgi.mock

Examples of org.springframework.osgi.mock.MockBundleContext


public class InvalidOsgiDefaultsTest extends TestCase {

  private GenericApplicationContext appContext;

  protected void setUp() throws Exception {
    BundleContext bundleContext = new MockBundleContext() {
      // service reference already registered
      public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
        return new ServiceReference[] { new MockServiceReference(new String[] { Serializable.class.getName() }) };
      }
    };
View Full Code Here


    // this.serviceFactoryBean.setApplicationContext(new
    // GenericApplicationContext());

    ref = new MockServiceReference(new String[] { Serializable.class.getName() });

    bundleContext = new MockBundleContext() {

      private final String filter_Serializable = OsgiFilterUtils.unifyFilter(Serializable.class, null);


      public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
View Full Code Here

  private ConfigurationAdminManager cam;
  private Map configuration;


  protected void setUp() throws Exception {
    cam = new ConfigurationAdminManager("bla", new MockBundleContext()) {

      public Map getConfiguration() {
        return configuration;
      }
View Full Code Here

  // test the
  // correct behaviour of the ProxyFactoryBean when OsgiServiceUtils
  // succesfully
  // finds the service.
  public void testGetObjectWithFilterOnly() throws Exception {
    this.serviceFactoryBean.setBundleContext(new MockBundleContext());
    this.serviceFactoryBean.setInterfaces(new Class[] { Serializable.class });
    String filter = "(beanName=myBean)";
    this.serviceFactoryBean.setFilter(filter);

    MockServiceReference ref = new MockServiceReference();
View Full Code Here

    bundleA = new MockBundle("bundleA");

    final Bundle[] bundles = new Bundle[] { installBundle, startBundle, updateBundle, bundleA };

    BundleContext bundleContext = new MockBundleContext() {
      // return proper bundles
      public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
        return new ServiceReference[0];
      }
View Full Code Here

    services = new LinkedHashMap();
    MockControl mc = MockControl.createNiceControl(Configuration.class);
    cfg = (Configuration) mc.getMock();
    mc.expectAndReturn(cfg.getProperties(), new Properties());
    mc.replay();
    bundleContext = new MockBundleContext() {

      public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
        services.put(service, properties);
        return super.registerService(clazzes, service, properties);
      }
View Full Code Here

    DummyListenerServiceSignature.UNBIND_CALLS = 0;

    DummyListenerServiceSignature2.BIND_CALLS = 0;
    DummyListenerServiceSignature2.UNBIND_CALLS = 0;

    BundleContext bundleContext = new MockBundleContext() {
      // service reference already registered
      public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
        return new ServiceReference[] { new MockServiceReference(new String[] { Cloneable.class.getName() }) };
      }
    };
View Full Code Here

    createWarDeployer();
    assertSame(servletContext, context.getServletContext());
  }

  public void testBundleContextPresenceInServletContext() throws Exception {
    BundleContext bundleCtx = new MockBundleContext();
    bundle = new MockBundle(bundleCtx);

    createWarDeployer();
    ServletContext ctx = context.getServletContext();
    Object attribute = ctx.getAttribute(WarDeploymentContext.OSGI_BUNDLE_CONTEXT_ATTRIBUTE);
View Full Code Here

public class OsgiDefaultsTests extends TestCase {

  private GenericApplicationContext appContext;

  protected void setUp() throws Exception {
    BundleContext bundleContext = new MockBundleContext() {
      // service reference already registered
      public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
        return new ServiceReference[] { new MockServiceReference(new String[] { Serializable.class.getName() }) };
      }
    };
View Full Code Here

  private ExtenderConfiguration config;
  private BundleContext bundleContext;


  protected void setUp() throws Exception {
    bundleContext = new MockBundleContext();
    config = new ExtenderConfiguration(bundleContext);
  }
View Full Code Here

TOP

Related Classes of org.springframework.osgi.mock.MockBundleContext

Copyright © 2018 www.massapicom. 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.