MessageDto instead of String in Event history
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
package com.release11.klaus.controller;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.release11.klaus.model.MockedMessageDto;
|
||||
import com.release11.klaus.service.KlausService;
|
||||
import com.release11.klaus.utilis.BusinessKey;
|
||||
import com.release11.klaus.utilis.TrackingClient;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -22,7 +24,7 @@ import java.util.UUID;
|
||||
|
||||
@Controller("/")
|
||||
@Slf4j
|
||||
@Profile({"DEV", "default"})
|
||||
//@Profile({"DEV", "default"})
|
||||
@AllArgsConstructor
|
||||
public class KlausController {
|
||||
|
||||
@@ -48,7 +50,7 @@ public class KlausController {
|
||||
|
||||
@RequestMapping(value = "klaus/v1/get/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity getMockedResponse(@PathVariable UUID clientUUID,
|
||||
@PathVariable int mockedResponseId){
|
||||
@PathVariable int mockedResponseId) throws JsonProcessingException {
|
||||
TrackingClient.setBusinessKeys(Map.of(BusinessKey.INTERFACE_NAME, "getMockedResponse",
|
||||
BusinessKey.CLIENT_UUID, String.valueOf(clientUUID),
|
||||
BusinessKey.MESSAGE_ID, String.valueOf(mockedResponseId)));
|
||||
@@ -59,20 +61,20 @@ public class KlausController {
|
||||
Objects.requireNonNull(HttpStatus.valueOf(mockedMessageDto.getHttpStatus())));
|
||||
}
|
||||
|
||||
@PostMapping(value = "klaus/v1/set/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity<String> setMockedResponse(@PathVariable UUID clientUUID,
|
||||
@PathVariable int mockedResponseId,
|
||||
@RequestParam(required = false) Integer httpStatus,
|
||||
RequestEntity<String> requestEntity){
|
||||
TrackingClient.setBusinessKeys(Map.of(BusinessKey.INTERFACE_NAME, "setMockedResponse",
|
||||
BusinessKey.CLIENT_UUID, String.valueOf(clientUUID),
|
||||
BusinessKey.MESSAGE_ID, String.valueOf(mockedResponseId)));
|
||||
if (httpStatus == null) httpStatus = 200;
|
||||
|
||||
MockedMessageDto mockedMessageDto = new MockedMessageDto(clientUUID, mockedResponseId,
|
||||
requestEntity.getHeaders().getContentType().toString(), requestEntity.getBody(),
|
||||
requestEntity.getHeaders().toSingleValueMap(), httpStatus);
|
||||
return klausService.setMockedResponse(mockedMessageDto);
|
||||
}
|
||||
// @PostMapping(value = "klaus/v1/set/{clientUUID}/{mockedResponseId}")
|
||||
// public ResponseEntity<String> setMockedResponse(@PathVariable UUID clientUUID,
|
||||
// @PathVariable int mockedResponseId,
|
||||
// @RequestParam(required = false) Integer httpStatus,
|
||||
// RequestEntity<String> requestEntity){
|
||||
// TrackingClient.setBusinessKeys(Map.of(BusinessKey.INTERFACE_NAME, "setMockedResponse",
|
||||
// BusinessKey.CLIENT_UUID, String.valueOf(clientUUID),
|
||||
// BusinessKey.MESSAGE_ID, String.valueOf(mockedResponseId)));
|
||||
// if (httpStatus == null) httpStatus = 200;
|
||||
//
|
||||
// MockedMessageDto mockedMessageDto = new MockedMessageDto(clientUUID, mockedResponseId,
|
||||
// requestEntity.getHeaders().getContentType().toString(), requestEntity.getBody(),
|
||||
// requestEntity.getHeaders().toSingleValueMap(), httpStatus);
|
||||
// return klausService.setMockedResponse(mockedMessageDto);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user