Java 类org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry 实例源码

项目:spring-cloud-aws    文件:AnnotationDrivenQueueListenerBeanDefinitionParserTest.java   
@Test
public void parseInternal_customSqsClient_shouldProduceContainerWithCustomSqsClientUsed() throws Exception {
    //Arrange
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);

    //Act
    reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-custom-amazon-sqs.xml", getClass()));

    //Assert
    BeanDefinition sqsAsync = registry.getBeanDefinition("myClient");
    assertNotNull(sqsAsync);

    BeanDefinition abstractContainerDefinition = registry.getBeanDefinition(SimpleMessageListenerContainer.class.getName() + "#0");
    assertNotNull(abstractContainerDefinition);

    assertEquals(3, abstractContainerDefinition.getPropertyValues().size());
    assertEquals("myClient",
            ((RuntimeBeanReference) abstractContainerDefinition.getPropertyValues().getPropertyValue("amazonSqs").getValue()).getBeanName());
}
项目:spring-cloud-aws    文件:AnnotationDrivenQueueListenerBeanDefinitionParserTest.java   
@Test
public void parseInternal_withSendToMessageTemplateAttribute_mustBeSetOnTheBeanDefinition() throws Exception {
    //Arrange
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);

    //Act
    reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-with-send-to-message-template.xml", getClass()));

    //Assert
    BeanDefinition queueMessageHandler = registry.getBeanDefinition(QueueMessageHandler.class.getName() + "#0");
    assertNotNull(queueMessageHandler);

    assertEquals(1, queueMessageHandler.getPropertyValues().size());
    ManagedList<?> returnValueHandlers = (ManagedList<?>) queueMessageHandler.getPropertyValues().getPropertyValue("customReturnValueHandlers").getValue();
    assertEquals(1, returnValueHandlers.size());
    RootBeanDefinition sendToReturnValueHandler = (RootBeanDefinition) returnValueHandlers.get(0);

    assertEquals("messageTemplate",
            ((RuntimeBeanReference) sendToReturnValueHandler.getConstructorArgumentValues().getArgumentValue(0, RuntimeBeanReference.class).getValue()).getBeanName());
}
项目:spring-cloud-aws    文件:AnnotationDrivenQueueListenerBeanDefinitionParserTest.java   
@Test
public void parseInternal_withCustomProperties_customPropertiesConfiguredOnContainer() throws Exception {
    //Arrange
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);

    //Act
    reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-custom-properties.xml", getClass()));

    //Assert
    BeanDefinition abstractContainerDefinition = registry.getBeanDefinition(SimpleMessageListenerContainer.class.getName() + "#0");
    assertNotNull(abstractContainerDefinition);

    assertEquals("false", abstractContainerDefinition.getPropertyValues().getPropertyValue("autoStartup").getValue());
    assertEquals("9", abstractContainerDefinition.getPropertyValues().getPropertyValue("maxNumberOfMessages").getValue());
    assertEquals("6", abstractContainerDefinition.getPropertyValues().getPropertyValue("visibilityTimeout").getValue());
    assertEquals("3", abstractContainerDefinition.getPropertyValues().getPropertyValue("waitTimeOut").getValue());
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
@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);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void generateBeanNameWithDefaultNamedComponent() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(DefaultNamedComponent.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("thoreau", beanName);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void generateBeanNameWithNamedComponentWhereTheNameIsBlank() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithBlankName.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));
    String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
    assertEquals(expectedGeneratedBeanName, beanName);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void generateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnonymousComponent.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));
    String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
    assertEquals(expectedGeneratedBeanName, beanName);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void generateBeanNameFromMetaComponentWithStringValue() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    assertEquals("henry", beanName);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void generateBeanNameFromMetaComponentWithNonStringValue() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromNonStringMeta.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    assertEquals("annotationBeanNameGeneratorTests.ComponentFromNonStringMeta", beanName);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
/**
 * @since 4.0.1
 * @see https://jira.spring.io/browse/SPR-11360
 */
@Test
public void generateBeanNameFromComposedControllerAnnotationWithoutName() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithoutName.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
    assertEquals(expectedGeneratedBeanName, beanName);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
/**
 * @since 4.0.1
 * @see https://jira.spring.io/browse/SPR-11360
 */
@Test
public void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithBlankName.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
    assertEquals(expectedGeneratedBeanName, beanName);
}
项目:spring4-understanding    文件:AnnotationBeanNameGeneratorTests.java   
/**
 * @since 4.0.1
 * @see https://jira.spring.io/browse/SPR-11360
 */
