T157 data is being saved, send and received

This commit is contained in:
2021-02-08 12:56:14 +01:00
parent 9e5600bdf7
commit 3523ede940
3 changed files with 53 additions and 15 deletions

3
.idea/workspace.xml generated
View File

@@ -20,8 +20,8 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment=""> <list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/main/resources/static/json/draft.js" afterDir="false" />
<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/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" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@@ -312,6 +312,7 @@
<workItem from="1612279535476" duration="5692000" /> <workItem from="1612279535476" duration="5692000" />
<workItem from="1612442837870" duration="8318000" /> <workItem from="1612442837870" duration="8318000" />
<workItem from="1612609113694" duration="13936000" /> <workItem from="1612609113694" duration="13936000" />
<workItem from="1612777983977" duration="5986000" />
</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

@@ -8,6 +8,7 @@ var json;
var jsonIndex = 0; var jsonIndex = 0;
const C_UUID = 'mock-uuid'; const C_UUID = 'mock-uuid';
function getData(){ function getData(){
// sleep(5000);
loadCookies(); loadCookies();
$.getJSON('http://localhost:8097/mock/json/'+clientUUID, function(data) { $.getJSON('http://localhost:8097/mock/json/'+clientUUID, function(data) {
json = data; json = data;
@@ -15,14 +16,17 @@ function getData(){
setCookies(); setCookies();
console.log(JSON.stringify(json)); console.log(JSON.stringify(json));
console.log("Json received"); console.log("Json received");
fillMessageList(); refreshData();
console.log("List initiated");
loadMessage(json[jsonIndex].mockedResponseId);
console.log("Message loaded");
}); });
} }
function refreshData(){
fillMessageList();
console.log("List initiated");
loadMessage(json[jsonIndex].mockedResponseId);
console.log("Message loaded");
}
function setCookies(){ function setCookies(){
document.cookie = C_UUID + '=' +clientUUID+';'; document.cookie = C_UUID + '=' +clientUUID+';';
} }
@@ -57,10 +61,8 @@ function updateData(){
console.log(e); console.log(e);
}, },
dataType: "json", dataType: "json",
contentType: "application/json" contentType: "application/json",
// success: function(data) { success: getData(),
// console.log('PUT request received 200');
// }
}); });
getData(); getData();
} }
@@ -69,9 +71,7 @@ function addMessage(){
$.ajax({ $.ajax({
url: 'http://localhost:8097/mock/json/'+clientUUID, url: 'http://localhost:8097/mock/json/'+clientUUID,
type: 'POST', type: 'POST',
// success: function(data) { success: getData(),
// console.log('PUT request received 200');
// }
}); });
getData(); getData();
} }
@@ -94,9 +94,9 @@ function initializeMock(index){
function fillStaticFields(uuid, id, mediaType, body, httpStatus){ function fillStaticFields(uuid, id, mediaType, body, httpStatus){
$('#messageLink').html(createLink(uuid,id)); $('#messageLink').html(createLink(uuid,id));
$('#httpStatus').html(httpStatus); $('#httpStatus').val(httpStatus);
$('#typeSelector').val(mediaType); $('#typeSelector').val(mediaType);
$('#bodyEditor').html(body); $('#bodyEditor').val(body);
$('#mockedMessageId').html(id); $('#mockedMessageId').html(id);
} }
@@ -211,6 +211,7 @@ function generateJson(){
}; };
newJson['httpHeaders'] = convertTableToJson(); newJson['httpHeaders'] = convertTableToJson();
console.log(JSON.stringify(newJson, null, 2)); console.log(JSON.stringify(newJson, null, 2));
json[jsonIndex] = newJson;
return newJson; return newJson;
} }

View File

@@ -0,0 +1,36 @@
[{
"clientUUID": "dfdea9a4-03e4-4157-abda-3723f998b6ee",
"mockedResponseId": 3,
"mediaType": "application/xml",
"messageBody": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<note>\n <to>Tove</to>\n <from>Jani</from>\n <heading>Reminder</heading>\n <body>Don't forget me this weekend!</body>\n</note>",
"httpHeaders": {"Connection": "keep-alive", "Keep-Alive": "timeout=60", "Date": "2021-02-08T11:36:43.375639"},
"httpStatus": 200
}, {
"clientUUID": "dfdea9a4-03e4-4157-abda-3723f998b6ee",
"mockedResponseId": 4,
"mediaType": "application/xml",
"messageBody": "Hello world!",
"httpHeaders": {"Keep-Alive": "timeout=60", "Connection": "keep-alive", "Date": "2021-02-08T11:37:00.644399"},
"httpStatus": 200
}, {
"clientUUID": "dfdea9a4-03e4-4157-abda-3723f998b6ee",
"mockedResponseId": 1,
"mediaType": "application/xml",
"messageBody": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<note>\n <to>Tove</to>\n <from>Jani</from>\n <heading>Reminder</heading>\n <body>Don't forget me this weekend!</body>\n</note>",
"httpHeaders": {"Connection": "keep-alive", "Keep-Alive": "timeout=60", "Date": "2021-02-08T11:36:39.348495"},
"httpStatus": 200
}, {
"clientUUID": "dfdea9a4-03e4-4157-abda-3723f998b6ee",
"mockedResponseId": 2,
"mediaType": "application/xml",
"messageBody": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<note>\n <to>Tove</to>\n <from>Jani</from>\n <heading>Reminder</heading>\n <body>Don't forget me this weekend!</body>\n</note>",
"httpHeaders": {"Keep-Alive": "timeout=60", "Connection": "keep-alive", "Date": "2021-02-08T11:36:41.569362"},
"httpStatus": 200
}, {
"clientUUID": "dfdea9a4-03e4-4157-abda-3723f998b6ee",
"mockedResponseId": 5,
"mediaType": "application/xml",
"messageBody": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<note>\n <to>Tove</to>\n <from>Jani</from>\n <heading>Reminder</heading>\n <body>Don't forget me this weekend!</body>\n</note>",
"httpHeaders": {"Keep-Alive": "timeout=60", "Connection": "keep-alive", "Date": "2021-02-08T11:37:28.249797"},
"httpStatus": 200
}]