diff --git a/.github/ISSUE_TEMPLATE/amendment_request.yml b/.github/ISSUE_TEMPLATE/amendment_request.yml deleted file mode 100644 index de9c4ec..0000000 --- a/.github/ISSUE_TEMPLATE/amendment_request.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 개발가이드 수정 요청 Requesting changes to the development guide -description: 개발가이드 수정 요청하는 템플릿입니다. Template for requesting changes to the dev guide. -title: "[Guide]: " -labels: ["guide"] -assignees: - - yongfire38 -body: - - type: markdown - attributes: - value: | - 시간을 내어 개발가이드 수정 요청을 작성해 주셔서 감사합니다. Thank you for taking the time to fill out a DevGuide correction request. (공유하고 싶은 기술문서나 노하우는 github wiki에 남겨 주세요. If you have any documentation or know-how you'd like to share, please leave it on our github wiki.) - - type: input - id: url - attributes: - label: 개발가이드 URL Dev Guide URL - description: 수정해야할 개발가이드 URL을 적어 주세요. Please write down the dev guide URL that needs to be modified. - placeholder: Example) https://www.egovframe.go.kr/wiki/doku.php?id=egovframework:rte4.1:fdl:aop:aspectj - validations: - required: true - - type: textarea - id: where-to-amend - attributes: - label: 수정 대상 내용 What to fix - description: 수정해야할 대상 내용을 기입해 주세요. Fill in what you need to fix. - placeholder: 수정해야할 대상은 다음과 같습니다. Here's what you'll need to modify - validations: - required: true - - type: textarea - id: amendment - attributes: - label: 수정 문구 Corrective Wording - description: 어떻게 수정되어야 하는지 적어주세요. Please write down how it should be fixed. - placeholder: 다음과 같이 수정되어야 합니다. It should be modified as follows - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 6815026..8a8967d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -3,7 +3,7 @@ description: 오류 내용을 이슈로 등록하는 템플릿입니다. Templat title: "[Bug]: " labels: ["bug", "triage"] assignees: - - yongfire38 + - rukegithub body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index d26f66a..b1323f1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,9 +1,9 @@ -name: 기능 요구 및 의견 Feature Request -description: 기능 요구나 기타 의견을 이슈로 등록하는 템플릿입니다. Suggest an idea for improving eGovFrame. +name: 기능 요구 Feature Request +description: 기능 요구를 이슈로 등록하는 템플릿입니다. Suggest a new feature for improving eGovFrame. title: "[기능요구(Feature)]: " labels: ["feature"] assignees: - - yongfire38 + - rukegithub body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/improvement_plan.yml b/.github/ISSUE_TEMPLATE/improvement_plan.yml new file mode 100644 index 0000000..c0e796b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/improvement_plan.yml @@ -0,0 +1,55 @@ +name: 발전 방안 제안 Improvement Plan +description: 발전 방안을 이슈로 등록하는 템플릿입니다. Suggest a new plan for improving eGovFrame. +title: "[발전 방안 제안(Improvement Plan)]: " +labels: ["Improvement"] +assignees: + - yongfire38 +body: + - type: markdown + attributes: + value: | + 시간을 내어 의견을 작성해 주셔서 감사합니다. Thank you for taking the time to fill out a request. + - type: input + id: idea-name + attributes: + label: 아이디어명 Idea Name + validations: + required: true + - type: textarea + id: idea-summary + attributes: + label: 아이디어 요약 Idea Summary + description: 과제 내용을 300자 이내로 간결하게 요약 및 정의해 주세요 Please summarize and define your content in 300 characters or less + placeholder: 예) 게시판 첨부기능 추가 Example) Adding a bulletin board attachment + validations: + required: true + - type: textarea + id: suggestion-background + attributes: + label: 제안배경 Suggestion Background + description: 아이디어를 제안하게 된 배경 및 필요성을 기술해 주세요. Please describe the background and need for the idea. + placeholder: 아이디어를 제안하게 된 배경은 다음과 같습니다. The background to suggesting the idea is as follows. + validations: + required: true + - type: textarea + id: expectations + attributes: + label: 기대효과 Expectations + description: 아이디어의 실현 가능성과 예상되는 기대효과를 제시하여 주세요. Please describe the expected impact and outcome of the idea. + placeholder: 해당 아이디어의 기대효과는 다음과 같습니다. Here are the expected effects of this idea. + validations: + required: false + - type: textarea + id: free-writing + attributes: + label: 자유기술 Free Writing + description: 추가 기재하고 싶은 항목 및 내용을 자유롭게 기재하여 주세요. Please feel free to add anything else you'd like to include. + validations: + required: false + - type: textarea + id: reference + attributes: + label: 참고문헌 Reference + description: 참고문헌이 있는 경우 작성하여 주세요. If you have references, please include them. + validations: + required: false diff --git a/DATABASE/db/hsqldb-1.8.0.10.jar b/DATABASE/db/hsqldb-1.8.0.10.jar new file mode 100644 index 0000000..e010269 Binary files /dev/null and b/DATABASE/db/hsqldb-1.8.0.10.jar differ diff --git a/DATABASE/db/hsqldb-2.7.2-jdk8.jar b/DATABASE/db/hsqldb-2.7.2-jdk8.jar deleted file mode 100644 index f2ef7fb..0000000 Binary files a/DATABASE/db/hsqldb-2.7.2-jdk8.jar and /dev/null differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c9d11a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +######################################################### +# 목적 : web-sample-1.0.0.war를 tomcat으로 구동하는 도커 이미지 생성 +# 실행방법 : 프로젝트 루트디렉토리에서(Dockerfile 경로) 아래 명령어 실행 +# (명령어) docker build . -t egovframe-web-sample:1.0.0 +######################################################### + +# tomcat base image설정 (8.5-jre8) +FROM tomcat:8.5-jre8 +COPY ./target/web-example-1.0.0.war /usr/local/tomcat/webapps/app.war +# tomcat의 web서버 포트설정 +EXPOSE 8080 +# 컨테이너 시작 시 tomcat이 구동되도록 해당 명령을 실행 +ENTRYPOINT ["catalina.sh","run"] \ No newline at end of file diff --git a/k8s/README.md b/k8s/README.md new file mode 100644 index 0000000..f1844db --- /dev/null +++ b/k8s/README.md @@ -0,0 +1,44 @@ +## K-Pass(Kubernetes) 배포 설정 +- web-sample 프로젝트를 kubernetes 환경에 배포하기 위한 설정파일 +- 로컬PC에 minikube가 구성된 환경을 가정 + +--- +### minikube 내 도커 이미지 로드 +- 대상 이미지 --> egovframe-web-sample:1.0.0 + - 대상 이미지 확인 명령어 ``` docker image ls ``` +- minikube 내 이미지 로드 + - ``` minikube image load egovframe-web-sample:1.0.0 ``` + +### deployment.yaml +- web-sample 이미지(egovframe-web-sample:1.0.0)를 pod로 배포하기 위한 설정파일 +- 위에서 로드한 이미지를 이용 + +### service.yaml +- web-sample pod에 연결하기위한 kubernetes(minikube)의 IP/PORT 설정 +- nodePort(30000)을 web-sample 서비스에 이용 + +### minikube IP 확인 +- 로컬에 구성된 kubernetes의 IP 확인 + - ```kubectl get nodes -o wide``` + - INTERNAL-IP 확인(예, 192.168.49.2) + +### web-sample 배포 (pod 생성) +- deployment.yaml 파일의 경로에서(./k8s) 다음 명령어 실행 + - ```kubectl apply -f deployment.yaml``` +- 확인 : ```kubectl get pod``` + +### 서비스 구성 +- service.yaml 파일의 경로에서(./k8s) 다음 명령어 실행 + - ```kubectl apply -f service.yaml``` +- 확인 : ```kubectl get svc``` +- 전체 확인 : ```kubectl get all``` + +### 웹서비스 접속 +- (위의 minikube IP 확인시 192.168.49.2 인 경우) + - http://192.168.49.2:30000/app/ 접속 + +### 참고사항 +- Apple Silicon Mac에서는 minikube + docker driver 이용 시 NodePort로 연결이 안되는 현상 발생 + - minikube에서 제공하는 명령어를 통해서 로컬 tunnel을 구성 + - ```minikube service egovframe-web-sample``` + - 기타 port-forwarding을 구성하는 방법 등 diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml new file mode 100644 index 0000000..7edd73d --- /dev/null +++ b/k8s/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: egovframe-web-sample + labels: + app: egovframe-web-sample +spec: + selector: + matchLabels: + app: egovframe-web-sample + template: + metadata: + labels: + app: egovframe-web-sample + spec: + containers: + - name: egovframe-web-sample + image: egovframe-web-sample:1.0.0 + ports: + - containerPort: 8080 + + \ No newline at end of file diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 0000000..c9b4f11 --- /dev/null +++ b/k8s/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: egovframe-web-sample +spec: + selector: + app: egovframe-web-sample + ports: + - port: 8080 + targetPort: 8080 + nodePort: 30000 + type: NodePort + \ No newline at end of file diff --git a/pom-core.xml b/pom-core.xml index 48d0e07..3153fc9 100644 --- a/pom-core.xml +++ b/pom-core.xml @@ -1,7 +1,7 @@ - 4.0.0 + 4.0.0 ###GROUP_ID### ###ARTIFACT_ID### war @@ -17,8 +17,8 @@ - 5.3.27 - 4.2.0 + 5.3.37 + 4.3.0 @@ -42,6 +42,11 @@ false + + projectRepository + Project Repository + file://${project.basedir}/src/main/webapp/WEB-INF/lib + @@ -97,45 +102,10 @@ org.hsqldb hsqldb - 2.7.2 + 2.7.3 jdk8 - - - org.eclipse yasson @@ -144,9 +114,37 @@ org.glassfish javax.json - 1.1.3 + 1.1.4 + + + org.junit.jupiter + junit-jupiter-api + 5.11.0 + test + + + + org.projectlombok + lombok + 1.18.34 + provided + + + + org.seleniumhq.selenium + selenium-java + 4.13.0 + test + + + + org.springframework + spring-test + ${spring.maven.artifact.version} + test + @@ -155,24 +153,10 @@ ${artifactId}-${version} - - org.codehaus.cargo - cargo-maven3-plugin - 1.10.7 - - - tomcat8x - embedded - - - - - - org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.13.0 1.8 1.8 @@ -182,141 +166,42 @@ org.apache.maven.plugins maven-war-plugin - 3.3.2 + 3.4.0 false - - org.codehaus.mojo - hibernate3-maven-plugin - 3.0 - - - - hbm2ddl - annotationconfiguration - - - - - - org.hsqldb - hsqldb - 2.7.2 - - - - - - org.codehaus.mojo - emma-maven-plugin - 1.0-alpha-3 - org.apache.maven.plugins maven-pmd-plugin - 3.21.0 + 3.23.0 - + org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + 3.3.0 - true - once - xml - - **/Abstract*.java - **/*Suite.java - - + **/*Test.java + methods + 2 + + propertyValue + - - org.codehaus.mojo - emma-maven-plugin - true - org.apache.maven.plugins maven-javadoc-plugin - 3.5.0 + 3.7.0 - - ${basedir}/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.4.4 - - - sunlink - - javadoc - - true - - - https://docs.oracle.com/javase/8/docs/api/ - - - - - - - - org.codehaus.mojo - emma-maven-plugin - true - - - org.codehaus.mojo - surefire-report-maven-plugin - true - - - - report-only - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - 128m - 512m - ${encoding} - ${encoding} - ${encoding} - - - - - org.apache.maven.plugins - maven-jxr-plugin - - ${encoding} - ${encoding} - true - apidocs - - - - - diff --git a/pom-web.xml b/pom-web.xml index 48d0e07..3153fc9 100644 --- a/pom-web.xml +++ b/pom-web.xml @@ -1,7 +1,7 @@ - 4.0.0 + 4.0.0 ###GROUP_ID### ###ARTIFACT_ID### war @@ -17,8 +17,8 @@ - 5.3.27 - 4.2.0 + 5.3.37 + 4.3.0 @@ -42,6 +42,11 @@ false + + projectRepository + Project Repository + file://${project.basedir}/src/main/webapp/WEB-INF/lib + @@ -97,45 +102,10 @@ org.hsqldb hsqldb - 2.7.2 + 2.7.3 jdk8 - - - org.eclipse yasson @@ -144,9 +114,37 @@ org.glassfish javax.json - 1.1.3 + 1.1.4 + + + org.junit.jupiter + junit-jupiter-api + 5.11.0 + test + + + + org.projectlombok + lombok + 1.18.34 + provided + + + + org.seleniumhq.selenium + selenium-java + 4.13.0 + test + + + + org.springframework + spring-test + ${spring.maven.artifact.version} + test + @@ -155,24 +153,10 @@ ${artifactId}-${version} - - org.codehaus.cargo - cargo-maven3-plugin - 1.10.7 - - - tomcat8x - embedded - - - - - - org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.13.0 1.8 1.8 @@ -182,141 +166,42 @@ org.apache.maven.plugins maven-war-plugin - 3.3.2 + 3.4.0 false - - org.codehaus.mojo - hibernate3-maven-plugin - 3.0 - - - - hbm2ddl - annotationconfiguration - - - - - - org.hsqldb - hsqldb - 2.7.2 - - - - - - org.codehaus.mojo - emma-maven-plugin - 1.0-alpha-3 - org.apache.maven.plugins maven-pmd-plugin - 3.21.0 + 3.23.0 - + org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + 3.3.0 - true - once - xml - - **/Abstract*.java - **/*Suite.java - - + **/*Test.java + methods + 2 + + propertyValue + - - org.codehaus.mojo - emma-maven-plugin - true - org.apache.maven.plugins maven-javadoc-plugin - 3.5.0 + 3.7.0 - - ${basedir}/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.4.4 - - - sunlink - - javadoc - - true - - - https://docs.oracle.com/javase/8/docs/api/ - - - - - - - - org.codehaus.mojo - emma-maven-plugin - true - - - org.codehaus.mojo - surefire-report-maven-plugin - true - - - - report-only - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - 128m - 512m - ${encoding} - ${encoding} - ${encoding} - - - - - org.apache.maven.plugins - maven-jxr-plugin - - ${encoding} - ${encoding} - true - apidocs - - - - - diff --git a/pom.xml b/pom.xml index 97abb9e..ab57f91 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,13 @@ - 4.0.0 - egov + 4.0.0 + egovframework web-example war 1.0.0 + egovframework + http://egovframe.go.kr @@ -15,8 +17,8 @@ - 5.3.27 - 4.2.0 + 5.3.37 + 4.3.0 @@ -40,6 +42,11 @@ false + + projectRepository + Project Repository + file://${project.basedir}/src/main/webapp/WEB-INF/lib + @@ -95,45 +102,10 @@ org.hsqldb hsqldb - 2.7.2 + 2.7.3 jdk8 - - - org.eclipse yasson @@ -142,9 +114,37 @@ org.glassfish javax.json - 1.1.3 + 1.1.4 + + + org.junit.jupiter + junit-jupiter-api + 5.11.0 + test + + + + org.projectlombok + lombok + 1.18.34 + provided + + + + org.seleniumhq.selenium + selenium-java + 4.13.0 + test + + + + org.springframework + spring-test + ${spring.maven.artifact.version} + test + @@ -153,24 +153,10 @@ ${artifactId}-${version} - - org.codehaus.cargo - cargo-maven3-plugin - 1.10.7 - - - tomcat8x - embedded - - - - - - org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.13.0 1.8 1.8 @@ -180,141 +166,42 @@ org.apache.maven.plugins maven-war-plugin - 3.3.2 + 3.4.0 false - - org.codehaus.mojo - hibernate3-maven-plugin - 3.0 - - - - hbm2ddl - annotationconfiguration - - - - - - org.hsqldb - hsqldb - 2.7.2 - - - - - - org.codehaus.mojo - emma-maven-plugin - 1.0-alpha-3 - org.apache.maven.plugins maven-pmd-plugin - 3.21.0 + 3.23.0 - + org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + 3.3.0 - true - once - xml - - **/Abstract*.java - **/*Suite.java - - + **/*Test.java + methods + 2 + + propertyValue + - - org.codehaus.mojo - emma-maven-plugin - true - org.apache.maven.plugins maven-javadoc-plugin - 3.5.0 + 3.7.0 - - ${basedir}/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.4.4 - - - sunlink - - javadoc - - true - - - https://docs.oracle.com/javase/8/docs/api/ - - - - - - - - org.codehaus.mojo - emma-maven-plugin - true - - - org.codehaus.mojo - surefire-report-maven-plugin - true - - - - report-only - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - 128m - 512m - ${encoding} - ${encoding} - ${encoding} - - - - - org.apache.maven.plugins - maven-jxr-plugin - - ${encoding} - ${encoding} - true - apidocs - - - - - diff --git a/src/main/java/egovframework/example/cmmn/web/EgovBindingInitializer.java b/src/main/java/egovframework/example/cmmn/web/EgovBindingInitializer.java index 233541b..1efc4f0 100644 --- a/src/main/java/egovframework/example/cmmn/web/EgovBindingInitializer.java +++ b/src/main/java/egovframework/example/cmmn/web/EgovBindingInitializer.java @@ -23,7 +23,6 @@ import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.support.WebBindingInitializer; -import org.springframework.web.context.request.WebRequest; /** * @Class Name : EgovBindingInitializer.java diff --git a/src/main/java/egovframework/example/sample/service/impl/EgovSampleServiceImpl.java b/src/main/java/egovframework/example/sample/service/impl/EgovSampleServiceImpl.java index 8a9bac9..f8859d3 100644 --- a/src/main/java/egovframework/example/sample/service/impl/EgovSampleServiceImpl.java +++ b/src/main/java/egovframework/example/sample/service/impl/EgovSampleServiceImpl.java @@ -17,19 +17,17 @@ import java.util.List; -import egovframework.example.sample.service.EgovSampleService; -import egovframework.example.sample.service.SampleDefaultVO; -import egovframework.example.sample.service.SampleVO; - import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; - -import javax.annotation.Resource; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import egovframework.example.sample.service.EgovSampleService; +import egovframework.example.sample.service.SampleDefaultVO; +import egovframework.example.sample.service.SampleVO; +import lombok.RequiredArgsConstructor; + /** * @Class Name : EgovSampleServiceImpl.java * @Description : Sample Business Implement Class @@ -47,18 +45,17 @@ * Copyright (C) by MOPAS All right reserved. */ -@Service("sampleService") +@Service +@RequiredArgsConstructor public class EgovSampleServiceImpl extends EgovAbstractServiceImpl implements EgovSampleService { private static final Logger LOGGER = LoggerFactory.getLogger(EgovSampleServiceImpl.class); /** SampleDAO */ - @Resource(name="sampleMapper") - private SampleMapper sampleDAO; + private final SampleMapper sampleDAO; /** ID Generation */ - @Resource(name = "egovIdGnrService") - private EgovIdGnrService egovIdGnrService; + private final EgovIdGnrService egovIdGnrService; /** * 글을 등록한다. diff --git a/src/main/java/egovframework/example/sample/service/impl/SampleMapper.java b/src/main/java/egovframework/example/sample/service/impl/SampleMapper.java index fd677f5..1dee879 100644 --- a/src/main/java/egovframework/example/sample/service/impl/SampleMapper.java +++ b/src/main/java/egovframework/example/sample/service/impl/SampleMapper.java @@ -37,7 +37,7 @@ * * */ -@Mapper("sampleMapper") +@Mapper public interface SampleMapper { /** diff --git a/src/main/java/egovframework/example/sample/web/EgovSampleController.java b/src/main/java/egovframework/example/sample/web/EgovSampleController.java index 1de61e3..2ee0f84 100644 --- a/src/main/java/egovframework/example/sample/web/EgovSampleController.java +++ b/src/main/java/egovframework/example/sample/web/EgovSampleController.java @@ -17,26 +17,24 @@ import java.util.List; -import egovframework.example.sample.service.EgovSampleService; -import egovframework.example.sample.service.SampleDefaultVO; -import egovframework.example.sample.service.SampleVO; - import org.egovframe.rte.fdl.property.EgovPropertyService; import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; - -import javax.annotation.Resource; - import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.support.SessionStatus; import org.springmodules.validation.commons.DefaultBeanValidator; +import egovframework.example.sample.service.EgovSampleService; +import egovframework.example.sample.service.SampleDefaultVO; +import egovframework.example.sample.service.SampleVO; +import lombok.RequiredArgsConstructor; + /** * @Class Name : EgovSampleController.java * @Description : EgovSample Controller Class @@ -55,19 +53,17 @@ */ @Controller +@RequiredArgsConstructor public class EgovSampleController { /** EgovSampleService */ - @Resource(name = "sampleService") - private EgovSampleService sampleService; + private final EgovSampleService sampleService; /** EgovPropertyService */ - @Resource(name = "propertiesService") - protected EgovPropertyService propertiesService; + private final EgovPropertyService propertiesService; /** Validator */ - @Resource(name = "beanValidator") - protected DefaultBeanValidator beanValidator; + private final DefaultBeanValidator beanValidator; /** * 글 목록을 조회한다. (pageing) @@ -76,7 +72,7 @@ public class EgovSampleController { * @return "egovSampleList" * @exception Exception */ - @RequestMapping(value = "/egovSampleList.do") + @GetMapping("/egovSampleList.do") public String selectSampleList(@ModelAttribute("searchVO") SampleDefaultVO searchVO, ModelMap model) throws Exception { /** EgovPropertyService.sample */ @@ -110,7 +106,7 @@ public String selectSampleList(@ModelAttribute("searchVO") SampleDefaultVO searc * @return "egovSampleRegister" * @exception Exception */ - @RequestMapping(value = "/addSample.do", method = RequestMethod.GET) + @GetMapping("/addSample.do") public String addSampleView(@ModelAttribute("searchVO") SampleDefaultVO searchVO, Model model) throws Exception { model.addAttribute("sampleVO", new SampleVO()); return "sample/egovSampleRegister"; @@ -124,7 +120,7 @@ public String addSampleView(@ModelAttribute("searchVO") SampleDefaultVO searchVO * @return "forward:/egovSampleList.do" * @exception Exception */ - @RequestMapping(value = "/addSample.do", method = RequestMethod.POST) + @PostMapping("/addSample.do") public String addSample(@ModelAttribute("searchVO") SampleDefaultVO searchVO, SampleVO sampleVO, BindingResult bindingResult, Model model, SessionStatus status) throws Exception { @@ -138,7 +134,12 @@ public String addSample(@ModelAttribute("searchVO") SampleDefaultVO searchVO, Sa sampleService.insertSample(sampleVO); status.setComplete(); - return "forward:/egovSampleList.do"; + + model.addAttribute("searchCondition", sampleVO.getSearchCondition()); + model.addAttribute("searchKeyword", sampleVO.getSearchKeyword()); + model.addAttribute("pageIndex", sampleVO.getPageIndex()); + + return "redirect:/egovSampleList.do"; } /** @@ -149,7 +150,7 @@ public String addSample(@ModelAttribute("searchVO") SampleDefaultVO searchVO, Sa * @return "egovSampleRegister" * @exception Exception */ - @RequestMapping("/updateSampleView.do") + @GetMapping("/updateSampleView.do") public String updateSampleView(@RequestParam("selectedId") String id, @ModelAttribute("searchVO") SampleDefaultVO searchVO, Model model) throws Exception { SampleVO sampleVO = new SampleVO(); sampleVO.setId(id); @@ -178,7 +179,7 @@ public SampleVO selectSample(SampleVO sampleVO, @ModelAttribute("searchVO") Samp * @return "forward:/egovSampleList.do" * @exception Exception */ - @RequestMapping("/updateSample.do") + @PostMapping("/updateSample.do") public String updateSample(@ModelAttribute("searchVO") SampleDefaultVO searchVO, SampleVO sampleVO, BindingResult bindingResult, Model model, SessionStatus status) throws Exception { @@ -191,7 +192,12 @@ public String updateSample(@ModelAttribute("searchVO") SampleDefaultVO searchVO, sampleService.updateSample(sampleVO); status.setComplete(); - return "forward:/egovSampleList.do"; + + model.addAttribute("searchCondition", sampleVO.getSearchCondition()); + model.addAttribute("searchKeyword", sampleVO.getSearchKeyword()); + model.addAttribute("pageIndex", sampleVO.getPageIndex()); + + return "redirect:/egovSampleList.do"; } /** @@ -202,11 +208,16 @@ public String updateSample(@ModelAttribute("searchVO") SampleDefaultVO searchVO, * @return "forward:/egovSampleList.do" * @exception Exception */ - @RequestMapping("/deleteSample.do") - public String deleteSample(SampleVO sampleVO, @ModelAttribute("searchVO") SampleDefaultVO searchVO, SessionStatus status) throws Exception { + @PostMapping("/deleteSample.do") + public String deleteSample(SampleVO sampleVO, @ModelAttribute("searchVO") SampleDefaultVO searchVO, Model model, SessionStatus status) throws Exception { sampleService.deleteSample(sampleVO); status.setComplete(); - return "forward:/egovSampleList.do"; + + model.addAttribute("searchCondition", sampleVO.getSearchCondition()); + model.addAttribute("searchKeyword", sampleVO.getSearchKeyword()); + model.addAttribute("pageIndex", sampleVO.getPageIndex()); + + return "redirect:/egovSampleList.do"; } } diff --git a/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleList.jsp b/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleList.jsp index eefa7c4..5ecfb6b 100644 --- a/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleList.jsp +++ b/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleList.jsp @@ -58,7 +58,7 @@ - +
diff --git a/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleRegister.jsp b/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleRegister.jsp index b4f4c94..dc17a7d 100644 --- a/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleRegister.jsp +++ b/src/main/webapp/WEB-INF/jsp/egovframework/example/sample/egovSampleRegister.jsp @@ -38,6 +38,7 @@ /* 글 목록 화면 function */ function fn_egov_selectList() { document.detailForm.action = ""; + document.detailForm.method = 'get'; document.detailForm.submit(); } diff --git a/src/test/java/egovframework/example/sample/service/impl/EgovSampleServiceImplTestInsertSampleTest.java b/src/test/java/egovframework/example/sample/service/impl/EgovSampleServiceImplTestInsertSampleTest.java new file mode 100644 index 0000000..71dabdd --- /dev/null +++ b/src/test/java/egovframework/example/sample/service/impl/EgovSampleServiceImplTestInsertSampleTest.java @@ -0,0 +1,92 @@ +package egovframework.example.sample.service.impl; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.ImportResource; +import org.springframework.test.context.ContextConfiguration; + +import egovframework.example.sample.service.EgovSampleService; +import egovframework.example.sample.service.SampleVO; +import egovframework.test.EgovTestAbstractSpring; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * [게시판][EgovSampleServiceImpl.insertSample] ServiceImpl 단위 테스트 + * + * @author 이백행 + * @since 2024-09-21 + * + */ + +@ContextConfiguration(classes = { EgovSampleServiceImplTestInsertSampleTest.class, EgovTestAbstractSpring.class }) + +@Configuration + +@ImportResource({ "classpath*:egovframework/spring/context-idgen.xml", }) + +@ComponentScan(useDefaultFilters = false, basePackages = { + "egovframework.example.sample.service.impl", }, includeFilters = { + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { EgovSampleServiceImpl.class, + SampleMapper.class, }) }) + +@RequiredArgsConstructor +@Slf4j +class EgovSampleServiceImplTestInsertSampleTest extends EgovTestAbstractSpring { + + /** + * + */ + @Autowired + private EgovSampleService egovSampleService; + + @Test + void test() throws Exception { + // given + final SampleVO sampleVO = new SampleVO(); + + final LocalDateTime now = LocalDateTime.now(); + final String now2 = now.format(DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss")); + final String now3 = now.format(DateTimeFormatter.ofPattern("uuuuMMddHHmmssS")); + + sampleVO.setName("test 이백행 카테고리명 " + now); + + sampleVO.setUseYn("Y"); // 사용여부 + + sampleVO.setDescription("test 이백행 설명 " + now); + + sampleVO.setRegUser("test"); + + // when + final String resultId = egovSampleService.insertSample(sampleVO); + + // then + final SampleVO resultSampleVO = egovSampleService.selectSample(sampleVO); + + if (log.isDebugEnabled()) { + log.debug("now={}", now); + log.debug("now2={}", now2); + log.debug("now3={}", now3); + + log.debug("sampleVO={}", sampleVO); + log.debug("getId={}", sampleVO.getId()); + + log.debug("resultSampleVO={}", resultSampleVO); + log.debug("getId={}", resultSampleVO.getId()); + + log.debug("resultId={}", resultId); + } + + assertEquals(resultId, resultSampleVO.getId(), "글을 등록한다."); + } + +} \ No newline at end of file diff --git a/src/test/java/egovframework/example/sample/service/impl/SampleMapperTestInsertSampleTest.java b/src/test/java/egovframework/example/sample/service/impl/SampleMapperTestInsertSampleTest.java new file mode 100644 index 0000000..9277204 --- /dev/null +++ b/src/test/java/egovframework/example/sample/service/impl/SampleMapperTestInsertSampleTest.java @@ -0,0 +1,97 @@ +package egovframework.example.sample.service.impl; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +import org.egovframe.rte.fdl.idgnr.EgovIdGnrService; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.ImportResource; +import org.springframework.test.context.ContextConfiguration; + +import egovframework.example.sample.service.SampleVO; +import egovframework.test.EgovTestAbstractSpring; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * [게시판][SampleMapper.insertSample] DAO 단위 테스트 + * + * @author 이백행 + * @since 2024-09-21 + * + */ + +@ContextConfiguration(classes = { SampleMapperTestInsertSampleTest.class, EgovTestAbstractSpring.class }) + +@Configuration + +@ImportResource({ "classpath*:egovframework/spring/context-idgen.xml", }) + +@ComponentScan(useDefaultFilters = false, basePackages = { + "egovframework.example.sample.service.impl", }, includeFilters = { + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { SampleMapper.class, }) }) + +@RequiredArgsConstructor +@Slf4j +class SampleMapperTestInsertSampleTest extends EgovTestAbstractSpring { + + /** + * sample에 관한 데이터처리 매퍼 클래스 + */ + @Autowired + private SampleMapper sampleMapper; + + /** + * + */ + @Autowired + private EgovIdGnrService egovIdGnrService; + + @Test + void test() throws Exception { + // given + final SampleVO sampleVO = new SampleVO(); + + sampleVO.setId(egovIdGnrService.getNextStringId()); + + final LocalDateTime now = LocalDateTime.now(); + final String now2 = now.format(DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss")); + final String now3 = now.format(DateTimeFormatter.ofPattern("uuuuMMddHHmmssS")); + + sampleVO.setName("test 이백행 카테고리명 " + now); + + sampleVO.setUseYn("Y"); // 사용여부 + + sampleVO.setDescription("test 이백행 설명 " + now); + + sampleVO.setRegUser("test"); + + // when + sampleMapper.insertSample(sampleVO); + + // then + final SampleVO resultSampleVO = sampleMapper.selectSample(sampleVO); + + if (log.isDebugEnabled()) { + log.debug("now={}", now); + log.debug("now2={}", now2); + log.debug("now3={}", now3); + + log.debug("sampleVO={}", sampleVO); + log.debug("getId={}", sampleVO.getId()); + + log.debug("resultSampleVO={}", resultSampleVO); + log.debug("getId={}", resultSampleVO.getId()); + } + + assertEquals(sampleVO.getId(), resultSampleVO.getId(), "글을 등록한다."); + } + +} \ No newline at end of file diff --git a/src/test/java/egovframework/example/sample/web/EgovSampleControllerTestAddSampleTest.java b/src/test/java/egovframework/example/sample/web/EgovSampleControllerTestAddSampleTest.java new file mode 100644 index 0000000..fc83ebe --- /dev/null +++ b/src/test/java/egovframework/example/sample/web/EgovSampleControllerTestAddSampleTest.java @@ -0,0 +1,72 @@ +package egovframework.example.sample.web; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.time.LocalDateTime; + +import org.junit.jupiter.api.Test; + +import egovframework.example.sample.service.SampleVO; +import egovframework.test.EgovTestAbstractSpringMvc; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * [게시판][EgovSampleController.addSample] Controller 단위 테스트 + * + * @author 이백행 + * @since 2024-09-21 + * + */ + +@RequiredArgsConstructor +@Slf4j +class EgovSampleControllerTestAddSampleTest extends EgovTestAbstractSpringMvc { + + @Test + void test() throws Exception { + // given + final SampleVO sampleVO = new SampleVO(); + + final LocalDateTime now = LocalDateTime.now(); + + sampleVO.setName("test 이백행 카테고리명 " + now); + + sampleVO.setUseYn("Y"); // 사용여부 + + sampleVO.setDescription("test 이백행 설명 " + now); + + sampleVO.setRegUser("test"); + + // when + mockMvc.perform( + + post("/addSample.do") + + .param("name", sampleVO.getName()) + + .param("description", sampleVO.getDescription()) + + .param("regUser", sampleVO.getRegUser()) + + ) + + .andDo(print()) + +// .andExpect(status().isOk()) + .andExpect(status().isFound()) + + ; + + // then + if (log.isDebugEnabled()) { + log.debug("test"); + } + + assertEquals("", "", "글을 등록한다."); + } + +} \ No newline at end of file diff --git a/src/test/java/egovframework/example/sample/web/TestEgovSampleControllerTestSelenium.java b/src/test/java/egovframework/example/sample/web/TestEgovSampleControllerTestSelenium.java new file mode 100644 index 0000000..f476e61 --- /dev/null +++ b/src/test/java/egovframework/example/sample/web/TestEgovSampleControllerTestSelenium.java @@ -0,0 +1,115 @@ +package egovframework.example.sample.web; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +import java.time.LocalDateTime; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; + +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * [게시판] 셀레늄 단위 테스트 + * + * @author 이백행 + * @since 2024-09-03 + * + */ +@Slf4j +@NoArgsConstructor +class TestEgovSampleControllerTestSelenium { + + /** + * 웹 드라이버 + */ + private WebDriver driver; + + /** + * 설정 + */ + @BeforeEach + public void setup() { + driver = new ChromeDriver(); + } + + @Test + void test() { + if (log.isDebugEnabled()) { + log.debug("[게시판] 셀레늄 단위 테스트"); + } + + // gevin + if (log.isDebugEnabled()) { + log.debug("게시판 목록 화면 이동"); + } + driver.get("http://localhost:8080/web-example"); + + final JavascriptExecutor executor = (JavascriptExecutor) driver; + + if (log.isDebugEnabled()) { + log.debug("등록 버튼 클릭"); + } + sleep(); + executor.executeScript("fn_egov_addView();"); + + if (log.isDebugEnabled()) { + log.debug("카테고리명 입력"); + } + sleep(); + final WebElement name = driver.findElement(By.id("name")); + final String now = LocalDateTime.now().toString(); + final String td3String = "test 이백행 카테고리명 " + now; + name.sendKeys(td3String); + + if (log.isDebugEnabled()) { + log.debug("사용여부 선택"); + } + sleep(); + final WebElement useYn = driver.findElement(By.id("useYn")); + useYn.sendKeys("N"); + + if (log.isDebugEnabled()) { + log.debug("설명 입력"); + } + sleep(); + final WebElement description = driver.findElement(By.id("description")); + final String td5String = "test 이백행 설명 " + now; + description.sendKeys(td5String); + + if (log.isDebugEnabled()) { + log.debug("등록자 입력"); + } + sleep(); + final WebElement regUser = driver.findElement(By.id("regUser")); + regUser.sendKeys("test 이백행 등록자 " + now); + + // when + if (log.isDebugEnabled()) { + log.debug("등록 버튼 클릭"); + } + sleep(); + executor.executeScript("fn_egov_save();"); + + // then + final WebElement td5WebElement = driver + .findElement(By.cssSelector("#table > table > tbody > tr:nth-child(2) > td:nth-child(5)")); + assertEquals(td5String, td5WebElement.getText().trim(), "게시판 등록 화면 실패"); + } + + private void sleep() { + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + fail("InterruptedException: Thread.sleep"); + } + } + +} \ No newline at end of file diff --git a/src/test/java/egovframework/test/EgovTestAbstractSpring.java b/src/test/java/egovframework/test/EgovTestAbstractSpring.java new file mode 100644 index 0000000..5d2480c --- /dev/null +++ b/src/test/java/egovframework/test/EgovTestAbstractSpring.java @@ -0,0 +1,155 @@ +package egovframework.test; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StopWatch; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * Spring 테스트 + * + * @author 이백행 + * @since 2024-09-21 + */ + +@ActiveProfiles({ "mysql", "dummy" }) +//@ActiveProfiles({ "oracle", "dummy" }) +//@ActiveProfiles({ "altibase", "dummy" }) +//@ActiveProfiles({ "tibero", "dummy" }) +//@ActiveProfiles({ "cubrid", "dummy" }) +//@ActiveProfiles({ "maria", "dummy" }) +//@ActiveProfiles({ "postgres", "dummy" }) +//@ActiveProfiles({ "goldilocks", "dummy" }) + +@ExtendWith(SpringExtension.class) +@TestMethodOrder(MethodOrderer.MethodName.class) + +@Transactional + +@Configuration + +@ImportResource({ + + // main + "classpath*:egovframework/spring/context-aspect.xml", + +// "classpath*:egovframework/spring/context-common.xml", + + "classpath*:egovframework/spring/context-datasource.xml", + +// "classpath*:egovframework/spring/context-idgen.xml", + + "classpath*:egovframework/spring/context-mapper.xml", + + "classpath*:egovframework/spring/context-properties.xml", + + "classpath*:egovframework/spring/context-transaction.xml", + +// "classpath*:egovframework/spring/context-validator.xml", + + // test + "classpath*:egovframework/spring/test-context-common.xml", + +}) + +@RequiredArgsConstructor +@Slf4j + +public class EgovTestAbstractSpring { + + /** + * BeforeClass AfterClass + */ + private static final StopWatch STOP_WATCH = new StopWatch(); + + /** + * Before After + */ + private final StopWatch stopWatch = new StopWatch(); + + /** + * beanDefinitionNames + */ + private static String[] beanDefinitionNames; + + /** + * ApplicationContext + */ + @Autowired + private ApplicationContext context; + + /** + * setUpBeforeClass + */ + @BeforeAll + static void setUpBeforeClass() { + STOP_WATCH.start(); + + log.debug("setUpBeforeClass start"); + } + + /** + * tearDownAfterClass + */ + @AfterAll + static void tearDownAfterClass() { + STOP_WATCH.stop(); + + if (log.isDebugEnabled()) { + log.debug("tearDownAfterClass stop"); + + log.debug("totalTimeMillis={}", STOP_WATCH.getTotalTimeMillis()); + log.debug("totalTimeSeconds={}", STOP_WATCH.getTotalTimeSeconds()); + } + } + + /** + * setUp + */ + @BeforeEach + void setUp() { + stopWatch.start(); + + log.debug("setUp start"); + + if (beanDefinitionNames == null) { + beanDefinitionNames = context.getBeanDefinitionNames(); + for (final String beanDefinitionName : beanDefinitionNames) { + log.debug("beanDefinitionName={}", beanDefinitionName); + } + if (log.isDebugEnabled()) { + log.debug("length={}", beanDefinitionNames.length); + } + } + } + + /** + * tearDown + */ + @AfterEach + void tearDown() { + stopWatch.stop(); + + if (log.isDebugEnabled()) { + log.debug("tearDown stop"); + + log.debug("totalTimeMillis={}", stopWatch.getTotalTimeMillis()); + log.debug("totalTimeSeconds={}", stopWatch.getTotalTimeSeconds()); + } + } + +} \ No newline at end of file diff --git a/src/test/java/egovframework/test/EgovTestAbstractSpringMvc.java b/src/test/java/egovframework/test/EgovTestAbstractSpringMvc.java new file mode 100644 index 0000000..fc4d8bb --- /dev/null +++ b/src/test/java/egovframework/test/EgovTestAbstractSpringMvc.java @@ -0,0 +1,145 @@ +package egovframework.test; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.util.StopWatch; +import org.springframework.web.context.WebApplicationContext; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * Spring MVC 테스트 + * + * @author 이백행 + * @since 2024-09-21 + */ + +@ActiveProfiles({ "mysql", "dummy" }) +//@ActiveProfiles({ "oracle", "dummy" }) +//@ActiveProfiles({ "altibase", "dummy" }) +//@ActiveProfiles({ "tibero", "dummy" }) +//@ActiveProfiles({ "cubrid", "dummy" }) +//@ActiveProfiles({ "maria", "dummy" }) +//@ActiveProfiles({ "postgres", "dummy" }) +//@ActiveProfiles({ "goldilocks", "dummy" }) + +@ExtendWith(SpringExtension.class) +@TestMethodOrder(MethodOrderer.MethodName.class) + +@WebAppConfiguration + +@ContextConfiguration({ + + "classpath*:egovframework/spring/context-*.xml", + + "file:src/main/webapp/WEB-INF/config/egovframework/springmvc/dispatcher-servlet.xml", + +}) + +@RequiredArgsConstructor +@Slf4j + +public class EgovTestAbstractSpringMvc { + + /** + * BeforeClass AfterClass + */ + private static final StopWatch STOP_WATCH = new StopWatch(); + + /** + * Before After + */ + private final StopWatch stopWatch = new StopWatch(); + + /** + * beanDefinitionNames + */ + private static String[] beanDefinitionNames; + + /** + * ApplicationContext + */ + @Autowired + private WebApplicationContext context; + + /** + * 서버 측 Spring MVC 테스트 지원을 위한 주요 진입점입니다. + */ + protected MockMvc mockMvc; + + /** + * setUpBeforeClass + */ + @BeforeAll + static void setUpBeforeClass() { + STOP_WATCH.start(); + + log.debug("setUpBeforeClass start"); + } + + /** + * tearDownAfterClass + */ + @AfterAll + static void tearDownAfterClass() { + STOP_WATCH.stop(); + + if (log.isDebugEnabled()) { + log.debug("tearDownAfterClass stop"); + + log.debug("totalTimeMillis={}", STOP_WATCH.getTotalTimeMillis()); + log.debug("totalTimeSeconds={}", STOP_WATCH.getTotalTimeSeconds()); + } + } + + /** + * setUp + */ + @BeforeEach + void setUp() { + stopWatch.start(); + + log.debug("setUp start"); + + if (beanDefinitionNames == null) { + beanDefinitionNames = context.getBeanDefinitionNames(); + for (final String beanDefinitionName : beanDefinitionNames) { + log.debug("beanDefinitionName={}", beanDefinitionName); + } + if (log.isDebugEnabled()) { + log.debug("length={}", beanDefinitionNames.length); + } + + mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); + } + } + + /** + * tearDown + */ + @AfterEach + void tearDown() { + stopWatch.stop(); + + if (log.isDebugEnabled()) { + log.debug("tearDown stop"); + + log.debug("totalTimeMillis={}", stopWatch.getTotalTimeMillis()); + log.debug("totalTimeSeconds={}", stopWatch.getTotalTimeSeconds()); + } + } + +} \ No newline at end of file diff --git a/src/test/resources/egovframework/spring/test-context-common.xml b/src/test/resources/egovframework/spring/test-context-common.xml new file mode 100644 index 0000000..ba87663 --- /dev/null +++ b/src/test/resources/egovframework/spring/test-context-common.xml @@ -0,0 +1,47 @@ + + + + + + + classpath:/egovframework/message/message-common + classpath:/org/egovframe/rte/fdl/idgnr/messages/idgnr + classpath:/org/egovframe/rte/fdl/property/messages/properties + + + + 60 + + + + + + + + + + + + + + + + + + * + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/log4j2.xml b/src/test/resources/log4j2.xml new file mode 100644 index 0000000..9a1750a --- /dev/null +++ b/src/test/resources/log4j2.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file