Skip to content
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 api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.lfenergy.shapeshifter</groupId>
<artifactId>shapeshifter-library</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions api/src/main/resources/uftp.xjb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="4.0">
<jaxb:bindings xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0">

<jaxb:globalBindings>
<jaxb:serializable uid="1"/>
Expand Down
12 changes: 6 additions & 6 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.lfenergy.shapeshifter</groupId>
<artifactId>shapeshifter-library</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -22,13 +22,13 @@
<jna.version>5.13.0</jna.version>
<lazysodium-java.version>5.1.4</lazysodium-java.version>
<resource-loader.version>2.0.2</resource-loader.version>
<swagger-annotations.version>2.2.20</swagger-annotations.version>
<wiremock.version>3.2.0</wiremock.version>
<swagger-annotations.version>2.2.21</swagger-annotations.version>
<wiremock.version>3.5.3</wiremock.version>
<xmlunit.verion>2.9.1</xmlunit.verion>
<lombok.version>1.18.30</lombok.version>
<commons-logging.version>1.2</commons-logging.version>
<lombok.version>1.18.32</lombok.version>
<commons-logging.version>1.3.1</commons-logging.version>
<jakarta-annotation.version>2.1.1</jakarta-annotation.version>
<awaitility.version>4.2.0</awaitility.version>
<awaitility.version>4.2.1</awaitility.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.lfenergy.shapeshifter</groupId>
<artifactId>shapeshifter-library</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Shapeshifter Library</name>
Expand Down Expand Up @@ -48,7 +48,7 @@
<!-- Test dependency versions -->
<junit.version>5.10.2</junit.version>
<assertj.version>3.25.3</assertj.version>
<mockito.version>5.6.0</mockito.version>
<mockito.version>5.11.0</mockito.version>

<!-- Plugin versions -->
<maven-surefire-plugin.version>3.2.1</maven-surefire-plugin.version>
Expand Down Expand Up @@ -138,6 +138,7 @@
<version>${dependency-check-maven.version}</version>
<configuration>
<failBuildOnCVSS>8</failBuildOnCVSS>
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled> <!-- We don't have .NET assemblies -->
</configuration>
<executions>
<execution>
Expand Down
6 changes: 3 additions & 3 deletions spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.lfenergy.shapeshifter</groupId>
<artifactId>shapeshifter-library</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -16,8 +16,8 @@
<url>https://www.lfenergy.org/projects/shapeshifter/</url>

<properties>
<spring-boot.version>3.2.3</spring-boot.version>
<swagger-annotations.version>2.2.20</swagger-annotations.version>
<spring-boot.version>3.2.5</spring-boot.version>
<swagger-annotations.version>2.2.21</swagger-annotations.version>
</properties>

<dependencyManagement>
Expand Down