@Test
public void generateBeanNameFromComposedControllerAnnotationWithStringValue() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(
        ComposedControllerAnnotationWithStringValue.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    assertEquals("restController", beanName);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test(expected = BeanDefinitionStoreException.class)
public void withOpenInputStream() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new InputStreamResource(getClass().getResourceAsStream(
            "test.xml"));
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test
public void withOpenInputStreamAndExplicitValidationMode() {
    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);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test
public void withImport() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new ClassPathResource("import.xml", getClass());
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test
public void withWildcardImport() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new ClassPathResource("importPattern.xml", getClass());
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test
public void withInputSourceAndExplicitValidationMode() {
    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);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test
public void withFreshInputStream() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    Resource resource = new ClassPathResource("test.xml", getClass());
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
    testBeanDefinitions(registry);
}
项目:class-guard    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void testGenerateBeanNameWithNamedComponent() {
    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);
}
项目:class-guard    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void testGenerateBeanNameWithDefaultNamedComponent() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(DefaultNamedComponent.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("thoreau", beanName);
}
项目:class-guard    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void testGenerateBeanNameWithNamedComponentWhereTheNameIsBlank() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithBlankName.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));
    String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
    assertEquals(expectedGeneratedBeanName, beanName);
}
项目:class-guard    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void testGenerateBeanNameWithAnonymousComponentYieldsGeneratedBeanName() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnonymousComponent.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));
    String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
    assertEquals(expectedGeneratedBeanName, beanName);
}
项目:class-guard    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void testGenerateBeanNameFromMetaComponentWithStringValue() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    assertEquals("henry", beanName);
}
项目:class-guard    文件:AnnotationBeanNameGeneratorTests.java   
@Test
public void testGenerateBeanNameFromMetaComponentWithNonStringValue() {
    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromNonStringMeta.class);
    String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
    assertEquals("annotationBeanNameGeneratorTests.ComponentFromNonStringMeta", beanName);
}
项目:class-guard    文件:XmlBeanDefinitionReaderTests.java   
public void testSetParserClassToNull() {
    try {
        SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
        new XmlBeanDefinitionReader(registry).setDocumentReaderClass(null);
        fail("Should have thrown IllegalArgumentException (null parserClass)");
    }
    catch (IllegalArgumentException expected) {
    }
}
项目:class-guard    文件:XmlBeanDefinitionReaderTests.java   
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) {
    }
}
项目:class-guard    文件:XmlBeanDefinitionReaderTests.java   
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) {
    }
}
项目:class-guard    文件:XmlBeanDefinitionReaderTests.java   
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);
}
项目:class-guard    文件:XmlBeanDefinitionReaderTests.java   
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) {
    }
}
项目:class-guard    文件:XmlBeanDefinitionReaderTests.java   
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);
}
项目:spring-cloud-aws    文件:NotificationMessagingTemplateBeanDefinitionParserTest.java   
@Test
public void parseInternal_withCustomAmazonSnsClient_shouldPassItAsConstructorArg() throws Exception {
    //Arrange
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);

    //Act
    reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-custom-amazon-sns.xml", getClass()));

    //Assert
    BeanDefinition notificationMessagingTemplateBeanDefinition = registry.getBeanDefinition("notificationMessagingTemplate");
    assertEquals("mySnsClient", ((RuntimeBeanReference) notificationMessagingTemplateBeanDefinition.getConstructorArgumentValues()
            .getArgumentValue(0, RuntimeBeanReference.class).getValue()).getBeanName());
}
项目:spring-cloud-aws    文件:NotificationMessagingTemplateBeanDefinitionParserTest.java   
@Test
public void parseInternal_withDefaultDestination_mustBeSetOnTemplate() throws Exception {
    //Arrange
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);

    //Act
    reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-with-default-destination.xml", getClass()));

    //Assert
    BeanDefinition notificationMessagingTemplateBeanDefinition = registry.getBeanDefinition("notificationMessagingTemplate");
    assertEquals("myDefaultDestination", notificationMessagingTemplateBeanDefinition.getPropertyValues()
            .getPropertyValue("defaultDestinationName").getValue());
}
项目:spring-cloud-aws    文件:QueueMessagingTemplateBeanDefinitionParserTest.java   
@Test
public void parseInternal_withCustomAmazonSqsClient_shouldPassItAsConstructorArg() throws Exception {
    //Arrange
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);

    //Act
    reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-custom-amazon-sqs.xml", getClass()));

    //Assert
    BeanDefinition queueMessagingTemplateBeanDefinition = registry.getBeanDefinition("queueMessagingTemplate");
    assertEquals("myClient", ((RuntimeBeanReference) queueMessagingTemplateBeanDefinition.getConstructorArgumentValues()
            .getArgumentValue(0, RuntimeBeanReference.class).getValue()).getBeanName());
}
项目:spring-cloud-aws    文件:QueueMessagingTemplateBeanDefinitionParserTest.java   
@Test
public void parseInternal_withDefaultDestination_mustBeSetOnTemplate() throws Exception {
    //Arrange
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry);

    //Act
    reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-with-default-destination.xml", getClass()));

    //Assert
    BeanDefinition queueMessagingTemplateBeanDefinition = registry.getBeanDefinition("queueMessagingTemplate");
    assertEquals("myDefaultDestination", queueMessagingTemplateBeanDefinition.getPropertyValues()
            .getPropertyValue("defaultDestinationName").getValue());
}
项目:spring-modular    文件:StrictContextParentBean.java   
private BeanDefinitionRegistry getBeanFactory(String location) {
    XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(new SimpleBeanDefinitionRegistry());
    beanDefinitionReader.setResourceLoader(context);
    beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(context));
    beanDefinitionReader.loadBeanDefinitions(location);

    return beanDefinitionReader.getBeanFactory();
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test
public void setParserClassSunnyDay() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    new XmlBeanDefinitionReader(registry).setDocumentReaderClass(DefaultBeanDefinitionDocumentReader.class);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test(expected = IllegalArgumentException.class)
public void setParserClassToNull() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    new XmlBeanDefinitionReader(registry).setDocumentReaderClass(null);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test(expected = IllegalArgumentException.class)
public void setParserClassToUnsupportedParserType() throws Exception {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    new XmlBeanDefinitionReader(registry).setDocumentReaderClass(String.class);
}
项目:spring4-understanding    文件:XmlBeanDefinitionReaderTests.java   
@Test(expected = BeanDefinitionStoreException.class)
public void withInputSource() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    InputSource resource = new InputSource(getClass().getResourceAsStream("test.xml"));
    new XmlBeanDefinitionReader(registry).loadBeanDefinitions(resource);
}
项目:class-guard    文件:XmlBeanDefinitionReaderTests.java   
public void testSetParserClassSunnyDay() {
    SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
    new XmlBeanDefinitionReader(registry).setDocumentReaderClass(DefaultBeanDefinitionDocumentReader.class);
}