|
| 1 | +/* |
| 2 | +This file is part of Giswater 3 |
| 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. |
| 4 | +This version of Giswater is provided by Giswater Association |
| 5 | +*/ |
| 6 | +BEGIN; |
| 7 | + |
| 8 | +-- Suppress NOTICE messages |
| 9 | +SET client_min_messages TO WARNING; |
| 10 | + |
| 11 | +SET search_path = "SCHEMA_NAME", public, pg_catalog; |
| 12 | + |
| 13 | +SELECT plan(6); |
| 14 | + |
| 15 | +-- arc -> pipe |
| 16 | +-- initial data is prepared before proceeding with the test |
| 17 | +INSERT INTO ve_node_air_valve |
| 18 | +(node_id, code, elevation, "depth", node_type, sys_type, nodecat_id, cat_matcat_id, cat_pnom, cat_dnom, cat_dint, epa_type, state, state_type, expl_id, macroexpl_id, sector_id, sector_name, macrosector_id, sector_type, presszone_id, preszone_name, presszone_type, presszone_head, dma_id, dma_name, dma_type, macrodma_id, dqa_id, dqa_name, dqa_type, macrodqa_id, arc_id, parent_id, annotation, observ, "comment", staticpressure, soilcat_id, function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, workcat_id_plan, builtdate, enddate, buildercat_id, ownercat_id, muni_id, postcode, district_id, streetname, postnumber, postcomplement, streetname2, postnumber2, postcomplement2, region_id, province_id, descript, svg, rotation, link, verified, undelete, "label", label_x, label_y, label_rotation, publish, inventory, hemisphere, num_value, adate, adescript, accessibility, dma_style, presszone_style, asset_id, om_state, conserv_state, access_type, placement_type, expl_id2, is_operative, brand_id, model_id, serial_number, minsector_id, macrominsector_id, demand_max, demand_min, demand_avg, press_max, press_min, press_avg, head_max, head_min, head_avg, quality_max, quality_min, quality_avg, tstamp, insert_user, lastupdate, lastupdate_user, the_geom, inp_type, closed, broken, buried, irrigation_indicator, pression_entry, pression_exit, depth_valveshaft, regulator_situation, regulator_location, regulator_observ, lin_meters, exit_type, exit_code, drive_type, cat_valve2, ordinarystatus, shutter, brand2, model2, valve_type, to_arc, active, airvalve_param_1, airvalve_param_2) |
| 19 | +VALUES('-902', '-902', 32.8100, NULL, 'AIR_VALVE', 'VALVE', 'AIR VALVE DN50', 'FD', '16', '50', NULL, 'UNDEFINED', 1, 2, 2, 1, 5, 'sector2-1d', 2, 'DISTRIBUTION', '3', 'pzone1-1d', NULL, NULL, 3, 'dma2-1d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'soil1', NULL, NULL, NULL, NULL, 'work1', NULL, NULL, '2024-08-22', NULL, NULL, 'owner1', 2, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, '', '1', NULL, NULL, NULL, NULL, NULL, true, true, NULL, NULL, NULL, NULL, NULL, '204,235,197', '204,235,197', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-08-22 17:00:13.000', 'postgres', '2024-08-22 17:00:13.000', 'postgres', 'SRID=25831;POINT (418474.19510507485 4577983.667174499)'::public.geometry, NULL, false, false, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL); |
| 20 | +INSERT INTO ve_node_air_valve |
| 21 | +(node_id, code, elevation, "depth", node_type, sys_type, nodecat_id, cat_matcat_id, cat_pnom, cat_dnom, cat_dint, epa_type, state, state_type, expl_id, macroexpl_id, sector_id, sector_name, macrosector_id, sector_type, presszone_id, preszone_name, presszone_type, presszone_head, dma_id, dma_name, dma_type, macrodma_id, dqa_id, dqa_name, dqa_type, macrodqa_id, arc_id, parent_id, annotation, observ, "comment", staticpressure, soilcat_id, function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, workcat_id_plan, builtdate, enddate, buildercat_id, ownercat_id, muni_id, postcode, district_id, streetname, postnumber, postcomplement, streetname2, postnumber2, postcomplement2, region_id, province_id, descript, svg, rotation, link, verified, undelete, "label", label_x, label_y, label_rotation, publish, inventory, hemisphere, num_value, adate, adescript, accessibility, dma_style, presszone_style, asset_id, om_state, conserv_state, access_type, placement_type, expl_id2, is_operative, brand_id, model_id, serial_number, minsector_id, macrominsector_id, demand_max, demand_min, demand_avg, press_max, press_min, press_avg, head_max, head_min, head_avg, quality_max, quality_min, quality_avg, tstamp, insert_user, lastupdate, lastupdate_user, the_geom, inp_type, closed, broken, buried, irrigation_indicator, pression_entry, pression_exit, depth_valveshaft, regulator_situation, regulator_location, regulator_observ, lin_meters, exit_type, exit_code, drive_type, cat_valve2, ordinarystatus, shutter, brand2, model2, valve_type, to_arc, active, airvalve_param_1, airvalve_param_2) |
| 22 | +VALUES('-901', '-901', 32.8100, NULL, 'AIR_VALVE', 'VALVE', 'AIR VALVE DN50', 'FD', '16', '50', NULL, 'UNDEFINED', 1, 2, 2, 1, 5, 'sector2-1d', 2, 'DISTRIBUTION', '3', 'pzone1-1d', NULL, NULL, 3, 'dma2-1d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'soil1', NULL, NULL, NULL, NULL, 'work1', NULL, NULL, '2024-08-22', NULL, NULL, 'owner1', 2, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, '', '1', NULL, NULL, NULL, NULL, NULL, true, true, NULL, NULL, NULL, NULL, NULL, '204,235,197', '204,235,197', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-08-22 17:00:02.000', 'postgres', '2024-08-22 17:00:02.000', 'postgres', 'SRID=25831;POINT (418473.00472849904 4577983.379842222)'::public.geometry, NULL, false, false, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL); |
| 23 | + |
| 24 | +INSERT INTO arc |
| 25 | +(arc_id, code, node_1, node_2, arccat_id, epa_type, sector_id, state, state_type, annotation, observ, "comment", "_sys_length", custom_length, dma_id, presszone_id, soilcat_id, function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, buildercat_id, builtdate, enddate, ownercat_id, muni_id, postcode, streetaxis_id, postnumber, postcomplement, streetaxis2_id, postnumber2, postcomplement2, descript, link, verified, the_geom, undelete, label_x, label_y, label_rotation, publish, inventory, expl_id, num_value, feature_type, tstamp, lastupdate, lastupdate_user, insert_user, minsector_id, dqa_id, staticpressure, district_id, "depth", adate, adescript, workcat_id_plan, asset_id, pavcat_id, nodetype_1, elevation1, depth1, staticpress1, nodetype_2, elevation2, depth2, staticpress2, om_state, conserv_state, parent_id, expl_id2, brand_id, model_id, serial_number, macrominsector_id) |
| 26 | +VALUES('-901', '-901', '-901', '-902', 'PVC63-PN10', 'PIPE', 5, 1, 2, NULL, NULL, NULL, NULL, NULL, 3, '3', 'soil1', NULL, NULL, NULL, NULL, 'work1', NULL, NULL, '2024-08-22', NULL, 'owner1', 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '1', 'SRID=25831;LINESTRING (418473.00472849904 4577983.379842222, 418474.19510507485 4577983.667174499)'::public.geometry, NULL, NULL, NULL, NULL, true, true, 2, NULL, 'ARC', '2024-08-22 17:05:32.365', '2024-08-22 17:05:32.436', 'postgres', 'postgres', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'Asphalt', 'AIR_VALVE', 32.8100, NULL, NULL, 'AIR_VALVE', 32.8100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 27 | +SELECT is((SELECT count(*)::integer FROM arc WHERE arc_id = '-901'), 1, 'INSERT: arc:pipe "-901" was inserted'); |
| 28 | + |
| 29 | +UPDATE arc SET custom_length = 1.0000 WHERE arc_id = '-901'; |
| 30 | +SELECT is((SELECT custom_length FROM arc WHERE arc_id = '-901'), 1.0000, 'UPDATE: arc:pipe "-901" was updated'); |
| 31 | + |
| 32 | +DELETE FROM arc WHERE arc_id = '-901'; |
| 33 | +SELECT is((SELECT count(*)::integer FROM arc WHERE arc_id = '-901'), 0, 'DELETE: arc:pipe "-901" was deleted'); |
| 34 | + |
| 35 | +-- arc -> varc |
| 36 | +-- initial data is prepared before proceeding with the test |
| 37 | +INSERT INTO ve_node_check_valve |
| 38 | +(node_id, code, elevation, "depth", node_type, sys_type, nodecat_id, cat_matcat_id, cat_pnom, cat_dnom, cat_dint, epa_type, state, state_type, expl_id, macroexpl_id, sector_id, sector_name, macrosector_id, sector_type, presszone_id, preszone_name, presszone_type, presszone_head, dma_id, dma_name, dma_type, macrodma_id, dqa_id, dqa_name, dqa_type, macrodqa_id, arc_id, parent_id, annotation, observ, "comment", staticpressure, soilcat_id, function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, workcat_id_plan, builtdate, enddate, buildercat_id, ownercat_id, muni_id, postcode, district_id, streetname, postnumber, postcomplement, streetname2, postnumber2, postcomplement2, region_id, province_id, descript, svg, rotation, link, verified, undelete, "label", label_x, label_y, label_rotation, publish, inventory, hemisphere, num_value, adate, adescript, accessibility, dma_style, presszone_style, asset_id, om_state, conserv_state, access_type, placement_type, expl_id2, is_operative, brand_id, model_id, serial_number, minsector_id, macrominsector_id, demand_max, demand_min, demand_avg, press_max, press_min, press_avg, head_max, head_min, head_avg, quality_max, quality_min, quality_avg, tstamp, insert_user, lastupdate, lastupdate_user, the_geom, inp_type, closed, broken, buried, irrigation_indicator, pression_entry, pression_exit, depth_valveshaft, regulator_situation, regulator_location, regulator_observ, lin_meters, exit_type, exit_code, drive_type, cat_valve2, ordinarystatus, shutter, brand2, model2, valve_type, to_arc, active, checkvalve_param_1, checkvalve_param_2) |
| 39 | +VALUES('-903', '-903', 32.8100, NULL, 'CHECK_VALVE', 'VALVE', 'CHK-VALVE63-PN16', 'FD', '16', '63', 65.00000, 'SHORTPIPE', 1, 2, 2, 1, 5, 'sector2-1d', 2, 'DISTRIBUTION', '3', 'pzone1-1d', NULL, NULL, 3, 'dma2-1d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'soil1', NULL, NULL, NULL, NULL, 'work1', NULL, NULL, '2024-08-22', NULL, NULL, 'owner1', 2, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, '', '1', NULL, NULL, NULL, NULL, NULL, true, true, NULL, NULL, NULL, NULL, NULL, '204,235,197', '204,235,197', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-08-22 17:01:53.000', 'postgres', '2024-08-22 17:01:53.000', 'postgres', 'SRID=25831;POINT (418473.1278709034 4577982.640987795)'::public.geometry, 'SHORTPIPE', false, false, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL); |
| 40 | +INSERT INTO ve_node_check_valve |
| 41 | +(node_id, code, elevation, "depth", node_type, sys_type, nodecat_id, cat_matcat_id, cat_pnom, cat_dnom, cat_dint, epa_type, state, state_type, expl_id, macroexpl_id, sector_id, sector_name, macrosector_id, sector_type, presszone_id, preszone_name, presszone_type, presszone_head, dma_id, dma_name, dma_type, macrodma_id, dqa_id, dqa_name, dqa_type, macrodqa_id, arc_id, parent_id, annotation, observ, "comment", staticpressure, soilcat_id, function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, workcat_id_plan, builtdate, enddate, buildercat_id, ownercat_id, muni_id, postcode, district_id, streetname, postnumber, postcomplement, streetname2, postnumber2, postcomplement2, region_id, province_id, descript, svg, rotation, link, verified, undelete, "label", label_x, label_y, label_rotation, publish, inventory, hemisphere, num_value, adate, adescript, accessibility, dma_style, presszone_style, asset_id, om_state, conserv_state, access_type, placement_type, expl_id2, is_operative, brand_id, model_id, serial_number, minsector_id, macrominsector_id, demand_max, demand_min, demand_avg, press_max, press_min, press_avg, head_max, head_min, head_avg, quality_max, quality_min, quality_avg, tstamp, insert_user, lastupdate, lastupdate_user, the_geom, inp_type, closed, broken, buried, irrigation_indicator, pression_entry, pression_exit, depth_valveshaft, regulator_situation, regulator_location, regulator_observ, lin_meters, exit_type, exit_code, drive_type, cat_valve2, ordinarystatus, shutter, brand2, model2, valve_type, to_arc, active, checkvalve_param_1, checkvalve_param_2) |
| 42 | +VALUES('-904', '-904', 32.8100, NULL, 'CHECK_VALVE', 'VALVE', 'CHK-VALVE63-PN16', 'FD', '16', '63', 65.00000, 'SHORTPIPE', 1, 2, 2, 1, 5, 'sector2-1d', 2, 'DISTRIBUTION', '3', 'pzone1-1d', NULL, NULL, 3, 'dma2-1d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'soil1', NULL, NULL, NULL, NULL, 'work1', NULL, NULL, '2024-08-22', NULL, NULL, 'owner1', 2, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, '', '1', NULL, NULL, NULL, NULL, NULL, true, true, NULL, NULL, NULL, NULL, NULL, '204,235,197', '204,235,197', NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2024-08-22 17:02:03.000', 'postgres', '2024-08-22 17:02:03.000', 'postgres', 'SRID=25831;POINT (418474.44138988364 4577982.928320073)'::public.geometry, 'SHORTPIPE', false, false, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, NULL, NULL); |
| 43 | + |
| 44 | +INSERT INTO arc |
| 45 | +(arc_id, code, node_1, node_2, arccat_id, epa_type, sector_id, state, state_type, annotation, observ, "comment", "_sys_length", custom_length, dma_id, presszone_id, soilcat_id, function_type, category_type, fluid_type, location_type, workcat_id, workcat_id_end, buildercat_id, builtdate, enddate, ownercat_id, muni_id, postcode, streetaxis_id, postnumber, postcomplement, streetaxis2_id, postnumber2, postcomplement2, descript, link, verified, the_geom, undelete, label_x, label_y, label_rotation, publish, inventory, expl_id, num_value, feature_type, tstamp, lastupdate, lastupdate_user, insert_user, minsector_id, dqa_id, staticpressure, district_id, "depth", adate, adescript, workcat_id_plan, asset_id, pavcat_id, nodetype_1, elevation1, depth1, staticpress1, nodetype_2, elevation2, depth2, staticpress2, om_state, conserv_state, parent_id, expl_id2, brand_id, model_id, serial_number, macrominsector_id) |
| 46 | +VALUES('-902', '-902', '-903', '-904', 'VIRTUAL', 'PIPE', 5, 1, 2, NULL, NULL, NULL, NULL, NULL, 3, '3', 'soil1', NULL, NULL, NULL, NULL, 'work1', NULL, NULL, '2024-08-22', NULL, 'owner1', 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '1', 'SRID=25831;LINESTRING (418473.1278709034 4577982.640987795, 418474.44138988364 4577982.928320073)'::public.geometry, NULL, NULL, NULL, NULL, true, true, 2, NULL, 'ARC', '2024-08-22 17:05:48.525', '2024-08-22 17:05:48.577', 'postgres', 'postgres', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'Asphalt', 'CHECK_VALVE', 32.8100, NULL, NULL, 'CHECK_VALVE', 32.8100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
| 47 | +SELECT is((SELECT count(*)::integer FROM arc WHERE arc_id = '-902'), 1, 'INSERT: arc:varc "-902" was inserted'); |
| 48 | + |
| 49 | +UPDATE arc SET custom_length = 1.0000 WHERE arc_id = '-902'; |
| 50 | +SELECT is((SELECT custom_length FROM arc WHERE arc_id = '-902'), 1.0000, 'UPDATE: arc:varc "-902" was updated'); |
| 51 | + |
| 52 | +DELETE FROM arc WHERE arc_id = '-902'; |
| 53 | +SELECT is((SELECT count(*)::integer FROM arc WHERE arc_id = '-902'), 0, 'DELETE: arc:varc "-902" was deleted'); |
| 54 | + |
| 55 | + |
| 56 | +SELECT * FROM finish(); |
| 57 | + |
| 58 | +ROLLBACK; |
0 commit comments