Files
release11-tools-mocked-serv…/target/classes/templates/index.html
2020-09-04 16:07:27 +02:00

120 lines
5.5 KiB
HTML

<!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="/js/main.js">
document.getElementById('localDateTimeFrom').valueAsDate = new Date();
</script>
<link href="css/styles.css" rel="stylesheet" />
</head>
<body>
<hr>
<div><br>In order to set mockup response. Please send the response, that you want to receive, on:
<br>http://localhost:8097/klaus/v1/set/ <a th:text="${mockedResponseDto.clientUUID}">clientUUID should be here</a>/{mockedResponseId}?httpStatus=200
</div>
<section class="page-section" id="main-section">
<div class="container">
<div class="row">
<div class="column">
<br>You can also simply fill and submit the below form:
<form action="#" th:action="@{/home}" th:object="${mockedResponseDto}" method="post">
<table>
<input type="text" th:field="*{clientUUID}" th:placeholder="*{clientUUID}" hidden/>
<tr>
<td>Mocked response id:</td>
<td><input type="text" th:field="*{mockedResponseId}"/></td>
<td th:if="${#fields.hasErrors('mockedResponseId')}" th:errors="*{mockedResponseId}">Id Error</td>
</tr>
<tr>
<td>Mocked response body:</td>
<td><textarea rows="4" cols="50" th:field="*{messageBody}"></textarea></td>
<td th:if="${#fields.hasErrors('messageBody')}" th:errors="*{messageBody}">Body Error</td>
</tr>
<tr>
<td>Mocked response http code status:</td>
<td><input type="text" th:field="*{httpStatus}"></td>
<td th:if="${#fields.hasErrors('httpStatus')}" th:errors="*{httpStatus}">HttpStatus Error</td>
</tr>
<tr>
<td>Provide mocked response headers:</td>
<td><a href="#" id="addHeader" onclick="addFields()">Add a new header</a>
<table>
<tr>
<td><div id="headers"></div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Media type:</td>
<td><select th:field="*{mediaType}">
<option value="application/xml">application/xml</option>
<option value="application/json">application/json</option>
<option value="text/xml">text/xml</option>
</select></td>
</tr>
<tr>
<td><input type="submit" value="Save mocked response"/></td>
</tr>
</table>
</form>
<table>
<tr>
<td>
<p th:if="${mockSaved}">Mock has been saved</p>
</td>
<td>
<form action="#" th:action="@{/home/getMockedResponse}" th:object="${mockedResponseDto}" method="get">
<input type="text" th:field="*{clientUUID}" hidden/>
<input type="text" th:field="*{mockedResponseId}" hidden/>
<p th:if="${mockSaved}"><input type="submit" value="Test your mock"/></p>
</form>
</td>
</tr>
</table>
</div>
<div class="column">
Your mocked requests:
<br>
larum ispum srutum tutum
</div>
</div>
</div>
</section>
<hr>
<div>
<br>In order to use the mocked response in your integration tests or simply
get your mocked response please send a request to
<br>http://localhost:8097/klaus/v1/get/<a th:text="${mockedResponseDto.clientUUID}">clientUUID should be here</a>/{mockedResponseId}
<br>You will receive the same body and headers as you sent them in the step 1.
</div>
<hr>
<div>
<br>To see your activity history use the form below
<form action="#" th:action="@{/eventsForm}" th:object="${eventsDto}" method="post">
<input type="text" th:name="clientUUID" th:value="${mockedResponseDto.clientUUID}" hidden/>
<br><label>Date from:</label><br>
<input type="datetime-local" th:field="*{localDateTimeFrom}"/>
<td th:if="${#fields.hasErrors('localDateTimeFrom')}" th:errors="*{localDateTimeFrom}">localDateTimeFrom Error</td>
<br><label>Date to:</label><br>
<input type="datetime-local" th:field="*{localDateTimeTo}"/>
<td th:if="${#fields.hasErrors('localDateTimeTo')}" th:errors="*{localDateTimeTo}">localDateTimeTo Error</td>
<div th:if="${#fields.hasAnyErrors()}">
<p th:each="err : ${#fields.allErrors()}" th:text="${err}">...</p>
</div>
<input type="submit" value="See my history"/>
</form>
</div>
<hr>
</div>
</div>
</body>
</html>