diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/constant/StudentLoadType.java b/api/src/main/java/ca/bc/gov/educ/api/trax/constant/StudentLoadType.java deleted file mode 100644 index fa36f08d..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/constant/StudentLoadType.java +++ /dev/null @@ -1,5 +0,0 @@ -package ca.bc.gov.educ.api.trax.constant; - -public enum StudentLoadType { - UNGRAD, GRAD_ONE, GRAD_TWO, NONE, NO_UTG -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/controller/TraxCommonController.java b/api/src/main/java/ca/bc/gov/educ/api/trax/controller/TraxCommonController.java index bbaa754a..df2d8823 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/controller/TraxCommonController.java +++ b/api/src/main/java/ca/bc/gov/educ/api/trax/controller/TraxCommonController.java @@ -38,21 +38,6 @@ public class TraxCommonController { @Autowired ResponseHelper response; - @GetMapping(EducGradTraxApiConstants.GET_TRAX_STUDENT_GRADUATED_BY_PEN_MAPPING) - @PreAuthorize(PermissionsConstants.READ_GRAD_TRAX_STUDENT_DATA) - @Operation(summary = "Get student is graduated or not from TSW", description = "Find a student graduated or not", tags = { "TSW" }) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "400", description = "BAD REQUEST")}) - public ResponseEntity getStudentIsGraduatedByPen(@PathVariable String pen) { - logger.debug("getTranscriptStudentGraduatedByPen : "); - validation.requiredField(pen, "Pen #"); - if (validation.hasErrors()) { - validation.stopOnErrors(); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - return response.GET(traxCommonService.isGraduatedStudent(pen)); - } - @GetMapping(EducGradTraxApiConstants.GET_TRAX_STUDENT_DEMOG_MAPPING) @PreAuthorize(PermissionsConstants.READ_GRAD_TRAX_STUDENT_DATA) @Operation(summary = "Find Student Demographics from TRAX", description = "Find Student Demographics from TRAX", tags = {"Student"}) @@ -71,14 +56,14 @@ public ResponseEntity> getStudentDemographicsDataFromTrax(@PathVar @PreAuthorize(PermissionsConstants.READ_GRAD_TRAX_STUDENT_DATA) @Operation(summary = "Find Student Master Record from TRAX", description = "Find Student Master Record from TRAX", tags = {"Student"}) @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "BAD REQUEST")}) - public ResponseEntity> getStudentMasterDataFromTrax(@PathVariable String pen, @RequestHeader(name="Authorization") String accessToken) { + public ResponseEntity> getStudentMasterDataFromTrax(@PathVariable String pen) { logger.debug("getStudentMasterDataFromTrax : "); validation.requiredField(pen, "Pen #"); if (validation.hasErrors()) { validation.stopOnErrors(); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } - return response.GET(traxCommonService.getStudentMasterDataFromTrax(pen, accessToken.replace(BEARER, ""))); + return response.GET(traxCommonService.getStudentMasterDataFromTrax(pen)); } @GetMapping(EducGradTraxApiConstants.GET_TRAX_STUDENT_NO_LIST_BY_PAGING_MAPPING) diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/controller/TswController.java b/api/src/main/java/ca/bc/gov/educ/api/trax/controller/TswController.java deleted file mode 100644 index dd858337..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/controller/TswController.java +++ /dev/null @@ -1,74 +0,0 @@ -package ca.bc.gov.educ.api.trax.controller; - -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentCourse; -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentDemog; -import ca.bc.gov.educ.api.trax.service.TswService; -import ca.bc.gov.educ.api.trax.util.EducGradTraxApiConstants; -import ca.bc.gov.educ.api.trax.util.GradValidation; -import ca.bc.gov.educ.api.trax.util.PermissionsConstants; -import ca.bc.gov.educ.api.trax.util.ResponseHelper; -import io.swagger.v3.oas.annotations.OpenAPIDefinition; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.info.Info; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -@CrossOrigin -@RestController -@RequestMapping(EducGradTraxApiConstants.GRAD_TSW_URL_MAPPING) -@OpenAPIDefinition(info = @Info(title = "API for TSW Data.", description = "This Read API is for Reading school data.", version = "1"), - security = {@SecurityRequirement(name = "OAUTH2", scopes = {"READ_GRAD_TRAX_STUDENT_DATA"})}) -public class TswController { - - private static Logger logger = LoggerFactory.getLogger(TswController.class); - - @Autowired - TswService tswService; - - @Autowired - GradValidation validation; - - @Autowired - ResponseHelper response; - - @GetMapping(EducGradTraxApiConstants.GET_TRANSCRIPT_DEMOG_BY_PEN_MAPPING) - @PreAuthorize(PermissionsConstants.READ_GRAD_TRAX_STUDENT_DATA) - @Operation(summary = "Get transcript student demographics data from TSW", description = "Find transcript student demographics data", tags = { "TSW" }) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "400", description = "BAD REQUEST")}) - public ResponseEntity getTranscriptStudentDemogByPen(@PathVariable String pen) { - logger.debug("getTranscriptStudentDemogByPen : "); - validation.requiredField(pen, "Pen #"); - if (validation.hasErrors()) { - validation.stopOnErrors(); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - return response.GET(tswService.getTranscriptStudentDemog(pen)); - } - - @GetMapping(EducGradTraxApiConstants.GET_TRANSCRIPT_COURSE_BY_PEN_MAPPING) - @PreAuthorize(PermissionsConstants.READ_GRAD_TRAX_STUDENT_DATA) - @Operation(summary = "Get transcript student courses from TSW", description = "Find transcript student courses", tags = { "TSW" }) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "400", description = "BAD REQUEST")}) - public ResponseEntity> getTranscriptStudentCoursesByPen(@PathVariable String pen) { - logger.debug("getTranscriptStudentCoursesByPen : "); - validation.requiredField(pen, "Pen #"); - if (validation.hasErrors()) { - validation.stopOnErrors(); - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - } - return response.GET(tswService.getTranscriptStudentCourses(pen)); - } - -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/ConvGradStudent.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/ConvGradStudent.java index 144b28d0..862ec148 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/ConvGradStudent.java +++ b/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/ConvGradStudent.java @@ -1,7 +1,6 @@ package ca.bc.gov.educ.api.trax.model.dto; import ca.bc.gov.educ.api.trax.constant.ConversionResultType; -import ca.bc.gov.educ.api.trax.constant.StudentLoadType; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.Builder; @@ -42,19 +41,8 @@ public class ConvGradStudent { // program codes for optional / career program private List programCodes; - // grad-one, grad-two, or ungrad - private StudentLoadType studentLoadType; - private Date distributionDate; - private String transcriptSchoolCategoryCode; - private String certificateSchoolCategoryCode; - private School transcriptSchool; - private School certificateSchool; - // tsw - private TranscriptStudentDemog transcriptStudentDemog; - private List transcriptStudentCourses; // 1950 "AD" private boolean adult19Rule; - private boolean allowedAdult; // data conversion status after being processed. private ConversionResultType result; diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/TranscriptStudentCourse.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/TranscriptStudentCourse.java deleted file mode 100644 index 2d5541cf..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/TranscriptStudentCourse.java +++ /dev/null @@ -1,103 +0,0 @@ -package ca.bc.gov.educ.api.trax.model.dto; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -/** - * The type TSW Transcript Course. - */ -@Data -@SuperBuilder -@AllArgsConstructor -@NoArgsConstructor -@JsonIgnoreProperties(ignoreUnknown = true) -public class TranscriptStudentCourse { - private String studNo; - private String courseCode; - private String courseLevel; - - private String reportType; - private String courseName; - private String foundationReq; - private String specialCase; - private String courseSession; - private String schoolPercentage; - private String examPercentage; - private String finalPercentage; - private String finalLG; - private String interimMark; - private String numberOfCredits; - private String courseType; - private String usedForGrad; - private String metLitNumReqt; - private String relatedCourse; - private String relatedCourseLevel; - private Long updateDate; // yyyymmdd - - public String getReportType() { - return reportType!=null?reportType.trim():null; - } - - public String getFoundationReq() { - return foundationReq!=null?foundationReq.trim():null; - } - - public String getSpecialCase() { - return specialCase!=null?specialCase.trim():null; - } - - public String getSchoolPercentage() { - return schoolPercentage!=null?schoolPercentage.trim():null; - } - - public String getFinalPercentage() { - return finalPercentage!=null?finalPercentage.trim():null; - } - - public String getFinalLG() { - return finalLG!=null?finalLG.trim():null; - } - - public String getInterimMark() { - return interimMark!=null?interimMark.trim():null; - } - - public String getNumberOfCredits() { - return numberOfCredits!=null?numberOfCredits.trim():null; - } - - public String getCourseType() { - return courseType!=null?courseType.trim():null; - } - - public String getUsedForGrad() { - return usedForGrad!=null?usedForGrad.trim():null; - } - - public String getMetLitNumReqt() { - return metLitNumReqt!=null?metLitNumReqt.trim():null; - } - - public String getRelatedCourseLevel() { - return relatedCourseLevel!=null?relatedCourseLevel.trim():null; - } - - public String getStudNo() { - return studNo != null ? studNo.trim():null; - } - - public String getCourseCode() { - return courseCode != null ? courseCode.trim(): null; - } - public String getCourseName() { - return courseName != null ? courseName.trim(): null; - } - - public String getCourseLevel() { - return courseLevel != null ? courseLevel.trim(): null; - } - -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/TranscriptStudentDemog.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/TranscriptStudentDemog.java deleted file mode 100644 index 215b607b..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/dto/TranscriptStudentDemog.java +++ /dev/null @@ -1,29 +0,0 @@ -package ca.bc.gov.educ.api.trax.model.dto; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -import jakarta.persistence.Column; -import jakarta.persistence.Id; - -/** - * The type TSW Transcript Demographics. - */ -@Data -@SuperBuilder -@AllArgsConstructor -@NoArgsConstructor -@JsonIgnoreProperties(ignoreUnknown = true) -public class TranscriptStudentDemog { - private String studNo; - private String mincode; - private String birthDate; // yyyymmdd - private String gradReqtYear; // yyyy - private String studentGrade; - private Long gradDate; // yyyymm - private String gradMessage; - private Long updateDate; // yyyymmdd -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentCourseEntity.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentCourseEntity.java deleted file mode 100644 index a8a4b00c..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentCourseEntity.java +++ /dev/null @@ -1,71 +0,0 @@ -package ca.bc.gov.educ.api.trax.model.entity; - -import lombok.Data; -import org.hibernate.annotations.Immutable; - -import jakarta.persistence.*; - -/** - * The type TSW Transcript Course entity. - */ -@Data -@Immutable -@Entity -@Table(name = "TSW_TRAN_CRSE") -public class TranscriptStudentCourseEntity { - - @EmbeddedId - private TranscriptStudentCourseKey studentCourseKey; - - @Column(name = "RPT_CRS_TYPE") - private String reportType; - - @Column(name = "COURSE_NAME") - private String courseName; - - // School info - @Column(name = "FOUNDATION_REQ") - private String foundationReq; - - @Column(name = "SPECIAL_CASE") - private String specialCase; - - @Column(name = "COURSE_SESSION") - private String courseSession; - - @Column(name = "SCHOOL_PCT") - private String schoolPercentage; - - @Column(name = "EXAM_PCT") - private String examPercentage; - - @Column(name = "FINAL_PCT") - private String finalPercentage; - - @Column(name = "FINAL_LG") - private String finalLG; - - @Column(name = "INTERIM_MARK") - private String interimMark; - - @Column(name = "NUM_CREDITS") - private String numberOfCredits; - - @Column(name = "CRSE_TYPE") - private String courseType; - - @Column(name = "USED_FOR_GRAD") - private String usedForGrad; - - @Column(name = "MET_LIT_NUM_REQT") - private String metLitNumReqt; - - @Column(name = "RELATED_CRSE") - private String relatedCourse; - - @Column(name = "RELATED_LEVEL") - private String relatedCourseLevel; - - @Column(name = "UPDATE_DT") - private Long updateDate; // yyyymmdd -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentCourseKey.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentCourseKey.java deleted file mode 100644 index d093807d..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentCourseKey.java +++ /dev/null @@ -1,31 +0,0 @@ -package ca.bc.gov.educ.api.trax.model.entity; - -import lombok.Data; - -import jakarta.persistence.Column; -import jakarta.persistence.Embeddable; -import java.io.Serializable; - -@Embeddable -@Data -public class TranscriptStudentCourseKey implements Serializable { - private static final long serialVersionUID = 1L; - - @Column(name = "STUD_NO", unique = true, updatable = false) - private String studNo; - - @Column(name = "CRSE_CODE", insertable = false, updatable = false, length = 5) - private String courseCode; - - @Column(name = "CRSE_LEVEL", insertable = false, updatable = false, length = 3) - private String courseLevel; - - public TranscriptStudentCourseKey() { - } - - public TranscriptStudentCourseKey(String studNo, String courseCode, String courseLevel) { - this.studNo = studNo; - this.courseCode = courseCode; - this.courseLevel = courseLevel; - } -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentDemogEntity.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentDemogEntity.java deleted file mode 100644 index 2cbbd36b..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/entity/TranscriptStudentDemogEntity.java +++ /dev/null @@ -1,45 +0,0 @@ -package ca.bc.gov.educ.api.trax.model.entity; - -import lombok.Data; -import org.hibernate.annotations.Immutable; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; -import jakarta.persistence.Table; - -/** - * The type TSW Transcript Demographics entity. - */ -@Data -@Immutable -@Entity -@Table(name = "TSW_TRAN_DEMOG") -public class TranscriptStudentDemogEntity { - @Id - @Column(name = "STUD_NO", unique = true, updatable = false) - private String studNo; - - // School info - @Column(name = "MINCODE") - private String mincode; - - // Student Demographics - @Column(name = "BIRTHDATE") - private String birthDate; // yyyymmdd - - @Column(name = "GRAD_REQT_YEAR") - private String gradReqtYear; // yyyy - - @Column(name = "STUD_GRADE") - private String studentGrade; - - @Column(name = "GRAD_DATE") - private Long gradDate; // yyyymm - - @Column(name = "GRAD_MSG") - private String gradMessage; - - @Column(name = "UPDATE_DT") - private Long updateDate; // yyyymmdd -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/transformer/TranscriptStudentCourseTransformer.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/transformer/TranscriptStudentCourseTransformer.java deleted file mode 100644 index 2cea1a08..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/transformer/TranscriptStudentCourseTransformer.java +++ /dev/null @@ -1,50 +0,0 @@ -package ca.bc.gov.educ.api.trax.model.transformer; - -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentCourse; -import ca.bc.gov.educ.api.trax.model.entity.TranscriptStudentCourseEntity; -import ca.bc.gov.educ.api.trax.util.EducGradTraxApiUtils; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -@Component -public class TranscriptStudentCourseTransformer { - - @Autowired - ModelMapper modelMapper; - - public TranscriptStudentCourse transformToDTO(TranscriptStudentCourseEntity transcriptStudentCourseEntity) { - return modelMapper.map(transcriptStudentCourseEntity, TranscriptStudentCourse.class); - } - - public TranscriptStudentCourse transformToDTO(Optional transcriptStudentCourseEntityOptional) { - TranscriptStudentCourseEntity entity; - entity = transcriptStudentCourseEntityOptional.orElseGet(TranscriptStudentCourseEntity::new); - - return modelMapper.map(entity, TranscriptStudentCourse.class); - } - - public List transformToDTO(Iterable transcriptStudentCourseEntities) { - List transcriptStudentCourseList = new ArrayList<>(); - - for (TranscriptStudentCourseEntity transcriptStudentCourseEntity : transcriptStudentCourseEntities) { - TranscriptStudentCourse transcriptStudentCourse = modelMapper.map(transcriptStudentCourseEntity, TranscriptStudentCourse.class); - - transcriptStudentCourse.setCourseCode(transcriptStudentCourseEntity.getStudentCourseKey().getCourseCode()); - transcriptStudentCourse.setCourseLevel(transcriptStudentCourseEntity.getStudentCourseKey().getCourseLevel()); - transcriptStudentCourse.setStudNo(transcriptStudentCourseEntity.getStudentCourseKey().getStudNo()); - transcriptStudentCourse.setCourseSession(EducGradTraxApiUtils.parseTraxDate(transcriptStudentCourseEntity.getCourseSession())); - transcriptStudentCourseList.add(transcriptStudentCourse); - } - - return transcriptStudentCourseList; - } - - public TranscriptStudentCourseEntity transformToEntity(TranscriptStudentCourse transcriptStudentCourse) { - return modelMapper.map(transcriptStudentCourse, TranscriptStudentCourseEntity.class); - } -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/model/transformer/TranscriptStudentDemogTransformer.java b/api/src/main/java/ca/bc/gov/educ/api/trax/model/transformer/TranscriptStudentDemogTransformer.java deleted file mode 100644 index 4fa2a4ea..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/model/transformer/TranscriptStudentDemogTransformer.java +++ /dev/null @@ -1,45 +0,0 @@ -package ca.bc.gov.educ.api.trax.model.transformer; - -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentDemog; -import ca.bc.gov.educ.api.trax.model.entity.TranscriptStudentDemogEntity; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -@Component -public class TranscriptStudentDemogTransformer { - - @Autowired - ModelMapper modelMapper; - - public TranscriptStudentDemog transformToDTO (TranscriptStudentDemogEntity transcriptStudentDemogEntity) { - return modelMapper.map(transcriptStudentDemogEntity, TranscriptStudentDemog.class); - } - - public TranscriptStudentDemog transformToDTO ( Optional traxUpdateInGradOptional ) { - if (traxUpdateInGradOptional.isPresent()) { - TranscriptStudentDemogEntity transcriptStudentDemogEntity = traxUpdateInGradOptional.get(); - return transformToDTO(transcriptStudentDemogEntity); - } - return null; - } - - public List transformToDTO (Iterable transcriptStudentDemogEntities ) { - List transcriptStudentDemogList = new ArrayList<>(); - - for (TranscriptStudentDemogEntity transcriptStudentDemogEntity : transcriptStudentDemogEntities) { - TranscriptStudentDemog traxUpdateInGrad = transformToDTO(transcriptStudentDemogEntity); - transcriptStudentDemogList.add(traxUpdateInGrad); - } - - return transcriptStudentDemogList; - } - - public TranscriptStudentDemogEntity transformToEntity(TranscriptStudentDemog transcriptStudentDemog) { - return modelMapper.map(transcriptStudentDemog, TranscriptStudentDemogEntity.class); - } -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TranscriptStudentCourseRepository.java b/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TranscriptStudentCourseRepository.java deleted file mode 100644 index 621cfb4b..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TranscriptStudentCourseRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package ca.bc.gov.educ.api.trax.repository; - -import ca.bc.gov.educ.api.trax.model.entity.TranscriptStudentCourseEntity; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -/** - * The interface TSW Student Course repository. - */ -@Repository -public interface TranscriptStudentCourseRepository extends CrudRepository { - @Query(value = "select e from TranscriptStudentCourseEntity e where e.studentCourseKey.studNo = :pen") - Iterable findByPen(@Param("pen")String pen); -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TranscriptStudentDemogRepository.java b/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TranscriptStudentDemogRepository.java deleted file mode 100644 index 18bfae07..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TranscriptStudentDemogRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package ca.bc.gov.educ.api.trax.repository; - -import ca.bc.gov.educ.api.trax.model.entity.TranscriptStudentDemogEntity; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -/** - * The interface TSW Student Demog repository. - */ -@Repository -public interface TranscriptStudentDemogRepository extends CrudRepository { - -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TraxStudentRepository.java b/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TraxStudentRepository.java index 56049aac..de68934a 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TraxStudentRepository.java +++ b/api/src/main/java/ca/bc/gov/educ/api/trax/repository/TraxStudentRepository.java @@ -7,7 +7,6 @@ import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import java.util.Date; import java.util.List; /** @@ -21,25 +20,12 @@ public interface TraxStudentRepository extends CrudRepository loadTraxStudent(@Param("pen") String pen); - // Student Load for the graduated - @Query(value="select trim(gs.stud_no) as PEN, gs.mincode as SCHOOL_OF_RECORD, m.mincode_grad as SCHOOL_AT_GRADUATION, gs.stud_grade as STUDENT_GRADE, m.stud_status as STUDENT_STATUS_CODE,\n" + - "m.archive_flag as ARCHIVE_FLAG, gs.grad_reqt_year as GRAD_REQT_YEAR, gs.grad_date as GRAD_DATE, m.slp_date as SLP_DATE, m.scc_date as SCC_DATE,\n" + - "trim(m.prgm_code) as PRGM_CODE1, trim(m.prgm_code2) as PRGM_CODE2, trim(m.prgm_code3) as PRGM_CODE3, trim(m.prgm_code4) as PRGM_CODE4, trim(m.prgm_code5) as PRGM_CODE5,\n" + - "trim(m.french_cert) as FRENCH_CERT, trim(m.stud_consed_flag) as STUD_CONSED_FLAG, trim(m.english_cert) as ENGLISH_CERT, m.honour_flag as HONOUR_FLAG, \n" + - "m.stud_citiz as CITIZENSHIP, m.french_dogwood as FRENCH_DOGWOOD, m.allowed_adult as ALLOWED_ADULT \n" + - "from student_master m, tsw_tran_demog gs\n" + - "where 1 = 1\n" + - "and m.stud_no = gs.stud_no\n" + - "and m.stud_no = :pen", nativeQuery=true) - @Transactional(readOnly = true) - List loadTraxGraduatedStudent(@Param("pen") String pen); - // Get Student Demographics Info from TRAX @Query(value="select trim(m.stud_no) as PEN, m.stud_given as LEGAL_FIRST_NAME, m.stud_surname as LEGAL_LAST_NAME, m.stud_middle as LEGAL_MIDDLE_NAME,\n" + "m.stud_status as STUDENT_STATUS_CODE, m.archive_flag as ARCHIVE_FLAG, m.mincode as SCHOOL_OF_RECORD, m.stud_grade as STUDENT_GRADE, m.postal as POSTAL_CODE,\n" + @@ -60,13 +46,4 @@ public interface TraxStudentRepository extends CrudRepository loadInitialCourseRestrictionRawData(); - @Query(value = "SELECT grad_reqt_year, grad_date, scc_date, slp_date FROM student_master WHERE stud_no = :pen", nativeQuery = true) - List getGraduationData(@Param("pen") String pen); - - @Query(value = "SELECT COUNT(*) FROM tsw_tran_nongrad WHERE stud_no = :pen AND non_grad_code = 'T'", nativeQuery = true) - Integer countAdult19RuleByPen(@Param("pen")String pen); - - @Query(value = "SELECT MAX(actv_date) FROM stud_actv WHERE stud_no = :pen AND actv_program = 'TRAX2040E1' AND actv_type = 'DOG' GROUP BY stud_no", nativeQuery = true) - Date getTheLatestDistributionDate(@Param("pen")String pen); - } diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxCommonService.java b/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxCommonService.java index b350d6fe..7ac0cfa9 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxCommonService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxCommonService.java @@ -1,7 +1,6 @@ package ca.bc.gov.educ.api.trax.service; import ca.bc.gov.educ.api.trax.constant.ConversionResultType; -import ca.bc.gov.educ.api.trax.constant.StudentLoadType; import ca.bc.gov.educ.api.trax.model.dto.*; import ca.bc.gov.educ.api.trax.model.entity.TraxStudentNoEntity; import ca.bc.gov.educ.api.trax.model.transformer.GradCourseTransformer; @@ -22,9 +21,6 @@ import java.util.*; -import static ca.bc.gov.educ.api.trax.util.EducGradTraxApiUtils.isTraxDateGreaterThanZero; -import static ca.bc.gov.educ.api.trax.util.EducGradTraxApiUtils.isTraxDateNullOrZero; - @SuppressWarnings("ALL") @Service @Slf4j @@ -36,9 +32,6 @@ public class TraxCommonService { private final TraxStudentNoTransformer traxStudentNoTransformer; private final GradCourseTransformer gradCourseTransformer; - private final TswService tswService; - private final SchoolService schoolService; - private final EducGradTraxApiConstants constants; @Autowired @@ -47,16 +40,12 @@ public TraxCommonService(TraxStudentRepository traxStudentRepository, GradCourseRepository gradCourseRepository, TraxStudentNoTransformer traxStudentNoTransformer, GradCourseTransformer gradCourseTransformer, - TswService tswService, - SchoolService schoolService, EducGradTraxApiConstants constants) { this.traxStudentRepository = traxStudentRepository; this.traxStudentNoRepository = traxStudentNoRepository; this.gradCourseRepository = gradCourseRepository; this.traxStudentNoTransformer = traxStudentNoTransformer; this.gradCourseTransformer = gradCourseTransformer; - this.tswService = tswService; - this.schoolService = schoolService; this.constants = constants; } @@ -73,33 +62,11 @@ public Integer getTotalNumberOfTraxStudentNo() { return traxStudentNoRepository.countAllByStatus(null); } - @Transactional(readOnly = true) - public boolean isGraduatedStudent(String pen) { - StudentLoadType loadType = getStudentLoadType(pen); - return loadType == StudentLoadType.GRAD_ONE || loadType == StudentLoadType.GRAD_TWO; - } - // Student Master from TRAX @Transactional(readOnly = true) - public List getStudentMasterDataFromTrax(String pen, String accessToken) { - List students; - StudentLoadType studentLoadType = constants.isEnableStudentMasterOnly()? StudentLoadType.UNGRAD : getStudentLoadType(pen); - switch (studentLoadType) { - case UNGRAD -> students = getStudentMasterAsNonGrad(pen, false, accessToken); - case GRAD_ONE, GRAD_TWO -> { - List results = traxStudentRepository.loadTraxGraduatedStudent(pen); - students = buildConversionGradStudents(results, studentLoadType, false, accessToken); - } - default -> students = Arrays.asList(buildErroredStudent(pen, studentLoadType)); - } - - return students; - } - - @Transactional(readOnly = true) - public List getStudentMasterAsNonGrad(String pen, boolean ongoingUpdate, String accessToken) { + public List getStudentMasterDataFromTrax(String pen) { List results = traxStudentRepository.loadTraxStudent(pen); - return buildConversionGradStudents(results, StudentLoadType.UNGRAD, ongoingUpdate, accessToken); + return buildConversionGradStudents(results); } @Transactional(readOnly = true) @@ -206,86 +173,15 @@ public TraxStudentNo saveTraxStudentNo(TraxStudentNo traxStudentNo) { return traxStudentNo; } - private List buildConversionGradStudents(List traxStudents, StudentLoadType studentLoadType, boolean ongoingUpdate, String accessToken) { + private List buildConversionGradStudents(List traxStudents) { List students = new ArrayList<>(); traxStudents.forEach(result -> { - ConvGradStudent student = populateConvGradStudent(result, studentLoadType); - handleAdultStartDateRule(student, studentLoadType, ongoingUpdate); - if (studentLoadType != StudentLoadType.UNGRAD) { - TranscriptStudentDemog transcriptStudentDemog = tswService.getTranscriptStudentDemog(student.getPen()); - student.setTranscriptStudentDemog(transcriptStudentDemog); - List transcriptStudentCourses = tswService.getTranscriptStudentCourses(student.getPen()); - student.setTranscriptStudentCourses(transcriptStudentCourses); - student.setDistributionDate(traxStudentRepository.getTheLatestDistributionDate(student.getPen())); - } - getSchoolsData(student, studentLoadType, accessToken); + ConvGradStudent student = populateConvGradStudent(result); students.add(student); }); return students; } - private void getSchoolsData(ConvGradStudent student, StudentLoadType studentLoadType, String accessToken) { - if (StringUtils.isBlank(accessToken)) { - return; - } - School schoolOfRecord = schoolService.getSchoolDetails(student.getSchoolOfRecord(), accessToken); - if (schoolOfRecord != null) { - student.setTranscriptSchool(schoolOfRecord); - } else { - return; - } - if (studentLoadType != StudentLoadType.UNGRAD) { - getSchoolsDataForGraduated(student, accessToken); - } - } - - private void getSchoolsDataForGraduated(ConvGradStudent student, String accessToken) { - CommonSchool commonSchoolOfRecord = schoolService.getCommonSchool(accessToken, student.getSchoolOfRecord()); - if (commonSchoolOfRecord != null) { - student.setTranscriptSchoolCategoryCode(commonSchoolOfRecord.getSchoolCategoryCode()); - } else { - return; - } - - boolean isGradSchoolDifferent = student.getSchoolAtGrad() != null && !StringUtils.equals(student.getSchoolAtGrad(), student.getSchoolOfRecord()); - if (isGradSchoolDifferent) { - School schoolAtGrad = schoolService.getSchoolDetails(student.getSchoolAtGrad(), accessToken); - if (schoolAtGrad != null) { - student.setCertificateSchool(schoolAtGrad); - } else { - student.setCertificateSchool(student.getTranscriptSchool()); - } - CommonSchool commonSchoolAtGrad = schoolService.getCommonSchool(accessToken, student.getSchoolAtGrad()); - if (commonSchoolAtGrad != null) { - student.setCertificateSchoolCategoryCode(commonSchoolAtGrad.getSchoolCategoryCode()); - } else { - student.setCertificateSchoolCategoryCode(student.getTranscriptSchoolCategoryCode()); - } - } else { - student.setCertificateSchool(student.getTranscriptSchool()); - student.setCertificateSchoolCategoryCode(student.getTranscriptSchoolCategoryCode()); - } - } - - private void handleAdultStartDateRule(ConvGradStudent student, StudentLoadType studentLoadType, boolean ongoingUpdate) { - if ("1950".equalsIgnoreCase(student.getGraduationRequirementYear()) && "AD".equalsIgnoreCase(student.getStudentGrade())) { - if (studentLoadType == StudentLoadType.UNGRAD) { - if (ongoingUpdate) { - student.setAdult19Rule(false); - } else { - student.setAdult19Rule(isAdult19Rule(student.getPen())); - } - } else { - if (student.isAllowedAdult() || - (student.getProgramCompletionDate() != null && EducGradTraxApiConstants.ADULT_18_RULE_VALID_DATE.compareTo(student.getProgramCompletionDate()) <= 0)) { - student.setAdult19Rule(false); - } else { - student.setAdult19Rule(true); - } - } - } - } - private void populateProgramCode(String code, List optionalProgramCodes) { if (StringUtils.isNotBlank(code)) { if (code.length() > 2) { @@ -296,7 +192,7 @@ private void populateProgramCode(String code, List optionalProgramCodes) } } - private ConvGradStudent populateConvGradStudent(Object[] fields, StudentLoadType studentLoadType) { + private ConvGradStudent populateConvGradStudent(Object[] fields) { String pen = (String) fields[0]; String schoolOfRecord = (String) fields[1]; String schoolAtGrad = (String) fields[2]; @@ -308,16 +204,9 @@ private ConvGradStudent populateConvGradStudent(Object[] fields, StudentLoadType // grad or non-grad Date programCompletionDate = null; String gradDateStr = null; - if (studentLoadType == StudentLoadType.UNGRAD) { - Integer gradDate = (Integer) fields[7]; // from student_master in trax - if (gradDate != null && !gradDate.equals(Integer.valueOf(0))) { - gradDateStr = gradDate.toString(); - } - } else { - gradDateStr = (String) fields[7]; // from tsw_tran_demog in tsw - if (gradDateStr != null) { - gradDateStr = gradDateStr.trim(); - } + Integer gradDate = (Integer) fields[7]; // from student_master in trax + if (gradDate != null && !gradDate.equals(Integer.valueOf(0))) { + gradDateStr = gradDate.toString(); } if (StringUtils.isNotBlank(gradDateStr) && !StringUtils.equals(gradDateStr, "0")) { @@ -362,9 +251,6 @@ private ConvGradStudent populateConvGradStudent(Object[] fields, StudentLoadType // french dogwood Character frenchDogwood = (Character) fields[20]; - // allowed adult - Character allowedAdult = (Character) fields[21]; - ConvGradStudent student = null; try { student = ConvGradStudent.builder() @@ -382,11 +268,10 @@ private ConvGradStudent populateConvGradStudent(Object[] fields, StudentLoadType .graduationRequirementYear(graduationRequirementYear) .programCodes(programCodes) .programCompletionDate(programCompletionDate) - .studentLoadType(studentLoadType) .consumerEducationRequirementMet(consumerEducationRequirementMet != null? (StringUtils.equalsIgnoreCase(consumerEducationRequirementMet.toString(), "Y")? "Y" : null) : null) .studentCitizenship(citizenship != null? citizenship.toString() : null) .frenchDogwood(frenchDogwood != null? frenchDogwood.toString() : null) - .allowedAdult(allowedAdult != null? StringUtils.equalsIgnoreCase(allowedAdult.toString(), "Y") : false) + .adult19Rule(false) .result(ConversionResultType.SUCCESS) .build(); } catch (Exception ex) { @@ -395,61 +280,4 @@ private ConvGradStudent populateConvGradStudent(Object[] fields, StudentLoadType return student; } - @Transactional(readOnly = true) - public StudentLoadType getStudentLoadType(String studNo) { - boolean existsUTG = tswService.existsTranscriptStudentDemog(studNo); - StudentLoadType loadType = StudentLoadType.NONE; - List list = traxStudentRepository.getGraduationData(studNo); - if (list != null && !list.isEmpty()) { - for (Object[] col : list) { - String graduationRequirementYear = (String) col[0]; - Integer gradDate = (Integer) col[1]; - Integer sccDate = (Integer) col[2]; - Integer slpDate = (Integer) col[3]; - - loadType = determineStudentLoadType(graduationRequirementYear, gradDate, sccDate, slpDate, existsUTG); - } - } - return loadType; - } - - private StudentLoadType determineStudentLoadType(String gradReqtYear, Integer gradDate, Integer sccDate, Integer slpDate, boolean existsUTG) { - StudentLoadType result; - if (!"SCCP".equalsIgnoreCase(gradReqtYear) && isTraxDateGreaterThanZero(sccDate)) { - result = StudentLoadType.GRAD_TWO; - } else if ((!"SCCP".equalsIgnoreCase(gradReqtYear) && isTraxDateGreaterThanZero(gradDate)) && isTraxDateNullOrZero(slpDate)) { - result = StudentLoadType.GRAD_ONE; - } else if ("SCCP".equalsIgnoreCase(gradReqtYear) && isTraxDateGreaterThanZero(sccDate)) { - result = StudentLoadType.GRAD_ONE; - } else if (isTraxDateNullOrZero(gradDate) && isTraxDateNullOrZero(sccDate)) { - result = StudentLoadType.UNGRAD; - } else { - result = StudentLoadType.NONE; - } - - // handling bad UTG data - if (!existsUTG) { - if (result == StudentLoadType.GRAD_TWO) { - result = StudentLoadType.NO_UTG; // report as an error - } else if (result == StudentLoadType.GRAD_ONE) { - result = StudentLoadType.UNGRAD; // treat it as nongrad - } - } - - return result; - } - - @Transactional(readOnly = true) - public boolean isAdult19Rule(String studNo) { - return traxStudentRepository.countAdult19RuleByPen(studNo) > 0; - } - - private ConvGradStudent buildErroredStudent(String pen, StudentLoadType studentLoadType) { - return ConvGradStudent.builder() - .pen(pen) - .studentLoadType(studentLoadType) - .result(ConversionResultType.FAILURE) - .build(); - } - } diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxUpdateService.java b/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxUpdateService.java index 88e05c51..e55f4b7f 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxUpdateService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/trax/service/TraxUpdateService.java @@ -103,7 +103,7 @@ private TraxUpdatedPubEvent persistTraxUpdatedEvent(TraxUpdateInGradEntity traxS private ConvGradStudent populateNewStudent(String pen) { ConvGradStudent payload = null; String accessToken = fetchAccessToken(); - List results = traxCommonService.getStudentMasterAsNonGrad(pen, true, accessToken); + List results = traxCommonService.getStudentMasterDataFromTrax(pen); if (results != null && !results.isEmpty()) { payload = results.get(0); } @@ -132,7 +132,7 @@ private TraxStudentUpdateDTO populateEventPayload(String updateType, String pen) TraxStudentUpdateDTO result = null; ConvGradStudent traxStudent; String accessToken = fetchAccessToken(); - List results = traxCommonService.getStudentMasterAsNonGrad(pen, true, accessToken); + List results = traxCommonService.getStudentMasterDataFromTrax(pen); if (results != null && !results.isEmpty()) { traxStudent = results.get(0); switch(updateType) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/service/TswService.java b/api/src/main/java/ca/bc/gov/educ/api/trax/service/TswService.java deleted file mode 100644 index 43e0d723..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/service/TswService.java +++ /dev/null @@ -1,48 +0,0 @@ -package ca.bc.gov.educ.api.trax.service; - -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentCourse; -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentDemog; -import ca.bc.gov.educ.api.trax.model.transformer.TranscriptStudentCourseTransformer; -import ca.bc.gov.educ.api.trax.model.transformer.TranscriptStudentDemogTransformer; -import ca.bc.gov.educ.api.trax.repository.TranscriptStudentCourseRepository; -import ca.bc.gov.educ.api.trax.repository.TranscriptStudentDemogRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Service -public class TswService { - - @Autowired - private TranscriptStudentDemogRepository transcriptStudentDemogRepository; - - @Autowired - private TranscriptStudentDemogTransformer transcriptStudentDemogTransformer; - - @Autowired - private TranscriptStudentCourseRepository transcriptStudentCourseRepository; - - @Autowired - private TranscriptStudentCourseTransformer transcriptStudentCourseTransformer; - - private static Logger logger = LoggerFactory.getLogger(TswService.class); - - @Transactional(readOnly = true) - public TranscriptStudentDemog getTranscriptStudentDemog(String studNo) { - return transcriptStudentDemogTransformer.transformToDTO(transcriptStudentDemogRepository.findById(studNo)); - } - - @Transactional(readOnly = true) - public List getTranscriptStudentCourses(String studNo) { - return transcriptStudentCourseTransformer.transformToDTO(transcriptStudentCourseRepository.findByPen(studNo)); - } - - @Transactional(readOnly = true) - public boolean existsTranscriptStudentDemog(String studNo) { - return transcriptStudentDemogRepository.existsById(studNo); - } -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/trax/util/EducGradTraxApiConstants.java b/api/src/main/java/ca/bc/gov/educ/api/trax/util/EducGradTraxApiConstants.java index eea710ea..5b54f029 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/trax/util/EducGradTraxApiConstants.java +++ b/api/src/main/java/ca/bc/gov/educ/api/trax/util/EducGradTraxApiConstants.java @@ -64,7 +64,6 @@ public class EducGradTraxApiConstants { public static final String GET_STUDENTS_BY_GRAD_YEAR_MAPPING = "/get-students/snapshot/{gradYear}"; public static final String GET_STUDENTS_BY_GRAD_YEAR_AND_SCHOOL_MAPPING = "/get-students/snapshot/{gradYear}/{minCode}"; - public static final String GET_TRAX_STUDENT_GRADUATED_BY_PEN_MAPPING = "/student/graduated/{pen}"; public static final String GET_TRAX_STUDENT_MASTER_MAPPING = "/student-master/{pen}"; public static final String GET_TRAX_STUDENT_DEMOG_MAPPING = "/student-demog/{pen}"; public static final String GET_TRAX_STUDENT_NO_LIST_BY_PAGING_MAPPING = "/student-no-list/paginated"; @@ -120,10 +119,6 @@ public class EducGradTraxApiConstants { @Value("${splunk.log-helper.enabled}") private boolean splunkLogHelperEnabled; - // Forced to read student master only - @Value("${trax.get.student-master-only.enabled}") - private boolean enableStudentMasterOnly; - @Value("${endpoint.educ-school-api.get-school-by-mincode.url}") private String schoolByMincodeSchoolApiUrl; diff --git a/api/src/main/resources/application.yaml b/api/src/main/resources/application.yaml index 6d04ba17..53011b7c 100644 --- a/api/src/main/resources/application.yaml +++ b/api/src/main/resources/application.yaml @@ -139,9 +139,6 @@ cron: trax: update: enabled: ${ENABLE_TRAX_UPDATE} - get: - student-master-only: - enabled: ${ENABLE_GET_STUDENT_MASTER_ONLY} #Splunk LogHelper splunk: diff --git a/api/src/main/resources/db/migration/1.0/V1.0.25__DDL-DROP_SYNONYM-tsw_tables.sql b/api/src/main/resources/db/migration/1.0/V1.0.25__DDL-DROP_SYNONYM-tsw_tables.sql new file mode 100644 index 00000000..e10882fc --- /dev/null +++ b/api/src/main/resources/db/migration/1.0/V1.0.25__DDL-DROP_SYNONYM-tsw_tables.sql @@ -0,0 +1,3 @@ +DROP SYNONYM "TSW_TRAN_DEMOG"; +DROP SYNONYM "TSW_TRAN_CRSE"; +DROP SYNONYM "TSW_TRAN_NONGRAD"; \ No newline at end of file diff --git a/api/src/main/resources/db/migration/1.0/V1.0.26__DDL-DROP_SYNONYM-stud_actv.sql b/api/src/main/resources/db/migration/1.0/V1.0.26__DDL-DROP_SYNONYM-stud_actv.sql new file mode 100644 index 00000000..99ea36ee --- /dev/null +++ b/api/src/main/resources/db/migration/1.0/V1.0.26__DDL-DROP_SYNONYM-stud_actv.sql @@ -0,0 +1 @@ +DROP SYNONYM "STUD_ACTV"; -- FOR "STUD_ACTV"@"TRAXLINK.WORLD"; diff --git a/api/src/test/java/ca/bc/gov/educ/api/trax/controller/TraxCommonControllerTest.java b/api/src/test/java/ca/bc/gov/educ/api/trax/controller/TraxCommonControllerTest.java index aa84524d..5a361d0f 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/trax/controller/TraxCommonControllerTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/trax/controller/TraxCommonControllerTest.java @@ -69,9 +69,9 @@ public void testGetStudentMasterDataFromTrax() { .schoolOfRecord("12345678") .build(); studentList.add(obj); - Mockito.when(traxCommonService.getStudentMasterDataFromTrax(pen, "123")).thenReturn(studentList); - traxCommonController.getStudentMasterDataFromTrax(pen, "123"); - Mockito.verify(traxCommonService).getStudentMasterDataFromTrax(pen, "123"); + Mockito.when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(studentList); + traxCommonController.getStudentMasterDataFromTrax(pen); + Mockito.verify(traxCommonService).getStudentMasterDataFromTrax(pen); } @Test @@ -145,10 +145,10 @@ public void testSaveTraxStudentNo() { Mockito.verify(traxCommonService).saveTraxStudentNo(obj); } - @Test - public void testGetStudentIsGraduatedByPen() { - Mockito.when(traxCommonService.isGraduatedStudent("123456789")).thenReturn(true); - traxCommonController.getStudentIsGraduatedByPen("123456789"); - Mockito.verify(traxCommonService).isGraduatedStudent("123456789"); - } +// @Test +// public void testGetStudentIsGraduatedByPen() { +// Mockito.when(traxCommonService.isGraduatedStudent("123456789")).thenReturn(true); +// traxCommonController.getStudentIsGraduatedByPen("123456789"); +// Mockito.verify(traxCommonService).isGraduatedStudent("123456789"); +// } } diff --git a/api/src/test/java/ca/bc/gov/educ/api/trax/controller/TswControllerTest.java b/api/src/test/java/ca/bc/gov/educ/api/trax/controller/TswControllerTest.java deleted file mode 100644 index d86125e7..00000000 --- a/api/src/test/java/ca/bc/gov/educ/api/trax/controller/TswControllerTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package ca.bc.gov.educ.api.trax.controller; - -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentCourse; -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentDemog; -import ca.bc.gov.educ.api.trax.service.TswService; -import ca.bc.gov.educ.api.trax.util.GradValidation; -import ca.bc.gov.educ.api.trax.util.ResponseHelper; -import org.junit.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.util.Arrays; - -@RunWith(MockitoJUnitRunner.class) -@ExtendWith(MockitoExtension.class) -public class TswControllerTest { - - @Mock - private TswService tswService; - - @Mock - GradValidation validation; - - @Mock - ResponseHelper responseHelper; - - @InjectMocks - private TswController tswController; - - @Test - public void testGetTranscriptStudentDemogByPen() { - TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); - transcriptStudentDemog.setStudNo("123456789"); - transcriptStudentDemog.setMincode("7654321"); - - Mockito.when(tswService.getTranscriptStudentDemog("123456789")).thenReturn(transcriptStudentDemog); - tswController.getTranscriptStudentDemogByPen("123456789"); - Mockito.verify(tswService).getTranscriptStudentDemog("123456789"); - - } - - @Test - public void testGetTranscriptStudentCoursesByPen() { - TranscriptStudentCourse transcriptStudentCourse = new TranscriptStudentCourse(); - transcriptStudentCourse.setStudNo("123456789"); - transcriptStudentCourse.setCourseCode("Test"); - transcriptStudentCourse.setCourseLevel("11"); - transcriptStudentCourse.setCourseName("Test Course1"); - - Mockito.when(tswService.getTranscriptStudentCourses("123456789")).thenReturn(Arrays.asList(transcriptStudentCourse)); - tswController.getTranscriptStudentCoursesByPen("123456789"); - Mockito.verify(tswService).getTranscriptStudentCourses("123456789"); - - } - -} diff --git a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java index 095afbb4..5435d6af 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxCommonServiceTest.java @@ -1,7 +1,5 @@ package ca.bc.gov.educ.api.trax.service; -import ca.bc.gov.educ.api.trax.constant.ConversionResultType; -import ca.bc.gov.educ.api.trax.constant.StudentLoadType; import ca.bc.gov.educ.api.trax.messaging.NatsConnection; import ca.bc.gov.educ.api.trax.messaging.jetstream.Publisher; import ca.bc.gov.educ.api.trax.messaging.jetstream.Subscriber; @@ -15,8 +13,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -55,9 +51,6 @@ public class TraxCommonServiceTest { @MockBean TraxStudentNoRepository traxStudentNoRepository; - @MockBean - TswService tswService; - @MockBean SchoolService schoolService; @@ -99,12 +92,9 @@ public void testGetStudentMasterDataFromTrax() { List list = new ArrayList<>(); list.add(cols); - when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); - when(this.traxStudentRepository.loadTraxStudent(pen)).thenReturn(results); - when(this.traxStudentRepository.countAdult19RuleByPen(pen)).thenReturn(1); - var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); + var result = traxCommonService.getStudentMasterDataFromTrax(pen); assertThat(result).isNotNull(); assertThat(result).hasSize(1); @@ -113,572 +103,464 @@ public void testGetStudentMasterDataFromTrax() { assertThat(responseObject.getStudentStatus()).isEqualTo(status.toString()); } - @Test - public void testGetGraduatedStudentMasterDataFromTrax() { - Object[] obj = new Object[] { - "123456789", "1234567", "1234567", "12", Character.valueOf('A'),Character.valueOf('A'), "2018", "202206", - Integer.valueOf(0), Integer.valueOf(0), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), null - }; - List results = new ArrayList<>(); - results.add(obj); - - final String pen = (String) obj[0]; - final String mincode = (String) obj[1]; - Character status = (Character)obj[4]; - - // TSW Demographics - TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); - transcriptStudentDemog.setStudNo(pen); - transcriptStudentDemog.setMincode(mincode); - transcriptStudentDemog.setGradDate(202201L); - - // TSW Courses - TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); - tswCourse1.setStudNo(pen); - tswCourse1.setReportType("1"); - tswCourse1.setCourseCode("Generic"); - tswCourse1.setCourseName("Generic Course Name"); - tswCourse1.setCourseLevel("12"); - tswCourse1.setFinalPercentage("91.00"); - tswCourse1.setFinalLG("A"); - tswCourse1.setCourseSession("202206"); - tswCourse1.setNumberOfCredits("4"); - tswCourse1.setUsedForGrad("4"); - tswCourse1.setFoundationReq("10"); - tswCourse1.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse"); - tswCourse2.setCourseName("Test Course Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("92.00"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setSpecialCase("E"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse2"); - tswCourse2.setCourseName("Test Course2 Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("XMT"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); - tswAssessment.setStudNo(pen); - tswAssessment.setReportType("3"); - tswAssessment.setCourseCode("TestAssmt"); - tswAssessment.setCourseName("Test Assessment Name"); - tswAssessment.setCourseLevel("12"); - tswAssessment.setFinalPercentage("XMT"); - tswAssessment.setCourseSession("202206"); - tswAssessment.setFoundationReq("15"); - tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); - - School school = new School(); - school.setMinCode(mincode); - school.setSchoolCategory("02"); - - CommonSchool commonSchool = new CommonSchool(); - commonSchool.setSchlNo(mincode); - commonSchool.setSchoolName("Test School"); - commonSchool.setSchoolCategoryCode("02"); - - Object[] cols = new Object[] { - "2018", Integer.valueOf(202206), Integer.valueOf(0), Integer.valueOf(0) - }; - List list = new ArrayList<>(); - list.add(cols); - - when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); - when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); - when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); - when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); - when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); - when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); - when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); - - var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); - - assertThat(result).hasSize(1); - ConvGradStudent responseObject = result.get(0); - assertThat(responseObject.getPen()).isEqualTo(pen); - assertThat(responseObject.getStudentStatus()).isEqualTo(status.toString()); - assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.GRAD_ONE); - assertThat(responseObject.getTranscriptStudentDemog()).isNotNull(); - assertThat(responseObject.getTranscriptStudentCourses()).hasSize(4); - } - - @Test - public void testGetGraduatedStudentMasterDataFromTraxFor1950AdultProgram_whenAllowedAdult_isYes_thenReturns_adult19RuleAsFalse() { - Object[] obj = new Object[] { - "123456789", "1234567", "1234568", "AD", Character.valueOf('A'),Character.valueOf('A'), "1950", "202206", - Integer.valueOf(0), Integer.valueOf(0), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), Character.valueOf('Y') - }; - List results = new ArrayList<>(); - results.add(obj); - - final String pen = (String) obj[0]; - final String mincode = (String) obj[1]; - final String mincodeAtGrad = (String) obj[2]; - Character status = (Character)obj[4]; - - // TSW Demographics - TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); - transcriptStudentDemog.setStudNo(pen); - transcriptStudentDemog.setMincode(mincode); - transcriptStudentDemog.setGradDate(202201L); - - // TSW Courses - TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); - tswCourse1.setStudNo(pen); - tswCourse1.setReportType("1"); - tswCourse1.setCourseCode("Generic"); - tswCourse1.setCourseName("Generic Course Name"); - tswCourse1.setCourseLevel("12"); - tswCourse1.setFinalPercentage("91.00"); - tswCourse1.setFinalLG("A"); - tswCourse1.setCourseSession("202206"); - tswCourse1.setNumberOfCredits("4"); - tswCourse1.setUsedForGrad("4"); - tswCourse1.setFoundationReq("10"); - tswCourse1.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse"); - tswCourse2.setCourseName("Test Course Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("92.00"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setSpecialCase("E"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse2"); - tswCourse2.setCourseName("Test Course2 Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("XMT"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); - tswAssessment.setStudNo(pen); - tswAssessment.setReportType("3"); - tswAssessment.setCourseCode("TestAssmt"); - tswAssessment.setCourseName("Test Assessment Name"); - tswAssessment.setCourseLevel("12"); - tswAssessment.setFinalPercentage("XMT"); - tswAssessment.setCourseSession("202206"); - tswAssessment.setFoundationReq("15"); - tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); - - School school = new School(); - school.setMinCode(mincode); - school.setSchoolCategory("02"); - - CommonSchool commonSchool = new CommonSchool(); - commonSchool.setSchlNo(mincode); - commonSchool.setSchoolName("Test School"); - commonSchool.setSchoolCategoryCode("02"); - - School schoolAtGrad = new School(); - schoolAtGrad.setMinCode(mincodeAtGrad); - schoolAtGrad.setSchoolCategory("02"); - - CommonSchool commonSchoolAtGrad = new CommonSchool(); - commonSchoolAtGrad.setSchlNo(mincodeAtGrad); - commonSchoolAtGrad.setSchoolName("Test GRAD School"); - commonSchoolAtGrad.setSchoolCategoryCode("02"); - - when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); - when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); - - when(this.schoolService.getSchoolDetails(mincodeAtGrad, "123")).thenReturn(schoolAtGrad); - when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchoolAtGrad); - - Object[] cols = new Object[] { - "1950", Integer.valueOf(202206), Integer.valueOf(0), Integer.valueOf(0) - }; - List list = new ArrayList<>(); - list.add(cols); - - when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); - when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); - when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); - when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); - when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); - - var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); - - assertThat(result).hasSize(1); - ConvGradStudent responseObject = result.get(0); - assertThat(responseObject.getPen()).isEqualTo(pen); - assertThat(responseObject.getStudentStatus()).isEqualTo(status.toString()); - assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.GRAD_ONE); - assertThat(responseObject.getTranscriptStudentDemog()).isNotNull(); - assertThat(responseObject.getTranscriptStudentCourses()).hasSize(4); - assertThat(responseObject.isAdult19Rule()).isFalse(); - } - - @Test - public void testGetGraduatedStudentMasterDataFromTraxFor1950AdultProgram_whenAllowedAdult_isNull_andGradDate_isBefore201207_thenReturns_adult19RuleAsTrue() { - Object[] obj = new Object[] { - "123456789", "1234567", "1234568", "AD", Character.valueOf('A'),Character.valueOf('A'), "1950", "201206", - Integer.valueOf(0), Integer.valueOf(0), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), null - }; - List results = new ArrayList<>(); - results.add(obj); - - final String pen = (String) obj[0]; - final String mincode = (String) obj[1]; - final String mincodeAtGrad = (String) obj[2]; - Character status = (Character)obj[4]; - - // TSW Demographics - TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); - transcriptStudentDemog.setStudNo(pen); - transcriptStudentDemog.setMincode(mincode); - transcriptStudentDemog.setGradDate(202201L); - - // TSW Courses - TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); - tswCourse1.setStudNo(pen); - tswCourse1.setReportType("1"); - tswCourse1.setCourseCode("Generic"); - tswCourse1.setCourseName("Generic Course Name"); - tswCourse1.setCourseLevel("12"); - tswCourse1.setFinalPercentage("91.00"); - tswCourse1.setFinalLG("A"); - tswCourse1.setCourseSession("202206"); - tswCourse1.setNumberOfCredits("4"); - tswCourse1.setUsedForGrad("4"); - tswCourse1.setFoundationReq("10"); - tswCourse1.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse"); - tswCourse2.setCourseName("Test Course Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("92.00"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setSpecialCase("E"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse2"); - tswCourse2.setCourseName("Test Course2 Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("XMT"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); - tswAssessment.setStudNo(pen); - tswAssessment.setReportType("3"); - tswAssessment.setCourseCode("TestAssmt"); - tswAssessment.setCourseName("Test Assessment Name"); - tswAssessment.setCourseLevel("12"); - tswAssessment.setFinalPercentage("XMT"); - tswAssessment.setCourseSession("202206"); - tswAssessment.setFoundationReq("15"); - tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); - - School school = new School(); - school.setMinCode(mincode); - school.setSchoolCategory("02"); - - CommonSchool commonSchool = new CommonSchool(); - commonSchool.setSchlNo(mincode); - commonSchool.setSchoolName("Test School"); - commonSchool.setSchoolCategoryCode("02"); - - School schoolAtGrad = new School(); - schoolAtGrad.setMinCode(mincodeAtGrad); - schoolAtGrad.setSchoolCategory("02"); - - CommonSchool commonSchoolAtGrad = new CommonSchool(); - commonSchoolAtGrad.setSchlNo(mincodeAtGrad); - commonSchoolAtGrad.setSchoolName("Test GRAD School"); - commonSchoolAtGrad.setSchoolCategoryCode("02"); - - when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); - when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); - when(this.schoolService.getSchoolDetails(mincodeAtGrad, "123")).thenReturn(schoolAtGrad); - when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchoolAtGrad); - - Object[] cols = new Object[] { - "1950", Integer.valueOf(201206), Integer.valueOf(0), Integer.valueOf(0) - }; - List list = new ArrayList<>(); - list.add(cols); - - when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); - - when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); - when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); - when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); - when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); - - var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); - - assertThat(result).hasSize(1); - ConvGradStudent responseObject = result.get(0); - assertThat(responseObject.getPen()).isEqualTo(pen); - assertThat(responseObject.getStudentStatus()).isEqualTo(status.toString()); - assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.GRAD_ONE); - assertThat(responseObject.getTranscriptStudentDemog()).isNotNull(); - assertThat(responseObject.getTranscriptStudentCourses()).hasSize(4); - assertThat(responseObject.isAdult19Rule()).isTrue(); - } - - @Test - public void testGetGraduatedStudentMasterDataFromTraxForNone() { - Object[] obj = new Object[] { - "123456789", "1234567", "1234567", "12", Character.valueOf('A'),Character.valueOf('A'), "SCCP", "201206", - Integer.valueOf(0), Integer.valueOf(0), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), null - }; - List results = new ArrayList<>(); - results.add(obj); - - final String pen = (String) obj[0]; - final String mincode = (String) obj[1]; - Character status = (Character)obj[4]; - - // TSW Demographics - TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); - transcriptStudentDemog.setStudNo(pen); - transcriptStudentDemog.setMincode(mincode); - transcriptStudentDemog.setGradDate(202201L); - - // TSW Courses - TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); - tswCourse1.setStudNo(pen); - tswCourse1.setReportType("1"); - tswCourse1.setCourseCode("Generic"); - tswCourse1.setCourseName("Generic Course Name"); - tswCourse1.setCourseLevel("12"); - tswCourse1.setFinalPercentage("91.00"); - tswCourse1.setFinalLG("A"); - tswCourse1.setCourseSession("202206"); - tswCourse1.setNumberOfCredits("4"); - tswCourse1.setUsedForGrad("4"); - tswCourse1.setFoundationReq("10"); - tswCourse1.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse"); - tswCourse2.setCourseName("Test Course Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("92.00"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setSpecialCase("E"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse2"); - tswCourse2.setCourseName("Test Course2 Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("XMT"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); - tswAssessment.setStudNo(pen); - tswAssessment.setReportType("3"); - tswAssessment.setCourseCode("TestAssmt"); - tswAssessment.setCourseName("Test Assessment Name"); - tswAssessment.setCourseLevel("12"); - tswAssessment.setFinalPercentage("XMT"); - tswAssessment.setCourseSession("202206"); - tswAssessment.setFoundationReq("15"); - tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); - - School school = new School(); - school.setMinCode(mincode); - school.setSchoolCategory("02"); - - CommonSchool commonSchool = new CommonSchool(); - commonSchool.setSchlNo(mincode); - commonSchool.setSchoolName("Test School"); - commonSchool.setSchoolCategoryCode("02"); - - Object[] cols = new Object[] { - "SCCP", Integer.valueOf(201206), Integer.valueOf(0), Integer.valueOf(0) - }; - List list = new ArrayList<>(); - list.add(cols); - - when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); - when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); - when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); - when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); - when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); - when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); - when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); - - var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); - - assertThat(result).hasSize(1); - ConvGradStudent responseObject = result.get(0); - assertThat(responseObject.getPen()).isEqualTo(pen); - assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.NONE); - assertThat(responseObject.getResult()).isEqualTo(ConversionResultType.FAILURE); - } - - @Test - public void testGetGraduatedStudentMasterDataFromTraxForTwoPrograms() { - Object[] obj = new Object[] { - "123456789", "1234567", "1234567", "12", Character.valueOf('A'),Character.valueOf('A'), "2018", "0", - Integer.valueOf(202206), Integer.valueOf(202206), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), null - }; - List results = new ArrayList<>(); - results.add(obj); - - final String pen = (String) obj[0]; - final String mincode = (String) obj[1]; - Character status = (Character)obj[4]; - - // TSW Demographics - TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); - transcriptStudentDemog.setStudNo(pen); - transcriptStudentDemog.setMincode(mincode); - transcriptStudentDemog.setGradDate(202201L); - - // TSW Courses - TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); - tswCourse1.setStudNo(pen); - tswCourse1.setReportType("1"); - tswCourse1.setCourseCode("Generic"); - tswCourse1.setCourseName("Generic Course Name"); - tswCourse1.setCourseLevel("12"); - tswCourse1.setFinalPercentage("91.00"); - tswCourse1.setFinalLG("A"); - tswCourse1.setCourseSession("202206"); - tswCourse1.setNumberOfCredits("4"); - tswCourse1.setUsedForGrad("4"); - tswCourse1.setFoundationReq("10"); - tswCourse1.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse"); - tswCourse2.setCourseName("Test Course Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("92.00"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setSpecialCase("E"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); - tswCourse2.setStudNo(pen); - tswCourse2.setReportType("2"); - tswCourse2.setCourseCode("TestCourse2"); - tswCourse2.setCourseName("Test Course2 Name"); - tswCourse2.setCourseLevel("12"); - tswCourse2.setFinalPercentage("XMT"); - tswCourse2.setFinalLG("A"); - tswCourse2.setCourseSession("202206"); - tswCourse2.setNumberOfCredits("4"); - tswCourse2.setUsedForGrad("4"); - tswCourse2.setFoundationReq("11"); - tswCourse2.setUpdateDate(20220601L); - - TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); - tswAssessment.setStudNo(pen); - tswAssessment.setReportType("3"); - tswAssessment.setCourseCode("TestAssmt"); - tswAssessment.setCourseName("Test Assessment Name"); - tswAssessment.setCourseLevel("12"); - tswAssessment.setFinalPercentage("XMT"); - tswAssessment.setCourseSession("202206"); - tswAssessment.setFoundationReq("15"); - tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); - - School school = new School(); - school.setMinCode(mincode); - school.setSchoolCategory("02"); - - CommonSchool commonSchool = new CommonSchool(); - commonSchool.setSchlNo(mincode); - commonSchool.setSchoolName("Test School"); - commonSchool.setSchoolCategoryCode("02"); - - // grad_reqt_year, grad_date, scc_date, slp_date - Object[] cols = new Object[] { - "2018", Integer.valueOf(0), Integer.valueOf(202206), Integer.valueOf(202206) - }; - List list = new ArrayList<>(); - list.add(cols); - - when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); - when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); - when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); - when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); - when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); - when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); - when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); - - var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); - - assertThat(result).hasSize(1); - ConvGradStudent responseObject = result.get(0); - assertThat(responseObject.getPen()).isEqualTo(pen); - assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.GRAD_TWO); - assertThat(responseObject.getResult()).isEqualTo(ConversionResultType.SUCCESS); - } +// @Test +// public void testGetGraduatedStudentMasterDataFromTraxFor1950AdultProgram_whenAllowedAdult_isYes_thenReturns_adult19RuleAsFalse() { +// Object[] obj = new Object[] { +// "123456789", "1234567", "1234568", "AD", Character.valueOf('A'),Character.valueOf('A'), "1950", "202206", +// Integer.valueOf(0), Integer.valueOf(0), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), Character.valueOf('Y') +// }; +// List results = new ArrayList<>(); +// results.add(obj); +// +// final String pen = (String) obj[0]; +// final String mincode = (String) obj[1]; +// final String mincodeAtGrad = (String) obj[2]; +// Character status = (Character)obj[4]; +// +// // TSW Demographics +// TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); +// transcriptStudentDemog.setStudNo(pen); +// transcriptStudentDemog.setMincode(mincode); +// transcriptStudentDemog.setGradDate(202201L); +// +// // TSW Courses +// TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); +// tswCourse1.setStudNo(pen); +// tswCourse1.setReportType("1"); +// tswCourse1.setCourseCode("Generic"); +// tswCourse1.setCourseName("Generic Course Name"); +// tswCourse1.setCourseLevel("12"); +// tswCourse1.setFinalPercentage("91.00"); +// tswCourse1.setFinalLG("A"); +// tswCourse1.setCourseSession("202206"); +// tswCourse1.setNumberOfCredits("4"); +// tswCourse1.setUsedForGrad("4"); +// tswCourse1.setFoundationReq("10"); +// tswCourse1.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse"); +// tswCourse2.setCourseName("Test Course Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("92.00"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setSpecialCase("E"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse2"); +// tswCourse2.setCourseName("Test Course2 Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("XMT"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); +// tswAssessment.setStudNo(pen); +// tswAssessment.setReportType("3"); +// tswAssessment.setCourseCode("TestAssmt"); +// tswAssessment.setCourseName("Test Assessment Name"); +// tswAssessment.setCourseLevel("12"); +// tswAssessment.setFinalPercentage("XMT"); +// tswAssessment.setCourseSession("202206"); +// tswAssessment.setFoundationReq("15"); +// tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); +// +// School school = new School(); +// school.setMinCode(mincode); +// school.setSchoolCategory("02"); +// +// CommonSchool commonSchool = new CommonSchool(); +// commonSchool.setSchlNo(mincode); +// commonSchool.setSchoolName("Test School"); +// commonSchool.setSchoolCategoryCode("02"); +// +// School schoolAtGrad = new School(); +// schoolAtGrad.setMinCode(mincodeAtGrad); +// schoolAtGrad.setSchoolCategory("02"); +// +// CommonSchool commonSchoolAtGrad = new CommonSchool(); +// commonSchoolAtGrad.setSchlNo(mincodeAtGrad); +// commonSchoolAtGrad.setSchoolName("Test GRAD School"); +// commonSchoolAtGrad.setSchoolCategoryCode("02"); +// +// when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); +// when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); +// +// when(this.schoolService.getSchoolDetails(mincodeAtGrad, "123")).thenReturn(schoolAtGrad); +// when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchoolAtGrad); +// +// Object[] cols = new Object[] { +// "1950", Integer.valueOf(202206), Integer.valueOf(0), Integer.valueOf(0) +// }; +// List list = new ArrayList<>(); +// list.add(cols); +// +// when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); +// when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); +// when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); +// when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); +// when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); +// +// var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); +// +// assertThat(result).hasSize(1); +// ConvGradStudent responseObject = result.get(0); +// assertThat(responseObject.getPen()).isEqualTo(pen); +// assertThat(responseObject.getStudentStatus()).isEqualTo(status.toString()); +// assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.GRAD_ONE); +// assertThat(responseObject.getTranscriptStudentDemog()).isNotNull(); +// assertThat(responseObject.getTranscriptStudentCourses()).hasSize(4); +// assertThat(responseObject.isAdult19Rule()).isFalse(); +// } +// +// @Test +// public void testGetGraduatedStudentMasterDataFromTraxFor1950AdultProgram_whenAllowedAdult_isNull_andGradDate_isBefore201207_thenReturns_adult19RuleAsTrue() { +// Object[] obj = new Object[] { +// "123456789", "1234567", "1234568", "AD", Character.valueOf('A'),Character.valueOf('A'), "1950", "201206", +// Integer.valueOf(0), Integer.valueOf(0), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), null +// }; +// List results = new ArrayList<>(); +// results.add(obj); +// +// final String pen = (String) obj[0]; +// final String mincode = (String) obj[1]; +// final String mincodeAtGrad = (String) obj[2]; +// Character status = (Character)obj[4]; +// +// // TSW Demographics +// TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); +// transcriptStudentDemog.setStudNo(pen); +// transcriptStudentDemog.setMincode(mincode); +// transcriptStudentDemog.setGradDate(202201L); +// +// // TSW Courses +// TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); +// tswCourse1.setStudNo(pen); +// tswCourse1.setReportType("1"); +// tswCourse1.setCourseCode("Generic"); +// tswCourse1.setCourseName("Generic Course Name"); +// tswCourse1.setCourseLevel("12"); +// tswCourse1.setFinalPercentage("91.00"); +// tswCourse1.setFinalLG("A"); +// tswCourse1.setCourseSession("202206"); +// tswCourse1.setNumberOfCredits("4"); +// tswCourse1.setUsedForGrad("4"); +// tswCourse1.setFoundationReq("10"); +// tswCourse1.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse"); +// tswCourse2.setCourseName("Test Course Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("92.00"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setSpecialCase("E"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse2"); +// tswCourse2.setCourseName("Test Course2 Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("XMT"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); +// tswAssessment.setStudNo(pen); +// tswAssessment.setReportType("3"); +// tswAssessment.setCourseCode("TestAssmt"); +// tswAssessment.setCourseName("Test Assessment Name"); +// tswAssessment.setCourseLevel("12"); +// tswAssessment.setFinalPercentage("XMT"); +// tswAssessment.setCourseSession("202206"); +// tswAssessment.setFoundationReq("15"); +// tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); +// +// School school = new School(); +// school.setMinCode(mincode); +// school.setSchoolCategory("02"); +// +// CommonSchool commonSchool = new CommonSchool(); +// commonSchool.setSchlNo(mincode); +// commonSchool.setSchoolName("Test School"); +// commonSchool.setSchoolCategoryCode("02"); +// +// School schoolAtGrad = new School(); +// schoolAtGrad.setMinCode(mincodeAtGrad); +// schoolAtGrad.setSchoolCategory("02"); +// +// CommonSchool commonSchoolAtGrad = new CommonSchool(); +// commonSchoolAtGrad.setSchlNo(mincodeAtGrad); +// commonSchoolAtGrad.setSchoolName("Test GRAD School"); +// commonSchoolAtGrad.setSchoolCategoryCode("02"); +// +// when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); +// when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); +// when(this.schoolService.getSchoolDetails(mincodeAtGrad, "123")).thenReturn(schoolAtGrad); +// when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchoolAtGrad); +// +// Object[] cols = new Object[] { +// "1950", Integer.valueOf(201206), Integer.valueOf(0), Integer.valueOf(0) +// }; +// List list = new ArrayList<>(); +// list.add(cols); +// +// when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); +// +// when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); +// when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); +// when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); +// when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); +// +// var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); +// +// assertThat(result).hasSize(1); +// ConvGradStudent responseObject = result.get(0); +// assertThat(responseObject.getPen()).isEqualTo(pen); +// assertThat(responseObject.getStudentStatus()).isEqualTo(status.toString()); +// assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.GRAD_ONE); +// assertThat(responseObject.getTranscriptStudentDemog()).isNotNull(); +// assertThat(responseObject.getTranscriptStudentCourses()).hasSize(4); +// assertThat(responseObject.isAdult19Rule()).isTrue(); +// } +// +// @Test +// public void testGetGraduatedStudentMasterDataFromTraxForNone() { +// Object[] obj = new Object[] { +// "123456789", "1234567", "1234567", "12", Character.valueOf('A'),Character.valueOf('A'), "SCCP", "201206", +// Integer.valueOf(0), Integer.valueOf(0), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), null +// }; +// List results = new ArrayList<>(); +// results.add(obj); +// +// final String pen = (String) obj[0]; +// final String mincode = (String) obj[1]; +// Character status = (Character)obj[4]; +// +// // TSW Demographics +// TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); +// transcriptStudentDemog.setStudNo(pen); +// transcriptStudentDemog.setMincode(mincode); +// transcriptStudentDemog.setGradDate(202201L); +// +// // TSW Courses +// TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); +// tswCourse1.setStudNo(pen); +// tswCourse1.setReportType("1"); +// tswCourse1.setCourseCode("Generic"); +// tswCourse1.setCourseName("Generic Course Name"); +// tswCourse1.setCourseLevel("12"); +// tswCourse1.setFinalPercentage("91.00"); +// tswCourse1.setFinalLG("A"); +// tswCourse1.setCourseSession("202206"); +// tswCourse1.setNumberOfCredits("4"); +// tswCourse1.setUsedForGrad("4"); +// tswCourse1.setFoundationReq("10"); +// tswCourse1.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse"); +// tswCourse2.setCourseName("Test Course Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("92.00"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setSpecialCase("E"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse2"); +// tswCourse2.setCourseName("Test Course2 Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("XMT"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); +// tswAssessment.setStudNo(pen); +// tswAssessment.setReportType("3"); +// tswAssessment.setCourseCode("TestAssmt"); +// tswAssessment.setCourseName("Test Assessment Name"); +// tswAssessment.setCourseLevel("12"); +// tswAssessment.setFinalPercentage("XMT"); +// tswAssessment.setCourseSession("202206"); +// tswAssessment.setFoundationReq("15"); +// tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); +// +// School school = new School(); +// school.setMinCode(mincode); +// school.setSchoolCategory("02"); +// +// CommonSchool commonSchool = new CommonSchool(); +// commonSchool.setSchlNo(mincode); +// commonSchool.setSchoolName("Test School"); +// commonSchool.setSchoolCategoryCode("02"); +// +// Object[] cols = new Object[] { +// "SCCP", Integer.valueOf(201206), Integer.valueOf(0), Integer.valueOf(0) +// }; +// List list = new ArrayList<>(); +// list.add(cols); +// +// when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); +// when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); +// when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); +// when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); +// when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); +// when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); +// when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); +// +// var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); +// +// assertThat(result).hasSize(1); +// ConvGradStudent responseObject = result.get(0); +// assertThat(responseObject.getPen()).isEqualTo(pen); +// assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.NONE); +// assertThat(responseObject.getResult()).isEqualTo(ConversionResultType.FAILURE); +// } +// +// @Test +// public void testGetGraduatedStudentMasterDataFromTraxForTwoPrograms() { +// Object[] obj = new Object[] { +// "123456789", "1234567", "1234567", "12", Character.valueOf('A'),Character.valueOf('A'), "2018", "0", +// Integer.valueOf(202206), Integer.valueOf(202206), null, null, null, null, null, "S", null, "E", null, Character.valueOf('C'), Character.valueOf('N'), null +// }; +// List results = new ArrayList<>(); +// results.add(obj); +// +// final String pen = (String) obj[0]; +// final String mincode = (String) obj[1]; +// Character status = (Character)obj[4]; +// +// // TSW Demographics +// TranscriptStudentDemog transcriptStudentDemog = new TranscriptStudentDemog(); +// transcriptStudentDemog.setStudNo(pen); +// transcriptStudentDemog.setMincode(mincode); +// transcriptStudentDemog.setGradDate(202201L); +// +// // TSW Courses +// TranscriptStudentCourse tswCourse1 = new TranscriptStudentCourse(); +// tswCourse1.setStudNo(pen); +// tswCourse1.setReportType("1"); +// tswCourse1.setCourseCode("Generic"); +// tswCourse1.setCourseName("Generic Course Name"); +// tswCourse1.setCourseLevel("12"); +// tswCourse1.setFinalPercentage("91.00"); +// tswCourse1.setFinalLG("A"); +// tswCourse1.setCourseSession("202206"); +// tswCourse1.setNumberOfCredits("4"); +// tswCourse1.setUsedForGrad("4"); +// tswCourse1.setFoundationReq("10"); +// tswCourse1.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse2 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse"); +// tswCourse2.setCourseName("Test Course Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("92.00"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setSpecialCase("E"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswCourse3 = new TranscriptStudentCourse(); +// tswCourse2.setStudNo(pen); +// tswCourse2.setReportType("2"); +// tswCourse2.setCourseCode("TestCourse2"); +// tswCourse2.setCourseName("Test Course2 Name"); +// tswCourse2.setCourseLevel("12"); +// tswCourse2.setFinalPercentage("XMT"); +// tswCourse2.setFinalLG("A"); +// tswCourse2.setCourseSession("202206"); +// tswCourse2.setNumberOfCredits("4"); +// tswCourse2.setUsedForGrad("4"); +// tswCourse2.setFoundationReq("11"); +// tswCourse2.setUpdateDate(20220601L); +// +// TranscriptStudentCourse tswAssessment = new TranscriptStudentCourse(); +// tswAssessment.setStudNo(pen); +// tswAssessment.setReportType("3"); +// tswAssessment.setCourseCode("TestAssmt"); +// tswAssessment.setCourseName("Test Assessment Name"); +// tswAssessment.setCourseLevel("12"); +// tswAssessment.setFinalPercentage("XMT"); +// tswAssessment.setCourseSession("202206"); +// tswAssessment.setFoundationReq("15"); +// tswAssessment.setUpdateDate(new Date(System.currentTimeMillis() - 100000L).getTime()); +// +// School school = new School(); +// school.setMinCode(mincode); +// school.setSchoolCategory("02"); +// +// CommonSchool commonSchool = new CommonSchool(); +// commonSchool.setSchlNo(mincode); +// commonSchool.setSchoolName("Test School"); +// commonSchool.setSchoolCategoryCode("02"); +// +// // grad_reqt_year, grad_date, scc_date, slp_date +// Object[] cols = new Object[] { +// "2018", Integer.valueOf(0), Integer.valueOf(202206), Integer.valueOf(202206) +// }; +// List list = new ArrayList<>(); +// list.add(cols); +// +// when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); +// when(this.traxStudentRepository.loadTraxGraduatedStudent(pen)).thenReturn(results); +// when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(true); +// when(this.tswService.getTranscriptStudentDemog(pen)).thenReturn(transcriptStudentDemog); +// when(this.tswService.getTranscriptStudentCourses(pen)).thenReturn(Arrays.asList(tswCourse1, tswCourse2, tswCourse3, tswAssessment)); +// when(this.schoolService.getSchoolDetails(mincode, "123")).thenReturn(school); +// when(this.schoolService.getCommonSchool("123", mincode)).thenReturn(commonSchool); +// +// var result = traxCommonService.getStudentMasterDataFromTrax(pen, "123"); +// +// assertThat(result).hasSize(1); +// ConvGradStudent responseObject = result.get(0); +// assertThat(responseObject.getPen()).isEqualTo(pen); +// assertThat(responseObject.getStudentLoadType()).isEqualTo(StudentLoadType.GRAD_TWO); +// assertThat(responseObject.getResult()).isEqualTo(ConversionResultType.SUCCESS); +// } @Test public void testGetStudentDemographicsDataFromTrax() { @@ -795,72 +677,72 @@ public void testSaveTraxStudentNo() { assertThat(traxStudentNo.getStatus()).isEqualTo(result.getStatus()); } - @Test - public void testStudentIsNotGraduated() { - // Student is graduated or not - Boolean result = isStudentGraduated("2004", 0, 0, false); - - assertThat(result).isNotNull(); - assertThat(result).isFalse(); - } - - @Test - public void testStudent_whenStatus_isNotInGraduatedOrUnGraduated_then_ReturnsNone() { - // Student is graduated or not - Boolean result = isStudentGraduated("SCCP", 202206, 0, false); - - assertThat(result).isNotNull(); - assertThat(result).isFalse(); - } - - @Test - public void testStudent_whenUTG_Data_doesNotExist_then_ReturnsUnGraduated() { - // Student is graduated or not - Boolean result = isStudentGraduated("1996", 202206, 0, false); - - when(this.tswService.existsTranscriptStudentDemog("123456789")).thenReturn(false); - - assertThat(result).isNotNull(); - assertThat(result).isFalse(); - } - - @Test - public void testStudentForTwoPrograms_whenUTG_Data_doesNotExist_then_ReturnsNO_UTG() { - // Student is graduated or not - Boolean result = isStudentGraduated("1996", 202206, 202206, false); - - when(this.tswService.existsTranscriptStudentDemog("123456789")).thenReturn(false); - - assertThat(result).isNotNull(); - assertThat(result).isFalse(); - } - - @ParameterizedTest - @CsvSource({ - "'1950', 202206, 0", // graduated 1 program - "'SCCP', 0, 202206", // graduated 1 program - "'1950', 0, 202206" // graduated 2 programs - }) - void testStudentIsGraduated(String gradReqtYear, int gradDate, int sccDate) { - // Student is graduated or not - Boolean result = isStudentGraduated(gradReqtYear, gradDate, sccDate, true); - - assertThat(result).isNotNull(); - assertThat(result).isTrue(); - } - - private Boolean isStudentGraduated(String gradReqtYear, int gradDate, int sccDate, boolean existsUTG) { - final String pen = "123456789"; - - Object[] cols = new Object[] { - gradReqtYear, gradDate, sccDate, Integer.valueOf(0) - }; - List list = new ArrayList<>(); - list.add(cols); - - when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(existsUTG); - when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); - return traxCommonService.isGraduatedStudent(pen); - } +// @Test +// public void testStudentIsNotGraduated() { +// // Student is graduated or not +// Boolean result = isStudentGraduated("2004", 0, 0, false); +// +// assertThat(result).isNotNull(); +// assertThat(result).isFalse(); +// } +// +// @Test +// public void testStudent_whenStatus_isNotInGraduatedOrUnGraduated_then_ReturnsNone() { +// // Student is graduated or not +// Boolean result = isStudentGraduated("SCCP", 202206, 0, false); +// +// assertThat(result).isNotNull(); +// assertThat(result).isFalse(); +// } +// +// @Test +// public void testStudent_whenUTG_Data_doesNotExist_then_ReturnsUnGraduated() { +// // Student is graduated or not +// Boolean result = isStudentGraduated("1996", 202206, 0, false); +// +// when(this.tswService.existsTranscriptStudentDemog("123456789")).thenReturn(false); +// +// assertThat(result).isNotNull(); +// assertThat(result).isFalse(); +// } +// +// @Test +// public void testStudentForTwoPrograms_whenUTG_Data_doesNotExist_then_ReturnsNO_UTG() { +// // Student is graduated or not +// Boolean result = isStudentGraduated("1996", 202206, 202206, false); +// +// when(this.tswService.existsTranscriptStudentDemog("123456789")).thenReturn(false); +// +// assertThat(result).isNotNull(); +// assertThat(result).isFalse(); +// } +// +// @ParameterizedTest +// @CsvSource({ +// "'1950', 202206, 0", // graduated 1 program +// "'SCCP', 0, 202206", // graduated 1 program +// "'1950', 0, 202206" // graduated 2 programs +// }) +// void testStudentIsGraduated(String gradReqtYear, int gradDate, int sccDate) { +// // Student is graduated or not +// Boolean result = isStudentGraduated(gradReqtYear, gradDate, sccDate, true); +// +// assertThat(result).isNotNull(); +// assertThat(result).isTrue(); +// } +// +// private Boolean isStudentGraduated(String gradReqtYear, int gradDate, int sccDate, boolean existsUTG) { +// final String pen = "123456789"; +// +// Object[] cols = new Object[] { +// gradReqtYear, gradDate, sccDate, Integer.valueOf(0) +// }; +// List list = new ArrayList<>(); +// list.add(cols); +// +// when(this.tswService.existsTranscriptStudentDemog(pen)).thenReturn(existsUTG); +// when(this.traxStudentRepository.getGraduationData(pen)).thenReturn(list); +// return traxCommonService.isGraduatedStudent(pen); +// } } diff --git a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxUpdateServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxUpdateServiceTest.java index fc0c7196..ca229043 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxUpdateServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/trax/service/TraxUpdateServiceTest.java @@ -152,7 +152,7 @@ public void testScheduledRunForTraxUpdates() throws JsonProcessingException { when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdateInGradRepository.findOutstandingUpdates(any())).thenReturn(Arrays.asList(traxUpdateInGradEntity)); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); @@ -202,7 +202,7 @@ public void testProcess_whenNewStudent_isAdded() throws JsonProcessingException tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); @@ -258,7 +258,7 @@ public void testProcess_whenStudentDemographicInfo_isUpdated() throws JsonProces tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); when(traxCommonService.getStudentDemographicsDataFromTrax(pen)).thenReturn(Arrays.asList(penStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); @@ -311,7 +311,7 @@ public void testProcess_whenGraduation_isUpdated() throws JsonProcessingExceptio tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); @@ -361,7 +361,7 @@ public void testProcess_whenStudentStatus_isUpdated() throws JsonProcessingExcep tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); @@ -411,7 +411,7 @@ public void testProcess_whenXProgram_isUpdated() throws JsonProcessingException tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); @@ -460,7 +460,7 @@ public void testProcess_whenAssessment_isUpdated() throws JsonProcessingExceptio tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); @@ -509,7 +509,7 @@ public void testProcess_whenCourse_isUpdated() throws JsonProcessingException { tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); @@ -561,7 +561,7 @@ public void testProcess_whenFrenchImmersion_forGrade10_isAdded() throws JsonProc tokenObj.setAccess_token("123"); when(restUtils.getTokenResponseObject()).thenReturn(tokenObj); when(traxUpdatedPubEventRepository.save(traxUpdatedPubEvent)).thenReturn(traxUpdatedPubEvent); - when(traxCommonService.getStudentMasterAsNonGrad(pen, true,"123")).thenReturn(Arrays.asList(traxStudent)); + when(traxCommonService.getStudentMasterDataFromTrax(pen)).thenReturn(Arrays.asList(traxStudent)); traxUpdateService.publishTraxUpdatedEvent(traxUpdateInGradEntity); traxUpdateService.updateStatus(traxUpdateInGradEntity); diff --git a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TswServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/trax/service/TswServiceTest.java deleted file mode 100644 index 23751eb9..00000000 --- a/api/src/test/java/ca/bc/gov/educ/api/trax/service/TswServiceTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package ca.bc.gov.educ.api.trax.service; - -import ca.bc.gov.educ.api.trax.messaging.NatsConnection; -import ca.bc.gov.educ.api.trax.messaging.jetstream.Publisher; -import ca.bc.gov.educ.api.trax.messaging.jetstream.Subscriber; -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentCourse; -import ca.bc.gov.educ.api.trax.model.dto.TranscriptStudentDemog; -import ca.bc.gov.educ.api.trax.model.entity.TranscriptStudentCourseEntity; -import ca.bc.gov.educ.api.trax.model.entity.TranscriptStudentCourseKey; -import ca.bc.gov.educ.api.trax.model.entity.TranscriptStudentDemogEntity; -import ca.bc.gov.educ.api.trax.repository.TranscriptStudentCourseRepository; -import ca.bc.gov.educ.api.trax.repository.TranscriptStudentDemogRepository; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.openMocks; - -@RunWith(SpringRunner.class) -@SpringBootTest -@ActiveProfiles("test") -public class TswServiceTest { - - @Autowired - private TswService tswService; - - @MockBean - private TranscriptStudentDemogRepository transcriptStudentDemogRepository; - - @MockBean - private TranscriptStudentCourseRepository transcriptStudentCourseRepository; - - // NATS - @MockBean - private NatsConnection natsConnection; - - @MockBean - private Publisher publisher; - - @MockBean - private Subscriber subscriber; - - @Before - public void setUp() { - openMocks(this); - } - - @After - public void tearDown() { - - } - - @Test - public void testGetTranscriptStudentDemographicsData() { - // Transcript Student Demographics data - - final TranscriptStudentDemogEntity transcriptStudentDemogEntity = new TranscriptStudentDemogEntity(); - transcriptStudentDemogEntity.setStudNo("123456789"); - transcriptStudentDemogEntity.setMincode("7654321"); - - when(transcriptStudentDemogRepository.findById(eq("123456789"))).thenReturn(Optional.of(transcriptStudentDemogEntity)); - - TranscriptStudentDemog result = tswService.getTranscriptStudentDemog(transcriptStudentDemogEntity.getStudNo()); - - assertThat(result).isNotNull(); - assertThat(result.getMincode()).isEqualTo(transcriptStudentDemogEntity.getMincode()); - assertThat(result.getStudNo()).isEqualTo(transcriptStudentDemogEntity.getStudNo()); - } - - @Test - public void testGetTranscriptStudentCourses() { - // Transcript Student Courses data - - final TranscriptStudentCourseKey key = new TranscriptStudentCourseKey(); - key.setStudNo("123456789"); - key.setCourseCode("Test"); - key.setCourseLevel("12"); - - final TranscriptStudentCourseEntity transcriptStudentCourseEntity = new TranscriptStudentCourseEntity(); - transcriptStudentCourseEntity.setStudentCourseKey(key); - transcriptStudentCourseEntity.setCourseName("Test Course"); - - when(transcriptStudentCourseRepository.findByPen(eq("123456789"))).thenReturn(Arrays.asList(transcriptStudentCourseEntity)); - - List results = tswService.getTranscriptStudentCourses(key.getStudNo()); - - assertThat(results).isNotNull(); - assertThat(results.size()).isGreaterThan(0); - assertThat(results.get(0).getStudNo()).isEqualTo(key.getStudNo()); - assertThat(results.get(0).getCourseCode()).isEqualTo(key.getCourseCode()); - assertThat(results.get(0).getCourseLevel()).isEqualTo(key.getCourseLevel()); - } -} diff --git a/api/src/test/resources/application.yaml b/api/src/test/resources/application.yaml index 28f46de3..105bf8e2 100644 --- a/api/src/test/resources/application.yaml +++ b/api/src/test/resources/application.yaml @@ -98,9 +98,6 @@ cron: trax: update: enabled: true - get: - student-master-only: - enabled: false #Splunk LogHelper splunk: diff --git a/tools/config/update-configmap.sh b/tools/config/update-configmap.sh index 60129e3f..bcf5f600 100644 --- a/tools/config/update-configmap.sh +++ b/tools/config/update-configmap.sh @@ -66,7 +66,6 @@ oc create -n "$GRAD_NAMESPACE"-"$envValue" configmap "$APP_NAME"-config-map \ --from-literal=CRON_SCHEDULED_TRIGGER_TRAX_UPDATES_LOCK_AT_MOST_FOR="PT20M" \ --from-literal=CRON_SCHEDULED_TRIGGER_TRAX_UPDATES_THRESHOLD="4000" \ --from-literal=ENABLE_FLYWAY="true" \ - --from-literal=ENABLE_GET_STUDENT_MASTER_ONLY="true" \ --from-literal=ENABLE_TRAX_UPDATE="true" \ --from-literal=KEYCLOAK_TOKEN_URL="https://soam-$envValue.apps.silver.devops.gov.bc.ca/" \ --from-literal=MAX_RETRY_ATTEMPTS="3" \