From 698092ff55184600eb34fbdef7829aaf4bd91494 Mon Sep 17 00:00:00 2001 From: Alex McDermid Date: Wed, 20 Nov 2024 13:21:08 -0800 Subject: [PATCH] Feature/grad2 3060 - gdc messaging (#701) * start of gdc messaging * gdc messaging * use grad student service * clean * extend base integration test * required fields for grad student record payload * clean * test --- .../educ/api/gradstudent/constant/Topics.java | 3 +- .../FetchGradStudentRecordSubscriber.java | 91 +++++++++++++++++++ .../model/dc/GradStudentRecordPayload.java | 15 +++ .../dto/messaging/GradStudentRecord.java | 20 ++++ .../service/GradStudentService.java | 17 ++++ .../service/CommonServiceTest.java | 4 +- .../service/DataConversionServiceTest.java | 4 +- .../service/EdwSnapshotServiceTest.java | 4 +- .../service/GradStudentServiceTest.java | 27 +++++- .../service/GraduationStatusServiceTest.java | 4 +- .../service/HistoryServiceTest.java | 4 +- .../JetStreamEventHandlerServiceTest.java | 22 ++--- .../support/MockConfiguration.java | 6 ++ 13 files changed, 194 insertions(+), 27 deletions(-) create mode 100644 api/src/main/java/ca/bc/gov/educ/api/gradstudent/messaging/jetstream/FetchGradStudentRecordSubscriber.java create mode 100644 api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dc/GradStudentRecordPayload.java create mode 100644 api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/messaging/GradStudentRecord.java diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/constant/Topics.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/constant/Topics.java index 7bc5019d..b7342b0d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/constant/Topics.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/constant/Topics.java @@ -8,5 +8,6 @@ public enum Topics { * GradStatus events topic. */ GRAD_STATUS_EVENT_TOPIC, - GRAD_STUDENT_API_FETCH_GRAD_STATUS_TOPIC + GRAD_STUDENT_API_FETCH_GRAD_STATUS_TOPIC, + GRAD_STUDENT_API_FETCH_GRAD_STUDENT_TOPIC, } diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/messaging/jetstream/FetchGradStudentRecordSubscriber.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/messaging/jetstream/FetchGradStudentRecordSubscriber.java new file mode 100644 index 00000000..278f2590 --- /dev/null +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/messaging/jetstream/FetchGradStudentRecordSubscriber.java @@ -0,0 +1,91 @@ +package ca.bc.gov.educ.api.gradstudent.messaging.jetstream; + +import ca.bc.gov.educ.api.gradstudent.constant.Topics; +import ca.bc.gov.educ.api.gradstudent.exception.EntityNotFoundException; +import ca.bc.gov.educ.api.gradstudent.model.dc.Event; +import ca.bc.gov.educ.api.gradstudent.model.dc.GradStatusPayload; +import ca.bc.gov.educ.api.gradstudent.model.dc.GradStudentRecordPayload; +import ca.bc.gov.educ.api.gradstudent.model.dto.messaging.GradStudentRecord; +import ca.bc.gov.educ.api.gradstudent.service.GradStudentService; +import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants; +import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiUtils; +import ca.bc.gov.educ.api.gradstudent.util.JsonUtil; +import com.fasterxml.jackson.core.JsonProcessingException; +import io.nats.client.*; +import lombok.val; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.UUID; + +@Component +public class FetchGradStudentRecordSubscriber implements MessageHandler { + + private final Connection natsConnection; + private Dispatcher dispatcher; + private final GradStudentService gradStudentService; + public static final String RESPONDING_BACK_TO_NATS_ON_CHANNEL = "responding back to NATS on {} channel "; + public static final String PAYLOAD_LOG = "payload is :: {}"; + + + + private static final String TOPIC = Topics.GRAD_STUDENT_API_FETCH_GRAD_STUDENT_TOPIC.toString(); + private static final Logger log = LoggerFactory.getLogger(FetchGradStudentRecordSubscriber.class); + + @Autowired + public FetchGradStudentRecordSubscriber(final Connection natsConnection, GradStudentService gradStudentService, EducGradStudentApiConstants constants) { + this.natsConnection = natsConnection; + this.gradStudentService = gradStudentService; + } + + @PostConstruct + public void subscribe() { + this.dispatcher = this.natsConnection.createDispatcher(this); + this.dispatcher.subscribe(TOPIC); + } + + @Override + public void onMessage(Message message) { + val eventString = new String(message.getData()); + log.debug("Received message: {}", eventString); + String response; + + try { + Event event = JsonUtil.getJsonObjectFromString(Event.class, eventString); + log.info("received GET_STUDENT event :: {}", event.getSagaId()); + log.trace(PAYLOAD_LOG, event.getEventPayload()); + UUID studentId = JsonUtil.getJsonObjectFromString(UUID.class, event.getEventPayload()); + GradStudentRecord studentRecord = gradStudentService.getGraduationStudentRecord(studentId); + response = getResponse(studentRecord); + log.info(RESPONDING_BACK_TO_NATS_ON_CHANNEL, message.getReplyTo() != null ? message.getReplyTo() : event.getReplyTo()); + this.natsConnection.publish(message.getReplyTo(), response.getBytes()); + } catch (Exception e) { + log.error("Error while processing GET_STUDENT event", e); + } + } + + private String getResponse(GradStudentRecord studentRecord) throws JsonProcessingException { + GradStudentRecordPayload gradStudentRecordPayload = GradStudentRecordPayload.builder() + .program(studentRecord.getProgram()) + .programCompletionDate(studentRecord.getProgramCompletionDate() != null ? EducGradStudentApiUtils.formatDate(studentRecord.getProgramCompletionDate()) : null) + .schoolOfRecord(studentRecord.getSchoolOfRecord()) + .build(); + return JsonUtil.getJsonStringFromObject(gradStudentRecordPayload); + } + + private String getErrorResponse(Exception e) { + String ex = (e instanceof EntityNotFoundException) ? "not found" : "error"; + GradStatusPayload gradStatusPayload = GradStatusPayload.builder() + .exception(ex) + .build(); + try { + return JsonUtil.getJsonStringFromObject(gradStatusPayload); + } catch (JsonProcessingException exc) { + log.error("Error while serializing error response", exc); + return "{\"program\": \"\", \"programCompletionDate\": \"\", \"schoolOfRecord\": \"\", \"exception\": \"JSON Parsing exception\"}"; + } + } +} diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dc/GradStudentRecordPayload.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dc/GradStudentRecordPayload.java new file mode 100644 index 00000000..9503cacb --- /dev/null +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dc/GradStudentRecordPayload.java @@ -0,0 +1,15 @@ +package ca.bc.gov.educ.api.gradstudent.model.dc; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class GradStudentRecordPayload { + + private String exception; + private String program; + private String programCompletionDate; + private String schoolOfRecord; + +} diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/messaging/GradStudentRecord.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/messaging/GradStudentRecord.java new file mode 100644 index 00000000..ba35f01a --- /dev/null +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/dto/messaging/GradStudentRecord.java @@ -0,0 +1,20 @@ +package ca.bc.gov.educ.api.gradstudent.model.dto.messaging; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; +import java.util.UUID; + +@Data +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class GradStudentRecord { + + private UUID studentID; + private String program; + private Date programCompletionDate; + private String schoolOfRecord; + +} diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java index 549865bd..d3421639 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentService.java @@ -1,6 +1,8 @@ package ca.bc.gov.educ.api.gradstudent.service; +import ca.bc.gov.educ.api.gradstudent.exception.EntityNotFoundException; import ca.bc.gov.educ.api.gradstudent.model.dto.*; +import ca.bc.gov.educ.api.gradstudent.model.dto.messaging.GradStudentRecord; import ca.bc.gov.educ.api.gradstudent.model.entity.GraduationStudentRecordEntity; import ca.bc.gov.educ.api.gradstudent.model.entity.GraduationStudentRecordView; import ca.bc.gov.educ.api.gradstudent.model.transformer.GraduationStatusTransformer; @@ -50,6 +52,7 @@ public class GradStudentService { private static final String PAGE_NUMBER="pageNumber"; private static final String PAGE_SIZE="pageSize"; private static final String SEARCH_CRITERIA_LIST = "searchCriteriaList"; + private static final String STD_NOT_FOUND_MSG = "Student with ID: %s not found"; final EducGradStudentApiConstants constants; final WebClient webClient; @@ -417,4 +420,18 @@ public List getStudentIDsBySearchCriteriaOrAll(StudentSearchRequest search } return result; } + + /** + * Returns a condensed version of GraduationStudentRecord for GDC + * @param studentID + * @return + * @throws EntityNotFoundException + */ + public GradStudentRecord getGraduationStudentRecord(UUID studentID) { + GradStudentRecord response = graduationStatusRepository.findByStudentID(studentID, GradStudentRecord.class); + if (response != null) { + return response; + } + throw new EntityNotFoundException(String.format(STD_NOT_FOUND_MSG, studentID)); + } } diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/CommonServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/CommonServiceTest.java index 97bf0306..78036f17 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/CommonServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/CommonServiceTest.java @@ -1,5 +1,6 @@ package ca.bc.gov.educ.api.gradstudent.service; +import ca.bc.gov.educ.api.gradstudent.controller.BaseIntegrationTest; import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher; @@ -34,8 +35,7 @@ @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles("test") -public class CommonServiceTest { +public class CommonServiceTest extends BaseIntegrationTest { @Autowired EducGradStudentApiConstants constants; @Autowired CommonService commonService; diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/DataConversionServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/DataConversionServiceTest.java index 9e11bc9a..9b51cf96 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/DataConversionServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/DataConversionServiceTest.java @@ -3,6 +3,7 @@ import ca.bc.gov.educ.api.gradstudent.constant.FieldName; import ca.bc.gov.educ.api.gradstudent.constant.FieldType; import ca.bc.gov.educ.api.gradstudent.constant.TraxEventType; +import ca.bc.gov.educ.api.gradstudent.controller.BaseIntegrationTest; import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher; @@ -39,8 +40,7 @@ @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles("test") -public class DataConversionServiceTest { +public class DataConversionServiceTest extends BaseIntegrationTest { @Autowired EducGradStudentApiConstants constants; @Autowired diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/EdwSnapshotServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/EdwSnapshotServiceTest.java index ea5adf7d..8fbb3655 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/EdwSnapshotServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/EdwSnapshotServiceTest.java @@ -1,5 +1,6 @@ package ca.bc.gov.educ.api.gradstudent.service; +import ca.bc.gov.educ.api.gradstudent.controller.BaseIntegrationTest; import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher; @@ -31,8 +32,7 @@ @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles("test") -public class EdwSnapshotServiceTest { +public class EdwSnapshotServiceTest extends BaseIntegrationTest { @Autowired EdwSnapshotService edwSnapshotService; diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java index 14847d5c..100e7305 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentServiceTest.java @@ -1,10 +1,13 @@ package ca.bc.gov.educ.api.gradstudent.service; +import ca.bc.gov.educ.api.gradstudent.controller.BaseIntegrationTest; +import ca.bc.gov.educ.api.gradstudent.exception.EntityNotFoundException; import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Subscriber; import ca.bc.gov.educ.api.gradstudent.model.dto.*; +import ca.bc.gov.educ.api.gradstudent.model.dto.messaging.GradStudentRecord; import ca.bc.gov.educ.api.gradstudent.model.entity.GraduationStudentRecordEntity; import ca.bc.gov.educ.api.gradstudent.model.entity.GraduationStudentRecordView; import ca.bc.gov.educ.api.gradstudent.model.transformer.GraduationStatusTransformer; @@ -41,6 +44,8 @@ import java.util.function.Function; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @@ -48,8 +53,7 @@ @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles("test") -public class GradStudentServiceTest { +public class GradStudentServiceTest extends BaseIntegrationTest { @Autowired EducGradStudentApiConstants constants; @@ -853,6 +857,25 @@ public void testGetStudentIDsBySearchCriterias() { assertThat(results).isNotEmpty(); } + @Test + public void testGetGraduationStudentRecord_GivenValidProgramCompletionDate_ExpectTrue() throws EntityNotFoundException { + UUID studentID = UUID.randomUUID(); + GraduationStudentRecordEntity graduationStudentRecordEntity = new GraduationStudentRecordEntity(); + graduationStudentRecordEntity.setProgramCompletionDate(new java.util.Date()); + when(graduationStatusRepository.findByStudentID(studentID, GradStudentRecord.class)).thenReturn(new GradStudentRecord(studentID, "2018-EN", new java.util.Date(), "schoolOfRecord")); + GradStudentRecord result = gradStudentService.getGraduationStudentRecord(studentID); + assertNotNull(result); + } + + @Test + public void testGetGraduationStudentRecord_givenNotFound_ExpectEntityNotFoundExcetpion() { + UUID studentID = UUID.randomUUID(); + when(graduationStatusRepository.findByStudentID(studentID, GradStudentRecord.class)).thenReturn(null); + assertThrows(EntityNotFoundException.class, () -> { + gradStudentService.getGraduationStudentRecord(studentID); + }); + } + @SneakyThrows protected Object createDataObjectFromJson(String jsonPath, Class clazz) { String json = readFile(jsonPath); diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java index 40336332..9b165379 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java @@ -1,5 +1,6 @@ package ca.bc.gov.educ.api.gradstudent.service; +import ca.bc.gov.educ.api.gradstudent.controller.BaseIntegrationTest; import ca.bc.gov.educ.api.gradstudent.exception.EntityNotFoundException; import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; @@ -50,8 +51,7 @@ @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles("test") -public class GraduationStatusServiceTest { +public class GraduationStatusServiceTest extends BaseIntegrationTest { @Autowired EducGradStudentApiConstants constants; @Autowired GraduationStatusService graduationStatusService; diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/HistoryServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/HistoryServiceTest.java index 107bdd6e..5d8765b8 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/HistoryServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/HistoryServiceTest.java @@ -1,5 +1,6 @@ package ca.bc.gov.educ.api.gradstudent.service; +import ca.bc.gov.educ.api.gradstudent.controller.BaseIntegrationTest; import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher; @@ -51,8 +52,7 @@ @RunWith(SpringRunner.class) @SpringBootTest -@ActiveProfiles("test") -public class HistoryServiceTest { +public class HistoryServiceTest extends BaseIntegrationTest { @Autowired EducGradStudentApiConstants constants; @Autowired HistoryService historyService; diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/JetStreamEventHandlerServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/JetStreamEventHandlerServiceTest.java index ba06130e..466cfb75 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/JetStreamEventHandlerServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/JetStreamEventHandlerServiceTest.java @@ -1,5 +1,6 @@ package ca.bc.gov.educ.api.gradstudent.service; +import ca.bc.gov.educ.api.gradstudent.controller.BaseIntegrationTest; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; import ca.bc.gov.educ.api.gradstudent.model.dto.ChoreographedEvent; import ca.bc.gov.educ.api.gradstudent.model.entity.GradStatusEvent; @@ -8,16 +9,12 @@ import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Subscriber; import ca.bc.gov.educ.api.gradstudent.repository.GradStatusEventRepository; import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; 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 org.springframework.web.reactive.function.client.WebClient; import java.util.Optional; @@ -27,10 +24,7 @@ import static ca.bc.gov.educ.api.gradstudent.constant.EventStatus.MESSAGE_PUBLISHED; import static org.mockito.MockitoAnnotations.openMocks; -@RunWith(SpringRunner.class) -@SpringBootTest -@ActiveProfiles("test") -public class JetStreamEventHandlerServiceTest { +class JetStreamEventHandlerServiceTest extends BaseIntegrationTest { @Autowired EducGradStudentApiConstants constants; @@ -59,18 +53,18 @@ public class JetStreamEventHandlerServiceTest { @MockBean private Subscriber subscriber; - @Before + @BeforeEach public void setUp() { openMocks(this); } - @After + @AfterEach public void tearDown() { } @Test - public void testUpdateEventStatus() { + void testUpdateEventStatus() { UUID eventId = UUID.randomUUID(); ChoreographedEvent choreographedEvent = new ChoreographedEvent(); diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java index d48efe26..5836a491 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/support/MockConfiguration.java @@ -2,6 +2,7 @@ import ca.bc.gov.educ.api.gradstudent.messaging.NatsConnection; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStatusSubscriber; +import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.FetchGradStudentRecordSubscriber; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher; import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Subscriber; import io.nats.client.Connection; @@ -56,6 +57,11 @@ public FetchGradStatusSubscriber fetchGradStatusSubscriber() { return Mockito.mock(FetchGradStatusSubscriber.class); } + @Bean + @Primary + public FetchGradStudentRecordSubscriber fetchGradStudentRecordSubscriber() {return Mockito.mock(FetchGradStudentRecordSubscriber.class); + } + @Bean @Primary public Connection connection() {