T157 PUT/update working, POST/addNew problems with eureka
This commit is contained in:
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -23,6 +23,7 @@
|
|||||||
<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" />
|
||||||
@@ -311,7 +312,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="7143000" />
|
<workItem from="1612609113694" duration="11380000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00077" summary="testing jenkins docker">
|
<task id="LOCAL-00077" summary="testing jenkins docker">
|
||||||
<created>1601453886631</created>
|
<created>1601453886631</created>
|
||||||
|
|||||||
@@ -69,8 +69,9 @@ public class MockController {
|
|||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/mock/json")
|
@PostMapping("/mock/json/{uuid}")
|
||||||
public ResponseEntity<String> addNewMessage(@RequestParam UUID clientUUID){
|
public ResponseEntity<String> addNewMessage(@PathVariable String uuidValue){
|
||||||
|
UUID clientUUID = UUID.fromString(uuidValue);
|
||||||
List<MockedMessageDto> messages = klausService.getAllMockedResponses(clientUUID);
|
List<MockedMessageDto> messages = klausService.getAllMockedResponses(clientUUID);
|
||||||
MockedMessageDto nextMessage = buildDefaultMessage(clientUUID, findNextId(messages));
|
MockedMessageDto nextMessage = buildDefaultMessage(clientUUID, findNextId(messages));
|
||||||
return klausService.setMockedResponse(nextMessage);
|
return klausService.setMockedResponse(nextMessage);
|
||||||
@@ -106,8 +107,8 @@ public class MockController {
|
|||||||
public static int findNextId(List<MockedMessageDto> messages) {
|
public static int findNextId(List<MockedMessageDto> messages) {
|
||||||
int highestId = 0;
|
int highestId = 0;
|
||||||
for (MockedMessageDto m : messages)
|
for (MockedMessageDto m : messages)
|
||||||
highestId = highestId < m.getMockedResponseId() ? highestId : m.getMockedResponseId();
|
highestId = highestId > m.getMockedResponseId() ? highestId : m.getMockedResponseId();
|
||||||
return highestId;
|
return ++highestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,15 +56,27 @@ function updateData(){
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'http://localhost:8097/mock/json',
|
url: 'http://localhost:8097/mock/json',
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: updatedJson,
|
data: JSON.stringify(updatedJson, null, 2),
|
||||||
success: function(data) {
|
error: function(e) {
|
||||||
console.log('PUT request received 200');
|
console.log(e);
|
||||||
}
|
},
|
||||||
|
dataType: "json",
|
||||||
|
contentType: "application/json"
|
||||||
|
// success: function(data) {
|
||||||
|
// console.log('PUT request received 200');
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
function addMessage(){
|
||||||
|
$.ajax({
|
||||||
|
url: 'http://localhost:8097/mock/json/'+clientUUID,
|
||||||
|
type: 'POST',
|
||||||
|
// success: function(data) {
|
||||||
|
// console.log('PUT request received 200');
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
// $.put('http://localhost:8097/mock/json', function(data){
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// console.log('PUT request sent');
|
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +145,7 @@ function generateHeaderTable(headers){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fillMessageList(){
|
function fillMessageList(){
|
||||||
|
$("#listItems").html('');
|
||||||
var innerHTML = '';
|
var innerHTML = '';
|
||||||
for(let i=0; i<json.length; i++){
|
for(let i=0; i<json.length; i++){
|
||||||
innerHTML += generateMessageTileHtml(json[i].mockedResponseId, json[i].httpStatus, json[i].mediaType);
|
innerHTML += generateMessageTileHtml(json[i].mockedResponseId, json[i].httpStatus, json[i].mediaType);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<div id="selectMenuContent" style="display: none;">
|
<div id="selectMenuContent" style="display: none;">
|
||||||
<div id="selectMenuHead" class="articleHead">List</div>
|
<div id="selectMenuHead" class="articleHead">List</div>
|
||||||
<div id="listItems"></div>
|
<div id="listItems"></div>
|
||||||
<div id="iconPlus" class="menuItem"><i class="icon-plus"></i></div>
|
<div id="iconPlus" class="menuItem" onclick="addMessage()"><i class="icon-plus"></i></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user