Removed old, depracated content

This commit is contained in:
2021-02-16 17:57:08 +01:00
parent b84deda5c9
commit 96d912fb87
23 changed files with 22 additions and 1452 deletions

23
.idea/workspace.xml generated
View File

@@ -20,7 +20,28 @@
</component>
<component name="ChangeListManager">
<list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment="">
<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/OlderVersion/static/css/styles.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/static/img/icons8-cancel-64.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/static/img/icons8-down-arrow-40.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/static/img/icons8-plus-48.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/static/img/update-button.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/static/js/etrackPaggination.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/static/js/main.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/static/js/paggination.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/templates/etrack.html" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/OlderVersion/templates/index.html" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/img/icons8-cancel-64.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/img/icons8-down-arrow-40.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/img/icons8-plus-48.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/img/update-button.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/js/jquery.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/json/draft.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/KlausApplicationTests.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/config/RedisConfigTest.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/controller/KlausControllerTest.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/controller/KlausMvcControllerTest.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/repository/EventRepositoryImplTest.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/service/KlausServiceImplTest.java" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -1,241 +0,0 @@
html {
height: 100%;
}
body {
min-height: 100%;
}
.page-section{
padding: 2rem 0;
}
.page-section .column{
float: left;
width: 50%;
}
.page-section .row:after {
content: "";
display: table;
clear: both;
}
@media screen and (max-width: 600px) {
.column {
width: 100%;
}
}
button:hover { font-weight: 600; }
button:hover i { margin-right: 20px; }
button:focus {
outline: none;
}
.pageable {
border: 1px solid rgba(0, 0, 0, .11);
;
padding: 10px;
}
.tr-pageable{
margin-left:1000px;
}
.controls-item {
display: inline-block;
}
.btn {
margin: 1px;
}
tr[name="tr-button"]:hover{
background-color: #ddd;
cursor: pointer;
}
#pagination-wrapper button {
background: none;
border: 2px solid #00b3b3;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
button[name="removeMessage"]{
background: none;
border: none;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
button[name="updateMessage"]{
background: none;
border: none;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
button[name="allMessagesClicked"] {
color: #00b3b3;
}
button[name="removeHeader"] {
position: absolute;
background: none;
border: none;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
.btn-sort {
border: 0;
padding: 0 20px;
text-align: center;
color: #fff;
text-shadow: 1px 1px 1px #000;
border-radius: 10px;
background-color: rgb(0, 102, 255);
background-image: linear-gradient(to top left,
rgba(0, 0, 0, .2),
rgba(0, 0, 0, .2) 30%,
rgba(0, 0, 0, 0));
}
.btn-sort:hover {
background-color: rgb(153, 194, 255);
cursor: pointer;
}
.activeButton {
background-color: rgb(153, 194, 255);
}
#child-body{
margin-left: 220px;
}
#container1{
}
#foot {
clear: both;
position: relative;
right: 0;
bottom: 0;
left: 0;
}
/* The side navigation menu */
.sidebar {
margin-top: 100px;
padding-top: 200px;
padding: 0;
width: 200px;
background-color: #f1f1f1;
position: absolute;
height: 100%;
overflow: auto;
}
/* Sidebar links */
.sidebar a {
display: block;
color: black;
padding: 16px;
text-decoration: none;
}
/* Active/current link */
.sidebar a.active {
background-color: #4CAF50;
color: white;
}
/* Links on mouse-over */
.sidebar a:hover:not(.active) {
background-color: #555;
color: white;
}
/* On screens that are less than 700px wide, make the sidebar into a topbar */
@media screen and (max-width: 700px) {
.sidebar {
width: 100%;
height: auto;
position: fixed;
}
.sidebar a {float: left;}
div.content {margin-left: 0;}
}
/* On screens that are less than 400px, display the bar vertically, instead of horizontally */
@media screen and (max-width: 400px) {
.sidebar a {
text-align: center;
float: none;
}
}
table { border-collapse: collapse; }
tr { border: none; }
td {
border: none;
vertical-align: top;
}
button{
padding: 5px 14px;
border-width: 1px;
border-style: solid;
background: #32a6cc;
color: #fff;
transition: all 0.3s ease;
font-family: Arial, sans-serif;
font-size: 1em;
border-radius: 2px;
}
disabled-button{
padding: 5px 14px;
border-width: 1px;
border-style: solid;
background: darkgrey;
color: #fff;
font-family: Arial, sans-serif;
font-size: 1em;
border-radius: 2px;
}
label { display: block;
}
.hint { display: none; color: gray; font-style: italic; float:right;}
input:focus + .hint { display: inline; float:right;}
textarea:focus + .hint { display: inline; float:right; }
textarea:focus + .hint { display: inline; float:right; }
select:focus + .hint { display: inline; float:right; }
select#media-type {
width: 500px;
}
textarea#message-body {
width: 500px;
height: 300px;
}
gen-link {
margin-top: 60px;
margin-bottom: 30px;
font-size: 24px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,180 +0,0 @@
var state = {
'querySet': [{
"clientUUID": "436c4774-038f-4540-9c18-2691ca9b53d4",
"mockedResponseId": 1908998,
"mediaType": "application/xml",
"messageBody": "body",
"httpHeaders": null,
"httpStatus": 200
}],
'page': 1,
'rows': 10,
'window': 5,
}
var myList, data, previousSort;
state.querySet = listForPagination;
buildTable();
for (let i = 3; i >= 0; i--) {
document.querySelector('#btn-sort-' + i).addEventListener('click', function() {
addButtonListeners(i)
})
}
function addButtonListeners(i) {
var buttons = document.querySelectorAll('.btn-sort');
for (var j = buttons.length - 1; j >= 0; j--) {
buttons[j].classList.remove('activeButton');
}
document.querySelector('#btn-sort-' + i).classList.add('activeButton');
buildTable();
}
function pagination(querySet, page, rows) {
var trimStart = (page - 1) * rows
var trimEnd = trimStart + rows
var trimmedData = querySet.slice(trimStart, trimEnd)
var pages = Math.ceil(querySet.length / rows);
if (pages === 0) {
pages = 1
}
return {
'querySet': trimmedData,
'pages': pages,
}
}
function pageButtons(pages) {
var wrapper = document.getElementById('pagination-wrapper');
wrapper.innerHTML = ``;
var maxLeft = (state.page - Math.floor(state.window / 2))
var maxRight = (state.page + Math.ceil(state.window / 2))
if (maxLeft < 1) {
maxLeft = 1
maxRight = state.window
}
if (maxRight > pages) {
maxLeft = pages - (state.window - 1)
if (maxLeft < 1) {
maxLeft = 1
}
maxRight = pages
}
for (var page = maxLeft; page <= maxRight; page++) {
if (page === state.page) {
wrapper.innerHTML += `<button value=${page} class="page btn btn-sm btn-info" name="allMessagesClicked">${page}</button>`
} else {
wrapper.innerHTML += `<button value=${page} class="page btn btn-sm btn-info">${page}</button>`
}
}
if (state.page != 1) {
wrapper.innerHTML = `<button value=${1} class="page btn btn-sm btn-info">&#171; First</button>` + wrapper.innerHTML
}
if (state.page != pages) {
wrapper.innerHTML += `<button value=${pages} class="page btn btn-sm btn-info">Last &#187;</button>`
}
$('.page').on('click', function() {
$('#table-body').empty()
state.page = Number($(this).val())
buildPage()
})
}
function showBody(elt){
$("#" + elt.id + "-body").toggle();
}
function showTable() {
var table = $('#table-body')
table.empty();
var color;
console.log(myList);
for (var i = 1; i <= myList.length; i++) {
var j = i + (state.page - 1) * 10;
i % 2 === 0 ? color = "#b3ffff" : color="#e6ffff";
var row = `<tr bgcolor="${color}" id="etrack-tr-${j}" onclick="showBody(this)" name="tr-button">
<td>` + j + `</td>
<td>${myList[i-1].messageId}</td>
<td>${myList[i-1].dateTimeStamp}</td>
<td>${myList[i-1].interfaceName}</td>
</tr>
<tr bgcolor="${color}" id="etrack-tr-${j}-body" name="tr-body" hidden>
<td colspan="4">"${JSON.stringify(myList[i-1].message)}"</td>
</tr>`
table.append(row)
}
for (var i = myList.length + 1; i <= state.rows; i++) {
i % 2 === 0 ? color = "#b3ffff" : color="#e6ffff";
var j = i + (state.page - 1) * 10;
var row = `<tr bgcolor="${color}">
<td>` + j + `</td>
<td></td>
<td></td>
<td></td>
`
table.append(row)
}
pageButtons(data.pages)
}
function sortTable() {
var sortBy = document.querySelector('.activeButton').textContent
switch (sortBy) {
case "MessageId":
if (previousSort === "MessageId") {
state.querySet.sort((a, b) => (a.messageId > b.messageId) ? -1 : ((b.messageId > a.messageId) ? 1 : 0));
} else {
state.querySet.sort((a, b) => (a.messageId > b.messageId) ? 1 : ((b.messageId > a.messageId) ? -1 : 0));
}
break;
case "TimeStamp":
if (previousSort === "TimeStamp") {
state.querySet.sort((a, b) => (a.dateTimeStamp > b.dateTimeStamp) ? -1 : ((b.dateTimeStamp > a.dateTimeStamp) ? 1 : 0));
} else {
state.querySet.sort((a, b) => (a.dateTimeStamp > b.dateTimeStamp) ? 1 : ((b.dateTimeStamp > a.dateTimeStamp) ? -1 : 0));
}
break;
case "Action":
if (previousSort === "Action") {
state.querySet.sort((a, b) => (a.interfaceName > b.interfaceName) ? -1 : ((b.interfaceName > a.interfaceName) ? 1 : 0));
} else {
state.querySet.sort((a, b) => (a.interfaceName > b.interfaceName) ? 1 : ((b.interfaceName > a.interfaceName) ? -1 : 0));
}
break;
}
if (previousSort === sortBy) {
previousSort = ""
} else previousSort = sortBy;
}
function prepareTable() {
data = pagination(state.querySet, state.page, state.rows)
myList = data.querySet
}
function buildTable() {
sortTable();
prepareTable();
showTable();
}
function buildPage() {
prepareTable();
showTable();
}

View File

@@ -1,37 +0,0 @@
function httpGet()
{
var clientUUID = document.getElementById("getClientUUID").value;
var mockedResponseId = document.getElementById("getMockedResponseId").value;
var url = "http://localhost:8097/klaus/v1/get/" + clientUUID + "/" + mockedResponseId;
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", url, false ); // false for synchronous request
xmlHttp.send( null );
var container = document.getElementById("getMockedResponse");
var headers = xmlHttp.getAllResponseHeaders();
container.appendChild(document.createTextNode(headers));
container.appendChild(document.createTextNode("Your message: "));
container.appendChild(document.createElement("br"));
container.appendChild(document.createTextNode((xmlHttp.responseText)));
return xmlHttp.responseText;
}
var numberOfHeaders = 0;
function addFields(){
var container = document.getElementById("headers");
numberOfHeaders++;
container.appendChild(document.createElement("br"));
container.appendChild(document.createTextNode("Header " + (numberOfHeaders)));
var headerInput = document.createElement("input");
headerInput.type = "text";
headerInput.name = "header";
container.appendChild(headerInput);
container.appendChild(document.createTextNode("Value " + (numberOfHeaders)));
var valueInput = document.createElement("input");
valueInput.type = "text";
valueInput.name = "value";
container.appendChild(valueInput);
}

View File

@@ -1,221 +0,0 @@
var pubhost = location.hostname;
document.getElementById("pubhost").innerHTML = location.hostname;
var state = {
'querySet': [{
"clientUUID": "436c4774-038f-4540-9c18-2691ca9b53d4",
"mockedResponseId": 1908998,
"mediaType": "application/xml",
"messageBody": "body",
"httpHeaders": null,
"httpStatus": 200
}],
'page': 1,
'rows': 10,
'window': 5,
}
var myList, data, previousSort;
state.querySet = listForPagination;
buildTable();
document.querySelector('#btn-list-1').addEventListener('click', function() {
var x = document.getElementById("list-wrapper");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
});
for (let i = 3; i >= 0; i--) {
document.querySelector('#btn-sort-' + i).addEventListener('click', function() {
addButtonListeners(i);
})
}
function addButtonListeners(i) {
var buttons = document.querySelectorAll('.btn-sort');
for (var j = buttons.length - 1; j >= 0; j--) {
buttons[j].classList.remove('activeButton');
}
document.querySelector('#btn-sort-' + i).classList.add('activeButton');
buildTable();
}
function pagination(querySet, page, rows) {
var trimStart = (page - 1) * rows
var trimEnd = trimStart + rows
var trimmedData = querySet.slice(trimStart, trimEnd)
var pages = Math.ceil(querySet.length / rows);
if(pages === 0){pages = 1}
return {
'querySet': trimmedData,
'pages': pages,
}
}
function pageButtons(pages) {
var wrapper = document.getElementById('pagination-wrapper');
wrapper.innerHTML = ``;
var maxLeft = (state.page - Math.floor(state.window / 2));
var maxRight = (state.page + Math.ceil(state.window / 2));
if (maxLeft < 1) {
maxLeft = 1;
maxRight = state.window;
}
if (maxRight > pages) {
maxLeft = pages - (state.window - 1);
if (maxLeft < 1) {
maxLeft = 1;
}
maxRight = pages;
}
for (var page = maxLeft; page <= maxRight; page++) {
if (page === state.page) {
wrapper.innerHTML += `<button value=${page} class="page btn btn-sm btn-info" name="allMessagesClicked">${page}</button>`
} else {
wrapper.innerHTML += `<button value=${page} class="page btn btn-sm btn-info">${page}</button>`
}
}
if (state.page != 1) {
wrapper.innerHTML = `<button value=${1} class="page btn btn-sm btn-info">&#171; First</button>` + wrapper.innerHTML
}
if (state.page != pages) {
wrapper.innerHTML += `<button value=${pages} class="page btn btn-sm btn-info">Last &#187;</button>`
}
$('.page').on('click', function() {
$('#table-body').empty();
state.page = Number($(this).val());
buildPage();
});
}
function showTable() {
var table = $('#table-body')
table.empty();
for (var i = 1; i <= myList.length; i++) {
var j = i + (state.page - 1) * 10;
if (i % 2 === 0) {
var row = `<tr bgcolor="#b3ffff">
<td>` + j + `</td>
<td>${myList[i-1].mockedResponseId}</td>
<td>${myList[i-1].mediaType}</td>
<td>${myList[i-1].httpStatus}</td>
<td>
<button type="submit" name="updateMessage" value="${myList[i-1].mockedResponseId}">
<img src="/img/update-button.png" style="width: 20px;"/>
</button>
</td>
<td>
<button type="submit" name="removeMessage" value="${myList[i-1].mockedResponseId}">
<img src="/img/icons8-cancel-64.png" style="width: 20px;"/>
</button>
</td>
`
} else {
var row = `<tr bgcolor="#e6ffff">
<td>` + j + `</td>
<td>${myList[i-1].mockedResponseId}</td>
<td>${myList[i-1].mediaType}</td>
<td>${myList[i-1].httpStatus}</td>
<td>
<button type="submit" name="updateMessage" value="${myList[i-1].mockedResponseId}">
<img src="/img/update-button.png" style="width: 20px;"/>
</button>
</td>
<td>
<button type="submit" name="removeMessage" value="${myList[i-1].mockedResponseId}">
<img src="/img/icons8-cancel-64.png" style="width: 20px;"/>
</button>
</td>
`
}
table.append(row);
}
for (var i = myList.length + 1; i <= state.rows; i++) {
var j = i + (state.page - 1) * 10;
if (i % 2 === 0) {
var row = `<tr bgcolor="#b3ffff">
<td>` + j + `</td>
<td></td>
<td></td>
<td></td>
`
} else {
var row = `<tr bgcolor="#e6ffff">
<td>` + j + `</td>
<td></td>
<td></td>
<td></td>
`
}
table.append(row)
}
pageButtons(data.pages);
}
function sortTable() {
console.log("sortTable");
var sortBy = document.querySelector('.activeButton').textContent;
console.log(sortBy);
switch (sortBy) {
case "MessageId":
if (previousSort === "MessageId") {
state.querySet.sort((a, b) => (a.mockedResponseId > b.mockedResponseId) ? -1 : ((b.mockedResponseId > a.mockedResponseId) ? 1 : 0));
} else {
state.querySet.sort((a, b) => (a.mockedResponseId > b.mockedResponseId) ? 1 : ((b.mockedResponseId > a.mockedResponseId) ? -1 : 0));
}
break;
case "Media Type":
if (previousSort === "Media Type") {
state.querySet.sort((a, b) => (a.mediaType > b.mediaType) ? -1 : ((b.mediaType > a.mediaType) ? 1 : 0));
} else {
state.querySet.sort((a, b) => (a.mediaType > b.mediaType) ? 1 : ((b.mediaType > a.mediaType) ? -1 : 0));
}
break;
case "Http Status":
if (previousSort === "Http Status") {
state.querySet.sort((a, b) => (a.httpStatus > b.httpStatus) ? -1 : ((b.httpStatus > a.httpStatus) ? 1 : 0));
} else {
state.querySet.sort((a, b) => (a.httpStatus > b.httpStatus) ? 1 : ((b.httpStatus > a.httpStatus) ? -1 : 0));
}
break;
}
if (previousSort === sortBy) {
previousSort = ""
} else previousSort = sortBy;
myList = state.querySet;
console.log(myList);
}
function prepareTable() {
data = pagination(state.querySet, state.page, state.rows);
myList = data.querySet;
}
function buildTable() {
console.log("buildTable");
sortTable();
prepareTable();
showTable();
}
function buildPage(){
prepareTable();
showTable();
}

View File

@@ -1,92 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>R11 Klaus</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,600" rel="stylesheet" type="text/css">
<link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css">
<link href="/css/styles.css" rel="stylesheet" />
</head>
<body>
<div id="container">
<div id="header"></div>
<div id="container1">
<div id="sidebar"></div>
<div id="child-body">
<section class="page-section" id="main-section">
<div class="row">
<div class="column">
<br>To see your activity history use the form below
<form action="#" th:action="@{/etrack/__${clientUUID}__}" th:object="${eventRequestDto}" method="post">
<input type="text" th:name="clientUUID" th:value="${clientUUID}" hidden />
<br><label>Mocked response id:</label><br>
<input type="text" th:name="mockedResponseId" th:id="mockedResponseId" th:placeholder="all" />
<td th:if="${#fields.hasErrors('mockedResponseId')}" th:errors="*{mockedResponseId}">mockedResponseId
error
</td>
<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>
<div class="column">
<br>
<table>
<thead>
<tr>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-0">#</p></th>
<th class="tr-pageable"><p class="btn-sort activeButton" id="btn-sort-1">MessageId</p></th>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-2">TimeStamp</p></th>
<th class="tr-pageable"><p class="btn-sort" id="btn-sort-3">Action</p></th>
</tr>
</thead>
<tbody id="table-body">
</tbody>
</table>
<div class="container ">
<div id="pagination-wrapper"></div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<div id="foot"></div>
</div>
<hr>
<script>
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/navbar.html", function(data){
$("#header").html(data);
});
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/sidebar.html", function(data){
$("#sidebar").html(data);
});
$.get("https://raw.githubusercontent.com/Szakalakamaka/viewpresenter/master/src/main/resources/templates/footer.html", function(data){
$("#foot").html(data);
});
</script>
<script type="text/javascript" th:inline="javascript">
var listForPagination = /*[[${eventList}]]*/;
</script>
<script src="/js/etrackPaggination.js"></script>
</body>
</html>

