Skip to content

Commit

Permalink
Bump com.amazonaws:aws-java-sdk-bom from 1.11.1000 to 1.12.748 in /gp…
Browse files Browse the repository at this point in the history
…2gp-translator (#637)

* Bump com.amazonaws:aws-java-sdk-bom in /gp2gp-translator

Bumps [com.amazonaws:aws-java-sdk-bom](https://github.com/aws/aws-sdk-java) from 1.11.1000 to 1.12.748.
- [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-java@1.11.1000...1.12.748)

---
updated-dependencies:
- dependency-name: com.amazonaws:aws-java-sdk-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Replace amazon namespace Exception with IllegalArgumentException

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adrian Clay <[email protected]>
  • Loading branch information
dependabot[bot] and adrianclay authored Jun 21, 2024
1 parent e3db86e commit 4e71f82
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gp2gp-translator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {

implementation 'com.azure:azure-storage-blob:12.26.1'

implementation platform('com.amazonaws:aws-java-sdk-bom:1.11.1000')
implementation platform('com.amazonaws:aws-java-sdk-bom:1.12.748')
implementation 'com.amazonaws:aws-java-sdk-s3'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import software.amazon.ion.NullValueException;
import uk.nhs.adaptors.connector.model.PatientAttachmentLog;
import uk.nhs.adaptors.pss.translator.config.SupportedFileTypes;
import uk.nhs.adaptors.pss.translator.exception.InlineAttachmentProcessingException;
Expand Down Expand Up @@ -125,14 +124,14 @@ public void storeAttachmentWithoutProcessing(String fileName, String payload, St

public byte[] getAttachment(String filename, String conversationId) {
if (!StringUtils.hasText(filename)) {
throw new NullValueException();
throw new IllegalArgumentException("filename must not be empty");
}
return storageManagerService.downloadFile(filename, conversationId);
}

public void removeAttachment(String filename, String conversationId) {
if (!StringUtils.hasText(filename)) {
throw new NullValueException();
throw new IllegalArgumentException("filename must not be empty");
}
storageManagerService.deleteFile(filename, conversationId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import software.amazon.ion.NullValueException;
import uk.nhs.adaptors.connector.model.PatientAttachmentLog;
import uk.nhs.adaptors.pss.translator.mhs.model.InboundMessage;
import uk.nhs.adaptors.pss.translator.model.EbxmlReference;
Expand Down Expand Up @@ -73,7 +72,7 @@ private InboundMessage insertSkeletonIntoInboundMessagePayload(PatientAttachment
.findFirst();

if (ebxmlSkeletonReference.isEmpty()) {
throw new NullValueException();
throw new IllegalArgumentException("inboundMessage does not contain a skeleton attachment reference");
}

var skeletonDocumentId = ebxmlSkeletonReference.get().getDocumentId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.xml.bind.JAXBException;
import javax.xml.transform.TransformerException;
Expand All @@ -31,7 +32,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;

import lombok.SneakyThrows;
import software.amazon.ion.NullValueException;
import uk.nhs.adaptors.connector.dao.PatientMigrationRequestDao;
import uk.nhs.adaptors.connector.model.PatientAttachmentLog;
import uk.nhs.adaptors.connector.model.PatientMigrationRequest;
Expand Down Expand Up @@ -115,7 +115,7 @@ private void prepareSkeletonRCMRMocks(InboundMessage inboundMessage) throws SAXE
}

@Test
public void When_UpdateInboundMessageAttachmentHandlerServiceThrowsNullException_Expect_ThrowsNullValueException()
public void When_UpdateInboundMessageAttachmentHandlerServiceThrowsIllegalArgumentException_Expect_ThrowsException()
throws JAXBException, JsonProcessingException, TransformerException, SAXException {

var inboundMessage = new InboundMessage();
Expand All @@ -124,9 +124,9 @@ public void When_UpdateInboundMessageAttachmentHandlerServiceThrowsNullException
inboundMessage.setPayload(readInboundMessagePayloadFromFile());
inboundMessage.setEbXML(readInboundMessageEbXmlFromFile());

doThrow(NullValueException.class).when(attachmentHandlerService).getAttachment(any(), any());
doThrow(IllegalArgumentException.class).when(attachmentHandlerService).getAttachment(any(), any());

assertThrows(NullValueException.class, () ->
assertThrows(IllegalArgumentException.class, () ->
skeletonProcessingService.updateInboundMessageWithSkeleton(attachmentLog,
inboundMessage, migrationRequest.getConversationId()));
}
Expand Down Expand Up @@ -190,16 +190,16 @@ public void When_SkeletonAsSectionMessage_Expect_ThrowNoErrors() throws JAXBExce
}

@Test
public void When_SkeletonAsSectionMessageAndEBXMLSkeletonReferenceIsEmpty_Expect_NullValueException()
throws JAXBException, JsonProcessingException, TransformerException, SAXException {
public void When_SkeletonAsSectionMessageAndEBXMLSkeletonReferenceIsEmpty_Expect_IllegalArgumentException()
throws SAXException {
var inboundMessage = new InboundMessage();
var attachmentLog = createSkeletonPatientAttachmentLog();

inboundMessage.setPayload(readInboundMessagePayloadFromFile());
inboundMessage.setEbXML(readInboundMessageEbXmlFromFile());

var reference = new EbxmlReference("First instance is always a payload", "mid:1", "docId");
var ebXmlAttachments = Arrays.asList(reference);
var ebXmlAttachments = List.of(reference);
var fileAsBytes = readInboundMessageSkeletonPayloadFromFile().getBytes(StandardCharsets.UTF_8);
when(attachmentHandlerService.getAttachment(any(), any())).thenReturn(fileAsBytes);
when(xmlParseUtilService.getEbxmlAttachmentsData(any())).thenReturn(ebXmlAttachments);
Expand All @@ -210,7 +210,7 @@ public void When_SkeletonAsSectionMessageAndEBXMLSkeletonReferenceIsEmpty_Expect
emptyAttachmentsData
);

assertThrows(NullValueException.class, () ->
assertThrows(IllegalArgumentException.class, () ->
skeletonProcessingService.updateInboundMessageWithSkeleton(attachmentLog,
inboundMessage, migrationRequest.getConversationId()));
}
Expand Down

0 comments on commit 4e71f82

Please sign in to comment.