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

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

Merge branch 'develop' into 'main'

Release 0.0.2

See merge request !20
parents 5a95a7e8 e06bddf5
No related branches found
No related tags found
1 merge request!20Release 0.0.2
Pipeline #239648 failed
PROJECT_VERSION_NUMBER=0.0.1
PROJECT_VERSION_NUMBER=0.0.2
......@@ -10,10 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@RestController
@RequestMapping("/contractnegotiation/v1")
@RequestMapping("/")
@Slf4j
public class ContractNegotiationController {
......@@ -23,8 +21,8 @@ public class ContractNegotiationController {
this.contractNegotiationService = contractNegotiationService;
}
@PostMapping(path = "/signed/{contractNegotiationId}/{signed}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SignedContract> notifyAboutSignedContract(@PathVariable UUID contractNegotiationId, @PathVariable boolean signed) {
@PostMapping(path = "signed/{contractNegotiationId}/{signed}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SignedContract> notifyAboutSignedContract(@PathVariable String contractNegotiationId, @PathVariable boolean signed) {
log.info("POST request to notify about signed contract");
return ResponseEntity.ok(contractNegotiationService.getResponse(contractNegotiationId, signed));
}
......
......@@ -4,13 +4,11 @@ import eu.simpl.simpl_stubs.transfer.SignedContract;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.UUID;
@Service
@Slf4j
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);
return SignedContract.builder()
.id(contractNegotiationId)
......
......@@ -5,14 +5,12 @@ import lombok.Builder;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.util.UUID;
@Slf4j
@AllArgsConstructor
@Getter
@Builder
public class SignedContract {
private UUID id;
private String id;
private String status;
}
......@@ -6,8 +6,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import java.util.UUID;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
......@@ -18,7 +16,7 @@ class ContractNegotiationControllerTest extends AbstractControllerTest {
@Test
void shouldRespondWithAnAnswerWhenGetPostContractNegotiationRequest() {
ResponseEntity<SignedContract> response = contractNegotiationController.notifyAboutSignedContract(UUID.randomUUID(), true);
ResponseEntity<SignedContract> response = contractNegotiationController.notifyAboutSignedContract("contract-1", true);
assertNotNull(response.getBody());
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