[JAVA-13976] Fix integration tests after Spring Boot upgrade to 2.7.2 (#12647)
This commit is contained in:
@@ -66,6 +66,7 @@ public class H2JpaConfig {
|
||||
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
|
||||
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
|
||||
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
|
||||
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
|
||||
|
||||
return hibernateProperties;
|
||||
}
|
||||
|
||||
@@ -8,4 +8,6 @@ spring.jpa.hibernate.ddl-auto = create
|
||||
spring.h2.console.enabled=true
|
||||
|
||||
# Uppercase Table Names
|
||||
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||
|
||||
hibernate.globally_quoted_identifiers=true
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SpringBootProfileIntegrationTest {
|
||||
private GenericEntityRepository genericEntityRepository;
|
||||
|
||||
@Test
|
||||
public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() {
|
||||
public void givenGenericEntityRepository_whenSaveAndRetrieveEntity_thenOK() {
|
||||
GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test"));
|
||||
GenericEntity foundEntity = genericEntityRepository.findById(genericEntity.getId()).orElse(null);
|
||||
assertNotNull(foundEntity);
|
||||
|
||||
@@ -62,6 +62,7 @@ public class H2TestProfileJPAConfig {
|
||||
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
|
||||
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
|
||||
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
|
||||
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
|
||||
|
||||
return hibernateProperties;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@ import com.baeldung.boot.repository.EmployeeRepository;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
@SqlGroup({ @Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
|
||||
@Sql("/import_employees.sql")})
|
||||
@SqlGroup({
|
||||
@Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
|
||||
@Sql("/import_employees.sql")}
|
||||
)
|
||||
public class SpringBootSqlGroupAnnotationIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -19,6 +19,7 @@ hibernate.hbm2ddl.auto=create-drop
|
||||
hibernate.cache.use_second_level_cache=true
|
||||
hibernate.cache.use_query_cache=true
|
||||
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
||||
hibernate.globally_quoted_identifiers=true
|
||||
|
||||
spring.jpa.properties.hibernate.hbm2ddl.import_files=import_books.sql
|
||||
spring.sql.init.data-locations=import_*_users.sql
|
||||
@@ -1,3 +1,5 @@
|
||||
insert into EMPLOYEES values(1, 'Harsha', 'Developer');
|
||||
insert into EMPLOYEES values(2, 'John', 'Tester');
|
||||
insert into EMPLOYEES values(3, 'Ram', 'Manager');
|
||||
delete from "employees";
|
||||
|
||||
insert into "employees" values(1, 'Harsha', 'Developer');
|
||||
insert into "employees" values(2, 'John', 'Tester');
|
||||
insert into "employees" values(3, 'Ram', 'Manager');
|
||||
@@ -1,2 +1,2 @@
|
||||
insert into EMPLOYEES values(4, 'Eric', 'Senior Developer');
|
||||
insert into EMPLOYEES values(5, 'Vidhyaah', 'Senior Manager');
|
||||
insert into "employees" values(4, 'Eric', 'Senior Developer');
|
||||
insert into "employees" values(5, 'Vidhyaah', 'Senior Manager');
|
||||
Reference in New Issue
Block a user