View File

@@ -1,193 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>R11 Tools: Mock</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,600" rel="stylesheet" type="text/css">
<link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css">
<link href="/css/styles.css" rel="stylesheet"/>
</head>
<body>
<hr>
<div id="container">
<div class="container">
<section class="page-section" id="main-section">
<div class="container">
<p>With this tool you can create mockups for http requests and use them for integration tests of
your system.
</p>
<div>
<br>
<p>You can test the mocked message using the url default values from the form will be used.</p>
<script>
var pubhost = location.hostname;
document.getElementById("pubhost").innerHTML = location.hostname;
</script>
<gen-link>http://<span id="pubhost">localhost</span>:8097/klaus/v1/get/[[${mockedMessageDto.clientUUID}]]/[[${mockedMessageDto.mockedResponseId}]]</gen-link>
<p>Use this link to get your message.</p>
<br>
<table>
<p>In order to change mockup response settings please fill the form below and save.</p>
<br>
<form action="#" th:action="@{/mock/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}" method="post">
<input type="text" th:field="*{clientUUID}" hidden/>
<tr>
<td>Media type:</td>
<td>
<label>
<select id="media-type" 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>
<span class="hint">Standard that indicates the nature and format of a document, file, or assortment of bytes.</span>
</label>
</td>
<td>
</td>
</tr>
<tr>
<td>Mocked response body:</td>
<!-- rows="4" cols="30"-->
<td><label>
<textarea id="message-body" th:field="*{messageBody}" placeholder="Your message body"></textarea>
<span class="hint">The resource data that will be requested by the client.</span>
</label>
</td>
<td th:if="${#fields.hasErrors('messageBody')}" th:errors="*{messageBody}">
Body Error
</td>
</tr>
<tr>
<td>Mocked response http code status:</td>
<td>
<label>
<input type="text" th:field="*{httpStatus}" placeholder="200">
<span class="hint">Status codes are issued by a server in response to a client's request made to the server.</span>
</label>
</td>
<td th:if="${#fields.hasErrors('httpStatus')}" th:errors="*{httpStatus}">
HttpStatus Error
</td>
</tr>
<tr>
<td><br></td>
<td><br></td>
</tr>
<tr>
<td>Header name</td>
<td>Header value</td>
</tr>
<tr>
<label>
<td><input type="text" name="headerKey" id="headerKey"
placeholder="myHeaderKey"/>
<span class="hint"></span>
</label>
</td>
<td>
<label>
<input type="text" name="headerValue" id="headerValue"
placeholder="myHeaderValue"/>
<span class="hint">HTTP headers let the client and the server pass additional information with an HTTP request or response.</span>
<input type="image" name="addHeader" src="/img/icons8-plus-48.png"
style="width: 20px;"/>
</label>
</td>
</tr>
<tr th:each="entry, stats : *{httpHeaders}">
<td bgcolor="#b3ffff"><input type="text" name="value" th:value="${entry.key}"
disabled="disabled"/></td>
<td>
&#9;
<input type="text" name="value"
th:field="*{httpHeaders[__${entry.key}__]}"/>
<button type="submit" name="removeHeader" th:value="${entry.key}">
<img src="/img/icons8-cancel-64.png" style="width: 20px;"/>
</button>
</td>
</tr>
<tr>
<td>Mocked response id:</td>
<td><label><input type="text" th:field="*{mockedResponseId}"
th:value="*{mockedResponseId}"/>
<span class="hint">Unique identifier for the mocked message.</span>
</label>
</td>
<td th:if="${#fields.hasErrors('mockedResponseId')}"
th:errors="*{mockedResponseId}">Id
Error
</td>
</tr>
<tr>
<td><input type="submit" value="Save settings"/></td>
<td>
<button type="submit" name="newMessage" th:value="*{clientUUID}">
<img src="/img/update-button.png" style="width: 20px;"/>
</button>
</td>
</tr>
</form>
</table>
<p th:if="${mockSaved}">Mock has been saved</p>
<table>
<tr>
<td>
<form action="#" th:action="@{/etrack/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}"
method="get">
<p><input type="submit" value="History"/></p>
</form>
</td>
<td>
<button class="btn-list" name="Messages List" id="btn-list-1">Messages List
</button>
</td>
</tr>
</table>
</div>
</div>
</section>
<hr>
</div>
<div>
<div id="list-wrapper" style="display: none;">
<p>Here you can see the interactive list of all your mocked messages. You can call all of them. Use
the buttons to sort the list and also update or delete messages.
</p>
<form action="#" th:action="@{/mock/__${mockedMessageDto.clientUUID}__}"
th:object="${mockedMessageDto}" method="post">
<table>
<thead>
<tr>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-0">#</p>
</th>
<th class="tr-pageable">
<p class="btn-sort activeButton" id="btn-sort-1">MessageId</p>
</th>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-2">Media Type</p>
</th>
<th class="tr-pageable">
<p class="btn-sort" id="btn-sort-3">Http Status</p>
</th>
</tr>
</thead>
<input type="text" th:field="*{clientUUID}" hidden/>
<tbody id="table-body"></tbody>
</table>
</form>
<div class="container ">
<div id="pagination-wrapper"></div>
</div>
</div>
</div>
<hr>
</div>
<script src="/js/paggination.js"></script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

