Skip to content

Commit

Permalink
Merge pull request #550 from bcgov/feature/GRAD2-2951
Browse files Browse the repository at this point in the history
GRAD2-2951: task is complete.
  • Loading branch information
infstar authored Nov 13, 2024
2 parents 49550a4 + ee45a94 commit e17cef7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1616,18 +1616,8 @@ public void testReportDataByPen_witherrors3() throws Exception {
gradSearchStudent.setPen(pen);
gradSearchStudent.setStudentID(gradStatus.getGradStudent().getStudentID());

// final ParameterizedTypeReference<List<GradSearchStudent>> 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");
Expand All @@ -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);


Expand All @@ -1677,15 +1653,6 @@ public void testReportDataByPen_witherrors2() throws Exception {
gradSearchStudent.setPen(pen);
gradSearchStudent.setStudentID(gradStatus.getGradStudent().getStudentID());

// final ParameterizedTypeReference<List<GradSearchStudent>> 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));


Expand All @@ -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());


Expand All @@ -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());

Expand All @@ -1764,18 +1710,8 @@ public void testTranscriptReportByPen() throws Exception {
gradSearchStudent.setPen(pen);
gradSearchStudent.setStudentID(gradStatus.getGradStudent().getStudentID());

final ParameterizedTypeReference<List<GradSearchStudent>> 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");
Expand Down Expand Up @@ -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<List<StudentOptionalProgram>> optionalProgramsResponseType = new ParameterizedTypeReference<>() {
};

StudentOptionalProgram studentOptionalProgram = new StudentOptionalProgram();
studentOptionalProgram.setOptionalProgramCode("FR");
studentOptionalProgram.setOptionalProgramName("Advanced Placement");
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e17cef7

Please sign in to comment.