Package org.springframework.beans.factory.support

Examples of org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry


    new XmlBeanDefinitionReader(registry).setDocumentReaderClass(DefaultBeanDefinitionDocumentReader.class);
  }

  public void testSetParserClassToNull() {
    try {
      SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
      new XmlBeanDefinitionReader(registry).setDocumentReaderClass(null);
      fail("Should have thrown IllegalArgumentException (null parserClass)");
    }
    catch (IllegalArgumentException expected) {
    }
View Full Code Here


    }
  }

  public void testSetParserClassToUnsupportedParserType() throws Exception {
    try {
      SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
      new XmlBeanDefinitionReader(registry).setDocumentReaderClass(String.class);
      fail("Should have thrown IllegalArgumentException (unsupported parserClass)");
    }
    catch (IllegalArgumentException expected) {
    }
View Full Code Here

    }
  }

  public void testWithOpenInputStream() {
    try {
      SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
      Resource resource = new InputStreamResource(getClass().getResourceAsStream("test.xml"));
      new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
      fail("Should have thrown BeanDefinitionStoreException (can't determine validation mode)");
    }
    catch (BeanDefinitionStoreException expected) {
View Full Code Here

    catch (BeanDefinitionStoreException expected) {
    }
  }

  public void testWithOpenInputStreamAndExplicitValidationMode() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new InputStreamResource(getClass().getResourceAsStream("test.xml"));
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);
    reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_DTD);
    reader.loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
View Full Code Here

    reader.loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
  }

  public void testWithImport() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new ClassPathResource("import.xml", getClass());
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
  }
View Full Code Here

    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
  }

  public void testWithWildcardImport() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new ClassPathResource("importPattern.xml", getClass());
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
  }
View Full Code Here

    testBeanDefinitions(registry);
  }

  public void testWithInputSource() {
    try {
      SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
      InputSource resource = new InputSource(getClass().getResourceAsStream("test.xml"));
      new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
      fail("Should have thrown BeanDefinitionStoreException (can't determine validation mode)");
    }
    catch (BeanDefinitionStoreException expected) {
View Full Code Here

    catch (BeanDefinitionStoreException expected) {
    }
  }

  public void testWithInputSourceAndExplicitValidationMode() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    InputSource resource = new InputSource(getClass().getResourceAsStream("test.xml"));
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);
    reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_DTD);
    reader.loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
View Full Code Here

    reader.loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
  }

  public void testWithFreshInputStream() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new ClassPathResource("test.xml", getClass());
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
  }
View Full Code Here

  private AnnotationBeanNameGenerator beanNameGenerator = new AnnotationBeanNameGenerator();


  @Test
  public void generateBeanNameWithNamedComponent() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithName.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    assertNotNull("The generated beanName must *never* be null.", beanName);
    assertTrue("The generated beanName must *never* be blank.", StringUtils.hasText(beanName));
    assertEquals("walden", beanName);
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry

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.