View File

@@ -1,36 +0,0 @@
[{
"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
}]

View File

@@ -1,12 +0,0 @@
package com.release11.klaus;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class KlausApplicationTests {
// @Test
// void contextLoads() {
// }
}

View File

@@ -1,12 +0,0 @@
package com.release11.klaus.config;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class RedisConfigTest {
// @Test
// void jedisPool() {
//
// }
}

View File

@@ -1,77 +0,0 @@
package com.release11.klaus.controller;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class KlausControllerTest {
// @Mock
// KlausService klausService;
//
// @InjectMocks
// KlausController klausController;
//
// ObjectMapper objectMapper;
// MockMvc mockMvc;
// UUID uuid;
// MockedMessageDto mockedMessageDto;
// List<MockedMessageDto> mockedMessageDtoList = new ArrayList<>();
//
// @BeforeEach
// void setUp() {
// uuid = UUID.randomUUID();
// mockedMessageDto = MockedMessageDto.builder()
// .clientUUID(uuid)
// .mockedResponseId(323)
// .mediaType(MediaType.APPLICATION_JSON.toString())
// .messageBody("my message body")
// .httpHeaders(new HashMap<>())
// .httpStatus(200)
// .build();
// mockedMessageDtoList.add(mockedMessageDto);
//
// mockMvc = MockMvcBuilders.standaloneSetup(klausController).build();
//
// objectMapper = new ObjectMapper();
// }
//
// @Test
// void deleteMockedResponse() throws Exception {
// mockMvc.perform(delete("/klaus/v1/delete/" + uuid + "/" + mockedMessageDto.getMockedResponseId()))
// .andExpect(status().isOk());
//
// verify(klausService).deleteMockedResponse(any(), anyInt());
// }
//
//
//
// @Test
// void getAllMockedResponses() throws Exception {
// when(klausService.getAllMockedResponses(uuid))
// .thenReturn(mockedMessageDtoList);
//
// mockMvc.perform(get("/klaus/v1/getAll/" + uuid)
// .accept(MediaType.APPLICATION_JSON))
// .andExpect(status().isOk());
//
// verify(klausService).getAllMockedResponses(any());
// }
//
// @Test
// void testGetMockedResponse() throws Exception {
// when(klausService.getMockedResponse(uuid, mockedMessageDto.getMockedResponseId()))
// .thenReturn(mockedMessageDto);
//
// mockMvc.perform(get("/klaus/v1/get/" + uuid + "/" + mockedMessageDto.getMockedResponseId())
// .accept(MediaType.APPLICATION_JSON))
// .andExpect(status().isOk());
//
// verify(klausService).getMockedResponse(any(), anyInt());
// }
//
// @AfterEach
// void tearDown() {
// reset(klausService);
// }
}

