Examples of MockServiceReference


Examples of org.springframework.osgi.mock.MockServiceReference

    ServiceUnavailableException exception = new ServiceUnavailableException((String) null);
    assertNotNull(exception.getMessage());
  }

  public void testServiceUnavailableExceptionServiceReference() {
    ServiceReference sr = new MockServiceReference();
    ServiceUnavailableException exception = new ServiceUnavailableException(sr);
    assertNotNull(exception.getMessage());
  }
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

    super.setUp();
    this.serviceFactoryBean = new OsgiServiceCollectionProxyFactoryBean();
    // 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);
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

    this.serviceFactoryBean.setBundleContext(new MockBundleContext());
    this.serviceFactoryBean.setInterfaces(new Class[] { Serializable.class });
    String filter = "(beanName=myBean)";
    this.serviceFactoryBean.setFilter(filter);

    MockServiceReference ref = new MockServiceReference();
    Dictionary dict = new Hashtable();
    dict.put(Constants.OBJECTCLASS, new String[] { Serializable.class.getName() });
    ref.setProperties(dict);

    serviceFactoryBean.setBeanClassLoader(getClass().getClassLoader());
    serviceFactoryBean.afterPropertiesSet();

    Object proxy = serviceFactoryBean.getObject();
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

    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() }) };
      }
    };

    appContext = new GenericApplicationContext();
    appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

  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() }) };
      }
    };

    appContext = new GenericApplicationContext();
    appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

    int i = 0;
    for (Iterator iter = intfs.iterator(); iter.hasNext();) {
      clazzez[i++] = ((Class) iter.next()).getName();
    }

    ref = new MockServiceReference(null, properties, null, clazzez);

    event = new ServiceEvent(ServiceEvent.REGISTERED, ref);

    services.put(ref, service);
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

  protected void addService(Object service) {
    addService(service, new Properties());
  }

  protected void removeService(Object service) {
    ServiceReference ref = new MockServiceReference();

    for (Iterator iter = services.entrySet().iterator(); iter.hasNext();) {
      Map.Entry entry = (Map.Entry) iter.next();
      if (entry.getValue().equals(service)) {
        ref = (ServiceReference) entry.getKey();
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

  private ServiceReference ref;


  protected void setUp() throws Exception {
    ref = new MockServiceReference();
    bundleContext = new MockBundleContext() {

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

Examples of org.springframework.osgi.mock.MockServiceReference

    };

    ServiceDynamicInterceptor interceptorA1 = createInterceptorWServiceRequired();
    interceptorA1.setRetryTimeout(10);

    Advice interceptorB1 = new ServiceStaticInterceptor(bundleContext, new MockServiceReference());

    InterfaceWithEquals proxyA = (InterfaceWithEquals) createProxy(target, InterfaceWithEquals.class,
      new Advice[] { interceptorA1 });
    InterfaceWithEquals proxyB = (InterfaceWithEquals) createProxy(target, InterfaceWithEquals.class,
      new Advice[] { interceptorB1 });
View Full Code Here

Examples of org.springframework.osgi.mock.MockServiceReference

  }

  public void testSpringInfrastructureProxyOnImportersWithDifferentRefs() throws Exception {
    Object service = new Object();
    BundleContext ctx = createObjectTrackingBundleContext(service);
    ServiceInvoker invokerA = new ServiceStaticInterceptor(ctx, new MockServiceReference());
    ServiceInvoker invokerB = new ServiceStaticInterceptor(ctx, new MockServiceReference());
    InfrastructureProxy proxyA = new InfrastructureOsgiProxyAdvice(invokerA);
    InfrastructureProxy proxyB = new InfrastructureOsgiProxyAdvice(invokerB);

    assertFalse("invokers should not be equal (they have different service references)", invokerA.equals(invokerB));
    assertFalse("proxies should not be equal", proxyA.equals(proxyB));
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.