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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 3.2.3
### Changed
- Upgrade to Spring Boot 4

## 3.2.2
### Changed
- Remove default from "Unsolicited" attribute in XSD to be backwards compatible with V3.0.0

## 3.2.1
### Changed
- Fix XSDs for V3.1.0

## 3.2.0

### Changed
Expand Down
19 changes: 6 additions & 13 deletions spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<url>https://www.lfenergy.org/projects/shapeshifter/</url>

<properties>
<spring-boot.version>3.5.8</spring-boot.version>
<spring-boot.version>4.0.0</spring-boot.version>
<swagger-annotations.version>2.2.41</swagger-annotations.version>
</properties>

Expand Down Expand Up @@ -45,17 +45,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<!-- Exclude transitive version 1.33 of snakeyaml because of CVE-2022-1471 -->
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
Expand Down Expand Up @@ -84,12 +73,16 @@
<version>${swagger-annotations.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.lfenergy.shapeshifter.api.*;
import org.lfenergy.shapeshifter.api.model.UftpParticipantInformation;
import org.lfenergy.shapeshifter.core.model.IncomingUftpMessage;
Expand All @@ -24,12 +25,13 @@
import org.lfenergy.shapeshifter.spring.service.receiving.UftpInternalController;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

import java.time.Duration;
Expand All @@ -44,13 +46,13 @@
import static org.lfenergy.shapeshifter.api.USEFRoleType.DSO;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@WebMvcTest(controllers = UftpInternalController.class)
@ContextConfiguration(classes = TestConfig.class)
@ExtendWith(MockitoExtension.class)
class ShapeshifterSpringIntegrationTest {

private static final String APPLICATION_ENDPOINT_PATH = "/shapeshifter/api/v3/message";
Expand All @@ -76,23 +78,23 @@ class ShapeshifterSpringIntegrationTest {
static class TestConfig {
}

@MockBean
@MockitoBean
private UftpParticipantService uftpParticipantService;
@MockBean
@MockitoBean
private UftpValidatorSupport uftpValidatorSupport;
@MockBean
@MockitoBean
private ParticipantSupport participantSupport;
@MockBean
@MockitoBean
private UftpMessageSupport uftpMessageSupport;
@MockBean
@MockitoBean
private ContractSupport contractSupport;
@MockBean
@MockitoBean
private CongestionPointSupport congestionPointSupport;
@MockBean
@MockitoBean
private UftpIncomingHandler<PayloadMessageType> uftpIncomingHandler;
@MockBean
@MockitoBean
private UftpOutgoingHandler<PayloadMessageType> uftpOutgoingHandler;
@MockBean
@MockitoBean
private UftpErrorProcessor uftpErrorProcessor;

@Autowired
Expand All @@ -114,6 +116,9 @@ static class TestConfig {
void setUp() {
given(uftpIncomingHandler.isSupported(any())).willReturn(true);
given(uftpOutgoingHandler.isSupported(any())).willReturn(true);

doNothing().when(uftpIncomingHandler).handle(incomingUftpMessageCaptor.capture());
doNothing().when(uftpOutgoingHandler).handle(outgoingUftpMessageCaptor.capture());
}

@Test
Expand All @@ -128,7 +133,7 @@ void postUftpMessage_flexRequest_happyFlow() throws Exception {
.content(createSignedMessageXml(flexRequest)))
.andExpect(status().isOk());

verify(uftpIncomingHandler).handle(incomingUftpMessageCaptor.capture());
verify(uftpIncomingHandler).handle(any());

var incomingUftpMessage = incomingUftpMessageCaptor.getValue();
assertThat(incomingUftpMessage.sender()).isEqualTo(DSO_PARTICIPANT);
Expand Down Expand Up @@ -180,7 +185,7 @@ void postUftpMessage_flexRequest_validationError() throws Exception {
.content(createSignedMessageXml(flexRequest)))
.andExpect(status().isOk());

verify(uftpIncomingHandler).handle(incomingUftpMessageCaptor.capture());
verify(uftpIncomingHandler).handle(any());

var incomingUftpMessage = incomingUftpMessageCaptor.getValue();
assertThat(incomingUftpMessage.sender()).isEqualTo(DSO_PARTICIPANT);
Expand Down Expand Up @@ -213,7 +218,7 @@ void postUftpMessage_testMessage_happyFlow() throws Exception {
.content(createSignedMessageXml(testMessage)))
.andExpect(status().isOk());

verify(uftpIncomingHandler).handle(incomingUftpMessageCaptor.capture());
verify(uftpIncomingHandler).handle(any());

var incomingUftpMessage = incomingUftpMessageCaptor.getValue();
assertThat(incomingUftpMessage.sender()).isEqualTo(DSO_PARTICIPANT);
Expand Down
Loading