Examples of OsgiServiceCollectionProxyFactoryBean


Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

  /**
   * Creates a dynamic OSGi list of OSGi services interested in receiving
   * events for OSGi application contexts.
   */
  private void createListenersList() {
    OsgiServiceCollectionProxyFactoryBean fb = new OsgiServiceCollectionProxyFactoryBean();
    fb.setBundleContext(bundleContext);
    fb.setCardinality(Cardinality.C_0__N);
    fb.setCollectionType(CollectionType.LIST);
    fb.setInterfaces(new Class[] { OsgiBundleApplicationContextListener.class });
    fb.setBeanClassLoader(extenderConfiguration.getClassLoader());
    fb.afterPropertiesSet();

    applicationListenersCleaner = fb;
    applicationListeners = (List) fb.getObject();
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

    Class<?>[] params = writeMethod.getParameterTypes();
    if (params.length != 1) {
      throw new IllegalArgumentException("Setter for [" + beanName + "] must have only one argument");
    }
    if (Collection.class.isAssignableFrom(params[0])) {
      return getServiceProperty(new OsgiServiceCollectionProxyFactoryBean(), s, writeMethod, beanName);
    }
    else {
      return getServiceProperty(new OsgiServiceProxyFactoryBean(), s, writeMethod, beanName);
    }
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

    processor.getServiceProperty(pfb, ref, setter, null);
    assertFalse(pfb.getCardinality().isMandatory());
  }

  public void testProperMultiCardinality() throws Exception {
    OsgiServiceCollectionProxyFactoryBean pfb = new OsgiServiceCollectionProxyFactoryBean();

    Method setter = AnnotatedBean.class.getMethod("setAnnotatedBeanTypeWithCardinality0_N",
      new Class[] { List.class });
    ServiceReference ref = AnnotationUtils.getAnnotation(setter, ServiceReference.class);
    processor.getServiceProperty(pfb, ref, setter, null);
    assertFalse(pfb.getCardinality().isMandatory());

    setter = AnnotatedBean.class.getMethod("setAnnotatedBeanTypeWithCardinality1_N",
      new Class[] { SortedSet.class });
    ref = AnnotationUtils.getAnnotation(setter, ServiceReference.class);
    pfb = new OsgiServiceCollectionProxyFactoryBean();
    processor.getServiceProperty(pfb, ref, setter, null);
    assertTrue(pfb.getCardinality().isMandatory());
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

    processor.getServiceProperty(pfb, ref, setter, null);
    assertTrue(pfb.getCardinality().isMandatory());
  }

  public void testErrorMultiCardinality() throws Exception {
    OsgiServiceCollectionProxyFactoryBean pfb = new OsgiServiceCollectionProxyFactoryBean();

    Method setter = AnnotatedBean.class.getMethod("setAnnotatedBeanErrorTypeWithCardinality1_N",
      new Class[] { SortedSet.class });
    ServiceReference ref = AnnotationUtils.getAnnotation(setter, ServiceReference.class);
    pfb = new OsgiServiceCollectionProxyFactoryBean();
    try {
      processor.getServiceProperty(pfb, ref, setter, null);
      fail("IllegalArgumentException should have been thrown");
    }
    catch (Exception e) {
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

  private OsgiServiceCollectionProxyFactoryBean fb;


  protected void onSetUp() throws Exception {
    fb = new OsgiServiceCollectionProxyFactoryBean();
    fb.setBundleContext(bundleContext);
    fb.setBeanClassLoader(getClass().getClassLoader());
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

  private OsgiServiceCollectionProxyFactoryBean fb;


  protected void onSetUp() throws Exception {
    fb = new OsgiServiceCollectionProxyFactoryBean();
    fb.setBundleContext(bundleContext);
    fb.setBeanClassLoader(getClass().getClassLoader());
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

  /**
   * Creates a dynamic OSGi list of OSGi services interested in receiving events for OSGi application contexts.
   */
  private void createListenersList() {
    OsgiServiceCollectionProxyFactoryBean fb = new OsgiServiceCollectionProxyFactoryBean();
    fb.setBundleContext(bundleContext);
    fb.setCardinality(Cardinality.C_0__N);
    fb.setCollectionType(CollectionType.LIST);
    fb.setInterfaces(new Class[] { OsgiBundleApplicationContextListener.class });
    fb.setBeanClassLoader(extenderConfiguration.getClassLoader());
    fb.afterPropertiesSet();

    applicationListenersCleaner = fb;
    applicationListeners = (List) fb.getObject();
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

  private ServiceReference ref;


  protected void setUp() throws Exception {
    super.setUp();
    this.serviceFactoryBean = new OsgiServiceCollectionProxyFactoryBean();
    // this.serviceFactoryBean.setApplicationContext(new
    // GenericApplicationContext());

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

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

    OsgiServiceProxyFactoryBean fb = (OsgiServiceProxyFactoryBean) appContext.getBean("&refWLocalConfig");
    assertEquals(55, getTimeout(fb));
  }

  public void testLocalDefinitionForCardinalityOnMultiImporter() throws Exception {
    OsgiServiceCollectionProxyFactoryBean fb = (OsgiServiceCollectionProxyFactoryBean) appContext.getBean("&colWLocalConfig");
    assertEquals(Cardinality.C_1__N, getCardinality(fb));
  }
View Full Code Here

Examples of org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean

    OsgiServiceProxyFactoryBean fb = (OsgiServiceProxyFactoryBean) appContext.getBean("&refWDefaults");
    assertEquals(Cardinality.C_0__1, getCardinality(fb));
  }

  public void testCardinalityDefaultOnMultiImporter() throws Exception {
    OsgiServiceCollectionProxyFactoryBean fb = (OsgiServiceCollectionProxyFactoryBean) appContext.getBean("&colWDefaults");
    assertEquals(Cardinality.C_0__N, getCardinality(fb));
  }
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.