View File

@@ -1,212 +0,0 @@
//package com.release11.klaus.controller;
//
//import com.release11.klaus.model.MockedMessageDto;
//import com.release11.klaus.service.KlausService;
//import org.junit.jupiter.api.AfterEach;
//import org.junit.jupiter.api.BeforeEach;
//import org.junit.jupiter.api.Test;
//import org.junit.jupiter.api.extension.ExtendWith;
//import org.mockito.InjectMocks;
//import org.mockito.Mock;
//import org.mockito.junit.jupiter.MockitoExtension;
//import org.springframework.http.MediaType;
//import org.springframework.test.web.servlet.MockMvc;
//import org.springframework.test.web.servlet.setup.MockMvcBuilders;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.UUID;
//
//import static org.mockito.ArgumentMatchers.any;
//import static org.mockito.Mockito.*;
//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
//
//@ExtendWith(MockitoExtension.class)
//class KlausMvcControllerTest {
//
// @Mock
// KlausService klausService;
//
// @InjectMocks
// KlausMvcController klausMvcController;
//
// MockMvc mockMvc;
// UUID uuid;
// MockedMessageDto mockedMessageDto;
// List<MockedMessageDto> mockedMessageDtoList = new ArrayList<>();
//
// @BeforeEach
// void beforeEach() {
// uuid = UUID.randomUUID();
// mockedMessageDto = MockedMessageDto.builder()
// .clientUUID(uuid)
// .mockedResponseId(323)
// .mediaType(MediaType.APPLICATION_JSON.toString())
// .messageBody("my message body")
// .httpHeaders(new HashMap<>())
// .httpStatus(200)
// .build();
// mockedMessageDtoList.add(mockedMessageDto);
//
// mockMvc = MockMvcBuilders.standaloneSetup(klausMvcController).build();
// }
//
// @Test
// void showHome() throws Exception {
// when(klausService.getAllMockedResponses(any()))
// .thenReturn(mockedMessageDtoList);
//
// mockMvc.perform(get("/mock/" + uuid))
// .andExpect(status().isOk())
// .andExpect(view().name("mock"))
// .andExpect(model().attributeExists("mockedMessageDtoList"));
//
// verify(klausService).getAllMockedResponses(any());
// }
//
// @Test
// void showHomePost() throws Exception {
// mockMvc.perform(post("/mock/e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
// .param("clientUUID", "e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
// .param("mockedResponseId", "323")
// .param("mediaType", "application/json")
// .param("messageBody", "my message body")
// .param("httpStatus", "200"))
// .andExpect(status().isOk())
// .andExpect(model().attributeExists("mockedMessageDtoList"))
// .andExpect(view().name("mock"));
//
// verify(klausService).setMockedResponse(any());
// }
//
// @Test
// void showHomePostNotValid() throws Exception {
//// mockMvc.perform(post("/mock/e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
//// .param("clientUUID", "e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
//// .param("mockedResponseId", "aaaa")
//// .param("mediaType", "application/json")
//// .param("messageBody", "my message body")
//// .param("httpStatus", "200"))
//// .andExpect(status().isOk())
//// .andExpect(model().attributeHasErrors("mockedMessageDto"))
//// .andExpect(model().attributeHasFieldErrors("mockedMessageDto", "mockedResponseId"))
//// .andExpect(view().name("mock"));
// }
//
// @Test
// void newMessage() throws Exception {
// when(klausService.getAllMockedResponses(any()))
// .thenReturn(mockedMessageDtoList);
//
// mockMvc.perform(post("/mock/e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
// .param("newMessage", "newMessage")
// .param("clientUUID", "e9dc0ad9-acd2-4699-99f7-368d53d7afd6"))
// .andExpect(status().isOk())
// .andExpect(model().attributeExists("mockedMessageDtoList"))
// .andExpect(view().name("mock"));
//
// verify(klausService).getAllMockedResponses(any());
// }
//
// @Test
// void showGetMockedResponse() throws Exception {
// when(klausService.getMockedResponse(any(), anyInt()))
// .thenReturn(mockedMessageDto);
//
// mockMvc.perform(get("/mock/getMockedResponse")
// .param("clientUUID", "e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
// .param("mockedResponseId", "323")
// .param("mediaType", "application/json")
// .param("messageBody", "my message body")
// .param("httpStatus", "200"))
// .andExpect(status().isOk());
//
// verify(klausService).getMockedResponse(any(), anyInt());
// }
//
// @Test
// void addHeader() throws Exception {
//// when(klausService.getAllMockedResponses(any()))
//// .thenReturn(mockedMessageDtoList);
////
//// mockMvc.perform(post("/mock/e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
//// .param("addHeader", "addHeader")
//// .param("headerKey", "myKey")
//// .param("headerValue", "myValue")
//// .param("clientUUID", "e9dc0ad9-acd2-4699-99f7-368d53d7afd6"))
//// .andExpect(status().isOk())
//// .andExpect(view().name("mock"))
//// .andExpect(model().attributeExists("mockedMessageDtoList"));
////
//// verify(klausService, times(0)).getAllMockedResponses(any());
// }
//
// @Test
// void removeHeader() throws Exception {
//// when(klausService.getAllMockedResponses(any()))
//// .thenReturn(mockedMessageDtoList);
////
//// mockMvc.perform(post("/mock/e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
//// .param("removeHeader", "removeHeader")
//// .param("clientUUID", "e9dc0ad9-acd2-4699-99f7-368d53d7afd6"))
//// .andExpect(status().isOk())
//// .andExpect(view().name("mock"))
//// .andExpect(model().attributeExists("mockedMessageDtoList"));
////
//// verify(klausService, times(0)).getAllMockedResponses(any());
// }
//
// @Test
// void updateMessage() throws Exception {
// when(klausService.getAllMockedResponses(any()))
// .thenReturn(mockedMessageDtoList);
// when(klausService.getMockedResponse(any(), anyInt())).
// thenReturn(mockedMessageDto);
//
// mockMvc.perform(post("/mock/e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
// .param("updateMessage", "323"))
// .andExpect(status().isOk())
// .andExpect(view().name("mock"))
// .andExpect(model().attributeExists("canTest"))
// .andExpect(model().attributeExists("mockedMessageDtoList"));
//
// verify(klausService, times(0)).getAllMockedResponses(any());
// verify(klausService).getMockedResponse(any(), anyInt());
// }
//
// @Test
// void removeMessage() throws Exception {
// when(klausService.getAllMockedResponses(any()))
// .thenReturn(mockedMessageDtoList);
//
// mockMvc.perform(post("/mock/e9dc0ad9-acd2-4699-99f7-368d53d7afd6")
// .param("removeMessage", "323"))
// .andExpect(status().isOk())
// .andExpect(view().name("mock"))
// .andExpect(model().attributeDoesNotExist("canTest"))
// .andExpect(model().attributeExists("mockedMessageDtoList"));
//
// verify(klausService).getAllMockedResponses(any());
// verify(klausService).deleteMockedResponse(any(), anyInt());
// }
//
// @Test
// void localhost() {
// assert klausMvcController.localhost() != null;
// }
//
// @Test
// void clientUUID() {
// assert klausMvcController.clientUUID() != null;
// }
//
//
// @AfterEach
// void afterEach() {
// reset(klausService);
// }
//
//}

