use of cn.taketoday.beans.factory.annotation.AnnotatedGenericBeanDefinition in project today-infrastructure by TAKETODAY.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromComposedControllerAnnotationWithBlankName.
@Test
public void generateBeanNameFromComposedControllerAnnotationWithBlankName() {
// SPR-11360
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComposedControllerAnnotationWithBlankName.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
String expectedGeneratedBeanName = this.beanNameGenerator.buildDefaultBeanName(bd);
assertThat(beanName).isEqualTo(expectedGeneratedBeanName);
}
use of cn.taketoday.beans.factory.annotation.AnnotatedGenericBeanDefinition in project today-infrastructure by TAKETODAY.
the class AnnotationBeanNameGeneratorTests method generateBeanNameWithNamedComponent.
@Test
public void generateBeanNameWithNamedComponent() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentWithName.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertThat(beanName).as("The generated beanName must *never* be null.").isNotNull();
assertThat(StringUtils.hasText(beanName)).as("The generated beanName must *never* be blank.").isTrue();
assertThat(beanName).isEqualTo("walden");
}
use of cn.taketoday.beans.factory.annotation.AnnotatedGenericBeanDefinition in project today-infrastructure by TAKETODAY.
the class AnnotationBeanNameGeneratorTests method generateBeanNameFromMetaComponentWithStringValue.
@Test
public void generateBeanNameFromMetaComponentWithStringValue() {
BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(ComponentFromStringMeta.class);
String beanName = this.beanNameGenerator.generateBeanName(bd, registry);
assertThat(beanName).isEqualTo("henry");
}
use of cn.taketoday.beans.factory.annotation.AnnotatedGenericBeanDefinition in project today-infrastructure by TAKETODAY.
the class AnnotationScopeMetadataResolverTests method resolveScopeMetadataShouldApplyScopedProxyModeToPrototype.
@Test
public void resolveScopeMetadataShouldApplyScopedProxyModeToPrototype() {
this.scopeMetadataResolver = new AnnotationScopeMetadataResolver(INTERFACES);
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithPrototypeScope.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
Assertions.assertThat(scopeMetadata).as("resolveScopeMetadata(..) must *never* return null.").isNotNull();
Assertions.assertThat(scopeMetadata.getScopeName()).isEqualTo(BeanDefinition.SCOPE_PROTOTYPE);
Assertions.assertThat(scopeMetadata.getScopedProxyMode()).isEqualTo(INTERFACES);
}
use of cn.taketoday.beans.factory.annotation.AnnotatedGenericBeanDefinition in project today-infrastructure by TAKETODAY.
the class AnnotationScopeMetadataResolverTests method customRequestScope.
@Test
public void customRequestScope() {
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithCustomRequestScope.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
Assertions.assertThat(scopeMetadata).as("resolveScopeMetadata(..) must *never* return null.").isNotNull();
Assertions.assertThat(scopeMetadata.getScopeName()).isEqualTo("request");
Assertions.assertThat(scopeMetadata.getScopedProxyMode()).isEqualTo(NO);
}
Aggregations