use of cn.taketoday.context.loader.ScopeMetadata in project today-framework by TAKETODAY.
the class AnnotationScopeMetadataResolverTests method resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton.
@Test
public void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() {
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
Assertions.assertThat(scopeMetadata).as("resolveScopeMetadata(..) must *never* return null.").isNotNull();
Assertions.assertThat(scopeMetadata.getScopeName()).isEqualTo(BeanDefinition.SCOPE_SINGLETON);
Assertions.assertThat(scopeMetadata.getScopedProxyMode()).isEqualTo(NO);
}
use of cn.taketoday.context.loader.ScopeMetadata in project today-framework by TAKETODAY.
the class AnnotationScopeMetadataResolverTests method customRequestScopeWithAttributeViaAsm.
@Test
public void customRequestScopeWithAttributeViaAsm() throws IOException {
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScopeWithAttributeOverride.class.getName());
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata());
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(TARGET_CLASS);
}
use of cn.taketoday.context.loader.ScopeMetadata in project today-framework by TAKETODAY.
the class AnnotationScopeMetadataResolverTests method customRequestScopeViaAsm.
@Test
public void customRequestScopeViaAsm() throws IOException {
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScope.class.getName());
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata());
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);
}
use of cn.taketoday.context.loader.ScopeMetadata in project today-framework by TAKETODAY.
the class AnnotationScopeMetadataResolverTests method resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation.
@Test
public void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() {
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.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(TARGET_CLASS);
}
use of cn.taketoday.context.loader.ScopeMetadata in project today-framework 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);
}
Aggregations