View File

@@ -1,19 +0,0 @@
package com.release11.klaus.repository;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class EventRepositoryImplTest {
// @BeforeEach
// void setUp() {
// }
//
// @Test
// void findEvents() {
// }
//
// @AfterEach
// void tearDown() {
// }
}

View File

@@ -1,117 +0,0 @@
//package com.release11.klaus.service;
//
//import com.fasterxml.jackson.core.JsonProcessingException;
//import com.release11.klaus.mappers.MockedMessageMapper;
//import com.release11.klaus.mappers.MockedMessageMapperImpl;
//import com.release11.klaus.model.MockedMessage;
//import com.release11.klaus.model.MockedMessageDto;
//import com.release11.klaus.repository.MockedResponseRepository;
//import org.junit.jupiter.api.AfterEach;
//import org.junit.jupiter.api.BeforeEach;
//import org.junit.jupiter.api.Test;
//import org.junit.runner.RunWith;
//import org.mockito.InjectMocks;
//import org.mockito.Mock;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.context.junit4.SpringRunner;
//
//import javax.ws.rs.core.MediaType;
//import java.util.*;
//
//import static org.assertj.core.api.Assertions.assertThat;
//import static org.mockito.ArgumentMatchers.any;
//import static org.mockito.Mockito.*;
//
//@RunWith(SpringRunner.class)
//@SpringBootTest(classes = {MockedMessageMapperImpl.class})
//class KlausServiceImplTest {
//
// @Mock
// MockedResponseRepository mockedResponseRepository;
//
// @Mock private MockedMessageMapper mockedMessageMapper;
//
// @InjectMocks
// KlausServiceImpl klausService;
//
// UUID uuid;
// MockedMessage mockedMessage1;
// Map<String, String> httpHeaders;
// MockedMessageDto mockedMessageDto1;
// MockedMessageDto mockedMessageDto2;
// MockedMessageDto mockedMessageDto3;
// List<MockedMessage> mockedMessageList = new ArrayList<>();
//
// @BeforeEach
// void setUp() {
// uuid = UUID.randomUUID();
// httpHeaders = new HashMap<>();
// mockedMessageDto1 = MockedMessageDto.builder()
// .clientUUID(uuid)
// .mockedResponseId(323)
// .mediaType(MediaType.APPLICATION_JSON)
// .messageBody("it's okey to be gey")
// .httpHeaders(httpHeaders)
// .httpStatus(200)
// .build();
//
// mockedMessageDto2 = MockedMessageDto.builder()
// .clientUUID(uuid)
// .mockedResponseId(3123)
// .mediaType(MediaType.APPLICATION_JSON)
// .messageBody("some random message")
// .httpHeaders(httpHeaders)
// .httpStatus(404)
// .build();
//
// mockedMessageDto3 = MockedMessageDto.builder()
// .clientUUID(uuid)
// .mockedResponseId(3233)
// .mediaType(MediaType.APPLICATION_XML)
// .messageBody("loooking good")
// .httpHeaders(httpHeaders)
// .httpStatus(205)
// .build();
//
// mockedMessage1 = new MockedMessage();
// mockedMessageList.add(mockedMessage1);
// mockedMessageList.add(mockedMessage1);
// mockedMessageList.add(mockedMessage1);
// }
//
// @Test
// void deleteMockedResponse() {
// klausService.deleteMockedResponse(uuid, 323);
// verify(mockedResponseRepository).deleteById(any());
// }
//
// @Test
// void getAllMockedResponses() {
//// when(mockedResponseRepository.findAllByClientUUID(any()))
//// .thenReturn(mockedMessageList);
////
//// assertThat(klausService.getAllMockedResponses(uuid), hasSize(3));
//// verify(mockedResponseRepository).findAllByClientUUID(any());
// }
//
// @Test
// void getMockedResponse() throws JsonProcessingException {
// when(mockedResponseRepository.getByCompositePrimaryKey(any()))
// .thenReturn(mockedMessage1);
//
// assertThat(klausService.getMockedResponse(uuid, 323)).isNotNull();
// verify(mockedResponseRepository).findById(any());
// }
//
// @Test
// void setMockedResponse() {
//// klausService.setMockedResponse(mockedMessageDto1);
////
//// verify(mockedResponseRepository).save(any());
// }
//
//
// @AfterEach
// void tearDown() { reset(mockedResponseRepository); }
//
//}