Skip to content

Commit

Permalink
adds validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed May 31, 2024
1 parent 7f0d031 commit fba6ef3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jpa/boot-data-customsequence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.17.0</version>
<version>1.19.2</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
spring.application.name=spring-boot-jpa-customsequence
spring.application.name=boot-data-jpa-customsequence
server.port=8080
server.shutdown=graceful
spring.main.allow-bean-definition-overriding=true
spring.jmx.enabled=false

################ Logging #####################
logging.file.name=logs/spring-boot-jpa-customsequence.log
logging.file.name=logs/${spring.application.name}.log
logging.level.web=INFO
logging.level.sql=INFO
logging.level.net.ttddyy.dsproxy.listener=debug
Expand All @@ -21,7 +21,7 @@ management.endpoint.health.show-details=always
################ Database #####################
spring.jpa.open-in-view=false
spring.datasource.hikari.auto-commit=false
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.jdbc.time_zone=UTC
spring.jpa.properties.hibernate.generate_statistics=false
spring.jpa.properties.hibernate.jdbc.batch_size=25
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.example.custom.sequence;

import static org.assertj.core.api.Assertions.assertThat;

import com.example.custom.sequence.common.ContainersConfig;
import com.github.gavlyukovskiy.boot.jdbc.decorator.DecoratedDataSource;
import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.Import;

@DataJpaTest(
properties = {
"spring.jpa.hibernate.ddl-auto=validate",
"spring.test.database.replace=none"
})
@Import(ContainersConfig.class)
class SchemaValidationTest {

@Autowired private DataSource dataSource;

@Test
void validateJpaMappingsWithDbSchema() {
assertThat(dataSource).isInstanceOf(DecoratedDataSource.class);
}
}

0 comments on commit fba6ef3

Please sign in to comment.