-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea9ac64
commit aae93a6
Showing
8 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 16 additions & 4 deletions
20
jpa/boot-jpa-locks/src/test/java/com/example/locks/SchemaValidationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
package com.example.locks; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.example.locks.common.ContainersConfig; | ||
import com.zaxxer.hikari.HikariDataSource; | ||
import javax.sql.DataSource; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.boot.testcontainers.context.ImportTestcontainers; | ||
import org.springframework.context.annotation.Import; | ||
|
||
@DataJpaTest(properties = {"spring.jpa.hibernate.ddl-auto=validate", "spring.test.database.replace=none"}) | ||
@ImportTestcontainers(ContainersConfig.class) | ||
@DataJpaTest(properties = {"spring.jpa.hibernate.ddl-auto=validate"}) | ||
@AutoConfigureTestDatabase | ||
@Import(ContainersConfig.class) | ||
class SchemaValidationTest { | ||
|
||
@Autowired | ||
private DataSource dataSource; | ||
|
||
@Test | ||
void validateJpaMappingsWithDbSchema() {} | ||
void validateJpaMappingsWithDbSchema() { | ||
assertThat(dataSource).isInstanceOf(HikariDataSource.class); | ||
} | ||
} |
7 changes: 5 additions & 2 deletions
7
jpa/boot-jpa-locks/src/test/java/com/example/locks/TestApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
package com.example.locks; | ||
|
||
import com.example.locks.common.ContainersConfig; | ||
import com.example.locks.utils.AppConstants; | ||
import org.springframework.boot.SpringApplication; | ||
|
||
public class TestApplication { | ||
|
||
public static void main(String[] args) { | ||
System.setProperty("spring.profiles.active", "local"); | ||
SpringApplication.from(Application::main).with(ContainersConfig.class).run(args); | ||
SpringApplication.from(Application::main) | ||
.with(ContainersConfig.class) | ||
.withAdditionalProfiles(AppConstants.PROFILE_LOCAL) | ||
.run(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters