Create an initial web service
Create a maven project structure. One mock webservice should be included. Both Json and XML payload accepted. Configuration of this webservice (response body, response headers, http status code) should be fully configured in a configuration file. Invoication details (headers, payload) should be logged. Closes #T124
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.release11.klaus.controller;
|
||||
|
||||
|
||||
import com.release11.klaus.service.KlausService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Controller("/")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class KlausController {
|
||||
|
||||
private final KlausService klausService;
|
||||
|
||||
@PostMapping(value = "klaus/v1/set/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity<String> setMockedResponse(@PathVariable UUID clientUUID,
|
||||
@PathVariable int mockedResponseId,
|
||||
@RequestParam(required = false) int httpStatus,
|
||||
RequestEntity<String> requestEntity){
|
||||
return klausService.setMockedResponse(clientUUID, mockedResponseId, HttpStatus.valueOf(httpStatus), requestEntity);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "klaus/v1/get/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity getMockedResponse(@PathVariable UUID clientUUID,
|
||||
@PathVariable int mockedResponseId){
|
||||
return klausService.getMockedResponse(clientUUID, mockedResponseId);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user