Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit b2ed8571 authored by Alicja Nicieja's avatar Alicja Nicieja
Browse files

Merge branch 'feature/SIMPL-6546-2' into 'develop'

SIMPL-6546 Stub endpoint as EDC callback

See merge request !17
parents d9aa2939 b5df6d16
No related branches found
No related tags found
2 merge requests!20Release 0.0.2,!17SIMPL-6546 Stub endpoint as EDC callback
Pipeline #235770 passed
...@@ -10,8 +10,6 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -10,8 +10,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@RestController @RestController
@RequestMapping("/contractnegotiation/v1") @RequestMapping("/contractnegotiation/v1")
@Slf4j @Slf4j
...@@ -24,7 +22,7 @@ public class ContractNegotiationController { ...@@ -24,7 +22,7 @@ public class ContractNegotiationController {
} }
@PostMapping(path = "/signed/{contractNegotiationId}/{signed}", produces = MediaType.APPLICATION_JSON_VALUE) @PostMapping(path = "/signed/{contractNegotiationId}/{signed}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SignedContract> notifyAboutSignedContract(@PathVariable UUID contractNegotiationId, @PathVariable boolean signed) { public ResponseEntity<SignedContract> notifyAboutSignedContract(@PathVariable String contractNegotiationId, @PathVariable boolean signed) {
log.info("POST request to notify about signed contract"); log.info("POST request to notify about signed contract");
return ResponseEntity.ok(contractNegotiationService.getResponse(contractNegotiationId, signed)); return ResponseEntity.ok(contractNegotiationService.getResponse(contractNegotiationId, signed));
} }
......
...@@ -4,13 +4,11 @@ import eu.simpl.simpl_stubs.transfer.SignedContract; ...@@ -4,13 +4,11 @@ import eu.simpl.simpl_stubs.transfer.SignedContract;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.UUID;
@Service @Service
@Slf4j @Slf4j
public class ContractNegotiationService { public class ContractNegotiationService {
public SignedContract getResponse(UUID contractNegotiationId, boolean signed) { public SignedContract getResponse(String contractNegotiationId, boolean signed) {
log.debug("Got request for id: {}, signed: {}", contractNegotiationId, signed); log.debug("Got request for id: {}, signed: {}", contractNegotiationId, signed);
return SignedContract.builder() return SignedContract.builder()
.id(contractNegotiationId) .id(contractNegotiationId)
......
...@@ -5,14 +5,12 @@ import lombok.Builder; ...@@ -5,14 +5,12 @@ import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.UUID;
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
@Builder @Builder
public class SignedContract { public class SignedContract {
private UUID id; private String id;
private String status; private String status;
} }
...@@ -6,8 +6,6 @@ import org.junit.jupiter.api.Test; ...@@ -6,8 +6,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import java.util.UUID;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
...@@ -18,7 +16,7 @@ class ContractNegotiationControllerTest extends AbstractControllerTest { ...@@ -18,7 +16,7 @@ class ContractNegotiationControllerTest extends AbstractControllerTest {
@Test @Test
void shouldRespondWithAnAnswerWhenGetPostContractNegotiationRequest() { void shouldRespondWithAnAnswerWhenGetPostContractNegotiationRequest() {
ResponseEntity<SignedContract> response = contractNegotiationController.notifyAboutSignedContract(UUID.randomUUID(), true); ResponseEntity<SignedContract> response = contractNegotiationController.notifyAboutSignedContract("contract-1", true);
assertNotNull(response.getBody()); assertNotNull(response.getBody());
assertEquals("AGREED", response.getBody().getStatus()); assertEquals("AGREED", response.getBody().getStatus());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment