use of com.alibaba.cloud.sentinel.datasource.factorybean.FileRefreshableDataSourceFactoryBean in project spring-cloud-alibaba by alibaba.
the class FileRefreshableDataSourceFactoryBeanTests method testFile.
@Test
public void testFile() throws Exception {
AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(TestConfig.class);
assertThat(annotationConfigApplicationContext.getBean("fileBean")).isNotNull();
FileRefreshableDataSource fileRefreshableDataSource = annotationConfigApplicationContext.getBean("fileBean", FileRefreshableDataSource.class);
assertThat(((List<FlowRule>) fileRefreshableDataSource.loadConfig()).size()).isEqualTo(1);
FileRefreshableDataSourceFactoryBean factoryBean = annotationConfigApplicationContext.getBean("&fileBean", FileRefreshableDataSourceFactoryBean.class);
assertThat(factoryBean.getBufSize()).isEqualTo(1024);
assertThat(factoryBean.getCharset()).isEqualTo("utf-8");
assertThat(factoryBean.getRecommendRefreshMs()).isEqualTo(2000);
assertThat(factoryBean.getFile()).isNotNull();
assertThat(factoryBean.getConverter()).isNotNull();
}
Aggregations