Merge pull request #3818 from madorb/master
* pr/3818: Polish contribution Consistently apply table prefix
This commit is contained in:
commit
e9fe34e2fa
|
|
@ -140,6 +140,10 @@ class BasicBatchConfigurer implements BatchConfigurer {
|
||||||
logger.warn("JPA does not support custom isolation levels, so locks may not be taken when launching Jobs");
|
logger.warn("JPA does not support custom isolation levels, so locks may not be taken when launching Jobs");
|
||||||
factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
|
factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
|
||||||
}
|
}
|
||||||
|
String tablePrefix = this.properties.getTablePrefix();
|
||||||
|
if (StringUtils.hasText(tablePrefix)) {
|
||||||
|
factory.setTablePrefix(tablePrefix);
|
||||||
|
}
|
||||||
factory.setTransactionManager(getTransactionManager());
|
factory.setTransactionManager(getTransactionManager());
|
||||||
factory.afterPropertiesSet();
|
factory.afterPropertiesSet();
|
||||||
return factory.getObject();
|
return factory.getObject();
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
* Tests for {@link BatchAutoConfiguration}.
|
* Tests for {@link BatchAutoConfiguration}.
|
||||||
*
|
*
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
public class BatchAutoConfigurationTests {
|
public class BatchAutoConfigurationTests {
|
||||||
|
|
||||||
|
|
@ -224,9 +225,12 @@ public class BatchAutoConfigurationTests {
|
||||||
PropertyPlaceholderAutoConfiguration.class);
|
PropertyPlaceholderAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
assertNotNull(this.context.getBean(JobLauncher.class));
|
assertNotNull(this.context.getBean(JobLauncher.class));
|
||||||
assertNotNull(this.context.getBean(JobExplorer.class));
|
|
||||||
assertEquals(0, new JdbcTemplate(this.context.getBean(DataSource.class))
|
assertEquals(0, new JdbcTemplate(this.context.getBean(DataSource.class))
|
||||||
.queryForList("select * from PREFIX_JOB_EXECUTION").size());
|
.queryForList("select * from PREFIX_JOB_EXECUTION").size());
|
||||||
|
JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
|
||||||
|
assertEquals(0, jobExplorer.findRunningJobExecutions("test").size());
|
||||||
|
JobRepository jobRepository = this.context.getBean(JobRepository.class);
|
||||||
|
assertNull(jobRepository.getLastJobExecution("test", new JobParameters()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue