diff options
author | 2022-01-28 11:41:38 +0000 | |
---|---|---|
committer | 2022-02-23 09:50:14 +0000 | |
commit | 4a50604b767176aa323acae366fa762015a7f9f6 (patch) | |
tree | 065f6be626573df3da5df23b3b2d2533cb9ed819 /gui-editors/gui-editor-apex/src/main/webapp | |
parent | 6e3d850c1b6efda12a70a111c8734972c99e3db5 (diff) |
Apex Editor using Spring Boot
Changed Apex Editor to use Spring Boot (MVC)
Changed all tests to use JUnit 5
Added more tests for policy upload feature
Updated JS files to reflect JSON encoding change
Added Apex Editor README
Changed rest path to /policy/gui/v1/apex/editor
Issue-ID: POLICY-3896
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I10f1ee3c40244a822a7032b4b24cb02060698fc3
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/webapp')
32 files changed, 309 insertions, 398 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/webapp/WEB-INF/web.xml b/gui-editors/gui-editor-apex/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index c60f575..0000000 --- a/gui-editors/gui-editor-apex/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2016-2018 Ericsson. All rights reserved. - Modifications Copyright (C) 2020 Nordix Foundation. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - SPDX-License-Identifier: Apache-2.0 - ============LICENSE_END========================================================= ---> - -<!-- This web.xml file is not required when using Servlet 3.0 container, - see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html --> -<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> - - <servlet> - <servlet-name>apex-services.rest</servlet-name> - <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> - <init-param> - <param-name>jersey.config.server.provider.packages</param-name> - <param-value>org.onap.policy.apex.client.editor.rest</param-value> - </init-param> - <load-on-startup>1</load-on-startup> - </servlet> - <servlet-mapping> - <servlet-name>apex-services.rest</servlet-name> - <url-pattern>/apexservices/*</url-pattern> - </servlet-mapping> - -</web-app> diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexAjax.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexAjax.js index 4a6dc7d..b583ffd 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexAjax.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexAjax.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -46,11 +46,11 @@ function ajax_getWithKeyInfo(requestURL, objectType, callback, keyNam) { ajax_get(keyInfoURL, function(dataKeyInfos) { ajax_get(requestURL, function(data) { var keyInfos = []; - for ( let value of dataKeyInfos.messages.message) { + for (let value of dataKeyInfos.messages) { var ki = JSON.parse(value).apexKeyInfo; keyInfos.push(ki); } - var object = JSON.parse(data.messages.message[0])[objectType]; + var object = JSON.parse(data.messages[0])[objectType]; var keyInfo = keyInfos.filter(function(ki) { return ki.key.name === object[keyName].name && ki.key.version === object[keyName].version; @@ -128,4 +128,4 @@ function ajax_delete(requestURL, callback) { }); } -export {ajax_get, ajax_delete, ajax_post, ajax_put, ajax_getOKOrFail, ajax_getWithKeyInfo};
\ No newline at end of file +export {ajax_get, ajax_delete, ajax_post, ajax_put, ajax_getOKOrFail, ajax_getWithKeyInfo}; diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumEditForm.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumEditForm.js index 23d138d..687d7b3 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumEditForm.js @@ -31,7 +31,7 @@ function editContextAlbumForm_createContextAlbum(formParent) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, @@ -63,7 +63,7 @@ function editContextAlbumForm_viewContextAlbum(parent, name, version) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, @@ -84,7 +84,7 @@ function editContextAlbumForm_editContextAlbum(formParent, name, version) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumTab.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumTab.js index 821e5f6..fe9bcbb 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumTab.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextAlbumTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +38,7 @@ function contextAlbumTab_activate() { ajax_get(requestURL, function(data) { $("#contextAlbumTableBody").find("tr:gt(0)").remove(); - for (let value of data.messages.message) { + for (let value of data.messages) { var contextAlbum = JSON.parse(value).apexContextAlbum; var contextAlbumRow_tr = document.createElement("tr"); @@ -125,4 +125,4 @@ function contextAlbumTab_create() { } //Testing purposes -export { contextAlbumTab_reset, contextAlbumTab_create, contextAlbumTab_activate, contextAlbumTab_deactivate };
\ No newline at end of file +export { contextAlbumTab_reset, contextAlbumTab_create, contextAlbumTab_activate, contextAlbumTab_deactivate }; diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextSchemaTab.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextSchemaTab.js index fa5ed6f..12f2e11 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextSchemaTab.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexContextSchemaTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ function contextSchemaTab_activate() { ajax_get(requestURL, function(data) { $("#contextSchemaTableBody").find("tr:gt(0)").remove(); - for (let value of data.messages.message) { + for (let value of data.messages) { var contextSchema = JSON.parse(value).apexContextSchema; var contextSchemaRow_tr = document.createElement("tr"); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventEditForm.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventEditForm.js index fef9278..cc14b63 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventEditForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ function editEventForm_createEvent(formParent) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; var dt = { "name" : contextSchema.key.name, @@ -72,7 +72,7 @@ function editEventForm_editEvent_inner(formParent, name, version, viewOrEdit) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventTab.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventTab.js index 44458c2..cc431b5 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventTab.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexEventTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,7 +40,7 @@ function eventTab_activate() { $("#eventTableBody").find("tr:gt(0)").remove(); - for (let value of data.messages.message) { + for (let value of data.messages) { var event = JSON.parse(value).apexEvent; var eventTableRow_tr = document.createElement("tr"); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexFiles.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexFiles.js index de9edf3..f24534f 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexFiles.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexFiles.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +38,7 @@ function files_fileOpen() { localStorage.setItem("apex_model_loaded", true); requestURL = window.restRootURL + "/Model/GetKey"; ajax_get(requestURL, function(data) { - var modelKey = JSON.parse(data.messages.message[0]).apexArtifactKey; + var modelKey = JSON.parse(data.messages[0]).apexArtifactKey; pageControl_modelMode(modelKey.name, modelKey.version, fileName); }); }); @@ -65,7 +65,7 @@ function files_fileUpload() { } ajax_getOKOrFail(requestURL, function(data) { let uploadResultString = ""; - for (let value of data.messages.message) { + for (let value of data.messages) { uploadResultString += (value + "\n"); } resultForm_activate(document.getElementById("mainArea"), "Model Upload Result", uploadResultString); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexKeyInformationTab.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexKeyInformationTab.js index 6cfc28d..814725a 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexKeyInformationTab.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexKeyInformationTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,7 +37,7 @@ function keyInformationTab_activate() { ajax_get(requestURL, function(data) { $("#keyInformationTableBody").find("tr:gt(0)").remove(); - for (let value of data.messages.message) { + for (let value of data.messages) { var keyInfo = JSON.parse(value).apexKeyInfo; var keyInfoRow_tr = document.createElement("tr"); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexMain.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexMain.js index 3fc3cd5..da75fc9 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexMain.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexMain.js @@ -117,7 +117,7 @@ function main_getRestRootURL() { + (location.port ? ':' + location.port : '') + (location.pathname.endsWith("/editor/") ? location.pathname.substring(0, location.pathname .indexOf("editor/")) : location.pathname); - const restContext = "apexservices/editor/"; + const restContext = "policy/gui/v1/apex/editor/"; if (localStorage.getItem("apex_session")) { restRootURL = href + restContext + localStorage.getItem("apex_session"); window.restRootURL = restRootURL; @@ -125,7 +125,7 @@ function main_getRestRootURL() { ajax_get(requestURL, function(data) { $("#statusMessageTable").append("<tr><td> REST root URL set to: " + restRootURL + "</td></tr>"); if (localStorage.getItem("apex_model_loaded")) { - const modelKey = JSON.parse(data.messages.message[0]).apexArtifactKey; + const modelKey = JSON.parse(data.messages[0]).apexArtifactKey; pageControl_modelMode(modelKey.name, modelKey.version, modelFileName); if (localStorage.getItem("apex_tab_index")) { $("#mainTabs").tabs({ @@ -138,7 +138,7 @@ function main_getRestRootURL() { const createSessionURL = href + restContext + "-1/Session/Create"; ajax_get(createSessionURL, function(data) { - localStorage.setItem("apex_session", data.messages.message[0]); + localStorage.setItem("apex_session", data.messages[0]); restRootURL = href + restContext + localStorage.getItem("apex_session"); window.restRootURL = restRootURL; $("#statusMessageTable").append("<tr><td> REST root URL set to: " + restRootURL + "</td></tr>"); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexModelHandling.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexModelHandling.js index 9c04102..27ff5f4 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexModelHandling.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexModelHandling.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ function modelHandling_analyse() { var requestURL = window.restRootURL + "/Model/Analyse"; ajax_get(requestURL, function(data) { - resultForm_activate(document.getElementById("mainArea"), "Model Analysis Result", data.messages.message[0]); + resultForm_activate(document.getElementById("mainArea"), "Model Analysis Result", data.messages[0]); }); } @@ -35,8 +35,8 @@ function modelHandling_validate() { ajax_getOKOrFail(requestURL, function(data) { var validationResultString = ""; - for (var i = 1; i < data.messages.message.length; i++) { - validationResultString += (data.messages.message[i] + "\n"); + for (var i = 1; i < data.messages.length; i++) { + validationResultString += (data.messages[i] + "\n"); } resultForm_activate(document.getElementById("mainArea"), "Model Validation Result", validationResultString); }); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexNewModelForm.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexNewModelForm.js index d7e5ccd..ff48d8f 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexNewModelForm.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexNewModelForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -224,7 +224,7 @@ function newModelForm_submitPressed() { requestURL = window.restRootURL + "/Model/GetKey"; ajax_get(requestURL, function(data) { - var modelKey = JSON.parse(data.messages.message[0]).apexArtifactKey; + var modelKey = JSON.parse(data.messages[0]).apexArtifactKey; var modelFileName = modelKey.name + ".json"; pageControl_modelMode(modelKey.name, modelKey.version, modelFileName); }); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPageControl.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPageControl.js index 7b1b884..d2e1911 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPageControl.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPageControl.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -221,24 +221,23 @@ function pageControl_successStatus(data) { $('#statusString').html(data.result); $("#statusMessageTable").empty(); - if (data.ok) { + if (data.result === 'SUCCESS' || data.result === 'FINISHED') { $('#statusString').css("color", "green"); $('#ebInlineMessage-iconHolder-icon').attr("class", "ebIcon ebIcon_big ebIcon_tick"); } else { $('#statusString').css("color", "red"); $('#ebInlineMessage-iconHolder-icon').attr("class", "ebIcon ebIcon_big ebIcon_error"); - for (let value of data.messages.message) { + for (let value of data.messages) { $("#statusMessageTable").append("<tr><td>" + value + "</td></tr>"); } // A session with session ID "0" does not exist var sessionDoesNotExistStringStart = "A session with session ID "; var sessionDoesNotExistStringEnd = " does not exist"; - if (data.content.indexOf(sessionDoesNotExistStringStart) !== -1 - && data.content.indexOf(sessionDoesNotExistStringEnd) !== -1) { + if (data.messages[0].indexOf(sessionDoesNotExistStringStart) !== -1 + && data.messages[0].indexOf(sessionDoesNotExistStringEnd) !== -1) { clearLocalStorage(); location.reload(); } - throw "REST call returned an error\n" + data; } } @@ -246,7 +245,7 @@ function pageControl_status(data) { $('#statusString').html(data.result); $("#statusMessageTable").empty(); - if (data.ok) { + if (data.result === 'SUCCESS' || data.result === 'FINISHED') { $('#statusString').css("color", "green"); $('#ebInlineMessage-iconHolder-icon').attr("class", "ebIcon ebIcon_big ebIcon_tick"); } else { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyEditForm.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyEditForm.js index 4c53959..cf046c1 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyEditForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -66,7 +66,7 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, @@ -79,7 +79,7 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { requestURL = window.restRootURL + "/Task/Get?name=&version="; var tasks = new Array(); ajax_get(requestURL, function(data3) { - for (let value of data3.messages.message) { + for (let value of data3.messages) { var task = JSON.parse(value).apexTask; tasks.push({ "name" : task.key.name, @@ -92,7 +92,7 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var albums = new Array(); ajax_get(requestURL, function(data4) { - for (let value of data4.messages.message) { + for (let value of data4.messages) { var album = JSON.parse(value).apexContextAlbum; albums.push({ "name" : album.key.name, @@ -105,7 +105,7 @@ function editPolicyForm_editPolicy_inner(formParent, policy, viewOrEdit) { requestURL = window.restRootURL + "/Event/Get?name=&version="; var events = new Array(); ajax_get(requestURL, function(data5) { - for (let value of data5.messages.message) { + for (let value of data5.messages) { var event = JSON.parse(value).apexEvent; events.push({ "name" : event.key.name, diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyTab.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyTab.js index 2aa96e4..902bb2a 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyTab.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexPolicyTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +38,7 @@ function policyTab_activate() { ajax_get(requestURL, function(data) { $("#policyTableBody").find("tr:gt(0)").remove(); - for (let value of data.messages.message) { + for (let value of data.messages) { var policy = JSON.parse(value).apexPolicy; var policyRow_tr = document.createElement("tr"); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskEditForm.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskEditForm.js index 4932de6..ea33904 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskEditForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,7 +33,7 @@ function editTaskForm_createTask(formParent) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; var dt = { "name" : contextSchema.key.name, @@ -47,7 +47,7 @@ function editTaskForm_createTask(formParent) { requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var contextAlbums = new Array(); ajax_get(requestURL, function(data3) { - for (let value of data3.messages.message) { + for (let value of data3.messages) { var contextAlbum = JSON.parse(value).apexContextAlbum; var ca = { "name" : contextAlbum.key.name, @@ -89,7 +89,7 @@ function editTaskForm_editTask_inner(formParent, name, version, viewOrEdit) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (let value of data2.messages.message) { + for (let value of data2.messages) { var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, @@ -102,7 +102,7 @@ function editTaskForm_editTask_inner(formParent, name, version, viewOrEdit) { requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var contextAlbums = new Array(); ajax_get(requestURL, function(data3) { - for (let value of data3.messages.message) { + for (let value of data3.messages) { var contextAlbum = JSON.parse(value).apexContextAlbum; var ca = { "name" : contextAlbum.key.name, diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskTab.js b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskTab.js index 9c79ad4..afd0cad 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskTab.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/ApexTaskTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +38,7 @@ function taskTab_activate() { ajax_get(requestURL, function(data) { $("#taskTableBody").find("tr:gt(0)").remove(); - for (let value of data.messages.message) { + for (let value of data.messages) { const task = JSON.parse(value).apexTask; const taskRow_tr = document.createElement("tr"); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js index dadbaa0..362a1f9 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexAjax.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation + * Copyright (C) 2020-2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,12 +29,9 @@ beforeEach(() => { port: 'port', username: 'username', password: 'password', - messages: { - message: '' - }, + messages: [''], content: ['01', '02'], - result: 'ok', - ok: true + result: 'SUCCESS' }; }); @@ -72,12 +69,10 @@ test('Test ajax_getWithKeyInfo success', (done) => { }); done(); }); - data.messages = { - message: [ - '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1", "version":' + - ' "version1"}}, "objectType": {"key": {"name": "name1", "version": "version1"}}}' - ] - }; + data.messages = [ + '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1", "version":' + + ' "version1"}}, "objectType": {"key": {"name": "name1", "version": "version1"}}}' + ]; const jqXHR = {status: 200, responseText: ""}; $.ajax = jest.fn().mockImplementation((args) => { @@ -98,12 +93,10 @@ test('Test ajax_getWithKeyInfo with custom key success', (done) => { }); done(); }); - data.messages = { - message: [ - '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1",' + - ' "version": "version1"}}, "objectType": {"customKey": {"name": "name1", "version": "version1"}}}' - ] - }; + data.messages = [ + '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1",' + + ' "version": "version1"}}, "objectType": {"customKey": {"name": "name1", "version": "version1"}}}' + ]; const jqXHR = {status: 200, responseText: ""}; $.ajax = jest.fn().mockImplementation((args) => { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js index 8d2976d..e5268fe 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextAlbumEditForm.test.js @@ -24,14 +24,12 @@ const keyInformationTab_reset = require('../ApexKeyInformationTab'); const formUtils_generateDescription = require('../ApexFormUtils'); let data = { - messages: { - message: [ - '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + - '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"},"itemSchema":{}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + - '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' - ] - }, - ok: true + messages: [ + '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + + '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"},"itemSchema":{}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + + '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' + ], + result: 'SUCCESS' }; test('Test mock_editContextAlbumForm_activate', () => { @@ -167,4 +165,4 @@ test('Test Submit Pressed with page', () => { const mock_activate = jest.fn(mod.editContextAlbumForm_submitPressed); mock_activate(); expect(mock_activate).toBeCalled(); -});
\ No newline at end of file +}); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaEditForm.test.js index 87b4f82..70f5fde 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaEditForm.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaEditForm.test.js @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation. + * Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,8 @@ const apexAjax = require('../ApexAjax'); const formUtils_generateDescription = require('../ApexFormUtils'); let data = { - messages: { - message: [] - }, - ok: true + messages: [], + result: 'SUCCESS' }; const contextSchema = { name: 'testName', @@ -107,4 +105,4 @@ test('Test Submit Pressed', () => { const mock_activate = jest.fn(mod.editContextSchemaForm_submitPressed); mock_activate(); expect(mock_activate).toBeCalled(); -});
\ No newline at end of file +}); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaTab.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaTab.test.js index 3883bd5..9c7ca8c 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaTab.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexContextSchemaTab.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation. + * Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,12 @@ const mod = require('../ApexContextSchemaTab'); let data = { - messages: { - message: [ - '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + - '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + - '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' - ] - }, - ok: true + messages: [ + '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + + '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + + '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' + ], + result: 'SUCCESS' }; test('Test activateContextSchema', () => { @@ -51,4 +49,4 @@ test('Test reset', () => { const mock_deactivate = jest.fn(mod.contextSchemaTab_reset); mock_deactivate(); expect(mock_deactivate).toBeCalledWith(); -});
\ No newline at end of file +}); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventEditForm.test.js index 48573e8..c1ac98b 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventEditForm.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventEditForm.test.js @@ -25,14 +25,12 @@ const formUtils_generateDescription = require('../ApexFormUtils'); const keyInformationTab_reset = require('../ApexKeyInformationTab'); let data = { - messages: { - message: [ - '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + - '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + - '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' - ] - }, - ok: true + messages: [ + '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + + '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + + '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' + ], + result: 'SUCCESS' }; const contextSchema = { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventTab.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventTab.test.js index 16042af..50d1101 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventTab.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexEventTab.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation. + * Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,17 +34,14 @@ test('Test activate', () => { port: 'port', username: 'username', password: 'password', - messages: { - message: [ - '{"apexEvent" : {"key": {"name": "name1", "version":"version1"}, "nameSpace":"nameSpace1",' + - ' "source":"source1", "target":"target1", "parameter": ' + - '{"entry": [{"key": "key1", "value": {"optional":"optional", "fieldSchemaKey": ' + - '{"name": "name2", "version":"version2"}}}]}}}' - ] - }, + messages: [ + '{"apexEvent" : {"key": {"name": "name1", "version":"version1"}, "nameSpace":"nameSpace1",' + + ' "source":"source1", "target":"target1", "parameter": ' + + '{"entry": [{"key": "key1", "value": {"optional":"optional", "fieldSchemaKey": ' + + '{"name": "name2", "version":"version2"}}}]}}}' + ], content: ['01', '02'], - result: 'ok', - ok: true + result: 'SUCCESS' }; $.ajax = jest.fn().mockImplementation((args) => { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexFiles.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexFiles.test.js index f5be3cc..9e2307a 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexFiles.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexFiles.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation + * Copyright (C) 2020-2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,14 +22,12 @@ const mod = require('../ApexFiles'); const resultForm_activate = require('../ApexResultForm'); let data = { - messages: { - message: [ - '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + - '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"},"itemSchema":{}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + - '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' - ] - }, - ok: true + messages: [ + '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + + '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"},"itemSchema":{}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + + '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' + ], + result: 'SUCCESS' }; test('test files_open', () => { @@ -54,4 +52,4 @@ test('Test files_upload', () => { const upload = jest.fn(mod.files_fileUpload); upload(); expect(upload).toBeCalled(); -});
\ No newline at end of file +}); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexKeyInformationTab.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexKeyInformationTab.test.js index 2dcc7c2..fb49214 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexKeyInformationTab.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexKeyInformationTab.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation + * Copyright (C) 2021-2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,15 +28,12 @@ test("Test keyInformationTab_activate", () => { port: 'port', username: 'username', password: 'password', - messages: { - message: [ - '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1", "version":' + - ' "version1"}}, "objectType": {"key": {"name": "name1", "version": "version1"}}}' - ] - }, + messages: [ + '{"apexKeyInfo": {"UUID": "UUID1", "description": "description1", "key":{"name": "name1", "version":' + + ' "version1"}}, "objectType": {"key": {"name": "name1", "version": "version1"}}}' + ], content: ['01', '02'], - result: 'ok', - ok: true + result: 'SUCCESS' }; $.ajax = jest.fn().mockImplementation((args) => { args.success(data, null, null); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexMain.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexMain.test.js index 13fd658..c825370 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexMain.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexMain.test.js @@ -30,21 +30,18 @@ const keyInformationTab = require('../ApexKeyInformationTab'); require('../../dist/js/jquery-ui-1.12.1/jquery-ui.js'); const data = { - messages: { - message: [ - '{' + - ' "apexArtifactKey": {' + - ' "key": {' + - ' "name": "name1",' + - ' "version": "version1"' + - ' }' + - ' }' + - '}' - ] - }, + messages: [ + '{' + + ' "apexArtifactKey": {' + + ' "key": {' + + ' "name": "name1",' + + ' "version": "version1"' + + ' }' + + ' }' + + '}' + ], content: ['01', '02'], - result: 'ok', - ok: true + result: 'SUCCESS' }; const jqXHR = { status: 200, responseText: "" }; @@ -85,7 +82,7 @@ test('Test main_getRestRootURL false', () => { const mock_main_getRestRootURL = jest.fn(mod.main_getRestRootURL); mock_main_getRestRootURL(); expect(mock_main_getRestRootURL).toBeCalled(); - expect(document.documentElement.innerHTML).toEqual('<head></head><body><div class="ebInlineMessage-description" id="statusMessageTable"><tr><td> REST root URL set to: http://localhost/apexservices/editor/false</td></tr></div></body>'); + expect(document.documentElement.innerHTML).toEqual('<head></head><body><div class="ebInlineMessage-description" id="statusMessageTable"><tr><td> REST root URL set to: http://localhost/policy/gui/v1/apex/editor/false</td></tr></div></body>'); }); test('Test clearLocalStorage', () => { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexModelHandling.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexModelHandling.test.js index 2144506..8b2055f 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexModelHandling.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexModelHandling.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation. + * Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,14 +32,11 @@ test('Test modelHandling_analyse', (done) => { port: 'port', username: 'username', password: 'password', - messages: { - message: [ - '{"apexKeyInfo": null}' - ] - }, + messages: [ + '{"apexKeyInfo": null}' + ], content: ['01'], - result: 'ok', - ok: true + result: 'SUCCESS' }; const expectedMessage = '{"apexKeyInfo": null}'; document.body.innerHTML = '<div id="mainArea"></div>'; @@ -65,16 +62,13 @@ test('Test modelHandling_validate', (done) => { port: 'port', username: 'username', password: 'password', - messages: { - message: [ - '{"apexKeyInfo": null}', - '{"apexPolicy": null}', - '{"apexEvent": null}' - ] - }, + messages: [ + '{"apexKeyInfo": null}', + '{"apexPolicy": null}', + '{"apexEvent": null}' + ], content: ['01'], - result: 'ok', - ok: true + result: 'SUCCESS' }; const expectedMessage = '{"apexPolicy": null}\n{"apexEvent": null}\n'; diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPageControl.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPageControl.test.js index b414bb1..f9e2a65 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPageControl.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPageControl.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,10 +40,8 @@ test('Test showPlaceholder hide', () => { test('Test pageControl_status', () => { let data = { - messages: { - message: [] - }, - ok: true + messages: [], + result: 'SUCCESS' }; const mock_activate = jest.fn(mod.pageControl_status); mock_activate(data); @@ -52,9 +50,7 @@ test('Test pageControl_status', () => { test('Test pageControl_status when data is not present', () => { let data = { - messages: { - message: [] - } + messages: [] }; const mock_activate = jest.fn(mod.pageControl_status); mock_activate(data); @@ -113,4 +109,4 @@ test('Test pageControl_readyMode', () => { const mock_activate = jest.fn(mod.pageControl_readyMode); mock_activate(); expect(mock_activate).toBeCalled(); -});
\ No newline at end of file +}); diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm.test.js index 24af346..fc92934 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyEditForm.test.js @@ -30,14 +30,12 @@ const policy = { uuid: 'testUUID' } let data = { - messages: { - message: [ - '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + - '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + - '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' - ] - }, - ok: true + messages: [ + '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + + '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + + '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' + ], + result: 'SUCCESS' }; test('Test Create Policy', () => { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyTab.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyTab.test.js index 4136fd6..58714c6 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyTab.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexPolicyTab.test.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation + * Copyright (C) 2020-2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,157 +33,154 @@ test('Test policyTab_activate', () => { port: 'port', username: 'username', password: 'password', - messages: { - message: [ - '{' + - ' "apexPolicy": {' + - ' "policyKey": {' + - ' "name": "name1",' + - ' "version": "version1"' + - ' },' + - ' "template": "template1",' + - ' "firstState": "key11",' + - ' "state": {' + - ' "entry": [' + - ' {' + - ' "key": "key1",' + - ' "value": {' + - ' "trigger": {' + - ' "name": "name2",' + - ' "version": "version2"' + - ' },' + - ' "taskReferences": {' + - ' "entry": [' + - ' {' + - ' "key": {' + - ' "name": "name3",' + - ' "version": "version3"' + - ' },' + - ' "version": "version2",' + - ' "value": {' + - ' "outputType": "outputType1",' + - ' "output": {' + - ' "localName": "localName1"' + - ' }' + - ' }' + - ' }' + - ' ]' + - ' },' + - ' "defaultTask": {' + - ' "name": "name4",' + - ' "version": "version4"' + - ' },' + - ' "taskSelectionLogic": {' + - ' "logicFlavour": "logicFlavour1"' + - ' },' + - ' "stateOutputs": {' + - ' "entry": [' + - ' {' + - ' "key": "key2",' + - ' "value": {' + - ' "nextState": {' + - ' "localName": "localName2"' + - ' },' + - ' "outgoingEvent": {' + - ' "name": "name4",' + - ' "version": "version4"' + - ' }' + - ' }' + - ' }' + - ' ]' + - ' },' + - ' "stateFinalizerLogicMap": {' + - ' "entry": [' + - ' {' + - ' "key": "key3",' + - ' "value": {' + - ' "logicFlavour": "logicFlavour2"' + - ' }' + - ' }' + - ' ]' + - ' },' + - ' "contextAlbumReference": [' + - ' {' + - ' "name": "name5",' + - ' "version": "version5"' + - ' }' + - ' ]' + - ' }' + - ' },' + - ' {' + - ' "key": "key11",' + - ' "value": {' + - ' "trigger": {' + - ' "name": "name12",' + - ' "version": "version12"' + - ' },' + - ' "taskReferences": {' + - ' "entry": [' + - ' {' + - ' "key": {' + - ' "name": "name13",' + - ' "version": "version13"' + - ' },' + - ' "version": "version12",' + - ' "value": {' + - ' "outputType": "outputType11",' + - ' "output": {' + - ' "localName": "localName11"' + - ' }' + - ' }' + - ' }' + - ' ]' + - ' },' + - ' "defaultTask": {' + - ' "name": "name14",' + - ' "version": "version14"' + - ' },' + - ' "taskSelectionLogic": {' + - ' "logicFlavour": "logicFlavour11"' + - ' },' + - ' "stateOutputs": {' + - ' "entry": [' + - ' {' + - ' "key": "key12",' + - ' "value": {' + - ' "nextState": {' + - ' "localName": "localName12"' + - ' },' + - ' "outgoingEvent": {' + - ' "name": "name14",' + - ' "version": "version14"' + - ' }' + - ' }' + - ' }' + - ' ]' + - ' },' + - ' "stateFinalizerLogicMap": {' + - ' "entry": [' + - ' {' + - ' "key": "key13",' + - ' "value": {' + - ' "logicFlavour": "logicFlavour12"' + - ' }' + - ' }' + - ' ]' + - ' },' + - ' "contextAlbumReference": [' + - ' {' + - ' "name": "name15",' + - ' "version": "version15"' + - ' }' + - ' ]' + - ' }' + - ' }' + - ' ]' + - ' }' + - ' }' + - '}' - ] - }, + messages: [ + '{' + + ' "apexPolicy": {' + + ' "policyKey": {' + + ' "name": "name1",' + + ' "version": "version1"' + + ' },' + + ' "template": "template1",' + + ' "firstState": "key11",' + + ' "state": {' + + ' "entry": [' + + ' {' + + ' "key": "key1",' + + ' "value": {' + + ' "trigger": {' + + ' "name": "name2",' + + ' "version": "version2"' + + ' },' + + ' "taskReferences": {' + + ' "entry": [' + + ' {' + + ' "key": {' + + ' "name": "name3",' + + ' "version": "version3"' + + ' },' + + ' "version": "version2",' + + ' "value": {' + + ' "outputType": "outputType1",' + + ' "output": {' + + ' "localName": "localName1"' + + ' }' + + ' }' + + ' }' + + ' ]' + + ' },' + + ' "defaultTask": {' + + ' "name": "name4",' + + ' "version": "version4"' + + ' },' + + ' "taskSelectionLogic": {' + + ' "logicFlavour": "logicFlavour1"' + + ' },' + + ' "stateOutputs": {' + + ' "entry": [' + + ' {' + + ' "key": "key2",' + + ' "value": {' + + ' "nextState": {' + + ' "localName": "localName2"' + + ' },' + + ' "outgoingEvent": {' + + ' "name": "name4",' + + ' "version": "version4"' + + ' }' + + ' }' + + ' }' + + ' ]' + + ' },' + + ' "stateFinalizerLogicMap": {' + + ' "entry": [' + + ' {' + + ' "key": "key3",' + + ' "value": {' + + ' "logicFlavour": "logicFlavour2"' + + ' }' + + ' }' + + ' ]' + + ' },' + + ' "contextAlbumReference": [' + + ' {' + + ' "name": "name5",' + + ' "version": "version5"' + + ' }' + + ' ]' + + ' }' + + ' },' + + ' {' + + ' "key": "key11",' + + ' "value": {' + + ' "trigger": {' + + ' "name": "name12",' + + ' "version": "version12"' + + ' },' + + ' "taskReferences": {' + + ' "entry": [' + + ' {' + + ' "key": {' + + ' "name": "name13",' + + ' "version": "version13"' + + ' },' + + ' "version": "version12",' + + ' "value": {' + + ' "outputType": "outputType11",' + + ' "output": {' + + ' "localName": "localName11"' + + ' }' + + ' }' + + ' }' + + ' ]' + + ' },' + + ' "defaultTask": {' + + ' "name": "name14",' + + ' "version": "version14"' + + ' },' + + ' "taskSelectionLogic": {' + + ' "logicFlavour": "logicFlavour11"' + + ' },' + + ' "stateOutputs": {' + + ' "entry": [' + + ' {' + + ' "key": "key12",' + + ' "value": {' + + ' "nextState": {' + + ' "localName": "localName12"' + + ' },' + + ' "outgoingEvent": {' + + ' "name": "name14",' + + ' "version": "version14"' + + ' }' + + ' }' + + ' }' + + ' ]' + + ' },' + + ' "stateFinalizerLogicMap": {' + + ' "entry": [' + + ' {' + + ' "key": "key13",' + + ' "value": {' + + ' "logicFlavour": "logicFlavour12"' + + ' }' + + ' }' + + ' ]' + + ' },' + + ' "contextAlbumReference": [' + + ' {' + + ' "name": "name15",' + + ' "version": "version15"' + + ' }' + + ' ]' + + ' }' + + ' }' + + ' ]' + + ' }' + + ' }' + + '}' + ], content: ['01', '02'], - result: 'ok', - ok: true + result: 'SUCCESS' }; $.ajax = jest.fn().mockImplementation((args) => { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js index e9fcc9b..5e2d2ae 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskEditForm.test.js @@ -41,14 +41,12 @@ const task = { }; let data = { - messages: { - message: [ - '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + - '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + - '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' - ] - }, - ok: true + messages: [ + '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"}},' + + '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + + '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' + ], + result: 'SUCCESS' }; let contextAlbumReference = { diff --git a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskTab.test.js b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskTab.test.js index f593bd8..bf5faee 100644 --- a/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskTab.test.js +++ b/gui-editors/gui-editor-apex/src/main/webapp/js/__test__/ApexTaskTab.test.js @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation. + * Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,18 +21,16 @@ const mod = require('../ApexTaskTab'); let data = { - messages: { - message: [ - '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"},' + - '"taskLogic":{"logicFlavour":"logicFlavour"},"inputFields":{"entry": [{"key":"","value":{"fieldSchemaKey":{"name":"name"}}}]},' + - '"outputFields":{"entry": [{"key":"","value":{"fieldSchemaKey":{"name":"name"}}}]},' + - '"taskParameters":{"entry": [{"key":"","value":{"fieldSchemaKey":{"name":"name"}}}]},'+ - '"contextAlbumReference":[{"name":"name", "version":"version"}]},'+ - '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + - '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' - ] - }, - ok: true + messages: [ + '{"apexContextSchema": {"key":{"name": "name1", "version": "version1"}}, "apexTask":{"key":{"name": "name1", "version": "version1"},' + + '"taskLogic":{"logicFlavour":"logicFlavour"},"inputFields":{"entry": [{"key":"","value":{"fieldSchemaKey":{"name":"name"}}}]},' + + '"outputFields":{"entry": [{"key":"","value":{"fieldSchemaKey":{"name":"name"}}}]},' + + '"taskParameters":{"entry": [{"key":"","value":{"fieldSchemaKey":{"name":"name"}}}]},'+ + '"contextAlbumReference":[{"name":"name", "version":"version"}]},'+ + '"apexContextAlbum":{"key":{"name": "name1", "version": "version1"}},"apexEvent":{"key":{"name": "name1", "version": "version1"}},' + + '"apexPolicy":{"policyKey":{"name": "name1", "version": "version1"}}, "apexKeyInfo":{"key":{"name": "name1", "version": "version1"}}}' + ], + result: 'SUCCESS' }; test('test dom : taskTab_activate', () => { @@ -49,4 +47,4 @@ test('test reset', () => { const reset_mock = jest.fn(mod.taskTab_reset); reset_mock(); expect(reset_mock).toBeCalled(); -});
\ No newline at end of file +}); |