-
Notifications
You must be signed in to change notification settings - Fork 0
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
532dfa2
commit 93e842a
Showing
13 changed files
with
379 additions
and
159 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
84 changes: 42 additions & 42 deletions
84
adapters/jdbc/src/main/resources/db/changelog/db.changelog-master.yaml
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,42 +1,42 @@ | ||
databaseChangeLog: | ||
- changeSet: | ||
id: "1" | ||
author: default | ||
changes: | ||
- createTable: | ||
tableName: customer | ||
columns: | ||
- column: | ||
name: id | ||
type: uuid | ||
constraints: | ||
primaryKey: true | ||
nullable: false | ||
- column: | ||
name: email | ||
type: varchar(50) | ||
- column: | ||
name: lastName | ||
type: varchar(50) | ||
- column: | ||
name: firstName | ||
type: varchar(50) | ||
- changeSet: | ||
id: "2" | ||
author: default | ||
changes: | ||
- insert: | ||
tableName: customer | ||
columns: | ||
- column: | ||
name: id | ||
value: 00000000-0000-0000-0000-000000000000 | ||
- column: | ||
name: email | ||
value: [email protected] | ||
- column: | ||
name: firstName | ||
value: First Name | ||
- column: | ||
name: lastName | ||
value: Last Name | ||
databaseChangeLog: | ||
- changeSet: | ||
id: "1" | ||
author: default | ||
changes: | ||
- createTable: | ||
tableName: customer | ||
columns: | ||
- column: | ||
name: id | ||
type: varchar(50) | ||
constraints: | ||
primaryKey: true | ||
nullable: false | ||
- column: | ||
name: email | ||
type: varchar(50) | ||
- column: | ||
name: lastname | ||
type: varchar(50) | ||
- column: | ||
name: firstname | ||
type: varchar(50) | ||
- changeSet: | ||
id: "2" | ||
author: default | ||
changes: | ||
- insert: | ||
tableName: customer | ||
columns: | ||
- column: | ||
name: id | ||
value: 00000000-0000-0000-0000-000000000000 | ||
- column: | ||
name: email | ||
value: [email protected] | ||
- column: | ||
name: firstname | ||
value: First Name | ||
- column: | ||
name: lastname | ||
value: Last Name |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
spring.datasource.url=jdbc:postgresql://localhost/spring-clean | ||
spring.datasource.driverClassName=org.postgresql.Driver | ||
spring.datasource.username=postgres | ||
spring.datasource.password=example |
33 changes: 33 additions & 0 deletions
33
adapters/jdbc/src/test/java/com/example/clean/adapter/DbCustomerRepositoryTest.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.example.clean.adapter; | ||
|
||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import com.example.clean.entities.Customer; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.context.annotation.PropertySource; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.UUID; | ||
|
||
@SpringBootTest(classes = {DbCustomerRepository.class}) | ||
@PropertySource("classpath:jdbc.properties") | ||
@Repository | ||
class DbCustomerRepositoryTest { | ||
//@Autowired | ||
//private JdbcTemplate jdbcTemplate; | ||
@Autowired | ||
DbCustomerRepository dbCustomerRepository; | ||
|
||
@Test | ||
void createOne() { | ||
//DbCustomerRepository dbCustomerRepository = new DbCustomerRepository(jdbcTemplate); | ||
String id = UUID.randomUUID().toString(); | ||
Customer testOne = dbCustomerRepository.create(Customer.builder().id(id).email("test-1@test-1").firstName("Test 1").lastName("Test 1").build()); | ||
assertEquals(testOne.getId(), id); | ||
} | ||
} |
Oops, something went wrong.