Package org.osgi.service.blueprint.reflect

Examples of org.osgi.service.blueprint.reflect.BeanMetadata


    /**
     * Lets ignore beans that are explicitly configured in the Spring XML files
     */
    protected boolean shouldIgnoreBean(Class<?> type) {
        for (Object metadataObject : blueprintContainer.getMetadata(BeanMetadata.class)) {
            BeanMetadata metadata = (BeanMetadata) metadataObject;
            if (BeanMetadata.SCOPE_SINGLETON.equals(metadata.getScope())) {
                Object bean = blueprintContainer.getComponentInstance(metadata.getId());
                if (type.isInstance(bean)) {
                    return true;
                }
            }
        }
View Full Code Here


                    String name = e.getLocalName() != null ? e.getLocalName() : e.getNodeName();
                    if (ENCRYPTOR_ELEMENT.equals(name)) {
                        if (encryptorRef != null) {
                            throw new ComponentDefinitionException("Only one of " + ENCRYPTOR_REF_ATTRIBUTE + " attribute or " + ENCRYPTOR_ELEMENT + " element is allowed");
                        }
                        BeanMetadata encryptor = context.parseElement(BeanMetadata.class, metadata, e);
                        metadata.addProperty("encryptor", encryptor);
                    }
                }
            }
        }
View Full Code Here

  }
 
  @Test
  public void testUnitNoName_110() {
    Element e = getTestElement("unitNoName", root_110);
    BeanMetadata bean =
      (BeanMetadata) sut.decorate(e, new BeanMetadataImpl(), parserCtx);
    BeanProperty property = (BeanProperty) bean.getProperties().get(0);
    ReferenceMetadata reference = (ReferenceMetadata) property.getValue();
   
    assertEquals("emf2", property.getName());
    assertEquals("(&(!(org.apache.aries.jpa.proxy.factory=*))"+NSHandler.EMPTY_UNIT_NAME_FILTER+")",
        reference.getFilter());
View Full Code Here

  }
 
  @Test
  public void testEmptyUnitName() {
    Element e = getTestElement("emptyUnitName", root);
    BeanMetadata bean =
      (BeanMetadata) sut.decorate(e, new BeanMetadataImpl(), parserCtx);
    BeanProperty property = (BeanProperty) bean.getProperties().get(0);
    ReferenceMetadata reference = (ReferenceMetadata) property.getValue();
   
    assertEquals("emf3", property.getName());
    assertEquals("(&(!(org.apache.aries.jpa.proxy.factory=*))"+NSHandler.EMPTY_UNIT_NAME_FILTER+")",
        reference.getFilter());
View Full Code Here

  }
 
  @Test
  public void testEmptyUnitName_110() {
    Element e = getTestElement("emptyUnitName", root_110);
    BeanMetadata bean =
      (BeanMetadata) sut.decorate(e, new BeanMetadataImpl(), parserCtx);
    BeanProperty property = (BeanProperty) bean.getProperties().get(0);
    ReferenceMetadata reference = (ReferenceMetadata) property.getValue();
   
    assertEquals("emf3", property.getName());
    assertEquals("(&(!(org.apache.aries.jpa.proxy.factory=*))"+NSHandler.EMPTY_UNIT_NAME_FILTER+")",
        reference.getFilter());
View Full Code Here

    Element e = getTestElement("unit", root);
    BeanMetadataImpl oldBean = new BeanMetadataImpl();
    oldBean.setId("myid");
    oldBean.setProperties(Arrays.asList(Skeleton.newMock(BeanProperty.class)));
   
    BeanMetadata bean = (BeanMetadata) sut.decorate(e, oldBean, parserCtx);

    assertEquals("myid", bean.getId());
    assertEquals(2, bean.getProperties().size());
   
    assertTrue(registeredComponents.isEmpty());
  }
View Full Code Here

    Element e = getTestElement("unit", root);
    BeanMetadataImpl oldBean = new BeanMetadataImpl();
    oldBean.setId("myid");
    oldBean.setProperties(Arrays.asList(Skeleton.newMock(BeanProperty.class)));
   
    BeanMetadata bean = (BeanMetadata) sut.decorate(e, oldBean, parserCtx);

    assertEquals("myid", bean.getId());
    assertEquals(2, bean.getProperties().size());
   
    assertTrue(registeredComponents.isEmpty());
  }
View Full Code Here

  }

  @Test
  public void testDefaultContext() {
    Element e = getTestElement("context", root);
    BeanMetadata bean =
      (BeanMetadata) sut.decorate(e, new BeanMetadataImpl(), parserCtx);
    BeanMetadata innerBean = (BeanMetadata) ((BeanProperty) bean.getProperties().get(0)).getValue();

    assertEquals("createEntityManager", innerBean.getFactoryMethod());
    assertEquals("internalClose", innerBean.getDestroyMethod());

    assertEquals(1, registeredComponents.size());
    ReferenceMetadata reference = (ReferenceMetadata) registeredComponents.get(0);
   
    assertEquals(EntityManagerFactory.class.getName(), reference.getInterface());
View Full Code Here

  }
 
  @Test
  public void testDefaultContext_110() {
    Element e = getTestElement("context", root_110);
    BeanMetadata bean =
      (BeanMetadata) sut.decorate(e, new BeanMetadataImpl(), parserCtx);
    BeanMetadata innerBean = (BeanMetadata) ((BeanProperty) bean.getProperties().get(0)).getValue();

    assertEquals("createEntityManager", innerBean.getFactoryMethod());
    assertEquals("internalClose", innerBean.getDestroyMethod());

    assertEquals(1, registeredComponents.size());
    ReferenceMetadata reference = (ReferenceMetadata) registeredComponents.get(0);
   
    assertEquals(EntityManagerFactory.class.getName(), reference.getInterface());
View Full Code Here

  @Test
  public void testContextNoPersistenceContextProvider() {
   
    sut.contextUnavailable(null);
    Element e = getTestElement("context", root);
    BeanMetadata bean =
      (BeanMetadata) sut.decorate(e, new BeanMetadataImpl(), parserCtx);
    BeanMetadata innerBean = (BeanMetadata) ((BeanProperty) bean.getProperties().get(0)).getValue();

    assertEquals("createEntityManager", innerBean.getFactoryMethod());
    assertEquals("internalClose", innerBean.getDestroyMethod());

    assertEquals(1, registeredComponents.size());
    ReferenceMetadata reference = (ReferenceMetadata) registeredComponents.get(0);
   
    assertEquals(EntityManagerFactory.class.getName(), reference.getInterface());
View Full Code Here

TOP

Related Classes of org.osgi.service.blueprint.reflect.BeanMetadata

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.