From 1725a4a7332ed8bbcec09593fa749b9a0d11dcf7 Mon Sep 17 00:00:00 2001 From: martin-nhs Date: Thu, 4 May 2023 10:43:18 +0100 Subject: [PATCH 01/10] [PRMT-3252] Added XML Unit Core dependency --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 3d3e0580..fd7e0136 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ dependencies { testImplementation 'org.jfree:jfreechart:1.5.0' testImplementation 'org.bouncycastle:bcpkix-jdk15on:1.68' testImplementation 'com.google.code.gson:gson:2.10.1' + testImplementation 'org.xmlunit:xmlunit-core:2.9.1' testCompileOnly 'org.projectlombok:lombok:1.18.24' testAnnotationProcessor 'org.projectlombok:lombok' From 4c54018a2d105275fb5612578b4908a9cdb179fa Mon Sep 17 00:00:00 2001 From: martin-nhs Date: Thu, 4 May 2023 10:45:24 +0100 Subject: [PATCH 02/10] [PRMT-3252] Added XML Unit Matchers dependency --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index fd7e0136..015508e7 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,7 @@ dependencies { testImplementation 'org.bouncycastle:bcpkix-jdk15on:1.68' testImplementation 'com.google.code.gson:gson:2.10.1' testImplementation 'org.xmlunit:xmlunit-core:2.9.1' + testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1' testCompileOnly 'org.projectlombok:lombok:1.18.24' testAnnotationProcessor 'org.projectlombok:lombok' From fd67c7d036c3ff029be959c8136995564932703b Mon Sep 17 00:00:00 2001 From: martin-nhs Date: Tue, 9 May 2023 11:34:34 +0100 Subject: [PATCH 03/10] [PRMT-3252] Attempted to create a test --- .../e2e/tests/RepositoryE2ETests.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java index 17acda3a..1cd21264 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java @@ -1,5 +1,7 @@ package uk.nhs.prm.deduction.e2e.tests; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -15,6 +17,7 @@ import uk.nhs.prm.deduction.e2e.ehr_transfer.*; import uk.nhs.prm.deduction.e2e.end_of_transfer_service.EndOfTransferMofUpdatedMessageQueue; import uk.nhs.prm.deduction.e2e.models.Gp2GpSystem; +import uk.nhs.prm.deduction.e2e.models.RepoIncomingMessage; import uk.nhs.prm.deduction.e2e.models.RepoIncomingMessageBuilder; import uk.nhs.prm.deduction.e2e.pdsadaptor.PdsAdaptorClient; import uk.nhs.prm.deduction.e2e.performance.awsauth.AssumeRoleCredentialsProviderFactory; @@ -61,6 +64,9 @@ @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RepositoryE2ETests { + // TODO PRMT-3252: REMOVE ONCE DONE IMPLEMENTING PRMT-3252 - FOR DEBUG USE ONLY. + private static final Logger debugLogger = LogManager.getLogger(RepositoryE2ETests.class); + @Autowired RepoIncomingQueue repoIncomingQueue; @Autowired @@ -101,7 +107,7 @@ void init() { // The following test should eventually test that we can send a small EHR - until we have an EHR in repo/test patient ready to send, // we are temporarily doing a smaller test to cover from amqp -> ehr out queue @Test - @EnabledIfEnvironmentVariable(named = "NHS_ENVIRONMENT", matches = "dev" ) + @EnabledIfEnvironmentVariable(named = "NHS_ENVIRONMENT", matches = "dev") void shouldIdentifyEhrRequestAsEhrOutMessage() { var ehrRequest = Resources.readTestResourceFile("RCMR_IN010000UK05"); var inboundQueueFromMhs = new SimpleAmqpQueue(config); @@ -112,6 +118,26 @@ void shouldIdentifyEhrRequestAsEhrOutMessage() { assertThat(ehrInUnhandledQueue.getMessageContaining(ehrRequest)).isNotNull(); } + @Test + void shouldVerifyThatALargeEhrXMLIsUnchanged() { + // Given + Patient patient = Patient.largeEhrAtEmisWithRepoMof(config); + setManagingOrganisationToRepo(patient.nhsNumber()); + RepoIncomingMessage message = new RepoIncomingMessageBuilder() + .withPatient(patient) + .withEhrSourceGp(Gp2GpSystem.EMIS_PTL_INT) + .withEhrDestinationAsRepo(config) // This is going INTO the repo! + .build(); + + // When + repoIncomingQueue.send(message); + + // Then + debugLogger.info("Message from Repo Incoming Queue: {}", repoIncomingQueue.getMessageContaining(message.conversationId())); + debugLogger.info("Message from EHR Complete Queue: {}", ehrCompleteQueue.getMessageContaining(message.conversationId())); + debugLogger.info(trackerDb.statusForConversationIdIs(message.conversationId(), "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE")); + } + @Test void shouldReceivingAndTrackAllLargeEhrFragments_DevAndTest() { var largeEhrAtEmisWithRepoMof = Patient.largeEhrAtEmisWithRepoMof(config); @@ -125,7 +151,7 @@ void shouldReceivingAndTrackAllLargeEhrFragments_DevAndTest() { .build(); repoIncomingQueue.send(triggerMessage); - assertThat(ehrCompleteQueue.getMessageContaining(triggerMessage.conversationId())); + assertThat(ehrCompleteQueue.getMessageContaining(triggerMessage.conversationId())).isNotNull(); assertTrue(trackerDb.statusForConversationIdIs(triggerMessage.conversationId(), "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE")); } From 971e491d078a04595ee268963b19c83fd3341c00 Mon Sep 17 00:00:00 2001 From: MohammedIqbal Date: Tue, 9 May 2023 17:07:57 +0100 Subject: [PATCH 04/10] [PRMT-3252] Integration test being developed for XML comparisons --- .../prm/deduction/e2e/TestConfiguration.java | 2 + .../e2e/ehr_transfer/Gp2gpMessengerQueue.java | 16 ++++++ .../e2e/tests/RepositoryE2ETests.java | 55 +++++++++++++++---- src/test/resources/ehr/small-ehr-copy | 1 + 4 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 src/test/java/uk/nhs/prm/deduction/e2e/ehr_transfer/Gp2gpMessengerQueue.java create mode 100644 src/test/resources/ehr/small-ehr-copy diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/TestConfiguration.java b/src/test/java/uk/nhs/prm/deduction/e2e/TestConfiguration.java index fe8e6898..7e138359 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/TestConfiguration.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/TestConfiguration.java @@ -271,6 +271,8 @@ public String largeEhrQueueUri() { return getQueueUri("ehr-transfer-service-large-ehr-observability"); } + public String gp2gpMessengerQueueUri() { return getQueueUri("hl7-message-sent-observability"); } + public String getMqUserName() { return awsConfigurationClient.getParamValue(String.format("/repo/%s/user-input/mq-app-username", getEnvironmentName())); } diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/ehr_transfer/Gp2gpMessengerQueue.java b/src/test/java/uk/nhs/prm/deduction/e2e/ehr_transfer/Gp2gpMessengerQueue.java new file mode 100644 index 00000000..c07fc481 --- /dev/null +++ b/src/test/java/uk/nhs/prm/deduction/e2e/ehr_transfer/Gp2gpMessengerQueue.java @@ -0,0 +1,16 @@ +package uk.nhs.prm.deduction.e2e.ehr_transfer; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import uk.nhs.prm.deduction.e2e.TestConfiguration; +import uk.nhs.prm.deduction.e2e.queue.QueueMessageHelper; +import uk.nhs.prm.deduction.e2e.queue.ThinlyWrappedSqsClient; + +@Component +public class Gp2gpMessengerQueue extends QueueMessageHelper { + + @Autowired + public Gp2gpMessengerQueue(ThinlyWrappedSqsClient thinlyWrappedSqsClient, TestConfiguration configuration) { + super(thinlyWrappedSqsClient, configuration.gp2gpMessengerQueueUri()); + } +} diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java index 1cd21264..6e167f99 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java @@ -33,6 +33,7 @@ import java.time.Duration; import java.time.Instant; import java.util.ArrayList; +import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; @@ -51,6 +52,7 @@ TrackerDb.class, SmallEhrQueue.class, LargeEhrQueue.class, + Gp2gpMessengerQueue.class, AttachmentQueue.class, EhrParsingDLQ.class, TransferTrackerDbClient.class, @@ -88,6 +90,8 @@ public class RepositoryE2ETests { @Autowired NegativeAcknowledgementQueue negativeAcknowledgementObservabilityQueue; @Autowired + Gp2gpMessengerQueue gp2gpMessengerQueue; + @Autowired TestConfiguration config; PdsAdaptorClient pdsAdaptorClient; @@ -119,25 +123,52 @@ void shouldIdentifyEhrRequestAsEhrOutMessage() { } @Test - void shouldVerifyThatALargeEhrXMLIsUnchanged() { + void shouldVerifyThatASmallEhrXMLIsUnchanged() { // Given - Patient patient = Patient.largeEhrAtEmisWithRepoMof(config); - setManagingOrganisationToRepo(patient.nhsNumber()); - RepoIncomingMessage message = new RepoIncomingMessageBuilder() - .withPatient(patient) - .withEhrSourceGp(Gp2GpSystem.EMIS_PTL_INT) - .withEhrDestinationAsRepo(config) // This is going INTO the repo! - .build(); + String conversationId = UUID.randomUUID().toString(); + var inboundQueueFromMhs = new SimpleAmqpQueue(config); + + String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-copy") + .replaceAll("__CONVERSATION_ID__", conversationId) + .replaceAll("__MESSAGE_ID__", UUID.randomUUID().toString()); + + String ehrRequest = Resources.readTestResourceFile("RCMR_IN010000UK05") + .replaceAll("9692842304", "9727018440") + .replaceAll("A91720", "M85019") + .replaceAll("200000000631", "200000000149"); + +// Patient patient = Patient.largeEhrAtEmisWithRepoMof(config); //TODO: Not large ehr. Needs replacing +// setManagingOrganisationToRepo(patient.nhsNumber()); +// RepoIncomingMessage message = new RepoIncomingMessageBuilder() +// .withPatient(patient) +// .withEhrSourceGp(Gp2GpSystem.EMIS_PTL_INT) +// .withEhrDestinationAsRepo(config) // This is going INTO the repo! +// .build(); // When - repoIncomingQueue.send(message); + // change transfer db status to ACTION:EHR_REQUEST_SENT before putting on inbound queue + // Put the patient to inboundQueueFromMhs as an UK05 message +// inboundQueueFromMhs.sendMessage(smallEhr, conversationId); +// debugLogger.info("conversationIdExists: {}",trackerDb.conversationIdExists(conversationId)); +// var status = trackerDb.waitForStatusMatching(conversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); + + // Put a EHR request to inboundQueueFromMhs + inboundQueueFromMhs.sendMessage(ehrRequest, conversationId); // Then - debugLogger.info("Message from Repo Incoming Queue: {}", repoIncomingQueue.getMessageContaining(message.conversationId())); - debugLogger.info("Message from EHR Complete Queue: {}", ehrCompleteQueue.getMessageContaining(message.conversationId())); - debugLogger.info(trackerDb.statusForConversationIdIs(message.conversationId(), "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE")); +// assertThat(gp2gpMessengerQueue.getMessageContaining("17a757f2-f4d2-444e-a246-9cb77bef7f22")).isNotNull(); + // assert gp2gpMessenger queue got a message of UK06 + assertThat(gp2gpMessengerQueue.getMessageContaining("RCMR_IN030000UK06")).isNotNull(); + + // assert the patient record is matching +// +// debugLogger.info("Message from Repo Incoming Queue: {}", repoIncomingQueue.getMessageContaining(message.conversationId())); +// debugLogger.info("Message from EHR Complete Queue: {}", ehrCompleteQueue.getMessageContaining(message.conversationId())); +// debugLogger.info(trackerDb.statusForConversationIdIs(message.conversationId(), "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE")); } + // TODO: PRMT-3252 Create test: shouldVerifyThatALargeEhrXMLIsUnchanged() + @Test void shouldReceivingAndTrackAllLargeEhrFragments_DevAndTest() { var largeEhrAtEmisWithRepoMof = Patient.largeEhrAtEmisWithRepoMof(config); diff --git a/src/test/resources/ehr/small-ehr-copy b/src/test/resources/ehr/small-ehr-copy new file mode 100644 index 00000000..145b7ba5 --- /dev/null +++ b/src/test/resources/ehr/small-ehr-copy @@ -0,0 +1 @@ +{"ebXML": "\n\n\n\t\n\t\t\n\t\t\tA91368-9199177\n\t\t\n\t\t\n\t\t\tM85019-9198820\n\t\t\n\t\tS918999543361\n\t\t__CONVERSATION_ID__\n\t\turn:nhs:names:services:gp2gp\n\t\tRCMR_IN030000UK06\n\t\t\n\t\t\t__MESSAGE_ID__\n\t\t\t2021-04-30T09:32:00Z\n\t\t\n \n \n \n\n\n\t\n\t\t\n\t\t\t\n\t\t\tHL7 payload\n\t\t\t\n\t\t\n\t\n\n\n", "payload": "NHS Digital Assurance GP2GP 1PartnerDrGpInps-Lm-OneNHS Digital Assurance GP2GP 1Vision 3Other
Drinking status on eventdate: Current drinker
Smoking status on date of event: Ex-smoker
Posture for BP recording: Sitting, Cuff size used: StandardAdministration
Other Attachment
Applied
", "attachments": []} \ No newline at end of file From cc18996ff6e4d8e9353d7c93caf38db5a09845de Mon Sep 17 00:00:00 2001 From: MohammedIqbal Date: Wed, 10 May 2023 17:16:27 +0100 Subject: [PATCH 05/10] Began developing XML comparison logic --- .../e2e/tests/RepositoryE2ETests.java | 132 ++++++++++++++---- src/test/resources/ehr/small-ehr-copy | 2 +- 2 files changed, 108 insertions(+), 26 deletions(-) diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java index 6e167f99..5a9f463c 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java @@ -2,6 +2,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.json.JSONException; +import org.json.JSONObject; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -13,16 +15,22 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.w3c.dom.Attr; +import org.w3c.dom.Node; +import org.xmlunit.builder.DiffBuilder; +import org.xmlunit.diff.*; +import org.xmlunit.matchers.CompareMatcher; +import org.xmlunit.util.Predicate; import uk.nhs.prm.deduction.e2e.TestConfiguration; import uk.nhs.prm.deduction.e2e.ehr_transfer.*; import uk.nhs.prm.deduction.e2e.end_of_transfer_service.EndOfTransferMofUpdatedMessageQueue; import uk.nhs.prm.deduction.e2e.models.Gp2GpSystem; -import uk.nhs.prm.deduction.e2e.models.RepoIncomingMessage; import uk.nhs.prm.deduction.e2e.models.RepoIncomingMessageBuilder; import uk.nhs.prm.deduction.e2e.pdsadaptor.PdsAdaptorClient; import uk.nhs.prm.deduction.e2e.performance.awsauth.AssumeRoleCredentialsProviderFactory; import uk.nhs.prm.deduction.e2e.performance.awsauth.AutoRefreshingRoleAssumingSqsClient; import uk.nhs.prm.deduction.e2e.queue.BasicSqsClient; +import uk.nhs.prm.deduction.e2e.queue.SqsMessage; import uk.nhs.prm.deduction.e2e.queue.ThinlyWrappedSqsClient; import uk.nhs.prm.deduction.e2e.queue.activemq.ForceXercesParserSoLogbackDoesNotBlowUpWhenUsingSwiftMqClient; import uk.nhs.prm.deduction.e2e.queue.activemq.SimpleAmqpQueue; @@ -30,9 +38,11 @@ import uk.nhs.prm.deduction.e2e.transfer_tracker_db.TrackerDb; import uk.nhs.prm.deduction.e2e.utility.Resources; +import java.lang.reflect.Array; import java.time.Duration; import java.time.Instant; import java.util.ArrayList; +import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; @@ -40,6 +50,7 @@ import static java.util.stream.Collectors.toList; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.springframework.test.util.AssertionErrors.assertFalse; @SpringBootTest(classes = { RepositoryE2ETests.class, @@ -125,46 +136,116 @@ void shouldIdentifyEhrRequestAsEhrOutMessage() { @Test void shouldVerifyThatASmallEhrXMLIsUnchanged() { // Given - String conversationId = UUID.randomUUID().toString(); + String inboundConversationId = "1632CD65-FD8F-4914-B62A-9763B50FC04A".toLowerCase(); // UUID.randomUUID().toString(); + String outboundConversationId = UUID.randomUUID().toString(); var inboundQueueFromMhs = new SimpleAmqpQueue(config); - String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-copy") - .replaceAll("__CONVERSATION_ID__", conversationId) - .replaceAll("__MESSAGE_ID__", UUID.randomUUID().toString()); + String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-copy"); String ehrRequest = Resources.readTestResourceFile("RCMR_IN010000UK05") .replaceAll("9692842304", "9727018440") .replaceAll("A91720", "M85019") - .replaceAll("200000000631", "200000000149"); - -// Patient patient = Patient.largeEhrAtEmisWithRepoMof(config); //TODO: Not large ehr. Needs replacing -// setManagingOrganisationToRepo(patient.nhsNumber()); -// RepoIncomingMessage message = new RepoIncomingMessageBuilder() -// .withPatient(patient) -// .withEhrSourceGp(Gp2GpSystem.EMIS_PTL_INT) -// .withEhrDestinationAsRepo(config) // This is going INTO the repo! -// .build(); + .replaceAll("200000000631", "200000000149") + .replaceAll("17a757f2-f4d2-444e-a246-9cb77bef7f22", outboundConversationId); // When // change transfer db status to ACTION:EHR_REQUEST_SENT before putting on inbound queue // Put the patient to inboundQueueFromMhs as an UK05 message -// inboundQueueFromMhs.sendMessage(smallEhr, conversationId); -// debugLogger.info("conversationIdExists: {}",trackerDb.conversationIdExists(conversationId)); -// var status = trackerDb.waitForStatusMatching(conversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); + + inboundQueueFromMhs.sendMessage(smallEhr, inboundConversationId); + debugLogger.info("conversationIdExists: {}",trackerDb.conversationIdExists(inboundConversationId)); +// var status = trackerDb.waitForStatusMatching(inboundConversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); +// debugLogger.info("tracker db status: {}", status); // Put a EHR request to inboundQueueFromMhs - inboundQueueFromMhs.sendMessage(ehrRequest, conversationId); + inboundQueueFromMhs.sendMessage(ehrRequest, outboundConversationId); // Then -// assertThat(gp2gpMessengerQueue.getMessageContaining("17a757f2-f4d2-444e-a246-9cb77bef7f22")).isNotNull(); // assert gp2gpMessenger queue got a message of UK06 - assertThat(gp2gpMessengerQueue.getMessageContaining("RCMR_IN030000UK06")).isNotNull(); + SqsMessage gp2gpMessage = gp2gpMessengerQueue.getMessageContaining(outboundConversationId); - // assert the patient record is matching -// -// debugLogger.info("Message from Repo Incoming Queue: {}", repoIncomingQueue.getMessageContaining(message.conversationId())); -// debugLogger.info("Message from EHR Complete Queue: {}", ehrCompleteQueue.getMessageContaining(message.conversationId())); -// debugLogger.info(trackerDb.statusForConversationIdIs(message.conversationId(), "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE")); + assertThat(gp2gpMessage).isNotNull(); + assertThat(gp2gpMessage.contains("RCMR_IN030000UK06")).isTrue(); + + try { + String gp2gpMessengerPayload = getPayload(gp2gpMessage.body()); + String smallEhrPayload = getPayload(smallEhr); + + debugLogger.info("Payload from gp2gpMessenger: {}", gp2gpMessengerPayload); + debugLogger.info("Payload from smallEhr: {}", smallEhrPayload); + Diff myDiff = DiffBuilder.compare(gp2gpMessengerPayload).withTest(smallEhrPayload) + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)) + .checkForSimilar().build(); + debugLogger.info("diff: {}", myDiff.fullDescription()); + + } catch (JSONException e) { + debugLogger.error(e); + } + + debugLogger.info("Message from gp2gpMessenger: {}", gp2gpMessage.body()); +// assertThat(gp2gpMessengerPayload, CompareMatcher.isSimilarTo(smallEhrPayload)); + } + + public class IgnoreAttributeDifferenceEvaluator implements DifferenceEvaluator { + private String attributeName; + public IgnoreAttributeDifferenceEvaluator(String attributeName) { + this.attributeName = attributeName; + } + + @Override + public ComparisonResult evaluate(Comparison comparison, ComparisonResult outcome) { + if (outcome == ComparisonResult.EQUAL) + return outcome; + final Node controlNode = comparison.getControlDetails().getTarget(); + if (controlNode instanceof Attr) { + Attr attr = (Attr) controlNode; + if (attr.getName().equals(attributeName)) { + return ComparisonResult.SIMILAR; + } + } + return outcome; + } + } + + private boolean excludeComparisons(Node node) { + // if the node is ODS code, ignore comparison by returning false + List excludeList = List.of( + "1.2.826.0.1285.0.1.10", // ODS code + "1.2.826.0.1285.0.2.0.107"); // ASID code + // TODO: messageId ^^ + + if (node.hasAttributes() && node.getAttributes().getNamedItem("root") != null) { + String rootId = node.getAttributes().getNamedItem("root").getNodeValue(); + if (node.getNodeName().equals("id") && excludeList.contains(rootId)) { + return false; + } + } + + return true; + } + + @Test + public void given2XMLsWithDifferences_whenTestsSimilarWithDifferenceEvaluator_thenCorrect() { +// final String control = ""; +// final String test = ""; + final String control = ""; + final String test = ""; + + Diff myDiff = DiffBuilder.compare(control).withTest(test) + .withNodeFilter(node -> excludeComparisons(node)) +// .withDifferenceEvaluator(new IgnoreAttributeDifferenceEvaluator("extension")) + .checkForSimilar().build(); + + assertFalse(myDiff.toString(), myDiff.hasDifferences()); + } + + private static String getPayload(String gp2gpMessageBody) throws JSONException { + JSONObject jsonObject = new JSONObject(gp2gpMessageBody); + if (jsonObject.has("payload") ) { + return jsonObject.getString("payload"); + } else { + return jsonObject.getJSONObject("request").getJSONObject("body").getString("payload"); + } } // TODO: PRMT-3252 Create test: shouldVerifyThatALargeEhrXMLIsUnchanged() @@ -363,6 +444,7 @@ void shouldUpdateDbStatusAndPublishToTransferCompleteQueueWhenReceivedNackFromGp assertThat(negativeAcknowledgementObservabilityQueue.getMessageContaining(triggerMessage.conversationId())); assertThat(transferCompleteQueue.getMessageContainingAttribute("conversationId", triggerMessage.conversationId())); + var status = trackerDb.waitForStatusMatching(triggerMessage.conversationId(), "ACTION:EHR_TRANSFER_FAILED"); assertThat(status).isEqualTo("ACTION:EHR_TRANSFER_FAILED:" + REQUESTER_NOT_REGISTERED_PRACTICE_FOR_PATIENT_CODE); } diff --git a/src/test/resources/ehr/small-ehr-copy b/src/test/resources/ehr/small-ehr-copy index 145b7ba5..04bfd486 100644 --- a/src/test/resources/ehr/small-ehr-copy +++ b/src/test/resources/ehr/small-ehr-copy @@ -1 +1 @@ -{"ebXML": "\n\n\n\t\n\t\t\n\t\t\tA91368-9199177\n\t\t\n\t\t\n\t\t\tM85019-9198820\n\t\t\n\t\tS918999543361\n\t\t__CONVERSATION_ID__\n\t\turn:nhs:names:services:gp2gp\n\t\tRCMR_IN030000UK06\n\t\t\n\t\t\t__MESSAGE_ID__\n\t\t\t2021-04-30T09:32:00Z\n\t\t\n \n \n \n\n\n\t\n\t\t\n\t\t\t\n\t\t\tHL7 payload\n\t\t\t\n\t\t\n\t\n\n\n", "payload": "NHS Digital Assurance GP2GP 1PartnerDrGpInps-Lm-OneNHS Digital Assurance GP2GP 1Vision 3Other
Drinking status on eventdate: Current drinker
Smoking status on date of event: Ex-smoker
Posture for BP recording: Sitting, Cuff size used: StandardAdministration
Other Attachment
Applied
", "attachments": []} \ No newline at end of file +{"ebXML": "YGM24-820388B85002-8226522b09c33f8279b1e094ce1632CD65-FD8F-4914-B62A-9763B50FC04Aurn:nhs:names:services:gp2gpRCMR_IN030000UK060206C270-E9A0-11ED-808B-AC162D1F16F02023-05-03T11:48:15Z2023-05-03T15:58:15Zalways", "payload": "DR DK NANDI'S PRACTICEDaveAvenueDR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNAssuranceTeamTwoDR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TN
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNNairobi sheep diseaseProblem severity: Major TEST patient with doctor note and line brea...Thyroid hormone tests normal
Nairobi sheep disease
TEST patient with doctor note and line break \\n\\n\\n\\n\\n test \\r\\r
tablettablettest multiline notes!!! \\n\\n \\n\\n\\n\\n \\r\\r\\n\\n <html> </html>take one as neededNairobi sheep disease
(New Episode). TEST patient with doctor note and line break deliberately add some linebreaks and <> tags to test how it will be stored in EHR \\n\\n\\n\\n \\n test \\r\\r test test test <html> testinng <h1> some html </h1> <br> <br> <br> </html>
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNtest doctor note with linebreak and <>s!! \\n\\n\\n \\r\\r\\r new line another line <xml> <br> <h1> </h1> <br> <br> <hr> </xml>
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNApplied
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TN ** Care started at DR DK NANDI'S PRACTICE (Applied) **", "attachments": [], "external_attachments": []} \ No newline at end of file From 31b352fd9ed7032dfe3f933b9b2365f6fc672e8a Mon Sep 17 00:00:00 2001 From: MohammedIqbal Date: Thu, 11 May 2023 14:09:21 +0100 Subject: [PATCH 06/10] End-to-end test for XML comparisons in small ehr complete --- .../e2e/tests/RepositoryE2ETests.java | 98 ++++++++++++------- .../e2e/transfer_tracker_db/TrackerDb.java | 5 + .../TransferTrackerDbClient.java | 26 ++++- .../TransferTrackerDbMessage.java | 49 ++++++++++ ...all-ehr-copy => small-ehr-with-linebreaks} | 0 .../ehr/small-ehr-without-linebreaks | 1 + 6 files changed, 138 insertions(+), 41 deletions(-) create mode 100644 src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java rename src/test/resources/ehr/{small-ehr-copy => small-ehr-with-linebreaks} (100%) create mode 100644 src/test/resources/ehr/small-ehr-without-linebreaks diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java index 5a9f463c..b91f396d 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java @@ -19,8 +19,6 @@ import org.w3c.dom.Node; import org.xmlunit.builder.DiffBuilder; import org.xmlunit.diff.*; -import org.xmlunit.matchers.CompareMatcher; -import org.xmlunit.util.Predicate; import uk.nhs.prm.deduction.e2e.TestConfiguration; import uk.nhs.prm.deduction.e2e.ehr_transfer.*; import uk.nhs.prm.deduction.e2e.end_of_transfer_service.EndOfTransferMofUpdatedMessageQueue; @@ -36,11 +34,13 @@ import uk.nhs.prm.deduction.e2e.queue.activemq.SimpleAmqpQueue; import uk.nhs.prm.deduction.e2e.transfer_tracker_db.TransferTrackerDbClient; import uk.nhs.prm.deduction.e2e.transfer_tracker_db.TrackerDb; +import uk.nhs.prm.deduction.e2e.transfer_tracker_db.TransferTrackerDbMessage; import uk.nhs.prm.deduction.e2e.utility.Resources; -import java.lang.reflect.Array; import java.time.Duration; import java.time.Instant; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -51,6 +51,7 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.test.util.AssertionErrors.assertFalse; +import static uk.nhs.prm.deduction.e2e.nhs.NhsIdentityGenerator.*; @SpringBootTest(classes = { RepositoryE2ETests.class, @@ -134,17 +135,25 @@ void shouldIdentifyEhrRequestAsEhrOutMessage() { } @Test - void shouldVerifyThatASmallEhrXMLIsUnchanged() { + void shouldVerifyThatASmallEhrXMLIsUnchanged() throws InterruptedException { // Given - String inboundConversationId = "1632CD65-FD8F-4914-B62A-9763B50FC04A".toLowerCase(); // UUID.randomUUID().toString(); + String inboundConversationId = UUID.randomUUID().toString(); + String smallEhrMessageId = UUID.randomUUID().toString(); String outboundConversationId = UUID.randomUUID().toString(); + String nhsNumberForTestPatient = "9727018440"; + String sourceGpForTestPatient = "M85019"; + String timeNow = ZonedDateTime.now(ZoneOffset.ofHours(0)).toString(); + var inboundQueueFromMhs = new SimpleAmqpQueue(config); - String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-copy"); +// String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-with-linebreaks"); + String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-without-linebreaks") + .replaceAll("1632CD65-FD8F-4914-B62A-9763B50FC04A", inboundConversationId.toUpperCase()) + .replaceAll("0206C270-E9A0-11ED-808B-AC162D1F16F0", smallEhrMessageId); String ehrRequest = Resources.readTestResourceFile("RCMR_IN010000UK05") - .replaceAll("9692842304", "9727018440") - .replaceAll("A91720", "M85019") + .replaceAll("9692842304", nhsNumberForTestPatient) + .replaceAll("A91720", sourceGpForTestPatient) .replaceAll("200000000631", "200000000149") .replaceAll("17a757f2-f4d2-444e-a246-9cb77bef7f22", outboundConversationId); @@ -152,10 +161,22 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() { // change transfer db status to ACTION:EHR_REQUEST_SENT before putting on inbound queue // Put the patient to inboundQueueFromMhs as an UK05 message + trackerDb.save(new TransferTrackerDbMessage( + inboundConversationId, + "", + randomNemsMessageId(), + nhsNumberForTestPatient, + sourceGpForTestPatient, + "ACTION:EHR_REQUEST_SENT", + timeNow, + timeNow, + timeNow + )); + inboundQueueFromMhs.sendMessage(smallEhr, inboundConversationId); debugLogger.info("conversationIdExists: {}",trackerDb.conversationIdExists(inboundConversationId)); -// var status = trackerDb.waitForStatusMatching(inboundConversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); -// debugLogger.info("tracker db status: {}", status); + var status = trackerDb.waitForStatusMatching(inboundConversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); + debugLogger.info("tracker db status: {}", status); // Put a EHR request to inboundQueueFromMhs inboundQueueFromMhs.sendMessage(ehrRequest, outboundConversationId); @@ -175,35 +196,25 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() { debugLogger.info("Payload from smallEhr: {}", smallEhrPayload); Diff myDiff = DiffBuilder.compare(gp2gpMessengerPayload).withTest(smallEhrPayload) .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)) + .withNodeFilter(node -> excludeComparisons(node)) + .withDifferenceEvaluator(DifferenceEvaluators.chain(DifferenceEvaluators.Default, + DifferenceEvaluators.downgradeDifferencesToEqual(ComparisonType.XML_STANDALONE))) .checkForSimilar().build(); - debugLogger.info("diff: {}", myDiff.fullDescription()); + + assertFalse(myDiff.toString(), myDiff.hasDifferences()); } catch (JSONException e) { debugLogger.error(e); + throw new Error(e); } - - debugLogger.info("Message from gp2gpMessenger: {}", gp2gpMessage.body()); -// assertThat(gp2gpMessengerPayload, CompareMatcher.isSimilarTo(smallEhrPayload)); } - public class IgnoreAttributeDifferenceEvaluator implements DifferenceEvaluator { - private String attributeName; - public IgnoreAttributeDifferenceEvaluator(String attributeName) { - this.attributeName = attributeName; - } - - @Override - public ComparisonResult evaluate(Comparison comparison, ComparisonResult outcome) { - if (outcome == ComparisonResult.EQUAL) - return outcome; - final Node controlNode = comparison.getControlDetails().getTarget(); - if (controlNode instanceof Attr) { - Attr attr = (Attr) controlNode; - if (attr.getName().equals(attributeName)) { - return ComparisonResult.SIMILAR; - } - } - return outcome; + private boolean isValidUuid(String rootId) { + try { + UUID validUuid = UUID.fromString(rootId); + return true; + } catch (IllegalArgumentException e) { + return false; } } @@ -212,11 +223,15 @@ private boolean excludeComparisons(Node node) { List excludeList = List.of( "1.2.826.0.1285.0.1.10", // ODS code "1.2.826.0.1285.0.2.0.107"); // ASID code - // TODO: messageId ^^ if (node.hasAttributes() && node.getAttributes().getNamedItem("root") != null) { - String rootId = node.getAttributes().getNamedItem("root").getNodeValue(); - if (node.getNodeName().equals("id") && excludeList.contains(rootId)) { + String idRootValue = node.getAttributes().getNamedItem("root").getNodeValue(); + // return false to skip comparison in case when id root value itself is a message id + if (isValidUuid(idRootValue)) { + return false; + } + // return false to skip comparison when the type of compared value is in the excludedList + if (node.getNodeName().equals("id") && excludeList.contains(idRootValue)) { return false; } } @@ -226,14 +241,21 @@ private boolean excludeComparisons(Node node) { @Test public void given2XMLsWithDifferences_whenTestsSimilarWithDifferenceEvaluator_thenCorrect() { + // helper test case for building the `excludeComparisons` function // final String control = ""; // final String test = ""; - final String control = ""; - final String test = ""; +// final String control = ""; +// final String test = ""; +// final String control = ""; +// final String test = ""; + final String control = ""; + final String test = ""; + Diff myDiff = DiffBuilder.compare(control).withTest(test) .withNodeFilter(node -> excludeComparisons(node)) -// .withDifferenceEvaluator(new IgnoreAttributeDifferenceEvaluator("extension")) + .withDifferenceEvaluator(DifferenceEvaluators.chain(DifferenceEvaluators.Default, + DifferenceEvaluators.downgradeDifferencesToEqual(ComparisonType.XML_STANDALONE))) .checkForSimilar().build(); assertFalse(myDiff.toString(), myDiff.hasDifferences()); diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java index 98f2eab8..256ed7f3 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java @@ -47,4 +47,9 @@ public String waitForStatusMatching(String conversationId, String partialStatus) .pollInterval(2, TimeUnit.SECONDS) .until(() -> transferTrackerDbClient.queryDbWithConversationId(conversationId).item().get("state").s(), containsString(partialStatus)); } + + public void save(TransferTrackerDbMessage message) + { + transferTrackerDbClient.save(message); + } } diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbClient.java b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbClient.java index 7c3e699c..8df8aa8b 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbClient.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbClient.java @@ -3,9 +3,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import software.amazon.awssdk.services.dynamodb.model.AttributeValue; -import software.amazon.awssdk.services.dynamodb.model.GetItemRequest; -import software.amazon.awssdk.services.dynamodb.model.GetItemResponse; +import software.amazon.awssdk.services.dynamodb.model.*; import uk.nhs.prm.deduction.e2e.TestConfiguration; import java.util.HashMap; @@ -28,4 +26,26 @@ public GetItemResponse queryDbWithConversationId(String conversationId) { System.out.println("query response is: " + getItemResponse); return getItemResponse; } + + public void save(TransferTrackerDbMessage transferTrackerDbMessage) { + Map item = new HashMap<>(); + + item.put("conversation_id", AttributeValue.builder().s(transferTrackerDbMessage.getConversationId()).build()); + item.put("large_ehr_core_message_id", AttributeValue.builder().s(transferTrackerDbMessage.getLargeEhrCoreMessageId()).build()); + item.put("nems_message_id", AttributeValue.builder().s(transferTrackerDbMessage.getNemsMessageId()).build()); + item.put("nhs_number", AttributeValue.builder().s(transferTrackerDbMessage.getNhsNumber()).build()); + item.put("source_gp", AttributeValue.builder().s(transferTrackerDbMessage.getSourceGp()).build()); + item.put("state", AttributeValue.builder().s(transferTrackerDbMessage.getState()).build()); + item.put("nems_event_last_updated", AttributeValue.builder().s(transferTrackerDbMessage.getNemsEventLastUpdated()).build()); + item.put("created_at", AttributeValue.builder().s(transferTrackerDbMessage.getCreatedAt()).build()); + item.put("last_updated_at", AttributeValue.builder().s(transferTrackerDbMessage.getLastUpdatedAt()).build()); + + + DynamoDbClient.builder().build().putItem(PutItemRequest.builder() + .tableName(testConfiguration.getTransferTrackerDb()) + .item(item) + .build() + ); + + } } diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java new file mode 100644 index 00000000..f2416ffb --- /dev/null +++ b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java @@ -0,0 +1,49 @@ +package uk.nhs.prm.deduction.e2e.transfer_tracker_db; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.gson.GsonBuilder; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@Builder(toBuilder = true) +@JsonIgnoreProperties(ignoreUnknown = true) +public class TransferTrackerDbMessage { + + private String conversationId; + private String largeEhrCoreMessageId; + private String nemsMessageId; + private String nhsNumber; + private String sourceGp; + private String state; + private String nemsEventLastUpdated; + private String createdAt; + private String lastUpdatedAt; + + public TransferTrackerDbMessage(@JsonProperty("conversationId") String conversationId, + @JsonProperty("largeEhrCoreMessageId") String largeEhrCoreMessageId, + @JsonProperty("nemsMessageId") String nemsMessageId, + @JsonProperty("nhsNumber") String nhsNumber, + @JsonProperty("sourceGp") String sourceGp, + @JsonProperty("state") String state, + @JsonProperty("nemsEventLastUpdated") String nemsEventLastUpdated, + @JsonProperty("createdAt") String createdAt, + @JsonProperty("lastUpdatedAt") String lastUpdatedAt){ + this.conversationId = conversationId; + this.largeEhrCoreMessageId = largeEhrCoreMessageId; + this.nemsMessageId = nemsMessageId; + this.nhsNumber = nhsNumber; + this.sourceGp = sourceGp; + this.state = state; + this.nemsEventLastUpdated = nemsEventLastUpdated; + this.createdAt = createdAt; + this.lastUpdatedAt = lastUpdatedAt; + } + + public String toJsonString() { + return new GsonBuilder().disableHtmlEscaping().create().toJson(this); + } +} diff --git a/src/test/resources/ehr/small-ehr-copy b/src/test/resources/ehr/small-ehr-with-linebreaks similarity index 100% rename from src/test/resources/ehr/small-ehr-copy rename to src/test/resources/ehr/small-ehr-with-linebreaks diff --git a/src/test/resources/ehr/small-ehr-without-linebreaks b/src/test/resources/ehr/small-ehr-without-linebreaks new file mode 100644 index 00000000..9a68f7f5 --- /dev/null +++ b/src/test/resources/ehr/small-ehr-without-linebreaks @@ -0,0 +1 @@ +{"ebXML": "YGM24-820388B85002-8226522b09c33f8279b1e094ce1632CD65-FD8F-4914-B62A-9763B50FC04Aurn:nhs:names:services:gp2gpRCMR_IN030000UK060206C270-E9A0-11ED-808B-AC162D1F16F02023-05-03T11:48:15Z2023-05-03T15:58:15Zalways", "payload": "DR DK NANDI'S PRACTICEDaveAvenueDR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNAssuranceTeamTwoDR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TN
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNNairobi sheep diseaseProblem severity: Major TEST patient with doctor note and line brea...Thyroid hormone tests normal
Nairobi sheep disease
TEST patient with doctor note and line break test
tablettablettest multiline notes!!!<html> </html>take one as neededNairobi sheep disease
(New Episode). TEST patient with doctor note and line breakdeliberately add some linebreaks and <> tags to test how it will be stored in EHR test test <html> testinng <h1> some html </h1> <br> <br> <br></html>
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNtest doctor note with without linebreaks!
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TNApplied
DR DK NANDI'S PRACTICE342 Troy RoadHorsforthLeedsWest YorkshireLS18 5TN ** Care started at DR DK NANDI'S PRACTICE (Applied) **", "attachments": [], "external_attachments": []} \ No newline at end of file From 7395e37864018523148c2be23f4a2d55c2a546e4 Mon Sep 17 00:00:00 2001 From: MohammedIqbal Date: Thu, 11 May 2023 16:08:30 +0100 Subject: [PATCH 07/10] [PRMT-3252] Addressed pull request comments --- .../e2e/tests/RepositoryE2ETests.java | 116 +++++++++--------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java index b91f396d..05b73e5a 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java @@ -15,7 +15,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.w3c.dom.Attr; import org.w3c.dom.Node; import org.xmlunit.builder.DiffBuilder; import org.xmlunit.diff.*; @@ -51,7 +50,8 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.test.util.AssertionErrors.assertFalse; -import static uk.nhs.prm.deduction.e2e.nhs.NhsIdentityGenerator.*; +import static uk.nhs.prm.deduction.e2e.nhs.NhsIdentityGenerator.randomNemsMessageId; +import static uk.nhs.prm.deduction.e2e.utility.TestUtils.isValidUUID; @SpringBootTest(classes = { RepositoryE2ETests.class, @@ -77,34 +77,50 @@ @ExtendWith(ForceXercesParserSoLogbackDoesNotBlowUpWhenUsingSwiftMqClient.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RepositoryE2ETests { + private static final Logger LOGGER = LogManager.getLogger(RepositoryE2ETests.class); + + private final RepoIncomingQueue repoIncomingQueue; + private final TrackerDb trackerDb; + private final SmallEhrQueue smallEhrQueue; + private final LargeEhrQueue largeEhrQueue; + private final AttachmentQueue attachmentQueue; + private final EhrParsingDLQ parsingDLQ; + private final EhrCompleteQueue ehrCompleteQueue; + private final TransferCompleteQueue transferCompleteQueue; + private final EhrInUnhandledQueue ehrInUnhandledQueue; + private final NegativeAcknowledgementQueue negativeAcknowledgementObservabilityQueue; + private final Gp2gpMessengerQueue gp2gpMessengerQueue; + private final TestConfiguration config; - // TODO PRMT-3252: REMOVE ONCE DONE IMPLEMENTING PRMT-3252 - FOR DEBUG USE ONLY. - private static final Logger debugLogger = LogManager.getLogger(RepositoryE2ETests.class); - - @Autowired - RepoIncomingQueue repoIncomingQueue; - @Autowired - TrackerDb trackerDb; - @Autowired - SmallEhrQueue smallEhrQueue; - @Autowired - LargeEhrQueue largeEhrQueue; - @Autowired - AttachmentQueue attachmentQueue; - @Autowired - EhrParsingDLQ parsingDLQ; - @Autowired - EhrCompleteQueue ehrCompleteQueue; - @Autowired - TransferCompleteQueue transferCompleteQueue; - @Autowired - EhrInUnhandledQueue ehrInUnhandledQueue; - @Autowired - NegativeAcknowledgementQueue negativeAcknowledgementObservabilityQueue; - @Autowired - Gp2gpMessengerQueue gp2gpMessengerQueue; @Autowired - TestConfiguration config; + public RepositoryE2ETests( + RepoIncomingQueue repoIncomingQueue, + TrackerDb trackerDb, + SmallEhrQueue smallEhrQueue, + LargeEhrQueue largeEhrQueue, + AttachmentQueue attachmentQueue, + EhrParsingDLQ parsingDLQ, + EhrCompleteQueue ehrCompleteQueue, + TransferCompleteQueue transferCompleteQueue, + EhrInUnhandledQueue ehrInUnhandledQueue, + NegativeAcknowledgementQueue negativeAcknowledgementObservabilityQueue, + Gp2gpMessengerQueue gp2gpMessengerQueue, + TestConfiguration config + + ) { + this.repoIncomingQueue = repoIncomingQueue; + this.trackerDb = trackerDb; + this.smallEhrQueue = smallEhrQueue; + this.largeEhrQueue = largeEhrQueue; + this.attachmentQueue = attachmentQueue; + this.parsingDLQ = parsingDLQ; + this.ehrCompleteQueue = ehrCompleteQueue; + this.transferCompleteQueue = transferCompleteQueue; + this.ehrInUnhandledQueue = ehrInUnhandledQueue; + this.negativeAcknowledgementObservabilityQueue = negativeAcknowledgementObservabilityQueue; + this.gp2gpMessengerQueue = gp2gpMessengerQueue; + this.config = config; + } PdsAdaptorClient pdsAdaptorClient; @@ -135,7 +151,7 @@ void shouldIdentifyEhrRequestAsEhrOutMessage() { } @Test - void shouldVerifyThatASmallEhrXMLIsUnchanged() throws InterruptedException { + void shouldVerifyThatASmallEhrXMLIsUnchanged() { // Given String inboundConversationId = UUID.randomUUID().toString(); String smallEhrMessageId = UUID.randomUUID().toString(); @@ -146,7 +162,6 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() throws InterruptedException { var inboundQueueFromMhs = new SimpleAmqpQueue(config); -// String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-with-linebreaks"); String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-without-linebreaks") .replaceAll("1632CD65-FD8F-4914-B62A-9763B50FC04A", inboundConversationId.toUpperCase()) .replaceAll("0206C270-E9A0-11ED-808B-AC162D1F16F0", smallEhrMessageId); @@ -174,9 +189,9 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() throws InterruptedException { )); inboundQueueFromMhs.sendMessage(smallEhr, inboundConversationId); - debugLogger.info("conversationIdExists: {}",trackerDb.conversationIdExists(inboundConversationId)); + LOGGER.info("conversationIdExists: {}",trackerDb.conversationIdExists(inboundConversationId)); var status = trackerDb.waitForStatusMatching(inboundConversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); - debugLogger.info("tracker db status: {}", status); + LOGGER.info("tracker db status: {}", status); // Put a EHR request to inboundQueueFromMhs inboundQueueFromMhs.sendMessage(ehrRequest, outboundConversationId); @@ -192,11 +207,11 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() throws InterruptedException { String gp2gpMessengerPayload = getPayload(gp2gpMessage.body()); String smallEhrPayload = getPayload(smallEhr); - debugLogger.info("Payload from gp2gpMessenger: {}", gp2gpMessengerPayload); - debugLogger.info("Payload from smallEhr: {}", smallEhrPayload); + LOGGER.info("Payload from gp2gpMessenger: {}", gp2gpMessengerPayload); + LOGGER.info("Payload from smallEhr: {}", smallEhrPayload); Diff myDiff = DiffBuilder.compare(gp2gpMessengerPayload).withTest(smallEhrPayload) .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)) - .withNodeFilter(node -> excludeComparisons(node)) + .withNodeFilter(this::excludeComparisons) .withDifferenceEvaluator(DifferenceEvaluators.chain(DifferenceEvaluators.Default, DifferenceEvaluators.downgradeDifferencesToEqual(ComparisonType.XML_STANDALONE))) .checkForSimilar().build(); @@ -204,38 +219,26 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() throws InterruptedException { assertFalse(myDiff.toString(), myDiff.hasDifferences()); } catch (JSONException e) { - debugLogger.error(e); + LOGGER.error(e); throw new Error(e); } } - private boolean isValidUuid(String rootId) { - try { - UUID validUuid = UUID.fromString(rootId); - return true; - } catch (IllegalArgumentException e) { - return false; - } - } - private boolean excludeComparisons(Node node) { - // if the node is ODS code, ignore comparison by returning false List excludeList = List.of( "1.2.826.0.1285.0.1.10", // ODS code - "1.2.826.0.1285.0.2.0.107"); // ASID code + "1.2.826.0.1285.0.2.0.107" // ASID code + ); if (node.hasAttributes() && node.getAttributes().getNamedItem("root") != null) { String idRootValue = node.getAttributes().getNamedItem("root").getNodeValue(); // return false to skip comparison in case when id root value itself is a message id - if (isValidUuid(idRootValue)) { + if (isValidUUID(idRootValue)) { return false; } // return false to skip comparison when the type of compared value is in the excludedList - if (node.getNodeName().equals("id") && excludeList.contains(idRootValue)) { - return false; - } + return !(node.getNodeName().equals("id") && excludeList.contains(idRootValue)); } - return true; } @@ -253,7 +256,7 @@ public void given2XMLsWithDifferences_whenTestsSimilarWithDifferenceEvaluator_th Diff myDiff = DiffBuilder.compare(control).withTest(test) - .withNodeFilter(node -> excludeComparisons(node)) + .withNodeFilter(this::excludeComparisons) .withDifferenceEvaluator(DifferenceEvaluators.chain(DifferenceEvaluators.Default, DifferenceEvaluators.downgradeDifferencesToEqual(ComparisonType.XML_STANDALONE))) .checkForSimilar().build(); @@ -270,7 +273,10 @@ private static String getPayload(String gp2gpMessageBody) throws JSONException { } } - // TODO: PRMT-3252 Create test: shouldVerifyThatALargeEhrXMLIsUnchanged() + @Test + void shouldVerifyThatALargeEhrXMLIsUnchanged() { + + } @Test void shouldReceivingAndTrackAllLargeEhrFragments_DevAndTest() { @@ -425,7 +431,7 @@ private void checkThatTransfersHaveCompletedSuccessfully(ArrayList conve long timeElapsed = Duration.between(timeLastRequestSent, finishedAt).toSeconds(); System.out.println("Total time taken for: " + conversationId + " in seconds was no more than : " + timeElapsed); - assertTrue(trackerDb.statusForConversationIdIs(conversationId.toString(), "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE")); + assertTrue(trackerDb.statusForConversationIdIs(conversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE")); } } From 15edc6eb0263d94f425806dcdd17ae2d209e21c8 Mon Sep 17 00:00:00 2001 From: MohammedIqbal Date: Thu, 11 May 2023 16:09:30 +0100 Subject: [PATCH 08/10] [PRMT-3252] Addressed pull request comments 2 --- .../prm/deduction/e2e/utility/TestUtils.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java b/src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java new file mode 100644 index 00000000..ce5d925f --- /dev/null +++ b/src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java @@ -0,0 +1,21 @@ +package uk.nhs.prm.deduction.e2e.utility; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.regex.Pattern; + +public final class TestUtils { + private static final Logger LOGGER = LogManager.getLogger(TestUtils.class); + private static final Pattern UUID_REGEX_PATTERN = + Pattern.compile("^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$"); + + public static boolean isValidUUID(String uuid) { + try { + return UUID_REGEX_PATTERN.matcher(uuid).matches(); + } catch (IllegalArgumentException exception) { + LOGGER.error("Exception occurred while testing UUID validity: {}", exception.getMessage()); + return false; + } + } +} From 2fe180aa83fbfaa630b66aaf4c6950acf5c1f7ca Mon Sep 17 00:00:00 2001 From: MohammedIqbal Date: Fri, 12 May 2023 15:52:24 +0100 Subject: [PATCH 09/10] [PRMT-3252] Extracted out logic into utility class --- .../e2e/tests/RepositoryE2ETests.java | 60 ++++--------------- .../prm/deduction/e2e/utility/TestUtils.java | 51 ++++++++++++++++ 2 files changed, 64 insertions(+), 47 deletions(-) diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java index 05b73e5a..6f936c0a 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java @@ -3,7 +3,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.json.JSONException; -import org.json.JSONObject; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -15,7 +14,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.w3c.dom.Node; import org.xmlunit.builder.DiffBuilder; import org.xmlunit.diff.*; import uk.nhs.prm.deduction.e2e.TestConfiguration; @@ -35,13 +33,13 @@ import uk.nhs.prm.deduction.e2e.transfer_tracker_db.TrackerDb; import uk.nhs.prm.deduction.e2e.transfer_tracker_db.TransferTrackerDbMessage; import uk.nhs.prm.deduction.e2e.utility.Resources; +import uk.nhs.prm.deduction.e2e.utility.TestUtils; import java.time.Duration; import java.time.Instant; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.ArrayList; -import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; @@ -51,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.test.util.AssertionErrors.assertFalse; import static uk.nhs.prm.deduction.e2e.nhs.NhsIdentityGenerator.randomNemsMessageId; -import static uk.nhs.prm.deduction.e2e.utility.TestUtils.isValidUUID; +import static uk.nhs.prm.deduction.e2e.utility.TestUtils.*; @SpringBootTest(classes = { RepositoryE2ETests.class, @@ -158,23 +156,18 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() { String outboundConversationId = UUID.randomUUID().toString(); String nhsNumberForTestPatient = "9727018440"; String sourceGpForTestPatient = "M85019"; + String asidCodeForTestPatient = "200000000149"; String timeNow = ZonedDateTime.now(ZoneOffset.ofHours(0)).toString(); - var inboundQueueFromMhs = new SimpleAmqpQueue(config); + SimpleAmqpQueue inboundQueueFromMhs = new SimpleAmqpQueue(config); - String smallEhr = Resources.readTestResourceFileFromEhrDirectory("small-ehr-without-linebreaks") - .replaceAll("1632CD65-FD8F-4914-B62A-9763B50FC04A", inboundConversationId.toUpperCase()) - .replaceAll("0206C270-E9A0-11ED-808B-AC162D1F16F0", smallEhrMessageId); + String smallEhr = getSmallEhrWithoutLinebreaks(inboundConversationId.toUpperCase(), smallEhrMessageId); - String ehrRequest = Resources.readTestResourceFile("RCMR_IN010000UK05") - .replaceAll("9692842304", nhsNumberForTestPatient) - .replaceAll("A91720", sourceGpForTestPatient) - .replaceAll("200000000631", "200000000149") - .replaceAll("17a757f2-f4d2-444e-a246-9cb77bef7f22", outboundConversationId); + String ehrRequest = getEhrRequest(nhsNumberForTestPatient, sourceGpForTestPatient, asidCodeForTestPatient, outboundConversationId); // When // change transfer db status to ACTION:EHR_REQUEST_SENT before putting on inbound queue - // Put the patient to inboundQueueFromMhs as an UK05 message + // Put the patient into inboundQueueFromMhs as a UK05 message trackerDb.save(new TransferTrackerDbMessage( inboundConversationId, @@ -190,7 +183,7 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() { inboundQueueFromMhs.sendMessage(smallEhr, inboundConversationId); LOGGER.info("conversationIdExists: {}",trackerDb.conversationIdExists(inboundConversationId)); - var status = trackerDb.waitForStatusMatching(inboundConversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); + String status = trackerDb.waitForStatusMatching(inboundConversationId, "ACTION:EHR_TRANSFER_TO_REPO_COMPLETE"); LOGGER.info("tracker db status: {}", status); // Put a EHR request to inboundQueueFromMhs @@ -211,37 +204,19 @@ void shouldVerifyThatASmallEhrXMLIsUnchanged() { LOGGER.info("Payload from smallEhr: {}", smallEhrPayload); Diff myDiff = DiffBuilder.compare(gp2gpMessengerPayload).withTest(smallEhrPayload) .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)) - .withNodeFilter(this::excludeComparisons) + .withNodeFilter(TestUtils::excludeComparisons) .withDifferenceEvaluator(DifferenceEvaluators.chain(DifferenceEvaluators.Default, DifferenceEvaluators.downgradeDifferencesToEqual(ComparisonType.XML_STANDALONE))) .checkForSimilar().build(); assertFalse(myDiff.toString(), myDiff.hasDifferences()); - } catch (JSONException e) { - LOGGER.error(e); - throw new Error(e); + } catch (JSONException exception) { + LOGGER.error(exception); + throw new Error(exception); } } - private boolean excludeComparisons(Node node) { - List excludeList = List.of( - "1.2.826.0.1285.0.1.10", // ODS code - "1.2.826.0.1285.0.2.0.107" // ASID code - ); - - if (node.hasAttributes() && node.getAttributes().getNamedItem("root") != null) { - String idRootValue = node.getAttributes().getNamedItem("root").getNodeValue(); - // return false to skip comparison in case when id root value itself is a message id - if (isValidUUID(idRootValue)) { - return false; - } - // return false to skip comparison when the type of compared value is in the excludedList - return !(node.getNodeName().equals("id") && excludeList.contains(idRootValue)); - } - return true; - } - @Test public void given2XMLsWithDifferences_whenTestsSimilarWithDifferenceEvaluator_thenCorrect() { // helper test case for building the `excludeComparisons` function @@ -256,7 +231,7 @@ public void given2XMLsWithDifferences_whenTestsSimilarWithDifferenceEvaluator_th Diff myDiff = DiffBuilder.compare(control).withTest(test) - .withNodeFilter(this::excludeComparisons) + .withNodeFilter(TestUtils::excludeComparisons) .withDifferenceEvaluator(DifferenceEvaluators.chain(DifferenceEvaluators.Default, DifferenceEvaluators.downgradeDifferencesToEqual(ComparisonType.XML_STANDALONE))) .checkForSimilar().build(); @@ -264,15 +239,6 @@ public void given2XMLsWithDifferences_whenTestsSimilarWithDifferenceEvaluator_th assertFalse(myDiff.toString(), myDiff.hasDifferences()); } - private static String getPayload(String gp2gpMessageBody) throws JSONException { - JSONObject jsonObject = new JSONObject(gp2gpMessageBody); - if (jsonObject.has("payload") ) { - return jsonObject.getString("payload"); - } else { - return jsonObject.getJSONObject("request").getJSONObject("body").getString("payload"); - } - } - @Test void shouldVerifyThatALargeEhrXMLIsUnchanged() { diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java b/src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java index ce5d925f..5b92dbd5 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/utility/TestUtils.java @@ -2,7 +2,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.json.JSONException; +import org.json.JSONObject; +import org.w3c.dom.Node; +import java.util.List; import java.util.regex.Pattern; public final class TestUtils { @@ -18,4 +22,51 @@ public static boolean isValidUUID(String uuid) { return false; } } + + public static String getSmallEhrWithoutLinebreaks(String newConversationId, String newMessageId) { + return Resources.readTestResourceFileFromEhrDirectory("small-ehr-without-linebreaks") + .replaceAll("1632CD65-FD8F-4914-B62A-9763B50FC04A", newConversationId.toUpperCase()) + .replaceAll("0206C270-E9A0-11ED-808B-AC162D1F16F0", newMessageId); + } + + public static String getEhrRequest( + String newNhsNumber, + String odsCodeOfRequestSender, + String asidCodeOfRequestSender, + String newConversationId) + { + return Resources.readTestResourceFile("RCMR_IN010000UK05") + .replaceAll("9692842304", newNhsNumber) + .replaceAll("A91720", odsCodeOfRequestSender) + .replaceAll("200000000631", asidCodeOfRequestSender) + .replaceAll("17a757f2-f4d2-444e-a246-9cb77bef7f22", newConversationId); + } + + public static boolean excludeComparisons(Node node) { + List excludeList = List.of( + "1.2.826.0.1285.0.1.10", // ODS code + "1.2.826.0.1285.0.2.0.107" // ASID code + ); + + if (node.hasAttributes() && node.getAttributes().getNamedItem("root") != null) { + String idRootValue = node.getAttributes().getNamedItem("root").getNodeValue(); + // return false to skip comparison in case when id root value itself is a message id + if (isValidUUID(idRootValue)) { + return false; + } + // return false to skip comparison when the type of compared value is in the excludedList + return !(node.getNodeName().equals("id") && excludeList.contains(idRootValue)); + } + return true; + } + + public static String getPayload(String gp2gpMessageBody) throws JSONException { + JSONObject jsonObject = new JSONObject(gp2gpMessageBody); + if (jsonObject.has("payload") ) { + return jsonObject.getString("payload"); + } else { + return jsonObject.getJSONObject("request").getJSONObject("body").getString("payload"); + } + } + } From 292a3209762e3f820b4d8e6933fc35db2165257e Mon Sep 17 00:00:00 2001 From: MohammedIqbal Date: Tue, 16 May 2023 13:41:15 +0100 Subject: [PATCH 10/10] Addressed pull request comments/removed @jsonProperty from TransferTrackerDbMessage.java --- .../e2e/tests/RepositoryE2ETests.java | 1 - .../e2e/transfer_tracker_db/TrackerDb.java | 3 +-- .../TransferTrackerDbMessage.java | 18 +++++++++--------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java index 6f936c0a..dd26bdf8 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/tests/RepositoryE2ETests.java @@ -241,7 +241,6 @@ public void given2XMLsWithDifferences_whenTestsSimilarWithDifferenceEvaluator_th @Test void shouldVerifyThatALargeEhrXMLIsUnchanged() { - } @Test diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java index 256ed7f3..cd12f343 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TrackerDb.java @@ -48,8 +48,7 @@ public String waitForStatusMatching(String conversationId, String partialStatus) .until(() -> transferTrackerDbClient.queryDbWithConversationId(conversationId).item().get("state").s(), containsString(partialStatus)); } - public void save(TransferTrackerDbMessage message) - { + public void save(TransferTrackerDbMessage message) { transferTrackerDbClient.save(message); } } diff --git a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java index f2416ffb..0a47f171 100644 --- a/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java +++ b/src/test/java/uk/nhs/prm/deduction/e2e/transfer_tracker_db/TransferTrackerDbMessage.java @@ -23,15 +23,15 @@ public class TransferTrackerDbMessage { private String createdAt; private String lastUpdatedAt; - public TransferTrackerDbMessage(@JsonProperty("conversationId") String conversationId, - @JsonProperty("largeEhrCoreMessageId") String largeEhrCoreMessageId, - @JsonProperty("nemsMessageId") String nemsMessageId, - @JsonProperty("nhsNumber") String nhsNumber, - @JsonProperty("sourceGp") String sourceGp, - @JsonProperty("state") String state, - @JsonProperty("nemsEventLastUpdated") String nemsEventLastUpdated, - @JsonProperty("createdAt") String createdAt, - @JsonProperty("lastUpdatedAt") String lastUpdatedAt){ + public TransferTrackerDbMessage(String conversationId, + String largeEhrCoreMessageId, + String nemsMessageId, + String nhsNumber, + String sourceGp, + String state, + String nemsEventLastUpdated, + String createdAt, + String lastUpdatedAt){ this.conversationId = conversationId; this.largeEhrCoreMessageId = largeEhrCoreMessageId; this.nemsMessageId = nemsMessageId;