From 9ba4c4d202119b324043073a13b025a68429e0fd Mon Sep 17 00:00:00 2001 From: sjmjys954646 Date: Sat, 30 Sep 2023 15:50:43 +0900 Subject: [PATCH 1/4] feat : initialize --- src/main/java/com/example/demo/account/dummy.txt | 0 src/main/java/com/example/demo/mentoring/dummy.txt | 0 src/main/java/com/example/demo/watching/dummy.txt | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/java/com/example/demo/account/dummy.txt create mode 100644 src/main/java/com/example/demo/mentoring/dummy.txt create mode 100644 src/main/java/com/example/demo/watching/dummy.txt diff --git a/src/main/java/com/example/demo/account/dummy.txt b/src/main/java/com/example/demo/account/dummy.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/main/java/com/example/demo/mentoring/dummy.txt b/src/main/java/com/example/demo/mentoring/dummy.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/main/java/com/example/demo/watching/dummy.txt b/src/main/java/com/example/demo/watching/dummy.txt new file mode 100644 index 00000000..e69de29b From 21457bdfc129b329b4973a7cfeab4025be1b6808 Mon Sep 17 00:00:00 2001 From: Jin_00 Date: Mon, 2 Oct 2023 18:31:00 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat=20:=20H2,=20devtools=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 0e017214..de5a09fd 100644 --- a/build.gradle +++ b/build.gradle @@ -38,6 +38,11 @@ dependencies { testImplementation 'org.springframework.security:spring-security-test' implementation group: 'com.auth0', name: 'java-jwt', version: '4.3.0' + + implementation 'org.springframework.boot:spring-boot-devtools' + + // local, test : h2 + runtimeOnly 'com.h2database:h2' } tasks.named('test') { From c690103fba1dfd1195b12014e3fded1eafc2cc14 Mon Sep 17 00:00:00 2001 From: Jin_00 Date: Mon, 2 Oct 2023 18:32:24 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat=20:=20local,=20test=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-local.yml | 24 +++++++++++++++++++ src/main/resources/application-test.yml | 24 +++++++++++++++++++ src/main/resources/application.properties | 1 - src/main/resources/application.yml | 4 ++++ .../java/com/example/demo/AccountTest.java | 2 ++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/application-local.yml create mode 100644 src/main/resources/application-test.yml delete mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/application.yml create mode 100644 src/test/java/com/example/demo/AccountTest.java diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml new file mode 100644 index 00000000..ce3e7f53 --- /dev/null +++ b/src/main/resources/application-local.yml @@ -0,0 +1,24 @@ +server: + servlet: + encoding: + charset: utf-8 + force: true + port: 8080 +spring: + datasource: + url: jdbc:h2:mem:test;MODE=MySQL + driver-class-name: org.h2.Driver + username: sa + password: + h2: + console: + enabled: true + jpa: + hibernate: + ddl-auto: create + show-sql: true + properties: + hibernate: + format_sql: true + default_batch_fetch_size: 100 + open-in-view: false diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 00000000..ce3e7f53 --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,24 @@ +server: + servlet: + encoding: + charset: utf-8 + force: true + port: 8080 +spring: + datasource: + url: jdbc:h2:mem:test;MODE=MySQL + driver-class-name: org.h2.Driver + username: sa + password: + h2: + console: + enabled: true + jpa: + hibernate: + ddl-auto: create + show-sql: true + properties: + hibernate: + format_sql: true + default_batch_fetch_size: 100 + open-in-view: false diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 8b137891..00000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 00000000..7fd2554e --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,4 @@ +spring: + profiles: + active: + - local \ No newline at end of file diff --git a/src/test/java/com/example/demo/AccountTest.java b/src/test/java/com/example/demo/AccountTest.java new file mode 100644 index 00000000..d7921434 --- /dev/null +++ b/src/test/java/com/example/demo/AccountTest.java @@ -0,0 +1,2 @@ +package com.example.demo;public class AccountTest { +} From cc77e6ad6b32209d2b014d24e1f6f66b20e31ee1 Mon Sep 17 00:00:00 2001 From: Jin_00 Date: Mon, 2 Oct 2023 18:33:10 +0900 Subject: [PATCH 4/4] =?UTF-8?q?test=20:=20H2=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=ED=9B=84=20JPA=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/demo/AccountTest.java | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/example/demo/AccountTest.java b/src/test/java/com/example/demo/AccountTest.java index d7921434..d6030dce 100644 --- a/src/test/java/com/example/demo/AccountTest.java +++ b/src/test/java/com/example/demo/AccountTest.java @@ -1,2 +1,42 @@ -package com.example.demo;public class AccountTest { +package com.example.demo; + +import com.example.demo.account.Account; +import com.example.demo.account.AccountJPARepository; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +@SpringBootTest +@ActiveProfiles("test") +public class AccountTest { + + @Autowired + private AccountJPARepository accountJPARepository; + + // saveTest + @Test + @DisplayName("account save test") + void test() { + Account account = Account.builder() + .uid(1) + .email("anjdal64@gmail.com") + .password("asdf1234!") + .firstname("Jin") + .lastname("Seung") + .country("Korea") + .age(21) + .role(Account.Role.MENTOR) + .build(); + + // account save + accountJPARepository.save(account); + + // find + Account account1 = accountJPARepository.findById(account.getUid()).get(); + Assertions.assertThat(account.getUid()) + .isEqualTo(account1.getUid()); + } }