Skip to content

Commit 065e943

Browse files
authored
Merge pull request #149 from jaewoo9797/part1-백재우-sprint3
[백재우] sprint3
2 parents f522cff + bf4d325 commit 065e943

File tree

189 files changed

+3206
-3635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+3206
-3635
lines changed

.github/workflows/sprint-mission1-pr-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: sprint mission 1 PR Test
33
on:
44
push:
55
branches:
6-
- 'part1-백재우-sprint1'
6+
- '*'
77
pull_request:
88
branches:
99
- 'part1-백재우'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/gradlew text eol=lf
2+
*.bat text eol=crlf
3+
*.jar binary
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1+
HELP.md
12
.gradle
23
build/
34
!gradle/wrapper/gradle-wrapper.jar
45
!**/src/main/**/build/
56
!**/src/test/**/build/
67

7-
### IntelliJ IDEA ###
8-
.idea/modules.xml
9-
.idea/jarRepositories.xml
10-
.idea/compiler.xml
11-
.idea/libraries/
12-
*.iws
13-
*.iml
14-
*.ipr
15-
out/
16-
!**/src/main/**/out/
17-
!**/src/test/**/out/
18-
19-
### Eclipse ###
8+
### STS ###
209
.apt_generated
2110
.classpath
2211
.factorypath
@@ -28,6 +17,15 @@ bin/
2817
!**/src/main/**/bin/
2918
!**/src/test/**/bin/
3019

20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
out/
26+
!**/src/main/**/out/
27+
!**/src/test/**/out/
28+
3129
### NetBeans ###
3230
/nbproject/private/
3331
/nbbuild/
@@ -37,11 +35,3 @@ bin/
3735

