diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/CommonSchool.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/CommonSchool.java deleted file mode 100644 index 1f7e7428..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/CommonSchool.java +++ /dev/null @@ -1,269 +0,0 @@ -package ca.bc.gov.educ.api.gradstudent.model.dto; - -import lombok.Data; -import org.springframework.stereotype.Component; - -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; - -@Data -@Component -public class CommonSchool { - - /** - * The constant serialVersionUID. - */ - private static final long serialVersionUID = 1L; - - @Size(max = 3) - @NotNull(message = "distNo can not be null.") - private String distNo; - - @Size(max = 5) - @NotNull(message = "schlNo can not be null.") - private String schlNo; - - @Size(max = 40) - private String scAddressLine1; - - @Size(max = 40) - private String scAddressLine2; - - @Size(max = 30) - private String scCity; - - @Size(max = 2) - private String scProvinceCode; - - @Size(max = 3) - private String scCountryCode; - - @Size(max = 6) - private String scPostalCode; - - @Size(max = 10) - private String scFaxNumber; - - @Size(max = 10) - private String scPhoneNumber; - - @Size(max = 100) - private String scEMailId; - - @Size(max = 2) - private String facilityTypeCode; - - @Size(max = 40) - private String schoolName; - - @Size(max = 2) - private String schoolTypeCode; - - @Size(max = 3) - private String schoolOrganizationCode; - - @Size(max = 2) - private String schoolCategoryCode; - - @Size(max = 25) - private String prGivenName; - - @Size(max = 25) - private String prSurname; - - @Size(max = 25) - private String prMiddleName; - - @Size(max = 2) - private String prTitleCode; - - private Long numberOfDivisions; - - private Long numberOfSecFteTeachers; - - private Long numberOfElmFteTeachers; - - private Long ttblElemInstrMinutes; - - @Size(max = 1) - private String schoolStatusCode; - - private Long enrolHeadcount1523; - - private Long enrolHeadcount1701; - - @Size(max = 1) - private String grade01Ind; - - @Size(max = 1) - private String grade29Ind; - - @Size(max = 1) - private String grade04Ind; - - @Size(max = 1) - private String grade05Ind; - - @Size(max = 1) - private String grade06Ind; - - @Size(max = 1) - private String grade07Ind; - - @Size(max = 1) - private String grade08Ind; - - @Size(max = 1) - private String grade09Ind; - - @Size(max = 1) - private String grade10Ind; - - @Size(max = 1) - private String grade11Ind; - - @Size(max = 1) - private String grade12Ind; - - @Size(max = 1) - private String grade79Ind; - - @Size(max = 1) - private String grade89Ind; - - @Size(max = 8) - private String openedDate; - - @Size(max = 8) - private String closedDate; - - @Size(max = 3) - private String authNumber; - - private Long createDate; - - private Long createTime; - - @Size(max = 12) - private String createUsername; - - private Long editDate; - - private Long editTime; - - @Size(max = 12) - private String editUsername; - - private Long elemTeachersHc; - - private Long secTeachersHc; - - @Size(max = 1) - private String gradeKhInd; - - @Size(max = 1) - private String gradeKfInd; - - @Size(max = 1) - private String grade02Ind; - - @Size(max = 1) - private String grade03Ind; - - @Size(max = 1) - private String gradeEuInd; - - @Size(max = 1) - private String gradeSuInd; - - @Size(max = 1) - private String gradeHsInd; - - @Size(max = 4) - private String contedFundFlag; - - private Long elemFteClassroom; - - private Long elemFteSupport; - - private Long elemFteAdmin; - - private Long secFteClassroom; - - private Long secFteSupport; - - private Long secFteAdmin; - - @Size(max = 40) - private String physAddressLine1; - - @Size(max = 40) - private String physAddressLine2; - - @Size(max = 30) - private String physCity; - - @Size(max = 2) - private String physProvinceCode; - - @Size(max = 3) - private String physCountryCode; - - @Size(max = 6) - private String physPostalCode; - - private Long educMethodClassCnt; - - private Long educMethodDelCnt; - - private Long educMethodBothCnt; - - @Size(max = 3) - private String newDistno; - - @Size(max = 5) - private String newSchlno; - - private String dateOpened; - - private String dateClosed; - - private Long assetNumber; - - @Size(max = 12) - private String assetAssignedBy; - - private String assetAssignedDate; - - @Size(max = 12) - private String assetChangedBy; - - private String assetChangedDate; - - @Size(max = 1) - private String restrictFunding; - - @Size(max = 1) - private String gradeGaInd; - - @Size(max = 1) - private String nlcEarlyLearningFlag; - - @Size(max = 1) - private String nlcAfterSchoolProgramFlag; - - @Size(max = 1) - private String nlcContinuingEdFlag; - - @Size(max = 1) - private String nlcSeniorsFlag; - - @Size(max = 1) - private String nlcSportAndRecFlag; - - @Size(max = 1) - private String nlcCommunityUseFlag; - - @Size(max = 1) - private String nlcIntegratedServicesFlag; -} \ No newline at end of file diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GradSearchStudent.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GradSearchStudent.java index 5a7a14fd..f88ca279 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GradSearchStudent.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GradSearchStudent.java @@ -42,6 +42,7 @@ public class GradSearchStudent { private String trueStudentID; private String program; private String schoolOfRecord; + private String schoolOfRecordId; private String schoolOfRecordName; private String schoolOfRecordindependentAffiliation; private String studentGrade; diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecord.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecord.java index c45f03e0..8715ec35 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecord.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecord.java @@ -32,6 +32,7 @@ public class GraduationStudentRecord extends BaseModel { private String studentStatusName; private UUID studentID; private String schoolAtGrad; + private UUID schoolAtGradId; private String schoolAtGradName; private String recalculateProjectedGrad; private Long batchId; diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecordHistory.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecordHistory.java index 33c10bd2..fe690f4a 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecordHistory.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/GraduationStudentRecordHistory.java @@ -27,10 +27,12 @@ public class GraduationStudentRecordHistory extends BaseModel{ private String honoursStanding; private String recalculateGradStatus; private String schoolOfRecord; + private UUID schoolOfRecordId; private String studentGrade; private String studentStatus; private UUID studentID; private String schoolAtGrad; + private UUID schoolAtGradId; private String recalculateProjectedGrad; private Long batchId; private String consumerEducationRequirementMet; diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/ReportGradStudentData.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/ReportGradStudentData.java index 35388e75..27f5f506 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/ReportGradStudentData.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/ReportGradStudentData.java @@ -15,6 +15,8 @@ public class ReportGradStudentData implements Serializable { private UUID graduationStudentRecordId; private String mincode; private String mincodeAtGrad; + private String schoolOfRecordId; + private String schoolAtGradId; private String distcode; private String distcodeAtGrad; private String pen; diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/School.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/School.java index d059bed1..bb97dd3e 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/School.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/School.java @@ -21,7 +21,7 @@ public class School { private String postal; private String openFlag; private String schoolCategoryCode; - private String schoolCategoryCodeInstitute; + private String schoolCategoryLegacyCode; public String getSchoolName() { return schoolName != null ? schoolName.trim(): null; @@ -49,7 +49,7 @@ public String getPostal() { @Override public String toString() { - return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryCodeInstitute=" + schoolCategoryCodeInstitute + return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryLegacyCode=" + schoolCategoryLegacyCode + ", schoolName=" + schoolName + ", districtName=" + districtName + ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility=" + certificateEligibility + ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode=" + provCode + ", countryCode=" + countryCode + ", postal=" + postal + ", openFlag=" + openFlag + "]"; diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordEntity.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordEntity.java index c429104b..1213c194 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordEntity.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordEntity.java @@ -82,7 +82,7 @@ public GraduationStudentRecordEntity() { private UUID schoolOfRecordId; @Column(name = "SCHOOL_AT_GRADUATION_ID", nullable = true) - private UUID schoolAtGraduationId; + private UUID schoolAtGradId; @Transient private String legalFirstName; diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordHistoryEntity.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordHistoryEntity.java index a7b4c323..33a478b5 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordHistoryEntity.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordHistoryEntity.java @@ -79,7 +79,7 @@ public class GraduationStudentRecordHistoryEntity extends BaseEntity { private UUID schoolOfRecordId; @Column(name = "SCHOOL_AT_GRADUATION_ID", nullable = true) - private UUID schoolAtGraduationId; + private UUID schoolAtGradId; //@Lob //@Column(name = "STUDENT_PROJECTED_GRAD_DATA", columnDefinition="CLOB") diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordView.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordView.java index 6e19ec77..ea789e7c 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordView.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/GraduationStudentRecordView.java @@ -23,7 +23,7 @@ public interface GraduationStudentRecordView { public Date getAdultStartDate(); public String getStudentProjectedGradData() ; public UUID getSchoolOfRecordId(); - public UUID getSchoolAtGraduationId(); + public UUID getSchoolAtGradId(); public LocalDateTime getCreateDate(); public LocalDateTime getUpdateDate(); } \ No newline at end of file diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java index 549865bd..325efe78 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java @@ -298,6 +298,7 @@ private GradSearchStudent populateGradStudent(GraduationStudentRecordView gradRe GradSearchStudent gradStu = new GradSearchStudent(); BeanUtils.copyProperties(gradRecord, gradStu); gradStu.setStudentID(gradRecord.getStudentID().toString()); + gradStu.setSchoolOfRecordId(gradRecord.getSchoolOfRecordId() != null? gradRecord.getSchoolOfRecordId().toString() : null); return populateGradStudent(gradStu, accessToken); } @@ -311,7 +312,7 @@ private GradSearchStudent populateGradStudent(GradSearchStudent gradStu, String if(studentPen != null) { BeanUtils.copyProperties(studentPen, gradStu); } - School school = webClient.get().uri(String.format(constants.getSchoolByMincodeUrl(), gradStu.getSchoolOfRecord())) + School school = webClient.get().uri(String.format(constants.getSchoolClobBySchoolIdUrl(), gradStu.getSchoolOfRecordId())) .headers(h -> { h.setBearerAuth(accessToken); h.set(EducGradStudentApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); @@ -333,9 +334,10 @@ private GradSearchStudent populateGradSearchStudent(Student student, String acce gradStu.setStudentGrade(gradObj.getStudentGrade()); gradStu.setStudentStatus(gradObj.getStudentStatus()); gradStu.setSchoolOfRecord(gradObj.getSchoolOfRecord()); + gradStu.setSchoolOfRecordId(gradObj.getSchoolOfRecordId() != null? gradObj.getSchoolOfRecordId().toString() : null); gradStu.setStudentCitizenship(gradObj.getStudentCitizenship()); - School school = webClient.get().uri(String.format(constants.getSchoolByMincodeUrl(), gradStu.getSchoolOfRecord())) + School school = webClient.get().uri(String.format(constants.getSchoolClobBySchoolIdUrl(), gradStu.getSchoolOfRecordId())) .headers(h -> { h.setBearerAuth(accessToken); h.set(EducGradStudentApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java index c6fb24df..a2e6a765 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java @@ -141,15 +141,15 @@ public GraduationStudentRecord getGraduationStatus(UUID studentID, String access if (gradStatus.getProgram() != null) { gradStatus.setProgramName(getProgramName(gradStatus.getProgram(), accessToken)); } - if (gradStatus.getSchoolOfRecord() != null) - gradStatus.setSchoolName(getSchoolName(gradStatus.getSchoolOfRecord(), accessToken)); + if (gradStatus.getSchoolOfRecordId() != null) + gradStatus.setSchoolName(getSchoolName(gradStatus.getSchoolOfRecordId().toString(), accessToken)); if (gradStatus.getStudentStatus() != null) { Optional statusEntity = studentStatusRepository.findById(StringUtils.toRootUpperCase(gradStatus.getStudentStatus())); statusEntity.ifPresent(studentStatusEntity -> gradStatus.setStudentStatusName(studentStatusEntity.getLabel())); } - if (gradStatus.getSchoolAtGrad() != null) - gradStatus.setSchoolAtGradName(getSchoolName(gradStatus.getSchoolAtGrad(), accessToken)); + if (gradStatus.getSchoolAtGradId() != null) + gradStatus.setSchoolAtGradName(getSchoolName(gradStatus.getSchoolAtGradId().toString(), accessToken)); List studentCareerProgramEntities = gradStudentCareerProgramRepository.findByStudentID(studentID); gradStatus.setCareerPrograms(gradStudentCareerProgramTransformer.transformToDTO(studentCareerProgramEntities)); @@ -366,7 +366,7 @@ public GraduationStudentRecordSearchResult searchGraduationStudentRecords(final for(Iterator it = schools.iterator(); it.hasNext();) { School school = it.next(); List schoolCategoryCodes = searchRequest.getSchoolCategoryCodes().stream().filter(StringUtils::isNotBlank).toList(); - if(!schoolCategoryCodes.isEmpty() && !schoolCategoryCodes.contains(school.getSchoolCategoryCode())) { + if(!schoolCategoryCodes.isEmpty() && !schoolCategoryCodes.contains(school.getSchoolCategoryLegacyCode())) { it.remove(); } else { searchRequest.getSchoolOfRecords().add(school.getMinCode()); @@ -441,7 +441,7 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken) } } - School school = getSchool(gradSearchStudent.getSchoolOfRecord(), accessToken); + School school = getSchool(gradSearchStudent.getSchoolOfRecordId(), accessToken); if(school == null) { validation.addErrorAndStop("School with mincode %s not found", gradSearchStudent.getMincode()); } @@ -500,8 +500,8 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken) .sccDate(sccDate) .transcriptEligibility(gradSearchStudent.getTranscriptEligibility()) .mincode(school.getMinCode()) - .schoolCategory(school.getSchoolCategoryCode()) - .schoolType("02".equalsIgnoreCase(school.getSchoolCategoryCode()) ? "02" : "") + .schoolCategory(school.getSchoolCategoryLegacyCode()) + .schoolType("02".equalsIgnoreCase(school.getSchoolCategoryLegacyCode()) ? "02" : "") .schoolName(school.getSchoolName()) .formerStudent(formerStudent) .build(); @@ -536,9 +536,9 @@ public List getSchoolsByDistrictNumber(String distNo, String accessToken }).block(); } - private School getSchool(String minCode, String accessToken) { + private School getSchool(String schoolId, String accessToken) { return webClient.get() - .uri(String.format(constants.getSchoolByMincodeUrl(), minCode)) + .uri(String.format(constants.getSchoolClobBySchoolIdUrl(), schoolId)) .headers(h -> { h.setBearerAuth(accessToken); h.set(EducGradStudentApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); @@ -548,8 +548,8 @@ private School getSchool(String minCode, String accessToken) { .block(); } - private String getSchoolName(String minCode, String accessToken) { - School schObj = getSchool(minCode, accessToken); + private String getSchoolName(String schoolId, String accessToken) { + School schObj = getSchool(schoolId, accessToken); if (schObj != null) return schObj.getSchoolName(); else @@ -639,9 +639,9 @@ private void validateProgram(GraduationStudentRecordEntity sourceEntity, String } } - private void validateSchool(String minCode, String accessToken) { + private void validateSchool(UUID schoolId, String accessToken) { School schObj = webClient.get() - .uri(String.format(constants.getSchoolByMincodeUrl(), minCode)) + .uri(String.format(constants.getSchoolClobBySchoolIdUrl(), schoolId)) .headers(h -> { h.setBearerAuth(accessToken); h.set(EducGradStudentApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); @@ -651,10 +651,10 @@ private void validateSchool(String minCode, String accessToken) { .block(); if (schObj == null) { validation.addError( - String.format("Invalid School entered, School [%s] does not exist on the School table", minCode)); + String.format("Invalid School entered, SchoolId [%s] does not exist in institute.", schoolId)); } else { if (schObj.getOpenFlag().equalsIgnoreCase("N")) { - validation.addWarning(String.format("This School [%s] is Closed", minCode)); + validation.addWarning(String.format("This School [%s] is Closed", schoolId)); } } } @@ -747,14 +747,14 @@ private ValidateDataResult validateData(GraduationStudentRecordEntity sourceEnti hasDataChanged.recalculateAll(); } - if (sourceEntity.getSchoolOfRecord() != null && !sourceEntity.getSchoolOfRecord().equalsIgnoreCase(existingEntity.getSchoolOfRecord())) { + if (sourceEntity.getSchoolOfRecordId() != null && !sourceEntity.getSchoolOfRecordId().equals(existingEntity.getSchoolOfRecordId())) { hasDataChanged.recalculateAll(); - validateSchool(sourceEntity.getSchoolOfRecord(), accessToken); + validateSchool(sourceEntity.getSchoolOfRecordId(), accessToken); } - if (sourceEntity.getSchoolAtGrad() != null && !sourceEntity.getSchoolAtGrad().equalsIgnoreCase(existingEntity.getSchoolAtGrad())) { + if (sourceEntity.getSchoolAtGradId() != null && !sourceEntity.getSchoolAtGradId().equals(existingEntity.getSchoolAtGradId())) { hasDataChanged.recalculateAll(); - validateSchool(sourceEntity.getSchoolAtGrad(), accessToken); + validateSchool(sourceEntity.getSchoolAtGradId(), accessToken); } if ((sourceEntity.getStudentGrade() != null && !sourceEntity.getStudentGrade().equalsIgnoreCase(existingEntity.getStudentGrade()))) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiConstants.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiConstants.java index aef7ff5b..d0bb9a53 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiConstants.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiConstants.java @@ -140,8 +140,8 @@ public class EducGradStudentApiConstants { private String connectionName; //Endpoints - @Value("${endpoint.grad-trax-api.school-by-min-code.url}") - private String schoolByMincodeUrl; + @Value("${endpoint.grad-trax-api.school-clob-by-school-id.url}") + private String schoolClobBySchoolIdUrl; @Value("${endpoint.grad-trax-api.district-by-district-code.url}") private String districtByDistrictCodeUrl; @@ -186,7 +186,7 @@ public class EducGradStudentApiConstants { @Value("${endpoint.grad-graduation-report-api.archive-student-achievement.url}") private String archiveStudentAchievements; - @Value("${endpoint.grad-trax-api.all-schools-by-district.url}") + @Value("${endpoint.grad-trax-api.schools-by-district-code.url}") private String schoolsByDistrictNumberUrl; // Splunk LogHelper Enabled diff --git a/api/src/main/resources/application.yaml b/api/src/main/resources/application.yaml index 28009a5b..e8f702d5 100644 --- a/api/src/main/resources/application.yaml +++ b/api/src/main/resources/application.yaml @@ -155,12 +155,12 @@ resilience4j.retry: #Endpoint properties endpoint: grad-trax-api: - all-schools-by-district: + schools-by-district-code: url: ${GRAD_TRAX_API}api/v2/trax/schools-by-district/%s - school-by-min-code: + school-clob-by-school-id: url: ${GRAD_TRAX_API}api/v2/trax/school-clob/%s district-by-district-code: - url: ${GRAD_TRAX_API}api/v2/trax/district/%s + url: ${GRAD_TRAX_API}api/v2/trax/district?distNo=%s grad-program-api: optional_program_name_by_optional_program_id: diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java index 14847d5c..7e9f38d2 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java @@ -153,11 +153,12 @@ public void testGetStudentFromStudentAPI() { // School final School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(mincode); school.setSchoolName(schoolName); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -203,11 +204,12 @@ public void testGetGRADStudents() { // School final School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(mincode); school.setSchoolName(schoolName); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -301,11 +303,12 @@ public void testGetStudentFromStudentAPIGradOnly() { // School final School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(mincode); school.setSchoolName(schoolName); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -428,7 +431,7 @@ public UUID getSchoolOfRecordId() { } @Override - public UUID getSchoolAtGraduationId() { + public UUID getSchoolAtGradId() { return null; } @@ -519,19 +522,15 @@ public void testStudentDemographics() { when(this.graduationStatusRepository.findById(studentID)).thenReturn(Optional.of(graduationStatusEntity)); - CommonSchool commonSchool = new CommonSchool(); - commonSchool.setSchlNo(mincode); - commonSchool.setSchoolName(schoolName); - commonSchool.setSchoolCategoryCode("02"); - School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(mincode); school.setSchoolName(schoolName); - school.setSchoolCategoryCode("02"); - school.setSchoolCategoryCodeInstitute("INDEPEN"); + school.setSchoolCategoryLegacyCode("02"); + school.setSchoolCategoryCode("INDEPEN"); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -617,11 +616,12 @@ public void testGetStudentByPenFromStudentAPI() { // School final School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(mincode); school.setSchoolName(schoolName); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -709,11 +709,12 @@ public void testGetStudentByStudentIDFromStudentAPI() { // School final School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(mincode); school.setSchoolName(schoolName); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java index 40336332..fab5658f 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java @@ -191,6 +191,7 @@ public void testGetGraduationStatusForAlgorithm() { public void testGetGraduationStatus() { // ID UUID studentID = UUID.randomUUID(); + UUID schoolId = UUID.randomUUID(); String mincode = "12345678"; GraduationStudentRecordEntity graduationStatusEntity = new GraduationStudentRecordEntity(); @@ -203,6 +204,8 @@ public void testGetGraduationStatus() { graduationStatusEntity.setSchoolAtGrad(mincode); graduationStatusEntity.setGpa("4"); graduationStatusEntity.setStudentStatus("A"); + graduationStatusEntity.setSchoolOfRecordId(schoolId); + graduationStatusEntity.setSchoolAtGradId(schoolId); StudentStatus studentStatus = new StudentStatus(); studentStatus.setCode("CUR"); @@ -213,6 +216,7 @@ public void testGetGraduationStatus() { program.setProgramName("Graduation Program 2018"); School school = new School(); + school.setSchoolId(schoolId.toString()); school.setMinCode(mincode); school.setSchoolName("Test School"); @@ -225,7 +229,7 @@ public void testGetGraduationStatus() { when(responseMock.bodyToMono(GradProgram.class)).thenReturn(Mono.just(program)); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -822,6 +826,7 @@ public void testUpdateGraduationStatus_givenDifferentSchoolOfRecords_whenSchoolI savedGraduationStatus.setProgramCompletionDate(graduationStatusEntity.getProgramCompletionDate()); School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(newMincode); school.setSchoolName("Test School"); school.setOpenFlag("Y"); @@ -830,7 +835,7 @@ public void testUpdateGraduationStatus_givenDifferentSchoolOfRecords_whenSchoolI when(graduationStatusRepository.saveAndFlush(graduationStatusEntity)).thenReturn(savedGraduationStatus); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),newMincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -883,6 +888,7 @@ public void testUpdateGraduationStatus_givenDifferentSchoolOfGrads_whenSchoolIsV savedGraduationStatus.setProgramCompletionDate(graduationStatusEntity.getProgramCompletionDate()); School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(newMincode); school.setSchoolName("Test School"); school.setOpenFlag("Y"); @@ -891,7 +897,7 @@ public void testUpdateGraduationStatus_givenDifferentSchoolOfGrads_whenSchoolIsV when(graduationStatusRepository.saveAndFlush(graduationStatusEntity)).thenReturn(savedGraduationStatus); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),newMincode))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -1653,10 +1659,11 @@ public void testSearchGraduationStudentRecords() { //schoolOfRecords.add(schoolOfRecord); School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(schoolOfRecord); school.setSchoolName("Test School"); - school.setSchoolCategoryCode("02"); - school.setSchoolCategoryCodeInstitute("INDEPEN"); + school.setSchoolCategoryLegacyCode("02"); + school.setSchoolCategoryCode("INDEPEN"); List districts = new ArrayList<>(); districts.add(distCode); @@ -1716,7 +1723,7 @@ public void testSearchGraduationStudentRecords() { when(this.responseMock.bodyToMono(Student.class)).thenReturn(Mono.just(student)); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),schoolOfRecord))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -1793,10 +1800,11 @@ public void testSearchGraduationStudentRecords_validateTrue() { schoolOfRecords.add(schoolOfRecord); School school = new School(); + school.setSchoolId(UUID.randomUUID().toString()); school.setMinCode(schoolOfRecord); school.setSchoolName("Test School"); - school.setSchoolCategoryCode("02"); - school.setSchoolCategoryCodeInstitute("INDEPEN"); + school.setSchoolCategoryLegacyCode("02"); + school.setSchoolCategoryCode("INDEPEN"); List districts = new ArrayList<>(); districts.add(distCode); @@ -1856,7 +1864,7 @@ public void testSearchGraduationStudentRecords_validateTrue() { when(this.responseMock.bodyToMono(Student.class)).thenReturn(Mono.just(student)); when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),schoolOfRecord))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolClobBySchoolIdUrl(),school.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school)); @@ -2305,7 +2313,7 @@ public UUID getSchoolOfRecordId() { } @Override - public UUID getSchoolAtGraduationId() { + public UUID getSchoolAtGradId() { return null; } @@ -2431,7 +2439,7 @@ public UUID getSchoolOfRecordId() { } @Override - public UUID getSchoolAtGraduationId() { + public UUID getSchoolAtGradId() { return null; } @@ -2915,7 +2923,7 @@ public UUID getSchoolOfRecordId() { } @Override - public UUID getSchoolAtGraduationId() { + public UUID getSchoolAtGradId() { return null; } @@ -3192,7 +3200,7 @@ public UUID getSchoolOfRecordId() { } @Override - public UUID getSchoolAtGraduationId() { + public UUID getSchoolAtGradId() { return null; } diff --git a/api/src/test/resources/application.yaml b/api/src/test/resources/application.yaml index c949ad89..863c719f 100644 --- a/api/src/test/resources/application.yaml +++ b/api/src/test/resources/application.yaml @@ -106,9 +106,9 @@ cron: #Endpoint properties endpoint: grad-trax-api: - all-schools-by-district: + schools-by-district-code: url: http://test - school-by-min-code: + school-clob-by-school-id: url: http://test district-by-district-code: url: http://test