@Test public void defaultJtaPlatform() throws Exception { this.context.register(JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); Map<String, Object> jpaPropertyMap = this.context .getBean(LocalContainerEntityManagerFactoryBean.class) .getJpaPropertyMap(); assertThat(jpaPropertyMap.get("hibernate.transaction.jta.platform")) .isInstanceOf(SpringJtaPlatform.class); }
@Test public void testCustomJtaPlatform() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "spring.jpa.properties.hibernate.transaction.jta.platform:" + TestJtaPlatform.class.getName()); this.context.register(JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); Map<String, Object> jpaPropertyMap = this.context .getBean(LocalContainerEntityManagerFactoryBean.class) .getJpaPropertyMap(); assertThat((String) jpaPropertyMap.get("hibernate.transaction.jta.platform")) .isEqualTo(TestJtaPlatform.class.getName()); }
@Test public void defaultJtaPlatform() throws Exception { this.context.register(JtaProperties.class, JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); Map<String, Object> jpaPropertyMap = this.context .getBean(LocalContainerEntityManagerFactoryBean.class) .getJpaPropertyMap(); assertThat(jpaPropertyMap.get("hibernate.transaction.jta.platform"), instanceOf(SpringJtaPlatform.class)); }
@Test public void testCustomJtaPlatform() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, "spring.jpa.properties.hibernate.transaction.jta.platform:" + TestJtaPlatform.class.getName()); this.context.register(JtaProperties.class, JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); Map<String, Object> jpaPropertyMap = this.context .getBean(LocalContainerEntityManagerFactoryBean.class) .getJpaPropertyMap(); assertThat((String) jpaPropertyMap.get("hibernate.transaction.jta.platform"), equalTo(TestJtaPlatform.class.getName())); }