From ee45a94d0f8731bfbd45d160ec12e84b99574792 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Tue, 5 Nov 2024 11:01:43 -0800 Subject: [PATCH] GRAD2-2951: task is complete. GRAD2-2951: task is complete. --- .../util/EducGraduationApiConstants.java | 3 - api/src/main/resources/application.yaml | 2 - .../graduation/service/ReportServiceTest.java | 91 ------------------- api/src/test/resources/application.yaml | 2 - 4 files changed, 98 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/graduation/util/EducGraduationApiConstants.java b/api/src/main/java/ca/bc/gov/educ/api/graduation/util/EducGraduationApiConstants.java index cd95174c..6a0df1fe 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/graduation/util/EducGraduationApiConstants.java +++ b/api/src/main/java/ca/bc/gov/educ/api/graduation/util/EducGraduationApiConstants.java @@ -143,9 +143,6 @@ public class EducGraduationApiConstants { @Value("${endpoint.grad-student-graduation-api.get-special-cases.url}") private String specialCase; - @Value("${endpoint.grad-trax-api.commonschool-by-mincode.url}") - private String schoolCategoryCode; - @Value("${endpoint.grad-student-api.update-grad-status-projected}") private String saveStudentRecordProjectedRun; diff --git a/api/src/main/resources/application.yaml b/api/src/main/resources/application.yaml index 1dc830d8..8268f243 100644 --- a/api/src/main/resources/application.yaml +++ b/api/src/main/resources/application.yaml @@ -144,8 +144,6 @@ endpoint: grad-trax-api: - commonschool-by-mincode: - url: ${GRAD_TRAX_API}api/v1/trax/school/common/%s school-by-min-code: url: ${GRAD_TRAX_API}api/v2/trax/school-clob/%s district-by-min-code: diff --git a/api/src/test/java/ca/bc/gov/educ/api/graduation/service/ReportServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/graduation/service/ReportServiceTest.java index 76df5f87..0072115c 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/graduation/service/ReportServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/graduation/service/ReportServiceTest.java @@ -1616,18 +1616,8 @@ public void testReportDataByPen_witherrors3() throws Exception { gradSearchStudent.setPen(pen); gradSearchStudent.setStudentID(gradStatus.getGradStudent().getStudentID()); -// final ParameterizedTypeReference> gradSearchStudentResponseType = new ParameterizedTypeReference<>() { -// }; - -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getPenStudentApiByPenUrl(),pen))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(gradSearchStudentResponseType)).thenReturn(Mono.just(List.of(gradSearchStudent))); - when(this.restService.get(String.format(constants.getPenStudentApiByPenUrl(),pen), List.class)).thenReturn(List.of(gradSearchStudent)); - GraduationStudentRecord graduationStudentRecord = new GraduationStudentRecord(); graduationStudentRecord.setPen(pen); graduationStudentRecord.setProgramCompletionDate("2003/01"); @@ -1642,21 +1632,7 @@ public void testReportDataByPen_witherrors3() throws Exception { gradProgram.setProgramCode("2018-EN"); gradProgram.setProgramName("2018 Graduation Program"); -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getProgramNameEndpoint(),gradStatus.getGradStudent().getProgram()))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(GraduationProgramCode.class)).thenReturn(Mono.just(gradProgram)); - when(this.restService.get(String.format(constants.getProgramNameEndpoint(),gradStatus.getGradStudent().getProgram()), GraduationProgramCode.class)).thenReturn(gradProgram); - -// -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getReadGradStudentRecord(),graduationStudentRecord.getStudentID().toString()))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(GraduationStudentRecord.class)).thenReturn(Mono.just(graduationStudentRecord)); - when(this.restService.get(String.format(constants.getReadGradStudentRecord(),graduationStudentRecord.getStudentID().toString()), GraduationStudentRecord.class)).thenReturn(graduationStudentRecord); @@ -1677,15 +1653,6 @@ public void testReportDataByPen_witherrors2() throws Exception { gradSearchStudent.setPen(pen); gradSearchStudent.setStudentID(gradStatus.getGradStudent().getStudentID()); -// final ParameterizedTypeReference> gradSearchStudentResponseType = new ParameterizedTypeReference<>() { -// }; - -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getPenStudentApiByPenUrl(),pen))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(gradSearchStudentResponseType)).thenReturn(Mono.just(List.of(gradSearchStudent))); - when(this.restService.get(String.format(constants.getPenStudentApiByPenUrl(),pen), List.class)).thenReturn(List.of(gradSearchStudent)); @@ -1703,21 +1670,7 @@ public void testReportDataByPen_witherrors2() throws Exception { gradProgram.setProgramCode("2018-EN"); gradProgram.setProgramName("2018 Graduation Program"); -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getProgramNameEndpoint(),gradStatus.getGradStudent().getProgram()))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(GraduationProgramCode.class)).thenReturn(Mono.just(gradProgram)); - when(this.restService.get(String.format(constants.getProgramNameEndpoint(),gradStatus.getGradStudent().getProgram()), GraduationProgramCode.class)).thenReturn(gradProgram); - -// -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getReadGradStudentRecord(),graduationStudentRecord.getStudentID().toString()))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(Exception.class)).thenReturn(Mono.just(new Exception())); - when(this.restService.get(String.format(constants.getReadGradStudentRecord(),graduationStudentRecord.getStudentID().toString()), Exception.class)).thenReturn(new Exception()); @@ -1738,15 +1691,8 @@ public void testReportDataByPen_withErrors() throws Exception { gradSearchStudent.setPen(pen); gradSearchStudent.setStudentID(gradStatus.getGradStudent().getStudentID()); -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getPenStudentApiByPenUrl(),pen))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(Exception.class)).thenReturn(Mono.just(new Exception())); - when(this.restService.get(String.format(constants.getPenStudentApiByPenUrl(),pen), Exception.class)).thenReturn(new Exception()); - ReportData transcriptData = reportService.prepareTranscriptData(pen, true, exception); assertNull(transcriptData.getTranscript()); @@ -1764,18 +1710,8 @@ public void testTranscriptReportByPen() throws Exception { gradSearchStudent.setPen(pen); gradSearchStudent.setStudentID(gradStatus.getGradStudent().getStudentID()); - final ParameterizedTypeReference> gradSearchStudentResponseType = new ParameterizedTypeReference<>() { - }; - -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getPenStudentApiByPenUrl(),pen))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(gradSearchStudentResponseType)).thenReturn(Mono.just(List.of(gradSearchStudent))); - when(this.restService.get(String.format(constants.getPenStudentApiByPenUrl(),pen), List.class)).thenReturn(List.of(gradSearchStudent)); - GraduationStudentRecord graduationStudentRecord = new GraduationStudentRecord(); graduationStudentRecord.setPen(pen); graduationStudentRecord.setProgramCompletionDate("2003/01"); @@ -2138,27 +2074,9 @@ public void testPrepareCertificateData() throws Exception { gradProgram.setProgramCode("2018-EN"); gradProgram.setProgramName("2018 Graduation Program"); -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getProgramNameEndpoint(),gradStatus.getGradStudent().getProgram()))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(GraduationProgramCode.class)).thenReturn(Mono.just(gradProgram)); - when(this.restService.get(String.format(constants.getProgramNameEndpoint(),gradStatus.getGradStudent().getProgram()), GraduationProgramCode.class)).thenReturn(gradProgram); - - -// when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); -// when(this.requestHeadersUriMock.uri(String.format(constants.getReadGradStudentRecord(),graduationStudentRecord.getStudentID().toString()))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); -// when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); -// when(this.responseMock.bodyToMono(GraduationStudentRecord.class)).thenReturn(Mono.just(graduationStudentRecord)); - when(this.restService.get(String.format(constants.getReadGradStudentRecord(),graduationStudentRecord.getStudentID().toString()), GraduationStudentRecord.class)).thenReturn(graduationStudentRecord); - - ParameterizedTypeReference> optionalProgramsResponseType = new ParameterizedTypeReference<>() { - }; - StudentOptionalProgram studentOptionalProgram = new StudentOptionalProgram(); studentOptionalProgram.setOptionalProgramCode("FR"); studentOptionalProgram.setOptionalProgramName("Advanced Placement"); @@ -2382,15 +2300,6 @@ public void testGetSchoolCategoryCode() { assertThat(result).isNotNull(); } - @Test - public void testGetSchoolCategoryCodeNull() { - when(this.restService.get(String.format(constants.getSchoolCategoryCode(),"09323027"), CommonSchool.class)).thenReturn(null); - - var result = reportService.getSchoolCategoryCode("09323027"); - assertThat(result).isNull(); - - } - protected GraduationData createGraduationData(String jsonPath) throws Exception { File file = new File(Objects.requireNonNull(ReportServiceTest.class.getClassLoader().getResource(jsonPath)).getFile()); return new ObjectMapper().readValue(file, GraduationData.class); diff --git a/api/src/test/resources/application.yaml b/api/src/test/resources/application.yaml index 279b20ad..53b1ae5f 100644 --- a/api/src/test/resources/application.yaml +++ b/api/src/test/resources/application.yaml @@ -142,8 +142,6 @@ endpoint: by-pen: url: https://student-api-75e61b-dev.apps.silver.devops.gov.bc.ca/api/v1/student?pen=%s grad-trax-api: - commonschool-by-mincode: - url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/school/common/%s school-by-min-code: url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/school-clob/%s district-by-min-code: