Package org.springframework.osgi.mock

Examples of org.springframework.osgi.mock.MockBundleContext


    }

    final Properties props = new Properties();
    final ServiceRegistration reg = new MockServiceRegistration();

    exporter.setBundleContext(new MockBundleContext() {

      public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
        assertTrue(service instanceof ServiceFactory);
        return reg;
      }
View Full Code Here


    final ServiceRegistration reg = new MockServiceRegistration();
    final ServiceFactory[] factory = new ServiceFactory[1];

    Object service = new Object();

    BundleContext ctx = new MockBundleContext() {

      public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
        assertTrue(service instanceof ServiceFactory);
        factory[0] = (ServiceFactory) service;
        return reg;
View Full Code Here

      public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) {
      }

    };

    BundleContext ctx = new MockBundleContext() {

      public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
        assertTrue(service instanceof ServiceFactory);
        factory[0] = (ServiceFactory) service;
        return reg;
View Full Code Here

    final ServiceRegistration reg = new MockServiceRegistration();
    final ServiceFactory[] factory = new ServiceFactory[1];

    Object service = new Object();

    BundleContext ctx = new MockBundleContext() {

      public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
        assertTrue(service instanceof ServiceFactory);
        factory[0] = (ServiceFactory) service;
        return reg;
View Full Code Here

      public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
      }
    };

    ctx = new MockBundleContext();
    exporter.setBundleContext(ctx);
    exporter.setBeanFactory(beanFactory);
    exporter.setInterfaces(new Class[] { Serializable.class, Cloneable.class });
    exporter.setTarget(factory);
    beanFactoryControl.replay();
View Full Code Here

    // [0] = service registration
    // [1] = service unregistration
   
    final int[] counters = new int[] { 0, 0 };

    MockBundleContext mCtx = new MockBundleContext() {

      public ServiceRegistration registerService(String clazz[], Object service, Dictionary properties) {
        counters[0]++;
        return new MockServiceRegistration(clazz, properties) {
View Full Code Here

    proxyCreator = createProxyCreator(classes);
  }

  private StaticServiceProxyCreator createProxyCreator(Class[] classes) {
    ClassLoader cl = getClass().getClassLoader();
    BundleContext ctx = new MockBundleContext();
    return new StaticServiceProxyCreator(classes, cl, cl, ctx, ImportContextClassLoader.UNMANAGED, true);
  }
View Full Code Here


  private StaticServiceProxyCreator createProxyCreator(BundleContext ctx, Class[] classes) {
    ClassLoader cl = getClass().getClassLoader();
    if (ctx == null) {
      ctx = new MockBundleContext();
    }
    return new StaticServiceProxyCreator(classes, cl, cl, ctx, ImportContextClassLoader.UNMANAGED, true);
  }
View Full Code Here

  public void testTargetProxy() throws Exception {
    final MockServiceReference ref = new MockServiceReference();
    final Object service = new Object();

    MockBundleContext ctx = new MockBundleContext() {

      public ServiceReference getServiceReference(String clazz) {
        return ref;
      }
View Full Code Here

  protected void setUp() throws Exception {
    listener = new SimpleTargetSourceLifecycleListener();

    refs = new ServiceReference[] { new MockServiceReference() };

    bundleContext = new MockBundleContext() {

      public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
        return refs;
      }
    };
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.