use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project spring-framework by spring-projects.
the class QuartzSupportTests method schedulerFactoryBeanWithCustomJobStore.
@Test
@SuppressWarnings("resource")
void schedulerFactoryBeanWithCustomJobStore() throws Exception {
StaticApplicationContext context = new StaticApplicationContext();
String dbName = "mydb";
EmbeddedDatabase database = new EmbeddedDatabaseBuilder().setName(dbName).build();
Properties properties = new Properties();
properties.setProperty("org.quartz.jobStore.class", JobStoreTX.class.getName());
properties.setProperty("org.quartz.jobStore.dataSource", dbName);
BeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(SchedulerFactoryBean.class).addPropertyValue("autoStartup", false).addPropertyValue("dataSource", database).addPropertyValue("quartzProperties", properties).getBeanDefinition();
context.registerBeanDefinition("scheduler", beanDefinition);
Scheduler scheduler = context.getBean(Scheduler.class);
assertThat(scheduler.getMetaData().getJobStoreClass()).isEqualTo(JobStoreTX.class);
}
use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project spring-framework by spring-projects.
the class AbstractDatabaseInitializationTests method setUp.
@BeforeEach
void setUp() {
db = new EmbeddedDatabaseBuilder().setType(getEmbeddedDatabaseType()).build();
jdbcTemplate = new JdbcTemplate(db);
}
Aggregations