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

Bump com.amazonaws:aws-java-sdk-bom from 1.11.1000 to 1.12.748 in /gp2gp-translator #637

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 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