T157 data is being saved, send and received
This commit is contained in:
		| @@ -8,6 +8,7 @@ var json; | ||||
| var jsonIndex = 0; | ||||
| const C_UUID = 'mock-uuid'; | ||||
| function getData(){ | ||||
|     // sleep(5000); | ||||
|     loadCookies(); | ||||
|     $.getJSON('http://localhost:8097/mock/json/'+clientUUID, function(data) { | ||||
|         json = data; | ||||
| @@ -15,14 +16,17 @@ function getData(){ | ||||
|         setCookies(); | ||||
|         console.log(JSON.stringify(json)); | ||||
|         console.log("Json received"); | ||||
|         fillMessageList(); | ||||
|         console.log("List initiated"); | ||||
|         loadMessage(json[jsonIndex].mockedResponseId); | ||||
|         console.log("Message loaded"); | ||||
|  | ||||
|         refreshData(); | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function refreshData(){ | ||||
|     fillMessageList(); | ||||
|     console.log("List initiated"); | ||||
|     loadMessage(json[jsonIndex].mockedResponseId); | ||||
|     console.log("Message loaded"); | ||||
| } | ||||
|  | ||||
| function setCookies(){ | ||||
|     document.cookie = C_UUID + '=' +clientUUID+';'; | ||||
| } | ||||
| @@ -57,10 +61,8 @@ function updateData(){ | ||||
|             console.log(e); | ||||
|         }, | ||||
|         dataType: "json", | ||||
|         contentType: "application/json" | ||||
|         // success: function(data) { | ||||
|         //     console.log('PUT request received 200'); | ||||
|         // } | ||||
|         contentType: "application/json", | ||||
|         success: getData(), | ||||
|     }); | ||||
|     getData(); | ||||
| } | ||||
| @@ -69,9 +71,7 @@ function addMessage(){ | ||||
|     $.ajax({ | ||||
|         url: 'http://localhost:8097/mock/json/'+clientUUID, | ||||
|         type: 'POST', | ||||
|         // success: function(data) { | ||||
|         //     console.log('PUT request received 200'); | ||||
|         // } | ||||
|         success: getData(), | ||||
|     }); | ||||
|     getData(); | ||||
| } | ||||
| @@ -94,9 +94,9 @@ function initializeMock(index){ | ||||
|  | ||||
| function fillStaticFields(uuid, id, mediaType, body, httpStatus){ | ||||
|     $('#messageLink').html(createLink(uuid,id)); | ||||
|     $('#httpStatus').html(httpStatus); | ||||
|     $('#httpStatus').val(httpStatus); | ||||
|     $('#typeSelector').val(mediaType); | ||||
|     $('#bodyEditor').html(body); | ||||
|     $('#bodyEditor').val(body); | ||||
|     $('#mockedMessageId').html(id); | ||||
|  | ||||
| } | ||||
| @@ -211,6 +211,7 @@ function generateJson(){ | ||||
|         }; | ||||
|     newJson['httpHeaders'] = convertTableToJson(); | ||||
|     console.log(JSON.stringify(newJson, null, 2)); | ||||
|     json[jsonIndex] = newJson; | ||||
|     return newJson; | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										36
									
								
								src/main/resources/static/json/draft.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/main/resources/static/json/draft.js
									
									
									
									
									
										Normal 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 | ||||
| }] | ||||
		Reference in New Issue
	
	Block a user