|
|
|
@ -92,8 +92,9 @@ public class BatchAutoConfigurationTests {
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
|
|
|
|
assertThat(this.context.getBean(JobExplorer.class)).isNotNull();
|
|
|
|
|
assertThat(this.context.getBean(BatchProperties.class)
|
|
|
|
|
.getInitializer().isEnabled()).isTrue();
|
|
|
|
|
assertThat(
|
|
|
|
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
|
|
|
|
.isTrue();
|
|
|
|
|
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
|
|
|
|
|
.queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty();
|
|
|
|
|
}
|
|
|
|
@ -193,8 +194,9 @@ public class BatchAutoConfigurationTests {
|
|
|
|
|
PropertyPlaceholderAutoConfiguration.class);
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
|
|
|
|
assertThat(this.context.getBean(BatchProperties.class)
|
|
|
|
|
.getInitializer().isEnabled()).isFalse();
|
|
|
|
|
assertThat(
|
|
|
|
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
|
|
|
|
.isFalse();
|
|
|
|
|
this.expected.expect(BadSqlGrammarException.class);
|
|
|
|
|
new JdbcTemplate(this.context.getBean(DataSource.class))
|
|
|
|
|
.queryForList("select * from BATCH_JOB_EXECUTION");
|
|
|
|
@ -233,8 +235,9 @@ public class BatchAutoConfigurationTests {
|
|
|
|
|
PropertyPlaceholderAutoConfiguration.class);
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
|
|
|
|
assertThat(this.context.getBean(BatchProperties.class)
|
|
|
|
|
.getInitializer().isEnabled()).isTrue();
|
|
|
|
|
assertThat(
|
|
|
|
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
|
|
|
|
.isTrue();
|
|
|
|
|
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
|
|
|
|
|
.queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty();
|
|
|
|
|
JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
|
|
|
|
@ -245,19 +248,20 @@ public class BatchAutoConfigurationTests {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testCustomTablePrefixWithDefaultSchemaDisablesInitializer() throws Exception {
|
|
|
|
|
public void testCustomTablePrefixWithDefaultSchemaDisablesInitializer()
|
|
|
|
|
throws Exception {
|
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(this.context,
|
|
|
|
|
"spring.datasource.name:batchtest",
|
|
|
|
|
"spring.batch.tablePrefix:PREFIX_");
|
|
|
|
|
"spring.datasource.name:batchtest", "spring.batch.tablePrefix:PREFIX_");
|
|
|
|
|
this.context.register(TestConfiguration.class,
|
|
|
|
|
EmbeddedDataSourceConfiguration.class,
|
|
|
|
|
HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
|
|
|
|
|
PropertyPlaceholderAutoConfiguration.class);
|
|
|
|
|
this.context.refresh();
|
|
|
|
|
assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
|
|
|
|
|
assertThat(this.context.getBean(BatchProperties.class)
|
|
|
|
|
.getInitializer().isEnabled()).isFalse();
|
|
|
|
|
assertThat(
|
|
|
|
|
this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
|
|
|
|
|
.isFalse();
|
|
|
|
|
this.expected.expect(BadSqlGrammarException.class);
|
|
|
|
|
new JdbcTemplate(this.context.getBean(DataSource.class))
|
|
|
|
|
.queryForList("select * from BATCH_JOB_EXECUTION");
|
|
|
|
|