use of cn.taketoday.beans.DirectFieldAccessor in project today-framework by TAKETODAY.
the class SchedulerBeanDefinitionParserTests method defaultScheduler.
@Test
public void defaultScheduler() {
ThreadPoolTaskScheduler scheduler = (ThreadPoolTaskScheduler) this.context.getBean("defaultScheduler");
Integer size = (Integer) new DirectFieldAccessor(scheduler).getPropertyValue("poolSize");
assertThat(size).isEqualTo(1);
}
use of cn.taketoday.beans.DirectFieldAccessor in project today-framework by TAKETODAY.
the class SchedulerBeanDefinitionParserTests method customScheduler.
@Test
public void customScheduler() {
ThreadPoolTaskScheduler scheduler = (ThreadPoolTaskScheduler) this.context.getBean("customScheduler");
Integer size = (Integer) new DirectFieldAccessor(scheduler).getPropertyValue("poolSize");
assertThat(size).isEqualTo(42);
}
use of cn.taketoday.beans.DirectFieldAccessor in project today-framework by TAKETODAY.
the class DefaultLifecycleProcessorTests method defaultLifecycleProcessorInstance.
@Test
public void defaultLifecycleProcessorInstance() {
StaticApplicationContext context = new StaticApplicationContext();
context.refresh();
Object lifecycleProcessor = new DirectFieldAccessor(context).getPropertyValue("lifecycleProcessor");
assertThat(lifecycleProcessor).isNotNull();
assertThat(lifecycleProcessor.getClass()).isEqualTo(DefaultLifecycleProcessor.class);
}
use of cn.taketoday.beans.DirectFieldAccessor in project today-framework by TAKETODAY.
the class DefaultLifecycleProcessorTests method customLifecycleProcessorInstance.
@Test
public void customLifecycleProcessorInstance() {
BeanDefinition beanDefinition = new RootBeanDefinition(DefaultLifecycleProcessor.class);
beanDefinition.getPropertyValues().add("timeoutPerShutdownPhase", 1000);
StaticApplicationContext context = new StaticApplicationContext();
context.registerBeanDefinition("lifecycleProcessor", beanDefinition);
context.refresh();
LifecycleProcessor bean = context.getBean("lifecycleProcessor", LifecycleProcessor.class);
Object contextLifecycleProcessor = new DirectFieldAccessor(context).getPropertyValue("lifecycleProcessor");
assertThat(contextLifecycleProcessor).isNotNull();
assertThat(contextLifecycleProcessor).isSameAs(bean);
assertThat(new DirectFieldAccessor(contextLifecycleProcessor).getPropertyValue("timeoutPerShutdownPhase")).isEqualTo(1000L);
}
use of cn.taketoday.beans.DirectFieldAccessor in project today-framework by TAKETODAY.
the class ScriptTemplateViewResolverTests method viewClass.
@Test
public void viewClass() throws Exception {
ScriptTemplateViewResolver resolver = new ScriptTemplateViewResolver();
assertThat(resolver.requiredViewClass()).isEqualTo(ScriptTemplateView.class);
DirectFieldAccessor viewAccessor = new DirectFieldAccessor(resolver);
Class<?> viewClass = (Class<?>) viewAccessor.getPropertyValue("viewClass");
assertThat(viewClass).isEqualTo(ScriptTemplateView.class);
}
Aggregations