diff --git a/api/pom.xml b/api/pom.xml index 134ccc5..72cfa40 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -5,7 +5,7 @@ org.lfenergy.shapeshifter shapeshifter-library - 2.4.0-SNAPSHOT + 2.5.0-SNAPSHOT ../pom.xml diff --git a/api/src/main/resources/uftp.xjb b/api/src/main/resources/uftp.xjb index 27c923c..8f92250 100644 --- a/api/src/main/resources/uftp.xjb +++ b/api/src/main/resources/uftp.xjb @@ -1,6 +1,6 @@ - + diff --git a/core/pom.xml b/core/pom.xml index 4e872a4..224c469 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ org.lfenergy.shapeshifter shapeshifter-library - 2.4.0-SNAPSHOT + 2.5.0-SNAPSHOT ../pom.xml @@ -22,13 +22,13 @@ 5.13.0 5.1.4 2.0.2 - 2.2.20 - 3.2.0 + 2.2.21 + 3.5.3 2.9.1 - 1.18.30 - 1.2 + 1.18.32 + 1.3.1 2.1.1 - 4.2.0 + 4.2.1 diff --git a/core/src/main/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageService.java b/core/src/main/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageService.java index 27c678f..d7e1751 100644 --- a/core/src/main/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageService.java +++ b/core/src/main/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageService.java @@ -52,7 +52,7 @@ public class UftpSendMessageService { private static final String MSG_CLIENT_ERROR = "Client error {0} received while sending UFTP message to {1}: {2}"; private static final String MSG_SERVER_ERROR = "Server error {0} received while sending UFTP message to {1}: {2}"; private static final String MSG_UNEXPECTED_RESPONSE_STATUS = "Unexpected response status {0} received while sending UFTP message to {1}: {2}"; - private static final String MSG_UNEXPECTED_IO_ERROR = "Unexpected I/O exception while sending UFTP message to {0}: {1}"; + private static final String MSG_UNEXPECTED_IO_ERROR = "Unexpected I/O exception while sending UFTP message to {0}: {1}: {2}"; private static final String MSG_INTERRUPTED = "Interrupted while sending UFTP message to {0}: {1}"; private static final String MSG_TOO_MANY_REDIRECTS = "Too many redirects while sending UFTP message to {0}"; private static final String MSG_MISSING_REDIRECT_LOCATION = "Redirect received without " + REDIRECT_LOCATION_HEADER_NAME + " header while sending UFTP message to {0}"; @@ -166,7 +166,7 @@ private void send(String signedXml, String url, int maxFollowRedirects) { } catch (URISyntaxException | IllegalArgumentException e) { throw new UftpSendException(MessageFormat.format(MSG_INVALID_ENDPOINT, e.getMessage()), e); } catch (IOException e) { - throw new UftpSendException(MessageFormat.format(MSG_UNEXPECTED_IO_ERROR, url, e.getMessage()), e); + throw new UftpSendException(MessageFormat.format(MSG_UNEXPECTED_IO_ERROR, url, e.getClass().getSimpleName(), e.getMessage()), e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new UftpSendException(MessageFormat.format(MSG_INTERRUPTED, url, e.getMessage()), e); diff --git a/core/src/test/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageServiceTest.java b/core/src/test/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageServiceTest.java index f1deeba..3afeea5 100644 --- a/core/src/test/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageServiceTest.java +++ b/core/src/test/java/org/lfenergy/shapeshifter/core/service/sending/UftpSendMessageServiceTest.java @@ -350,6 +350,26 @@ void attemptToSendMessage_MalformedUrl() { verifyNoInteractions(uftpValidationService); } + @Test + void attemptToSendMessage_connectFailed() { + mockSerialisation(); + mockSending(); + var endpoint = "http://localhost:1"; // something that will trigger a java.net.ConnectException + given(participantService.getEndPointUrl(any())).willReturn(endpoint); + var httpStatusCode = HttpStatusCode.INTERNAL_SERVER_ERROR; + + var actual = assertThrows(UftpSendException.class, () -> + testSubject.attemptToSendMessage(flexRequest, details)); + + verifySending(); + + assertThat(actual) + .isInstanceOf(UftpSendException.class) + .hasMessage("Unexpected I/O exception while sending UFTP message to " + endpoint + ": ConnectException: null"); + assertThat(actual.getHttpStatusCode()).isEqualTo(httpStatusCode); + verifyNoInteractions(uftpValidationService); + } + @Test void attemptToValidateAndSendMessage_ValidationException() { given(details.sender()).willReturn(sender); diff --git a/core/src/test/java/org/lfenergy/shapeshifter/core/service/serialization/TestFile.java b/core/src/test/java/org/lfenergy/shapeshifter/core/service/serialization/TestFile.java index cfcb631..b65b6b6 100644 --- a/core/src/test/java/org/lfenergy/shapeshifter/core/service/serialization/TestFile.java +++ b/core/src/test/java/org/lfenergy/shapeshifter/core/service/serialization/TestFile.java @@ -10,7 +10,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import org.apache.commons.io.FileUtils; public class TestFile { @@ -26,7 +25,7 @@ private static String toFolder(Class testClass) { public static String readResourceFileAsString(Class testClass, String testName, String postFix) throws IOException { File file = resourceAsFile(testClass, testName, postFix); - return FileUtils.readFileToString(file, StandardCharsets.UTF_8); + return Files.readString(file.toPath(), StandardCharsets.UTF_8); } public static void compareAsXml(Class testClass, String testName, String actualXml) throws IOException { diff --git a/pom.xml b/pom.xml index 31a8023..2b13519 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.lfenergy.shapeshifter shapeshifter-library - 2.4.0-SNAPSHOT + 2.5.0-SNAPSHOT pom Shapeshifter Library @@ -48,7 +48,7 @@ 5.10.2 3.25.3 - 5.6.0 + 5.11.0 3.2.1 @@ -138,6 +138,7 @@ ${dependency-check-maven.version} 8 + false diff --git a/spring/pom.xml b/spring/pom.xml index c6a4333..907fa69 100644 --- a/spring/pom.xml +++ b/spring/pom.xml @@ -5,7 +5,7 @@ org.lfenergy.shapeshifter shapeshifter-library - 2.4.0-SNAPSHOT + 2.5.0-SNAPSHOT ../pom.xml @@ -16,8 +16,8 @@ https://www.lfenergy.org/projects/shapeshifter/ - 3.2.3 - 2.2.20 + 3.2.5 + 2.2.21