Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNDIT 1703: Rollback Investigation Service loop debug changes #28

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Build-and-deploy-reporting-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
- rel-**
# Uncomment the following line only to test the build deploy from private branches.
- CNDIT-*
# - CNDIT-*
paths-ignore:
- "docker-compose.yml"
- "**.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,12 @@ public String processInvestigation(String value) {
InvestigationReporting reportingModel = modelMapper.map(investigation, InvestigationReporting.class);
InvestigationTransformed investigationTransformed = processDataUtil.transformInvestigationData(investigation);
buildReportingModelForTransformedData(reportingModel, investigationTransformed);
pushKeyValuePairToKafka(investigationKey, reportingModel, investigationTopicReporting);

//ToDo: Revert this after the loop debugging issue
// only process and send notifications when investigation data has been sent
/* .whenComplete((res, ex) ->
pushKeyValuePairToKafka(investigationKey, reportingModel, investigationTopicReporting)
// only process and send notifications when investigation data has been sent
.whenComplete((res, ex) ->
logger.info("Investigation data (uid={}) sent to {}", investigation.getPublicHealthCaseUid(), investigationTopicReporting))
.thenRunAsync(() -> processDataUtil.processNotifications(investigation.getInvestigationNotifications(), objectMapper))
.join();*/
.join();
return objectMapper.writeValueAsString(investigation);
} else {
throw new NoDataException("No investigation data found for id: " + publicHealthCaseUid);
Expand Down Expand Up @@ -141,10 +139,10 @@ private void processPhcFactDatamart(String publicHealthCaseUid) {
}

// This same method can be used for elastic search as well and that is why the generic model is present
private void pushKeyValuePairToKafka(InvestigationKey investigationKey, Object model, String topicName) {
private CompletableFuture<SendResult<String, String>> pushKeyValuePairToKafka(InvestigationKey investigationKey, Object model, String topicName) {
String jsonKey = jsonGenerator.generateStringJson(investigationKey);
String jsonValue = jsonGenerator.generateStringJson(model);
kafkaTemplate.send(topicName, jsonKey, jsonValue);
return kafkaTemplate.send(topicName, jsonKey, jsonValue);
}

private void buildReportingModelForTransformedData(InvestigationReporting reportingModel, InvestigationTransformed investigationTransformed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ public void processNotifications(String investigationNotifications, ObjectMapper

String jsonKey = jsonGenerator.generateStringJson(investigationNotificationsKey);
String jsonValue = jsonGenerator.generateStringJson(tempInvestigationNotificationsObject);
// ToDo: Revert this
// kafkaTemplate.send(investigationNotificationsOutputTopicName, jsonKey, jsonValue)
// .whenComplete((res, e) -> logger.info("Notification data (uid={}) sent to {}", notificationUid, investigationNotificationsOutputTopicName));
kafkaTemplate.send(investigationNotificationsOutputTopicName, jsonKey, jsonValue)
.whenComplete((res, e) -> logger.info("Notification data (uid={}) sent to {}", notificationUid, investigationNotificationsOutputTopicName));
}
}
else {
Expand Down Expand Up @@ -187,8 +186,7 @@ private void transformObservationIds(String observationNotificationIds, Investig
for(Long id : observationIds) {
investigationObservation.setObservationId(id);
String jsonValue = jsonGenerator.generateStringJson(investigationObservation);
//ToDo: Revert this after the loop debugging issue
// kafkaTemplate.send(investigationObservationOutputTopicName, jsonValue, jsonValue);
kafkaTemplate.send(investigationObservationOutputTopicName, jsonValue, jsonValue);
}
}
else {
Expand Down Expand Up @@ -244,8 +242,7 @@ private void transformInvestigationConfirmationMethod(String investigationConfir
investigationConfirmationMethodKey.setConfirmationMethodCd(key);
String jsonKey = jsonGenerator.generateStringJson(investigationConfirmationMethodKey);
String jsonValue = jsonGenerator.generateStringJson(investigationConfirmation);
//ToDo: Revert this after the loop debugging issue
// kafkaTemplate.send(investigationConfirmationOutputTopicName, jsonKey, jsonValue);
kafkaTemplate.send(investigationConfirmationOutputTopicName, jsonKey, jsonValue);
}
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import gov.cdc.etldatapipeline.investigation.repository.model.dto.*;
import gov.cdc.etldatapipeline.investigation.repository.rdb.InvestigationCaseAnswerRepository;
import gov.cdc.etldatapipeline.investigation.util.ProcessInvestigationDataUtil;
import org.junit.Ignore;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
Expand All @@ -28,7 +27,6 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.*;

@Ignore
class InvestigationDataProcessingTests {
@Mock
KafkaTemplate<String, String> kafkaTemplate;
Expand Down Expand Up @@ -65,8 +63,7 @@ void setUp() {
transformer = new ProcessInvestigationDataUtil(kafkaTemplate, investigationCaseAnswerRepository);
}

@Ignore
//@Test
@Test
void testConfirmationMethod() {
Investigation investigation = new Investigation();

Expand Down Expand Up @@ -102,7 +99,7 @@ void testConfirmationMethod() {
assertTrue(containsWords.apply(messageCaptor.getValue(), cmDetailsFn.apply(confirmationMethod)));
}

//@Test
@Test
void testObservationNotificationIds() {
Investigation investigation = new Investigation();

Expand All @@ -127,7 +124,7 @@ void testObservationNotificationIds() {
assertTrue(containsWords.apply(actualCombined, oDetailsFn.apply(observation)));
}

// @Test
@Test
void testNotifications() {
Investigation investigation = new Investigation();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import gov.cdc.etldatapipeline.investigation.repository.model.reporting.InvestigationReporting;
import gov.cdc.etldatapipeline.investigation.repository.rdb.InvestigationCaseAnswerRepository;
import gov.cdc.etldatapipeline.investigation.util.ProcessInvestigationDataUtil;
import org.junit.Ignore;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
Expand All @@ -24,7 +23,6 @@
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;

@Ignore
class InvestigationServiceTest {

@Mock
Expand Down Expand Up @@ -54,7 +52,7 @@ void setUp() {
transformer = new ProcessInvestigationDataUtil(kafkaTemplate, investigationCaseAnswerRepository);
}

// @Test
@Test
void testProcessMessage() {
String investigationTopic = "Investigation";
String investigationTopicOutput = "InvestigationOutput";
Expand Down