3836
### VS Code ###
3937
.vscode/
40-
41-
### Mac OS ###
42-
.DS_Store
43-
44-
45-
/build
46-
/build/test-results/
47-
/build/reports/
Original file line numberDiff line numberDiff line change
@@ -1,93 +0,0 @@
1-
간단하게 얼른 하고 끝내버리자.
2-
1. 서비스 구현체를 구현하라. -> 기존 유저 서비스의 구현
3-
4-
## 로직 생각해보기
5-
객체 직렬화를 사용해서 할 경우, 바이너리로 저장된다. 수정을 하고 싶은 경우 특정 부분만 삭제하거나, 수정하는 것이 어렵다
6-
=> 모든 저장 내용을 읽어들이고 파일을 새롭게 쓰는 방법이 쉬운 방법이다.
7-
8-
성능적으로 보면, 매우 안좋다고 볼 수 있다. 만약 파일에 저장된 데이터가 매우 많을 경우를 생각하면 읽고 새롭게 쓰고 하면 성능저하가 당연하다.
9-
10-
데이터가 많을 경우 데이터베이스를 이용하는 것이 좋다.
11-
12-
요구사항
13-
기본 요구사항
14-
File IO를 통한 데이터 영속화
15-
- [ ] 다음의 조건을 만족하는 서비스 인터페이스의 구현체를 작성하세요.
16-
17-
- [ ] 클래스 패키지명: com.sprint.mission.discodeit.service.file
18-
19-
- [ ] 클래스 네이밍 규칙: File[인터페이스 이름]
20-
21-
- [ ] JCF 대신 FileIO와 객체 직렬화를 활용해 메소드를 구현하세요.
22-
23-
객체 직렬화/역직렬화 가이드
24-
25-
- [ ] Application에서 서비스 구현체를 File*Service로 바꾸어 테스트해보세요.
26-
27-
서비스 구현체 분석
28-
- [ ] JCF*Service 구현체와 File*Service 구현체를 비교하여 공통점과 차이점을 발견해보세요.
29-
- [ ] "비즈니스 로직"과 관련된 코드를 식별해보세요.
30-
- [ ] "저장 로직"과 관련된 코드를 식별해보세요.
31-
레포지토리 설계 및 구현
32-
- [ ] "저장 로직"과 관련된 기능을 도메인 모델 별 인터페이스로 선언하세요.
33-
- [ ] 인터페이스 패키지명: com.sprint.mission.discodeit.repository
34-
- [ ] 인터페이스 네이밍 규칙: [도메인 모델 이름]Repository
35-
- [ ] 다음의 조건을 만족하는 레포지토리 인터페이스의 구현체를 작성하세요.
36-
- [ ] 클래스 패키지명: com.sprint.mission.discodeit.repository.jcf
37-
- [ ] 클래스 네이밍 규칙: JCF[인터페이스 이름]
38-
- [ ] 기존에 구현한 JCF*Service 구현체의 "저장 로직"과 관련된 코드를 참고하여 구현하세요.
39-
- [ ] 다음의 조건을 만족하는 레포지토리 인터페이스의 구현체를 작성하세요.
40-
- [ ] 클래스 패키지명: com.sprint.mission.discodeit.repository.file
41-
- [ ] 클래스 네이밍 규칙: File[인터페이스 이름]
42-
- [ ] 기존에 구현한 File*Service 구현체의 "저장 로직"과 관련된 코드를 참고하여 구현하세요.
43-
심화 요구 사항
44-
관심사 분리를 통한 레이어 간 의존성 주입
45-
- [ ] 다음의 조건을 만족하는 서비스 인터페이스의 구현체를 작성하세요.
46-
- [ ] 클래스 패키지명: com.sprint.mission.discodeit.service.basic
47-
- [ ] 클래스 네이밍 규칙: Basic[인터페이스 이름]
48-
- [ ] 기존에 구현한 서비스 구현체의 "비즈니스 로직"과 관련된 코드를 참고하여 구현하세요.
49-
- [ ] 필요한 Repository 인터페이스를 필드로 선언하고 생성자를 통해 초기화하세요.
50-
- [ ] "저장 로직"은 Repository 인터페이스 필드를 활용하세요. (직접 구현하지 마세요.)
51-
- [ ] Basic*Service 구현체를 활용하여 테스트해보세요.
52-
코드 템플릿
53-
54-
```java
55-
56-
57-
public class JavaApplication {
58-
static User setupUser(UserService userService) {
59-
User user = userService.create("woody", "[email protected]", "woody1234");
60-
return user;
61-
}
62-
63-
static Channel setupChannel(ChannelService channelService) {
64-
Channel channel = channelService.create(ChannelType.PUBLIC, "공지", "공지 채널입니다.");
65-
return channel;
66-
}
67-
68-
static void messageCreateTest(MessageService messageService, Channel channel, User author) {
69-
Message message = messageService.create("안녕하세요.", channel.getId(), author.getId());
70-
System.out.println("메시지 생성: " + message.getId());
71-
}
72-
73-
public static void main(String[] args) {
74-
// 서비스 초기화
75-
// TODO Basic*Service 구현체를 초기화하세요.
76-
UserService userService;
77-
ChannelService channelService;
78-
MessageService messageService;
79-
80-
// 셋업
81-
User user = setupUser(userService);
82-
Channel channel = setupChannel(channelService);
83-
// 테스트
84-
messageCreateTest(messageService, channel, user);
85-
}
86-
}
87-
```
88-
89-
- [ ] JCF*Repository 구현체를 활용하여 테스트해보세요.
90-
91-
- [ ] File*Repository 구현체를 활용하여 테스트해보세요.
92-
93-
- [ ] 이전에 작성했던 코드(JCF*Service 또는 File*Service)와 비교해 어떤 차이가 있는지 정리해보세요.
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
plugins {
22
id 'java'
3+
id 'org.springframework.boot' version '3.4.0'
4+
id 'io.spring.dependency-management' version '1.1.7'
35
}
46

57
group = 'com.sprint.mission'
6-
version = '1.0-SNAPSHOT'
8+
version = '0.0.1-SNAPSHOT'
9+
10+
java {
11+
toolchain {
12+
languageVersion = JavaLanguageVersion.of(17)
13+
}
14+
}
15+
16+
configurations {
17+
compileOnly {
18+
extendsFrom annotationProcessor
19+
}
20+
}
721

