T157 POST request works. Need sleep time before GET

This commit is contained in:
2021-02-06 17:28:06 +01:00
parent ec9dd9172c
commit 9e5600bdf7
3 changed files with 11 additions and 14 deletions

3
.idea/workspace.xml generated
View File

@@ -23,7 +23,6 @@
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/templates/mock.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/mock.html" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -312,7 +311,7 @@
<workItem from="1612259068808" duration="10440000" /> <workItem from="1612259068808" duration="10440000" />
<workItem from="1612279535476" duration="5692000" /> <workItem from="1612279535476" duration="5692000" />
<workItem from="1612442837870" duration="8318000" /> <workItem from="1612442837870" duration="8318000" />
<workItem from="1612609113694" duration="11380000" /> <workItem from="1612609113694" duration="13936000" />
</task> </task>
<task id="LOCAL-00077" summary="testing jenkins docker"> <task id="LOCAL-00077" summary="testing jenkins docker">
<created>1601453886631</created> <created>1601453886631</created>

View File

@@ -58,18 +58,20 @@ public class MockController {
} }
@ResponseBody @ResponseBody
@GetMapping({"/mock/json", "/mock/json/{uuid}"}) @GetMapping({"/mock/json", "/mock/json/{uuidValue}"})
public List<MockedMessageDto> getJson(@PathVariable(required = false) UUID uuid){ public List<MockedMessageDto> getJson(@PathVariable(required = false) String uuidValue){
if(uuid == null) uuid = UUID.randomUUID(); UUID clientUUID = UUID.fromString(uuidValue);
List<MockedMessageDto> messages = klausService.getAllMockedResponses(uuid); if(clientUUID == null) clientUUID = UUID.randomUUID();
List<MockedMessageDto> messages = klausService.getAllMockedResponses(clientUUID);
if(messages.size() == 0) { if(messages.size() == 0) {
klausService.setMockedResponse(buildDefaultMessage(uuid)); klausService.setMockedResponse(buildDefaultMessage(clientUUID));
messages = klausService.getAllMockedResponses(uuid); messages = klausService.getAllMockedResponses(clientUUID);
} }
return messages; return messages;
} }
@PostMapping("/mock/json/{uuid}") @ResponseBody
@PostMapping("/mock/json/{uuidValue}")
public ResponseEntity<String> addNewMessage(@PathVariable String uuidValue){ public ResponseEntity<String> addNewMessage(@PathVariable String uuidValue){
UUID clientUUID = UUID.fromString(uuidValue); UUID clientUUID = UUID.fromString(uuidValue);
List<MockedMessageDto> messages = klausService.getAllMockedResponses(clientUUID); List<MockedMessageDto> messages = klausService.getAllMockedResponses(clientUUID);

View File

@@ -1,10 +1,6 @@
//TODO: Add sleep after PUT,POST,DELETE request. Data might not be processed before GET request
//TODO: Add button to add new header //TODO: Add button to add new header
//TODO: Add PUT request to Save button
//TODO: Add POST request to new message button
//TODO: Add cookie check when getting the data in getData()
//TODO: Add cookie update after receiving data
//TODO: Update cookie when displayed message is changed //TODO: Update cookie when displayed message is changed
//TODO: Add getData() recall after PUT, POST or DELETE
//TODO: Add delete buttons for headers //TODO: Add delete buttons for headers
//TODO: Add delete buttons for messages //TODO: Add delete buttons for messages
var clientUUID; var clientUUID;