-
Notifications
You must be signed in to change notification settings - Fork 10
Story/672/marshal results into fhir #755
Changes from 17 commits
53a0d0b
8abaf38
eb091c2
65a1606
8894567
a4eb334
77f7f61
fb2e2f9
9c18f78
e3a0712
6f34e1e
757fbbd
fbe883a
4b47b2d
2ef1be6
a81f471
8b8434e
d363e8f
1d412cc
03c54ce
269dd5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ protected Connection connect() throws SQLException { | |
|
||
// If the below prop isn't set to require and we just set ssl=true it will expect a CA cert | ||
// in azure which breaks it | ||
props.setProperty("sslmode", ssl); | ||
props.setProperty("ssl", ssl); | ||
conn = driverManager.getConnection(url, props); | ||
logger.logInfo("DB Connected Successfully"); | ||
return conn; | ||
|
@@ -90,9 +90,12 @@ public synchronized void upsertMetadata( | |
|
||
try (Connection conn = connect(); | ||
PreparedStatement statement = | ||
conn.prepareStatement("INSERT INTO metadata VALUES (?, ?, ?, ?, ?)")) { | ||
// TODO: Update the below statement to handle on conflict, after we figure out what that | ||
// behavior should be | ||
conn.prepareStatement( | ||
""" | ||
INSERT INTO metadata VALUES (?, ?, ?, ?, ?) | ||
ON CONFLICT (message_id) DO UPDATE SET receiver = EXCLUDED.receiver | ||
""")) { | ||
|
||
statement.setString(1, receivedSubmissionId); | ||
statement.setString(2, sender); | ||
statement.setString(3, receiver); | ||
|
@@ -120,6 +123,7 @@ public synchronized PartnerMetadata fetchMetadata(String receivedSubmissionId) | |
|
||
return new PartnerMetadata( | ||
result.getString("message_id"), | ||
result.getString("sender"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change going to be in the other PR that will add the sentSubmissionId handling? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
result.getString("receiver"), | ||
result.getTimestamp("time_received").toInstant(), | ||
result.getString("hash_of_order")); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,17 +148,18 @@ class PostgresDaoTest extends Specification { | |
def "fetchMetadata returns partnermetadata when rows exist"() { | ||
given: | ||
def messageId = "12345" | ||
def receiver = "DogCow" | ||
def sender = "DogCow" | ||
Timestamp timestampForMock = Timestamp.from(Instant.parse("2024-01-03T15:45:33.30Z")) | ||
Instant timeReceived = timestampForMock.toInstant() | ||
def hash = receiver.hashCode().toString() | ||
def expected = new PartnerMetadata(messageId, receiver, timeReceived, hash) | ||
def hash = sender.hashCode().toString() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the changes to the DB implementation in this PR be in the other PR given is not directly related to the marshaling of the response? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The above changes are fixing a bug I had from previous PRs, because of how I was retrieving results, one column from the db was never being populated. So I updated the above test after fixing the results retrieval as the test started to fail. |
||
def expected = new PartnerMetadata(messageId, sender, null, timeReceived, hash) | ||
|
||
mockDriver.getConnection(_ as String, _ as Properties) >> mockConn | ||
mockConn.prepareStatement(_ as String) >> mockPreparedStatement | ||
mockResultSet.next() >> true | ||
mockResultSet.getString("message_id") >> messageId | ||
mockResultSet.getString("receiver") >> receiver | ||
mockResultSet.getString("sender") >> sender | ||
mockResultSet.getString("receiver") >> null | ||
mockResultSet.getTimestamp("time_received") >> timestampForMock | ||
mockResultSet.getString("hash_of_order") >> hash | ||
mockPreparedStatement.executeQuery() >> mockResultSet | ||
|
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.
Will this be removed?
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 in the PR to add Submission received id
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.
So it will be added in this PR, and then removed in the other one? Is that necessary?