822
repositories {
923
mavenCentral()
1024
}
1125

1226
dependencies {
13-
testImplementation platform('org.junit:junit-bom:5.10.0')
14-
testImplementation 'org.junit.jupiter:junit-jupiter'
15-
16-
// https://mvnrepository.com/artifact/org.mockito/mockito-core
17-
testImplementation 'org.mockito:mockito-core:4.11.0'
18-
// https://mvnrepository.com/artifact/org.assertj/assertj-core
19-
testImplementation 'org.assertj:assertj-core:3.24.2'
27+
implementation 'org.springframework.boot:spring-boot-starter-web'
28+
// compileOnly 'org.projectlombok:lombok'
29+
// annotationProcessor 'org.projectlombok:lombok'
30+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
31+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2032

2133
// https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator
2234
implementation 'org.hibernate.validator:hibernate-validator:8.0.2.Final'
23-
// https://mvnrepository.com/artifact/org.glassfish.expressly/expressly
24-
implementation 'org.glassfish.expressly:expressly:5.0.0'
25-
// https://mvnrepository.com/artifact/com.google.guava/guava
26-
implementation 'com.google.guava:guava:33.2.1-jre'
35+
36+
// https://mvnrepository.com/artifact/org.mindrot/jbcrypt
37+
implementation 'org.mindrot:jbcrypt:0.4'
2738

2839
}
2940

30-
test {
41+
tasks.named('test') {
3142
useJUnitPlatform()
32-
}
43+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#Tue Jan 07 00:58:32 KST 2025
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

codeit-bootcamp-spring/1-sprint-mission/gradlew

+31-13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +82,12 @@ do
8082
esac
8183
done
8284

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
85+
# This is normally unused
86+
# shellcheck disable=SC2034
8687
APP_BASE_NAME=${0##*/}
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
88+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90+
' "$PWD" ) || exit
9091

9192
# Use the maximum available, or set MAX_FD != -1 to use that value.
9293
MAX_FD=maximum
@@ -133,22 +134,29 @@ location of your Java installation."
133134
fi
134135
else
135136
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137+
if ! command -v java >/dev/null 2>&1
138+
then
139+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137140
138141
Please set the JAVA_HOME variable in your environment to match the
139142
location of your Java installation."
143+
fi
140144
fi
141145

142146
# Increase the maximum file descriptors if we can.
143147
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144148
case $MAX_FD in #(
145149
max*)
150+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151+
# shellcheck disable=SC2039,SC3045
146152
MAX_FD=$( ulimit -H -n ) ||
147153
warn "Could not query maximum file descriptor limit"
148154
esac
149155
case $MAX_FD in #(
150156
'' | soft) :;; #(
151157
*)
158+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159+
# shellcheck disable=SC2039,SC3045
152160
ulimit -n "$MAX_FD" ||
153161
warn "Could not set maximum file descriptor limit to $MAX_FD"
154162
esac
@@ -193,18 +201,28 @@ if "$cygwin" || "$msys" ; then
193201
done
194202
fi
195203

196-
# Collect all arguments for the java command;
197-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198-
# shell script including quotes and variable substitutions, so put them in
199-
# double quotes to make sure that they get re-expanded; and
200-
# * put everything else in single quotes, so that it's not re-expanded.
204+
205+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207+
208+
# Collect all arguments for the java command:
209+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210+
# and any embedded shellness will be escaped.
211+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212+
# treated as '${Hostname}' itself on the command line.
201213

202214
set -- \
203215
"-Dorg.gradle.appname=$APP_BASE_NAME" \
204216
-classpath "$CLASSPATH" \
205217
org.gradle.wrapper.GradleWrapperMain \
206218
"$@"
207219

220+
# Stop when "xargs" is not available.
221+
if ! command -v xargs >/dev/null 2>&1
222+
then
223+
die "xargs is not available"
224+
fi
225+
208226
# Use "xargs" to parse quoted args.
209227
#
210228
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

0 commit comments

Comments
 (0)