-
Notifications
You must be signed in to change notification settings - Fork 0
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
PRMT-3439 - Multiple EHR requests for the same EHR from the same GP #23
base: main
Are you sure you want to change the base?
Conversation
…ot exist on queue
…and the other for unknown NHS number
… sec, unify the way to generate trigger message in two tests
…obvious that it is for testing
…h unknown conversation id
…seString to TestUtils
… send the same message to consumer more than once
…efore triggering EHR OUT
@@ -6,6 +6,7 @@ public enum Patient { | |||
SUSPENDED_WITH_EHR_AT_TPP("9693642937"), | |||
PATIENT_WITH_LARGE_EHR_AT_EMIS_WITH_MOF_SET_TO_REPO_DEV_ODS("9693643038"), | |||
PATIENT_WITH_LARGE_EHR_AT_EMIS_WITH_MOF_SET_TO_REPO_TEST_ODS("9694181372"), | |||
PATIENT_WITH_SMALL_EHR_RECORD_IN_REPO_AND_MOF_SET_TO_TPP("9727018440"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of consistency, I suggest removing the word "RECORD" from the enum.
PATIENT_WITH_SMALL_EHR_RECORD_IN_REPO_AND_MOF_SET_TO_TPP("9727018440"), | |
PATIENT_WITH_SMALL_EHR_IN_REPO_AND_MOF_SET_TO_TPP("9727018440"), |
String smallEhrMessageId = createUuidAsString(); | ||
String previousGpForTestPatient = "M85019"; | ||
|
||
// TODO: Consider to implement a better way of filling details into the EHR files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 'TODO' needs addressing.
.withEhrSourceAsRepo(config) | ||
.withEhrDestinationGp(Gp2GpSystem.TPP_PTL_INT) | ||
.build(); | ||
int numberOfDuplicatedMessage = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider pluralising this variable to 'numberOfDuplicatedMessages'
int numberOfDuplicatedMessage = 3; | |
int numberOfDuplicatedMessages = 3; |
assertThat(outboundMessages.size()).isEqualTo(1); | ||
|
||
String outboundEhrCore = outboundMessages.get(0).body(); | ||
assertThat(outboundEhrCore).contains(testPatient.nhsNumber()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reuse the variable 'nhsNumberForTest' that had already been assigned the method 'testPatient.nhsNumber()'.
assertThat(outboundEhrCore).contains(testPatient.nhsNumber()); | |
assertThat(outboundEhrCore).contains(nhsNumberForTest); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I have addressed the PR comments
@@ -161,4 +162,12 @@ public static LargeEhrTestFiles prepareTestFilesForLargeEhr( | |||
|
|||
return new LargeEhrTestFiles(largeEhrCore, largeEhrFragment1, largeEhrFragment2, ehrRequest, continueRequest); | |||
} | |||
|
|||
public static String createUuidAsString() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static String createUuidAsString() { | |
public static String createUUIDAsString() { |
Could we capitalise UUID, please?
@@ -181,6 +181,10 @@ public String getEhrRepoUrl() { | |||
return String.format("https://ehr-repo.%s.patient-deductions.nhs.uk/", getEnvSuffix()); | |||
} | |||
|
|||
public String getEhrOutUrl() { | |||
return String.format("https://ehr-out-service.%s.patient-deductions.nhs.uk/", getEnvSuffix()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this not just be a class-level member constant?
return String.format("https://ehr-out-service.%s.patient-deductions.nhs.uk/", getEnvSuffix()); | |
public static String EHR_OUT_URL = String.format("https://ehr-out-service.%s.patient-deductions.nhs.uk/", getEnvSuffix()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, reflect throughout the URLs :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I have addressed this by changing the urls into static constants and updating the references in the new tests that we written.
There are some references to those getXXXUrl methods in other test suites which is not in the scope of this ticket, so I added a TODO comment to address those after we finish moving all packages to main.
public String conversationId() { | ||
return getUUIDAsUpperCaseString(conversationId); | ||
} | ||
|
||
public String messageId() { | ||
return getUUIDAsUpperCaseString(messageId); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these really required? I would say that if all the function does is return a single UUID in uppercase - could we not just use:
conversationId.toString().toUpperCase();
messageId.toString().toUpperCase();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, previously we used toString().toUpperCase() here, but we extracted that to a static function as suggested by a PR comment in PRMT-3413, so probably I am keeping it like this for now.
private UUID conversationId; | ||
private UUID messageId; | ||
private String sourceGpOds; | ||
private String destinationGpOds; | ||
private String sourceGpAsid; | ||
private String destinationGpAsid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be final :D
private UUID conversationId; | |
private UUID messageId; | |
private String sourceGpOds; | |
private String destinationGpOds; | |
private String sourceGpAsid; | |
private String destinationGpAsid; | |
private UUID conversationId; | |
private final UUID messageId; | |
private final String sourceGpOds; | |
private final String destinationGpOds; | |
private final String sourceGpAsid; | |
private final String destinationGpAsid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, comment addressed
public ContinueRequestMessage(UUID conversationId, UUID messageId, String sourceGpOds, String destinationGpOds, String sourceGpAsid, String destinationGpAsid) { | ||
this.conversationId = conversationId; | ||
this.messageId = messageId; | ||
this.sourceGpOds = sourceGpOds; | ||
this.destinationGpOds = destinationGpOds; | ||
this.sourceGpAsid = sourceGpAsid; | ||
this.destinationGpAsid = destinationGpAsid; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leverage Lombok here in favour of adding the following annotation to the class level, in favour of this constructor - just removes some boilerplate stuff :)
@AllArgsConstructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It's so good to know this useful annotation! Boilerplate gone now :D
src/test/java/uk/nhs/prm/deduction/e2e/models/ContinueRequestMessage.java
Show resolved
Hide resolved
public EhrRequestMessage(String nhsNumber, String sourceGpOds, String destinationGpOds, String sourceGpAsid, String destinationGpAsid, UUID conversationId, UUID messageId) { | ||
this.nhsNumber = nhsNumber; | ||
this.sourceGpOds = sourceGpOds; | ||
this.destinationGpOds = destinationGpOds; | ||
this.sourceGpAsid = sourceGpAsid; | ||
this.destinationGpAsid = destinationGpAsid; | ||
this.conversationId = conversationId; | ||
this.messageId = messageId; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previously mentioned, please use Lombok's @AllArgsConstructor
in favour of the manually defined constructor!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Replaced boilerplate with @ AllArgsConstructor here as well
public String conversationId() { | ||
return getUUIDAsUpperCaseString(conversationId); | ||
} | ||
|
||
public String messageId() { | ||
return getUUIDAsUpperCaseString(messageId); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, do we need these?
this.messageId = messageId; | ||
} | ||
|
||
public String toJsonString() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above again! :D
public String toJsonString() { | |
public String getJsonString() { |
@@ -29,7 +30,7 @@ public void deleteAllMessages() { | |||
log(String.format("Trying to delete all the messages on : %s", this.queueUri)); | |||
try { | |||
thinlyWrappedSqsClient.deleteAllMessages(queueUri); | |||
} catch (Exception e){ | |||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find what exception is being thrown here and be explicit, such as IllegalArgumentException
:) Additionally, please rename e
in favour of exception
.
} catch (Exception e) { | |
} catch (Exception exception) { |
Brilliant! You've picked up Java fast 😄 |
getAllMessageContaining
method to account for that SQS may not return all messages in one go, and may return same message more than once on repeated polling