Skip to content
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

karrot-0017: postgis, jts demo #34 #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

karrot-0017: postgis, jts demo #34 #35

wants to merge 1 commit into from

Conversation

tae0y
Copy link
Contributor

@tae0y tae0y commented Jun 5, 2023

postgis, jts demo 공유를 위한 PR

  • maven pom profile을 dev, test-docker, test-h2mem으로 나눔
  • 각각의 설정파일은 main/resources/{profile_name}에 위치해 있음

주요내용

  • PolygonPoint는 JTS라이브러리를 사용해야하고, 객체 생성은 팩터리 메서드로 해야함
  • JTS 내부에 hibernate core가 들어있어서 다른 의존성과 충돌남(버전을 동일한걸로 맞춰줌)
  • Repository에서 @Lom 어노테이션 사용, 그외 컨버터 등은 최신 JTS에서는 불필요함
  • applicatoin.properties에서 dialect에 주의
  • testcontainer를 사용하면 편하긴한데, 사용해본 결과 최종 '비추천'
    • testcontainer는 구동시마다 새로운 이름으로 컨테이너를 생성하는데, 맥북에서 메모리 부하 및 발열 아주 심함..
    • 테스트전후로 start(), stop() 메서드를 꼭 포함할 것, stop() 메서드를 호출하지 않으면 테스트횟수만큼 컨테이너 생성/구동
    • maven 명령어와 엮어서 자동으로 docker를 띄우고 끄는 방법이 있으면 좋겠음

테스트방법

  • maven 프로필을 원하는 것으로 선택후, 해당되는 Junit 테스트 실행
  • test-docker > test.com.karrot.domain.demo_postgis_docker
  • test-h3meme > test.com.karrot.domain.demo_postgis_h2mem

배운 점

  • mockito를 사용하면 service와 repository를 완전히 격리된 상태에서 테스트할 수 있어 오류원인을 찾는 데 효과적임.
  • h2 dialect가 실제 db 케이스를 모두 커버하지는 못한다, @Lom 오류는 h2말고 도커 테스트에서만 발생했음.
  • 의존성... 의존성...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant