diff --git a/.gitignore b/.gitignore index d4247a2..dcbaf2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ -target/ +.idea +*.iws *.iml -.idea/workspace.xml \ No newline at end of file +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ \ No newline at end of file diff --git a/target/classes/com/release11/klaus/controller/MockController.class b/target/classes/com/release11/klaus/controller/MockController.class new file mode 100644 index 0000000..4150df3 Binary files /dev/null and b/target/classes/com/release11/klaus/controller/MockController.class differ diff --git a/target/classes/com/release11/klaus/model/MockedMessageDtoTest$MockedMessageDtoTestBuilder.class b/target/classes/com/release11/klaus/model/MockedMessageDtoTest$MockedMessageDtoTestBuilder.class new file mode 100644 index 0000000..9e498ea Binary files /dev/null and b/target/classes/com/release11/klaus/model/MockedMessageDtoTest$MockedMessageDtoTestBuilder.class differ diff --git a/target/classes/com/release11/klaus/model/MockedMessageDtoTest.class b/target/classes/com/release11/klaus/model/MockedMessageDtoTest.class new file mode 100644 index 0000000..547242b Binary files /dev/null and b/target/classes/com/release11/klaus/model/MockedMessageDtoTest.class differ diff --git a/target/classes/com/release11/klaus/utilis/ObjectConfig.class b/target/classes/com/release11/klaus/utilis/ObjectConfig.class new file mode 100644 index 0000000..a96e378 Binary files /dev/null and b/target/classes/com/release11/klaus/utilis/ObjectConfig.class differ diff --git a/target/classes/static/Dependency/fontello-plus/LICENSE.txt b/target/classes/static/Dependency/fontello-plus/LICENSE.txt new file mode 100644 index 0000000..5897837 --- /dev/null +++ b/target/classes/static/Dependency/fontello-plus/LICENSE.txt @@ -0,0 +1,21 @@ +Font license info + + +## Entypo + + Copyright (C) 2012 by Daniel Bruce + + Author: Daniel Bruce + License: SIL (http://scripts.sil.org/OFL) + Homepage: http://www.entypo.com + + +## Font Awesome + + Copyright (C) 2016 by Dave Gandy + + Author: Dave Gandy + License: SIL () + Homepage: http://fortawesome.github.com/Font-Awesome/ + + diff --git a/target/classes/static/Dependency/fontello-plus/README.txt b/target/classes/static/Dependency/fontello-plus/README.txt new file mode 100644 index 0000000..d870892 --- /dev/null +++ b/target/classes/static/Dependency/fontello-plus/README.txt @@ -0,0 +1,75 @@ +This webfont is generated by https://fontello.com open source project. + + +================================================================================ +Please, note, that you should obey original font licenses, used to make this +webfont pack. Details available in LICENSE.txt file. + +- Usually, it's enough to publish content of LICENSE.txt file somewhere on your + site in "About" section. + +- If your project is open-source, usually, it will be ok to make LICENSE.txt + file publicly available in your repository. + +- Fonts, used in Fontello, don't require a clickable link on your site. + But any kind of additional authors crediting is welcome. +================================================================================ + + +Comments on archive content +--------------------------- + +- /font/* - fonts in different formats + +- /css/* - different kinds of css, for all situations. Should be ok with + twitter bootstrap. Also, you can skip style and assign icon classes + directly to text elements, if you don't mind about IE7. + +- demo.html - demo file, to show your webfont content + +- LICENSE.txt - license info about source fonts, used to build your one. + +- config.json - keeps your settings. You can import it back into fontello + anytime, to continue your work + + +Why so many CSS files ? +----------------------- + +Because we like to fit all your needs :) + +- basic file, .css - is usually enough, it contains @font-face + and character code definitions + +- *-ie7.css - if you need IE7 support, but still don't wish to put char codes + directly into html + +- *-codes.css and *-ie7-codes.css - if you like to use your own @font-face + rules, but still wish to benefit from css generation. That can be very + convenient for automated asset build systems. When you need to update font - + no need to manually edit files, just override old version with archive + content. See fontello source code for examples. + +- *-embedded.css - basic css file, but with embedded WOFF font, to avoid + CORS issues in Firefox and IE9+, when fonts are hosted on the separate domain. + We strongly recommend to resolve this issue by `Access-Control-Allow-Origin` + server headers. But if you ok with dirty hack - this file is for you. Note, + that data url moved to separate @font-face to avoid problems with + + + + + + + +
+

fontello font demo

+ +
+
+
+
icon-check0xe800
+
icon-plus0xe801
+
icon-plus-squared-alt0xf196
+
+
+ + + \ No newline at end of file diff --git a/target/classes/static/Dependency/fontello-plus/font/fontello.eot b/target/classes/static/Dependency/fontello-plus/font/fontello.eot new file mode 100644 index 0000000..cd5035c Binary files /dev/null and b/target/classes/static/Dependency/fontello-plus/font/fontello.eot differ diff --git a/target/classes/static/Dependency/fontello-plus/font/fontello.svg b/target/classes/static/Dependency/fontello-plus/font/fontello.svg new file mode 100644 index 0000000..906a1c5 --- /dev/null +++ b/target/classes/static/Dependency/fontello-plus/font/fontello.svg @@ -0,0 +1,16 @@ + + + +Copyright (C) 2021 by original authors @ fontello.com + + + + + + + + + + + + \ No newline at end of file diff --git a/target/classes/static/Dependency/fontello-plus/font/fontello.ttf b/target/classes/static/Dependency/fontello-plus/font/fontello.ttf new file mode 100644 index 0000000..755ffc9 Binary files /dev/null and b/target/classes/static/Dependency/fontello-plus/font/fontello.ttf differ diff --git a/target/classes/static/Dependency/fontello-plus/font/fontello.woff b/target/classes/static/Dependency/fontello-plus/font/fontello.woff new file mode 100644 index 0000000..bf18569 Binary files /dev/null and b/target/classes/static/Dependency/fontello-plus/font/fontello.woff differ diff --git a/target/classes/static/Dependency/fontello-plus/font/fontello.woff2 b/target/classes/static/Dependency/fontello-plus/font/fontello.woff2 new file mode 100644 index 0000000..1b988f7 Binary files /dev/null and b/target/classes/static/Dependency/fontello-plus/font/fontello.woff2 differ diff --git a/target/classes/static/css/main.css b/target/classes/static/css/main.css new file mode 100644 index 0000000..9141794 --- /dev/null +++ b/target/classes/static/css/main.css @@ -0,0 +1,277 @@ +#container { + width: 1400px; + margin-left: 15px; + margin-top: 30px; + min-height: 700px; + background: white; +} + +label { + font-size: 18px; + font-weight: 700; +} + +#toolName { + width: 850px; + font-weight: 700; + font-size: 42px; + margin-bottom: 40px; + /*text-align: center;*/ + /*padding: 50px;*/ +} + +.articleHead { + font-size: 32px; + font-weight: 400; + height: 70px; + /*padding: 10px;*/ +} + +#itemData { + min-height: 1736px; + float: left; + width: 720px; + font-size: 24px; +} + +#optional { + width: 100%; + font-size: 24px; + cursor: pointer; +} + +#optional:hover { + color: orange; +} + +#advanced { + width: 100%; + margin-bottom: 50px; +} + +/*TODO create tab menu style in common.css*/ + +#advancedMenu { + margin-top: 30px; + width: 720px; + height: 50px; +} + +.advancedMenuTab { + width: 340px; + height: 30px; + float: left; + text-align: center; + padding: 10px; + font-size: 24px; + cursor: pointer; + border-bottom: #f0f0f0 1px solid; +} + +.advancedMenuTab:hover { + font-weight: 700; +} + +.advancedMenuTabSelected { + width: 340px; + height: 30px; + float: left; + text-align: center; + padding: 10px; + font-size: 24px; + background: gray; + color: white; + font-weight: 700; + border-bottom: gray 1px solid; +} + +#messageFields { + height: 120px; +} + +.fieldFloater { + float: left; + height: 100%; +} + +#functionBar { +} + +/*TODO add inactive state of the button*/ + +.buttonSpacer { + height: 30%; +} + +.functionBarButton { + clear: both; + width: 263px; + height: 40%; + margin-left: 80px; + right: 0; + /*margin: auto;*/ + font-size: 24px; + padding: 12px; + text-align: center; +} + +. + +#link { + width: 750px; + margin-bottom: 40px; +} + +/*TODO add style to common*/ +#messageLink { + width: 630px; + padding: 10px; + font-size: 14px; + background: #f0f0f0; +} + +#messageLink a { + color: inherit; + text-decoration: inherit; +} + +#messageLink a:hover { + color: #d6860d !important; +} + +.fieldDefault { + width: 300px; + height: 30px; +} + +.fieldText { + width: 630px; + padding: 10px; + height: 296px; + resize: none; +} + +#httpStatus { + resize: none; +} + +#selectMenu { + min-height: 1736px; + float: left; + width: 200px; + margin-right: 30px; +} + +.menuItem { + float: left; + width: 150px; + padding: 10px; + height: 42px; + font-size: 14px; + text-align: left; + margin-bottom: 5px; + border: 1px solid lightgray; + cursor: pointer; +} + +#iconPlus { + text-align: center; + font-size: 28px; + color: lightgray; +} + +.menuItem:hover { + background: lightgray; + color: white; + font-weight: 400; +} + +.menuItemSelected { + float: left; + width: 150px; + padding: 10px; + height: 42px; + font-size: 14px; + text-align: left; + margin-bottom: 5px; + border: 1px solid lightgray; + background: gray; + color: white; + font-weight: 400; +} + +/*TODO add style to general stylesheet. Gray if inactive red if hover*/ +.btn-del-MenuItem { + float: left; + font-size: 24px; + color: lightgray; + text-align: center; + cursor: pointer; +} + +.btn-del-MenuItem:hover { + color: red; +} + +#headerTable { + margin-top: 40px; + margin-bottom: 20px; +} + +.tableHead { + width: 240px; + padding: 5px; +} + +/*TODO gray out key value in table*/ +.tableField { + height: 20px; + padding: 5px; + width: 240px; +} + +#mockIntroTip { + margin-top: 10px; + text-align: justify; + padding: 5px; + margin-bottom: 10px; +} + +.btn-function-table { + font-size: 24px; + font-weight: 700; +} + +/*TODO add to general styles. Gray if inactive green if hover*/ +.btn-table-add { + color: lightgray; + cursor: pointer; +} + +.btn-table-add:hover { + color: green; +} + + +.btn-table-remove { + color: lightgray; + cursor: pointer; +} + +.btn-table-remove:hover { + color: red; +} + +/*TODO add to commons*/ +input:focus { + box-shadow: 0 0 5px rgba(81, 203, 238); + outline: none; +} + + +/*TODO add to commons*/ +.btn-inactive { + color: #f1f1f1 !important; + background: #999999 !important; + cursor: default !important; +} \ No newline at end of file diff --git a/target/classes/static/css/tooltip.css b/target/classes/static/css/tooltip.css new file mode 100644 index 0000000..43bcb3b --- /dev/null +++ b/target/classes/static/css/tooltip.css @@ -0,0 +1,53 @@ +p#tooltipText { + /* /* padding: 20px; */ + width: 200px; + height: 150px; +} + +label, input, select, textarea { + display: block; +} + +div#tooltip { + border-radius: 15px; + padding-left: 20px; + padding-right: 20px; + padding-bottom: 20px; + margin-top: 20px; + border: 2px solid rgba(155, 165, 160, 0.507); + width: 350px; + /* width: 70%; */ + /* background-color: rgb(68, 158, 116); */ + min-height: 400px; +} + +.collapsible { + /*background-color: rgba(155, 165, 160, 0.507);*/ + color: rgb(44, 44, 44); + cursor: pointer; + padding: 5px; + width: 100%; + /*border: none;*/ + /*outline: none;*/ + /*max-height: 0;*/ + /*overflow: hidden;*/ + /*transition: max-height 0.2s ease-out;*/ +} + +/*.active, .collapsibleActive:hover {*/ +/* background-color: rgb(85, 85, 85);*/ +/*}*/ + +.collapsibleData { + padding: 0 18px; + + background-color: #f1f1f1; +} + +.fixed { + position: fixed; + /*top: 50%;*/ + /*left: 50%;*/ + margin-top: 100px; + margin-left: 950px; +} \ No newline at end of file diff --git a/target/classes/static/css/wojtas.css b/target/classes/static/css/wojtas.css new file mode 100644 index 0000000..d595257 --- /dev/null +++ b/target/classes/static/css/wojtas.css @@ -0,0 +1,43 @@ +p#tooltipText { + /* /* padding: 20px; */ + width: 200px; + height: 150px; +} + +div#tooltip { + border-radius: 15px; + padding-left: 20px; + padding-right: 20px; + padding-bottom: 20px; + margin-top: 160px; + border: 2px solid rgba(155, 165, 160, 0.507); + float: right; + width: 40%; + /* width: 70%; */ + /* background-color: rgb(68, 158, 116); */ + height: 100%; +} + +.collapsible { + background-color: rgba(155, 165, 160, 0.507); + color: rgb(44, 44, 44); + cursor: pointer; + padding: 18px; + width: 100%; + border: none; + text-align: center; + outline: none; + font-size: 20px; +} + +.active, .collapsibleActive:hover { + background-color: rgb(85, 85, 85); +} + +.collapsibleData { + padding: 0 18px; + max-height: 0; + overflow: hidden; + transition: max-height 0.2s ease-out; + background-color: #f1f1f1; +} \ No newline at end of file diff --git a/target/classes/static/html/mock.html b/target/classes/static/html/mock.html new file mode 100644 index 0000000..c120c53 --- /dev/null +++ b/target/classes/static/html/mock.html @@ -0,0 +1,165 @@ + + + + R11 MockedServices + + + + + + + + + + +
+
Mocked Service
+
+
Your message
+ + +
+
+
+
+ + + + +
+
+ + + + +
+
+
+
+
+
+
+
+
+
+ +
+ + +
+ +
+
> show/hide advanced settings
+ + +
+
+ +
+
+
+

What's mock service?

+

It's super simple! Need data as response from the server? Mock your api in just a few clicks.

+

Hover over an item to see description!

+
+

Help:

+
+ + + + + + + + +
+
+ + +
+ + + + \ No newline at end of file diff --git a/target/classes/static/js/datatransfer.js b/target/classes/static/js/datatransfer.js new file mode 100644 index 0000000..f092e5e --- /dev/null +++ b/target/classes/static/js/datatransfer.js @@ -0,0 +1,339 @@ +//TODO: Add delete buttons for messages +//TODO: Save button deactivation after swap, post or delete +//TODO: It sends request, gets responds but doesnt run a function!! +//TODO: Warning is displayed twice +var clientUUID = ''; +var json = {}; +var jsonIndex = 0; +var htable_row = 0; +var host = getDomain(); +var dataModified = false; +const C_UUID = 'mock-uuid'; +const setModified = function(){ + setDataModified(); +} +const setOrigin = function(){ + setDataOrigin(); +} + +const getUpdate = function(){ + updateData(); +} +$('#iconPlus').click(function(){addMessage()}); +$('#btn-addRow').click(function(){addRow()}); +//TODO remove later save onclick init +$('#btn-save').click(getUpdate); + +function getData(){ + loadCookies(); + $.getJSON(host + '/mock/json/'+clientUUID, function(data) { + json = data; + clientUUID = json[jsonIndex].clientUUID; + setCookies(); + console.log(JSON.stringify(json)); + console.log("Json received"); + refreshData(); + }); +} + +function getDomain(){ + var url = window.location.href; + var arr = url.split("/"); + var result = arr[0] + "//" + arr[2]; + return result; +} + +function setDataModified(){ + if(dataModified) return; + dataModified = true; + $('#btn-save').removeClass('btn-inactive'); + $('#btn-save').addClass('btn-action'); + $('#btn-save').click(getUpdate); +} + +//Adding change listener to fields +$('.field').change(setModified); + +function setDataOrigin(){ + dataModified = false; + $('#btn-save').addClass('btn-inactive'); + $('#btn-save').removeClass('btn-action'); + $('#btn-save').off(); +} + +function displayDataLossWarn(){ + if(dataModified) alert('Data modification lost'); +} + +function refreshData(){ + fillMessageList(); + console.log("List initiated"); + loadMessage(json[jsonIndex].mockedResponseId); + console.log("Message loaded"); +} + +function setCookies(){ + document.cookie = C_UUID + '=' +clientUUID+';'; +} + +function loadCookies(){ + clientUUID = getCookie(C_UUID); +} + +function getCookie(cname) { + var name = cname + '='; + var decodedCookie = decodeURIComponent(document.cookie); + var ca = decodedCookie.split(';'); + for(var i = 0; i ' + link + ''); + $('#httpStatus').val(httpStatus); + $('#typeSelector').val(mediaType); + $('#bodyEditor').val(body); + $('#mockedMessageId').html(id); + +} + +function createLink(uuid, id){ + var link = host + '/klaus/v1/get/'+uuid+'/'+id; + return link; +} + +function fillHeaderTable(headers){ + var innerHTML = $('#httpStatusValues').html(); + innerHTML += generateHeaderTable(headers); + $('#httpStatusValues').html(innerHTML); + $('.tableField').change(function(){setDataModified()}); +} +//TODO: Add addRow() to generate new rows and populate them with data +function generateHeaderTable(headers){ + let count = 0; + let innerHTML = ''; + for(var item in headers){ + if( headers.hasOwnProperty(item) ) count++; + } + var keys = new Array(count); + var values = new Array(count); + let index = 0; + for(var key in Object.keys(headers)){ + keys[index++]=Object.keys(headers)[key]; + } + index = 0; + for(var val in headers){ + values[index++]=headers[val]; + } + + for(let i=0; i' + + '' + + '' + + '' + + '' + + 'X' + + ''; + htable_row++; + } + return innerHTML; +} + +function removeRow(row){ + $('#hrow' + row).remove(); + setDataModified(); +} + +function addRow(){ + var table = $('#httpStatusValues'); + var hkey = $('#headerKeyInput'); + var hval = $('#headerValueInput'); + if(hkey.val() == 'key' || hkey.val() == '' || hval.val() == 'value' || hval.val() == '') return; + var innerHtml = + '' + + '' + + '' + + '' + + '' + + 'X' + + ''; + htable_row++; + table.append(innerHtml); + hkey.val(''); + hval.val(''); + setDataModified(); +} + +function fillMessageList(){ + $("#listItems").html(''); + var innerHTML = ''; + for(let i=0; i' + + '' + + '' + + '
Id: '+ id +'
Http-status: '+ httpStatus +'
X
' + + '
'; + return innerHTML; +} + + + +function onbuild(){ + getData(); + sleep(1000); +} + +$(document).ready(onbuild()); + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + + + +function generateJson(){ + var newJson = + { + clientUUID: json[jsonIndex].clientUUID, + mockedResponseId: json[jsonIndex].mockedResponseId, + mediaType: $('#typeSelector').val(), + messageBody: $('#bodyEditor').val(), + httpStatus: $('#httpStatus').val(), + httpHeaders: {}, + }; + newJson['httpHeaders'] = convertTableToJson(); + console.log(JSON.stringify(newJson, null, 2)); + json[jsonIndex] = newJson; + return newJson; +} + + +function convertTableToJson(){ + var rows = $('.httpStatusValue'); + console.log("Rows: "+rows.length); + var obj = {}; + var key; + for(let i=0; i