Examples of BeanDefinition


Examples of org.springframework.beans.factory.config.BeanDefinition

   * @see DATACMNS-47
   */
  @Test
  public void beanDefinitionSourceIsSetForJavaConfigScannedBeans() {

    BeanDefinition definition = context.getBeanDefinition("myRepository");
    assertThat(definition.getSource(), is(notNullValue()));
  }
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

  public void evaluatesExcludeFiltersCorrectly() {

    Collection<BeanDefinition> candidates = source.getCandidates(new DefaultResourceLoader());
    assertThat(candidates, hasSize(1));

    BeanDefinition candidate = candidates.iterator().next();
    assertThat(candidate.getBeanClassName(), is(MyRepository.class.getName()));
  }
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

  @Test
  public void readsCouchbaseTemplateAttributesCorrectly() {
    reader.loadBeanDefinitions(new ClassPathResource("namespace/couchbase-template-bean.xml"));

    BeanDefinition definition = factory.getBeanDefinition("couchbaseTemplate");
    assertEquals(1, definition.getConstructorArgumentValues().getArgumentCount());

    factory.getBean("couchbaseTemplate");
  }
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

  @Test
  public void readsCouchbaseTemplateWithTranslationServiceAttributesCorrectly() {
    reader.loadBeanDefinitions(new ClassPathResource("namespace/couchbase-template-with-translation-service-bean.xml"));

    BeanDefinition definition = factory.getBeanDefinition("couchbaseTemplate");
    assertEquals(2, definition.getConstructorArgumentValues().getArgumentCount());

    factory.getBean("couchbaseTemplate");
  }
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

  protected void createBeanDefEntry(final Class<?> clazz, final CompositeComponentDefinition compositeDef,
    final String refName, final Object eleSource, final ParserContext parserContext) {
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(clazz);
    builder.getRawBeanDefinition().setSource(eleSource);
    builder.addConstructorArgReference(refName);
    BeanDefinition assertDef = builder.getBeanDefinition();
    String assertName = parserContext.getReaderContext().registerWithGeneratedName(assertDef);
    compositeDef.addNestedComponent(new BeanComponentDefinition(assertDef, assertName));
  }
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

                factoryPropertyValues.addPropertyValue("properties", properties);
            }
        }
       
        BeanDefinitionBuilder featureServiceBuilder = BeanDefinitionBuilder.genericBeanDefinition();
        BeanDefinition featureServiceRawBean = featureServiceBuilder.getRawBeanDefinition();
        featureServiceRawBean.setFactoryBeanName(FlipSpringAspect.FEATURE_SERVICE_FACTORY_BEAN_NAME);
        featureServiceRawBean.setFactoryMethodName("createFeatureService");
        parserContext.getRegistry().registerBeanDefinition(FlipSpringAspect.FEATURE_SERVICE_BEAN_NAME, featureServiceBuilder.getBeanDefinition());
       
        return null;
    }
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

    }
   
    @Test
    public void testCreateFlipHandlerAspect() {
        assertTrue(context.containsBeanDefinition(FlipSpringAspect.ASPECT_BEAN_NAME));
        BeanDefinition flipHandlerAspectBeanDefinition = context.getBeanDefinition(FlipSpringAspect.ASPECT_BEAN_NAME);
        MutablePropertyValues properties = flipHandlerAspectBeanDefinition.getPropertyValues();
        assertEquals(FlipSpringAspect.class.getName(), flipHandlerAspectBeanDefinition.getBeanClassName());
       
        FlipSpringAspect aspect = context.getBean(FlipSpringAspect.ASPECT_BEAN_NAME, FlipSpringAspect.class);
        assertNotNull(aspect.getFeatureService());
        assertNotNull(aspect.getDefaultValue());
        assertEquals("test", aspect.getDefaultValue());
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

        assertEquals(FeatureServiceDirectFactory.class.getName(), context.getBeanDefinition("featureServiceFactory").getBeanClassName());
    }
   
    @Test
    public void testFeatureServiceFactoryProperties() {
        BeanDefinition beanDefinition = context.getBeanDefinition("featureServiceFactory");

        // Test ContextProviders setup
        PropertyValue contextProvidersProperty = beanDefinition.getPropertyValues().getPropertyValue("contextProviders");
        assertNotNull(contextProvidersProperty);
        assertTrue(contextProvidersProperty.getValue() instanceof List);
        List contextProvidersList = ((List)contextProvidersProperty.getValue());
        assertEquals(2, contextProvidersList.size());
       
        assertTrue(contextProvidersList.get(0) instanceof BeanDefinitionHolder);
        assertEquals(SystemPropertiesContextProvider.class.getName(), ((BeanDefinitionHolder)contextProvidersList.get(0)).getBeanDefinition().getBeanClassName());
       
        assertTrue(contextProvidersList.get(1) instanceof BeanReference);
        assertEquals("contextProviderBean", ((BeanReference)contextProvidersList.get(1)).getBeanName());

        // Test PropertyReaders setup
        PropertyValue propertyReadersProperty = beanDefinition.getPropertyValues().getPropertyValue("propertyReaders");
        assertNotNull(propertyReadersProperty);
        assertTrue(propertyReadersProperty.getValue() instanceof List);
        List propertyReadersList = ((List)propertyReadersProperty.getValue());
        assertEquals(2, propertyReadersList.size());
       
        assertTrue(propertyReadersList.get(0) instanceof BeanDefinitionHolder);
        assertEquals(XmlPropertyReader.class.getName(), ((BeanDefinitionHolder)propertyReadersList.get(0)).getBeanDefinition().getBeanClassName());
       
        assertTrue(propertyReadersList.get(1) instanceof BeanReference);
        assertEquals("propertyReaderBean", ((BeanReference)propertyReadersList.get(1)).getBeanName());
       
        // Test properties setup
        PropertyValue propertiesProperty = beanDefinition.getPropertyValues().getPropertyValue("properties");
        assertNotNull(propertiesProperty);
        assertTrue(propertiesProperty.getValue() instanceof Properties);
        Properties properties = ((Properties)propertiesProperty.getValue());
        assertEquals(1, properties.size());
       
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

    }
   
    @Test
    public void testFeatureServiceFactoryPropertiesMising() {
        setupContext("test-feature-service-context-empty.xml");
        BeanDefinition beanDefinition = context.getBeanDefinition("featureServiceFactory");

        // Test ContextProviders setup
        PropertyValue contextProvidersProperty = beanDefinition.getPropertyValues().getPropertyValue("contextProviders");
        assertNull(contextProvidersProperty);

        // Test PropertyReaders setup
        PropertyValue propertyReadersProperty = beanDefinition.getPropertyValues().getPropertyValue("propertyReaders");
        assertNull(propertyReadersProperty);
       
        // Test properties setup
        PropertyValue propertiesProperty = beanDefinition.getPropertyValues().getPropertyValue("properties");
        assertNull(propertiesProperty);
    }
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanDefinition

    }
   
    @Test
    public void testFeatureServiceFactoryPropertiesWithPropChildren() {
        setupContext("test-feature-service-context-no-prop-children.xml");
        BeanDefinition beanDefinition = context.getBeanDefinition("featureServiceFactory");

        // Test ContextProviders setup
        PropertyValue contextProvidersProperty = beanDefinition.getPropertyValues().getPropertyValue("contextProviders");
        assertNull(contextProvidersProperty);

        // Test PropertyReaders setup
        PropertyValue propertyReadersProperty = beanDefinition.getPropertyValues().getPropertyValue("propertyReaders");
        assertNull(propertyReadersProperty);
       
        // Test properties setup
        PropertyValue propertiesProperty = beanDefinition.getPropertyValues().getPropertyValue("properties");
        assertNull(propertiesProperty);
    }
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.