From 425440ea7c7a0f031337f09b3020a95a2016288a Mon Sep 17 00:00:00 2001 From: Daniel Marin Date: Tue, 13 Aug 2024 13:21:19 +0200 Subject: [PATCH] tests(ws): remove toolbar files, and create each function test file --- test/plsql/ws/test_gw_fct_anl_arc_length.sql | 33 +++++++++++++++ .../test_gw_fct_anl_arc_no_startend_node.sql | 24 +++++++++++ .../ws/test_gw_fct_anl_arc_same_startend.sql | 32 +++++++++++++++ .../ws/test_gw_fct_anl_connec_duplicated.sql | 32 +++++++++++++++ ...> test_gw_fct_graphanalytics_mapzones.sql} | 9 +++++ test/plsql/ws/test_gw_fct_pg2epa_main.sql | 22 ++++++++++ ...basic.sql => test_gw_fct_setarcdivide.sql} | 9 +++++ ..._plan.sql => test_gw_fct_setarcfusion.sql} | 10 ++++- .../plsql/ws/test_gw_fct_setlinktonetwork.sql | 23 +++++++++++ test/plsql/ws/test_plsql_ws_edit.sql | 21 ---------- test/plsql/ws/test_plsql_ws_epa.sql | 17 -------- test/plsql/ws/test_plsql_ws_utilities.sql | 40 ------------------- 12 files changed, 193 insertions(+), 79 deletions(-) create mode 100644 test/plsql/ws/test_gw_fct_anl_arc_length.sql create mode 100644 test/plsql/ws/test_gw_fct_anl_arc_no_startend_node.sql create mode 100644 test/plsql/ws/test_gw_fct_anl_arc_same_startend.sql create mode 100644 test/plsql/ws/test_gw_fct_anl_connec_duplicated.sql rename test/plsql/ws/{test_plsql_ws_om.sql => test_gw_fct_graphanalytics_mapzones.sql} (70%) create mode 100644 test/plsql/ws/test_gw_fct_pg2epa_main.sql rename test/plsql/ws/{test_plsql_ws_basic.sql => test_gw_fct_setarcdivide.sql} (71%) rename test/plsql/ws/{test_plsql_ws_plan.sql => test_gw_fct_setarcfusion.sql} (71%) create mode 100644 test/plsql/ws/test_gw_fct_setlinktonetwork.sql delete mode 100644 test/plsql/ws/test_plsql_ws_edit.sql delete mode 100644 test/plsql/ws/test_plsql_ws_epa.sql delete mode 100644 test/plsql/ws/test_plsql_ws_utilities.sql diff --git a/test/plsql/ws/test_gw_fct_anl_arc_length.sql b/test/plsql/ws/test_gw_fct_anl_arc_length.sql new file mode 100644 index 0000000000..f7e1febdf0 --- /dev/null +++ b/test/plsql/ws/test_gw_fct_anl_arc_length.sql @@ -0,0 +1,33 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ +BEGIN; + +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- Plan for 2 test +SELECT plan(2); + +-- Extract and test the "status" field from the function's JSON response +SELECT is ( + (gw_fct_anl_arc_length($${"client":{"device":4, "infoType":1, "lang":"ES"}, "form":{},"feature":{"tableName":"v_edit_arc", + "featureType":"ARC", "id":[2001,2002]}, "data":{"selectionMode":"previousSelection","parameters":{"arcLength":"3"}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_anl_arc_length -> previousSelection returns status "Accepted"' +); + + +SELECT is ( + (gw_fct_anl_arc_length($${"client":{"device":4, "infoType":1, "lang":"ES"},"form":{},"feature":{"tableName":"v_edit_arc", + "featureType":"ARC", "id":[]}, "data":{"selectionMode":"wholeSelection","parameters":{"arcLength":"3"}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_anl_arc_length -> wholeSelection returns status "Accepted"' +); + + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_gw_fct_anl_arc_no_startend_node.sql b/test/plsql/ws/test_gw_fct_anl_arc_no_startend_node.sql new file mode 100644 index 0000000000..a2622c376b --- /dev/null +++ b/test/plsql/ws/test_gw_fct_anl_arc_no_startend_node.sql @@ -0,0 +1,24 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ +BEGIN; + +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- Plan for 1 test +SELECT plan(1); + +-- Extract and test the "status" field from the function's JSON response +SELECT is ( + (gw_fct_anl_arc_no_startend_node($${"client":{"device":4, "infoType":1, "lang":"ES"}, "feature":{"tableName":"v_edit_arc", + "featureType":"ARC"}, "data":{"parameters":{"arcSearchNodes":"0.1"}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_anl_arc_no_startend_node returns status "Accepted"' +); + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_gw_fct_anl_arc_same_startend.sql b/test/plsql/ws/test_gw_fct_anl_arc_same_startend.sql new file mode 100644 index 0000000000..72f9598084 --- /dev/null +++ b/test/plsql/ws/test_gw_fct_anl_arc_same_startend.sql @@ -0,0 +1,32 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ +BEGIN; + +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- Plan for 2 test +SELECT plan(2); + +-- Extract and test the "status" field from the function's JSON response +SELECT is ( + (gw_fct_anl_arc_same_startend($${"client":{"device":4, "infoType":1, "lang":"ES"}, + "feature":{"tableName":"v_edit_arc", "id":[2001,2002]}, "data":{"selectionMode":"previousSelection","parameters":{}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_anl_arc_same_startend -> previousSelection returns status "Accepted"' +); + +SELECT is ( + (gw_fct_anl_arc_same_startend($${"client":{"device":4, "infoType":1, "lang":"ES"}, + "feature":{"tableName":"v_edit_arc"}, "data":{"selectionMode":"wholeSelection","parameters":{}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_anl_arc_same_startend -> wholeSelection returns status "Accepted"' +); + + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_gw_fct_anl_connec_duplicated.sql b/test/plsql/ws/test_gw_fct_anl_connec_duplicated.sql new file mode 100644 index 0000000000..729cfd5d16 --- /dev/null +++ b/test/plsql/ws/test_gw_fct_anl_connec_duplicated.sql @@ -0,0 +1,32 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ +BEGIN; + +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- Plan for 2 test +SELECT plan(2); + +-- Extract and test the "status" field from the function's JSON response +SELECT is ( + (gw_fct_anl_connec_duplicated($${"client":{"device":4, "infoType":1, "lang":"ES"},"feature":{"tableName":"v_edit_connec"}, + "data":{"selectionMode":"wholeSelection", "parameters":{"connecTolerance":10}, "parameters":{}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_anl_connec_duplicated -> wholeSelection returns status "Accepted"' +); + +SELECT is ( + (gw_fct_anl_connec_duplicated($${"client":{"device":4, "infoType":1, "lang":"ES"},"feature":{"tableName":"v_edit_connec", + "id":[3101, 3102]}, "data":{"selectionMode":"previousSelection", "parameters":{"connecTolerance":10}, "parameters":{}}}$$)::JSON)->>'status', + 'Accepted', + 'Check if gw_fct_anl_connec_duplicated -> previousSelection returns status "Accepted"' +); + + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_plsql_ws_om.sql b/test/plsql/ws/test_gw_fct_graphanalytics_mapzones.sql similarity index 70% rename from test/plsql/ws/test_plsql_ws_om.sql rename to test/plsql/ws/test_gw_fct_graphanalytics_mapzones.sql index 0b16a64518..4ca8389602 100644 --- a/test/plsql/ws/test_plsql_ws_om.sql +++ b/test/plsql/ws/test_gw_fct_graphanalytics_mapzones.sql @@ -3,4 +3,13 @@ This file is part of Giswater 3 The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This version of Giswater is provided by Giswater Association */ +BEGIN; +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- gw_fct_graphanalytics_mapzones + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_gw_fct_pg2epa_main.sql b/test/plsql/ws/test_gw_fct_pg2epa_main.sql new file mode 100644 index 0000000000..610c769194 --- /dev/null +++ b/test/plsql/ws/test_gw_fct_pg2epa_main.sql @@ -0,0 +1,22 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ +BEGIN; + +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- gw_fct_pg2epa_main +-- SELECT gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"1"}}$$); +-- SELECT gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"2"}}$$); +-- SELECT gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"3"}}$$); +-- SELECT gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"4"}}$$); +-- SELECT gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"5"}}$$); +-- SELECT gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"6"}}$$); +-- SELECT gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"7"}}$$); + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_plsql_ws_basic.sql b/test/plsql/ws/test_gw_fct_setarcdivide.sql similarity index 71% rename from test/plsql/ws/test_plsql_ws_basic.sql rename to test/plsql/ws/test_gw_fct_setarcdivide.sql index 0b16a64518..a9238cef94 100644 --- a/test/plsql/ws/test_plsql_ws_basic.sql +++ b/test/plsql/ws/test_gw_fct_setarcdivide.sql @@ -3,4 +3,13 @@ This file is part of Giswater 3 The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This version of Giswater is provided by Giswater Association */ +BEGIN; +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- gw_fct_setarcdivide + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_plsql_ws_plan.sql b/test/plsql/ws/test_gw_fct_setarcfusion.sql similarity index 71% rename from test/plsql/ws/test_plsql_ws_plan.sql rename to test/plsql/ws/test_gw_fct_setarcfusion.sql index 9587df728d..875f0c51a0 100644 --- a/test/plsql/ws/test_plsql_ws_plan.sql +++ b/test/plsql/ws/test_gw_fct_setarcfusion.sql @@ -3,5 +3,13 @@ This file is part of Giswater 3 The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This version of Giswater is provided by Giswater Association */ +BEGIN; --- gw_fct_graphanalytics_mapzones \ No newline at end of file +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- gw_fct_setarcfusion + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_gw_fct_setlinktonetwork.sql b/test/plsql/ws/test_gw_fct_setlinktonetwork.sql new file mode 100644 index 0000000000..482d17386f --- /dev/null +++ b/test/plsql/ws/test_gw_fct_setlinktonetwork.sql @@ -0,0 +1,23 @@ +/* +This file is part of Giswater 3 +The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This version of Giswater is provided by Giswater Association +*/ +BEGIN; + +SET search_path = "SCHEMA_NAME", public, pg_catalog; + +-- gw_fct_setlinktonetwork +-- SELECT gw_fct_setlinktonetwork($${"client":{"device":4, "infoType":1, "lang":"ES"}, +-- "feature":{"id":["3201","3200"]},"data":{"feature_type":"CONNEC", "forcedArcs":["2001","2002"]}}$$); + +-- SELECT gw_fct_setlinktonetwork($${"client":{"device":4, "infoType":1, "lang":"ES"}, +-- "feature":{"id":["100013"]},"data":{"feature_type":"CONNEC"}}$$); + +-- SELECT gw_fct_setlinktonetwork($${"client":{"device":4, "infoType":1, "lang":"ES"}, +-- "feature":{"id":["100014"]},"data":{"feature_type":"GULLY"}}$$); + +-- Finish the test +SELECT finish(); + +ROLLBACK; diff --git a/test/plsql/ws/test_plsql_ws_edit.sql b/test/plsql/ws/test_plsql_ws_edit.sql deleted file mode 100644 index bcde0e7af8..0000000000 --- a/test/plsql/ws/test_plsql_ws_edit.sql +++ /dev/null @@ -1,21 +0,0 @@ -/* -This file is part of Giswater 3 -The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -This version of Giswater is provided by Giswater Association -*/ - --- gw_fct_setarcfusion - - --- gw_fct_setarcdivide - - --- gw_fct_setlinktonetwork -SELECT gw_fct_setlinktonetwork($${"client":{"device":4, "infoType":1, "lang":"ES"}, -"feature":{"id":["3201","3200"]},"data":{"feature_type":"CONNEC", "forcedArcs":["2001","2002"]}}$$); - -SELECT gw_fct_setlinktonetwork($${"client":{"device":4, "infoType":1, "lang":"ES"}, -"feature":{"id":["100013"]},"data":{"feature_type":"CONNEC"}}$$); - -SELECT gw_fct_setlinktonetwork($${"client":{"device":4, "infoType":1, "lang":"ES"}, -"feature":{"id":["100014"]},"data":{"feature_type":"GULLY"}}$$); \ No newline at end of file diff --git a/test/plsql/ws/test_plsql_ws_epa.sql b/test/plsql/ws/test_plsql_ws_epa.sql deleted file mode 100644 index debcfd7292..0000000000 --- a/test/plsql/ws/test_plsql_ws_epa.sql +++ /dev/null @@ -1,17 +0,0 @@ -/* -This file is part of Giswater 3 -The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -This version of Giswater is provided by Giswater Association -*/ - - --- go2epa -SELECT SCHEMA_NAME.gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"1"}}$$); -SELECT SCHEMA_NAME.gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"2"}}$$); -SELECT SCHEMA_NAME.gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"3"}}$$); -SELECT SCHEMA_NAME.gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"4"}}$$); -SELECT SCHEMA_NAME.gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"5"}}$$); -SELECT SCHEMA_NAME.gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"6"}}$$); -SELECT SCHEMA_NAME.gw_fct_pg2epa_main($${"client":{"device":4, "infoType":1, "lang":"ES", "epsg":25831}, "data":{"resultId":"test1", "step":"7"}}$$); - - diff --git a/test/plsql/ws/test_plsql_ws_utilities.sql b/test/plsql/ws/test_plsql_ws_utilities.sql deleted file mode 100644 index e65e29b459..0000000000 --- a/test/plsql/ws/test_plsql_ws_utilities.sql +++ /dev/null @@ -1,40 +0,0 @@ -/* -This file is part of Giswater 3 -The program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -This version of Giswater is provided by Giswater Association -*/ - - --- gw_fct_anl_arc_duplicated -SELECT gw_fct_anl_arc_duplicated($${"client":{"device":4, "infoType":1, "lang":"ES"}, -"form":{},"feature":{"tableName":"v_edit_arc", "id":[]}, "data":{"filterFields":{}, "pageInfo":{}, "selectionMode":"wholeSelection", -"parameters":{"checkType":"finalNodes"}}}$$)::JSON - -SELECT gw_fct_anl_arc_duplicated($${"client":{"device":4, "infoType":1, "lang":"ES"}, -"form":{},"feature":{"tableName":"v_edit_arc", "id":[2001,2002]}, "data":{"filterFields":{}, "pageInfo":{}, "selectionMode":"previousSelection", -"parameters":{"checkType":"finalNodes"}}}$$)::JSON - --- gw_fct_anl_arc_length -SELECT gw_fct_anl_arc_length($${"client":{"device":4, "infoType":1, "lang":"ES"}, "form":{},"feature":{"tableName":"v_edit_arc", -"featureType":"ARC", "id":[2001,2002]}, "data":{"selectionMode":"previousSelection","parameters":{"arcLength":"3"}}}$$)::JSON - -SELECT gw_fct_anl_arc_length($${"client":{"device":4, "infoType":1, "lang":"ES"},"form":{},"feature":{"tableName":"v_edit_arc", -"featureType":"ARC", "id":[]}, "data":{"selectionMode":"wholeSelection","parameters":{"arcLength":"3"}}}$$)::JSON - --- gw_fct_anl_arc_no_startend_node -SELECT gw_fct_anl_arc_no_startend_node($${"client":{"device":4, "infoType":1, "lang":"ES"}, "feature":{"tableName":"v_edit_arc", -"featureType":"ARC"}, "data":{"parameters":{"arcSearchNodes":"0.1"}}}$$)::text - --- gw_fct_anl_arc_same_startend -SELECT gw_fct_anl_arc_same_startend($${"client":{"device":4, "infoType":1, "lang":"ES"}, -"feature":{"tableName":"v_edit_arc", "id":[2001,2002]}, "data":{"selectionMode":"previousSelection","parameters":{}}}$$); - -SELECT gw_fct_anl_arc_same_startend($${"client":{"device":4, "infoType":1, "lang":"ES"}, -"feature":{"tableName":"v_edit_arc"}, "data":{"selectionMode":"wholeSelection","parameters":{}}}$$); - --- gw_fct_anl_connec_duplicated -SELECT gw_fct_anl_connec_duplicated($${"client":{"device":4, "infoType":1, "lang":"ES"},"feature":{"tableName":"v_edit_connec"}, -"data":{"selectionMode":"wholeSelection", "parameters":{"connecTolerance":10}, "parameters":{}}}$$); - -SELECT gw_fct_anl_connec_duplicated($${"client":{"device":4, "infoType":1, "lang":"ES"},"feature":{"tableName":"v_edit_connec", -"id":[3101, 3102]}, "data":{"selectionMode":"previousSelection", "parameters":{"connecTolerance":10}, "parameters":{}}}$$); \ No newline at end of file