Merge pull request #3818 from madorb/master

* pr/3818:
  Polish contribution
  Consistently apply table prefix
This commit is contained in:
Stephane Nicoll 2015-08-27 16:32:46 +02:00
commit e9fe34e2fa
2 changed files with 9 additions and 1 deletions

View File

@ -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");
factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
}
String tablePrefix = this.properties.getTablePrefix();
if (StringUtils.hasText(tablePrefix)) {
factory.setTablePrefix(tablePrefix);
}
factory.setTransactionManager(getTransactionManager());
factory.afterPropertiesSet();
return factory.getObject();

View File

@ -68,6 +68,7 @@ import static org.junit.Assert.assertTrue;
* Tests for {@link BatchAutoConfiguration}.
*
* @author Dave Syer
* @author Stephane Nicoll
*/
public class BatchAutoConfigurationTests {
@ -224,9 +225,12 @@ public class BatchAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
assertNotNull(this.context.getBean(JobLauncher.class));
assertNotNull(this.context.getBean(JobExplorer.class));
assertEquals(0, new JdbcTemplate(this.context.getBean(DataSource.class))
.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