-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3, 4단계 - 체스] 허브(방대의) 미션 제출합니다. #529
Merged
Merged
Changes from 74 commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
e22fcb3
refactor: 스트림 미니 미션 테스트 Disable
greeng00se 8a78c7b
refactor: 보드 생성 책임을 담당하는 BoardGenerator 추가
greeng00se 4e41311
test: 체스판 검증 기능 가독성 개선
greeng00se 8659523
refactor: static 제거
greeng00se 85e3615
refactor: 사용하지 않는 메서드 제거
greeng00se 547058d
refactor: EmptyPiece의 정적 팩터리 메서드 네이밍 변경
greeng00se d878f8b
refactor: board 검증부 부정연산자 제거
greeng00se b904300
refactor: 기물 메서드명 일관성있게 변경
greeng00se 319563d
refactor: 줄바꿈 일관성있게 변경
greeng00se 5d450b8
refactor: Board를 문자열로 변경해주는 Converter 클래스 추가
greeng00se 0441806
refactor: Position 패키지 분리
greeng00se d9522c7
docs: 3단계 요구사항 정리
greeng00se 0119bd3
feat: 같은 생상인지 확인하는 메서드 추가
greeng00se de53b5d
feat: 기물의 점수를 계산하는 기능 추가
greeng00se b1b6758
refactor: 보드 상태패턴 적용
greeng00se 65739a2
feat: 왕이 잡히면 게임이 종료되는 기능 추가
greeng00se 0ad4ac9
feat: 결과를 반환하는 기능 추가
greeng00se 2e408fc
feat: 결과를 계산하는 클래스 추가
greeng00se 505143e
feat: 상태 출력하는 기능 추가
greeng00se 392be91
refactor: 커맨드 길이 검증 개선
greeng00se a87dc9d
docs: 요구사항 정리
greeng00se abceac6
refactor: 상태 클래스명 변경
greeng00se e986881
refactor: Board의 Move가 Position을 받도록 수정
greeng00se 7130470
feat: 데이터베이스 연동기능 추가
greeng00se 01fe9d9
feat: 체스게임 초기화 기능 추가
greeng00se 4e8d1c2
refactor: ChessGame에서 MoveDto 사용하도록 수정
greeng00se 87dc039
refactor: 템플릿 콜백 패턴 적용
greeng00se 2ebb089
refactor: 매개변수명 수정 및 final 추가
greeng00se 4746e46
refactor: Dao 예외 전환 적용, RowMapper 메서드 시그니처 수정
greeng00se 62ecd3a
refactor: 체스게임 내부에서 생성하도록 수정
greeng00se b476169
remove: 미니미션 코드 제거
greeng00se 6484578
refactor: 상태 패턴 적용한 부분 제거
greeng00se beb6237
refactor: RowMapper에 Functional Interface 적용
greeng00se 3f4e9c6
feat: 게임이 종료되면 상태가 출력되는 기능 추가
greeng00se 76f20e7
feat: dao 테스트 추가
greeng00se 73fe527
refactor: 데이터베이스 연결 시 ConnectionPool을 사용하도록 수정
greeng00se 0b7ba9d
refactor: Command -> ChessGameCommand로 클래스명 변경
greeng00se ace0bbc
docs: 요구사항 추가
greeng00se 0f87826
feat: MainCommand, CommandMapper 클래스 추가
greeng00se 5d4f8ff
feat: 로그인한 사용자, 선택한 방에 대한 정보를 가지고 있는 클래스 추가
greeng00se 97207dc
feat: MainController 추가
greeng00se 15536f5
style: 줄바꿈 수정
greeng00se 0b811a0
feat: 사용자 저장 및 조회기능 추가
greeng00se eb8f6b9
style: ChessDao 코드 포맷 수정
greeng00se 5f14eec
feat: UserService 추가
greeng00se 7bb6ce1
feat: 사용자 회원가입, 로그인, 로그아웃 기능 추가
greeng00se e9271bd
test: CommandTest 패키지 변경
greeng00se 535553d
refactor: Input, Output 필드로 추가
greeng00se 5315ae3
feat: 중복 로그인, 중복 회원가입시 예외 던지도록 기능 추가
greeng00se 0dc4140
refactor: 유저, 방 도메인 패키지로 이동
greeng00se c5c6b43
feat: 방 생성, 조회 기능 추가
greeng00se c9352d3
refactor: RoomDao가 Room 반환하도록 수정
greeng00se 7dc8153
refactor: UserDao가 User 반환하도록 수정
greeng00se 0dea052
feat: RoomController 추가
greeng00se a9a0f2f
feat: RoomService 추가
greeng00se 20824ad
feat: RoomController 기능 추가
greeng00se ffac2e8
refactor: UI 수정
greeng00se b9d5966
refactor: UI 수정
greeng00se 0ed5a87
feat: ThreadLocal 값 제거 로직 추가
greeng00se ecd5232
refactor: 게임 진행 기능 수정
greeng00se e025164
Merge remote-tracking branch 'origin/step2' into step2
greeng00se 1ffb77c
refactor: nameDto 제거
greeng00se ef1ce69
refactor: Action 하나만 사용하도록 수정
greeng00se 1149eae
refactor: static import 설정
greeng00se 682dd16
remove: 사용하지 않는 namedto 제거
greeng00se fb10477
docs: 요구사항 정리
greeng00se 9717a43
refactor: 방 finished 필드 제거
greeng00se 515fbd1
refactor: 방 미선택시 선택한 방 이름 none으로 보이도록 수정
greeng00se 995fd19
remove: 사용하지 않는 메서드 제거
greeng00se 89d8395
docs: 다이어그램 추가
greeng00se 41e1643
fear: GameController에서 나가면 service에 올라간 board 제거
greeng00se 172151a
refactor: 메서드 위치 변경
greeng00se ba1baf4
remove: 사용하지 않는 생성자 제거
greeng00se 8751e86
remove: 사용하지 않는 변수 제거
greeng00se 0d5f686
refactor: MainController Controller 인터페이스 구현하는 부분 제거
greeng00se a8adb91
refactor: 인터페이스명 SubController로 변경
greeng00se 1a13e1f
docs: 외래키 추가
greeng00se e971899
refactor: DAO optional 적용
greeng00se f9f953a
refactor: rowMapper 재사용 가능하도록 필드로 설정
greeng00se e24049a
refactor: 각각의 DaoStub 이너 클래스로 생성
greeng00se 602c24f
refactor: InputView 중복 제거
greeng00se 9c8b418
remove: 사용하지 않는 클래스 제거
greeng00se File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
package chess; | ||
|
||
import chess.controller.ChessGameController; | ||
import chess.domain.game.ChessGame; | ||
import chess.controller.Controller; | ||
import chess.controller.ControllerFactory; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
|
||
public class ChessGameApplication { | ||
|
||
public static void main(String[] args) { | ||
final ChessGameController chessGameController = new ChessGameController(new ChessGame()); | ||
chessGameController.run(); | ||
ExecutorService executor = Executors.newSingleThreadExecutor(); | ||
executor.execute(() -> { | ||
final Controller controller = ControllerFactory.mainController(); | ||
controller.run(); | ||
}); | ||
executor.shutdown(); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,16 @@ | ||
package chess.controller; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class CommandMapper<K, V> { | ||
private final Map<K, V> commandMapper = new HashMap<>(); | ||
|
||
public CommandMapper(final Map<K, V> commandMapper) { | ||
this.commandMapper.putAll(commandMapper); | ||
} | ||
|
||
public V getValue(final K command) { | ||
return commandMapper.get(command); | ||
} | ||
} |
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,6 @@ | ||
package chess.controller; | ||
|
||
@FunctionalInterface | ||
public interface Controller { | ||
void run(); | ||
} |
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,77 @@ | ||
package chess.controller; | ||
|
||
import chess.controller.game.GameController; | ||
import chess.controller.main.MainCommand; | ||
import chess.controller.main.MainController; | ||
import chess.controller.room.RoomController; | ||
import chess.controller.user.UserController; | ||
import chess.db.FixedConnectionPool; | ||
import chess.db.JdbcTemplate; | ||
import chess.repository.GameDao; | ||
import chess.repository.GameJdbcDao; | ||
import chess.repository.RoomDao; | ||
import chess.repository.RoomJdbcDao; | ||
import chess.repository.UserDao; | ||
import chess.repository.UserJdbcDao; | ||
import chess.service.GameService; | ||
import chess.service.RoomService; | ||
import chess.service.UserService; | ||
import chess.view.input.GameInputView; | ||
import chess.view.input.MainInputView; | ||
import chess.view.input.RoomInputView; | ||
import chess.view.input.UserInputView; | ||
import chess.view.output.GameOutputView; | ||
import chess.view.output.MainOutputView; | ||
import chess.view.output.RoomOutputView; | ||
import chess.view.output.UserOutputView; | ||
import java.util.Map; | ||
import java.util.Scanner; | ||
|
||
public class ControllerFactory { | ||
private static final Controller INSTANCE; | ||
private static final Scanner SCANNER = new Scanner(System.in); | ||
private static final JdbcTemplate JDBC_TEMPLATE = new JdbcTemplate(FixedConnectionPool.getInstance()); | ||
|
||
static { | ||
final CommandMapper<MainCommand, Controller> mainCommandMapper = new CommandMapper<>(Map.of( | ||
MainCommand.USER, userController(), | ||
MainCommand.ROOM, roomController(), | ||
MainCommand.START, gameController(), | ||
MainCommand.END, empty() | ||
)); | ||
INSTANCE = new MainController(new MainInputView(SCANNER), new MainOutputView(), mainCommandMapper); | ||
} | ||
|
||
private static Controller userController() { | ||
return new UserController(new UserInputView(SCANNER), new UserOutputView(), new UserService(userDao())); | ||
} | ||
|
||
private static UserDao userDao() { | ||
return new UserJdbcDao(JDBC_TEMPLATE); | ||
} | ||
|
||
private static Controller roomController() { | ||
return new RoomController(new RoomInputView(SCANNER), new RoomOutputView(), new RoomService(roomDao())); | ||
} | ||
|
||
private static RoomDao roomDao() { | ||
return new RoomJdbcDao(JDBC_TEMPLATE); | ||
} | ||
|
||
private static Controller gameController() { | ||
return new GameController(new GameInputView(SCANNER), new GameOutputView(), new GameService(gameDao())); | ||
} | ||
|
||
private static GameDao gameDao() { | ||
return new GameJdbcDao(JDBC_TEMPLATE); | ||
} | ||
|
||
private static Controller empty() { | ||
return () -> { | ||
}; | ||
} | ||
|
||
public static Controller mainController() { | ||
return INSTANCE; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리팩토링 시 README 도 계속 관리해주시는군요 👍 👍 👍