From 35261c602df16b83850c25fe8cb8a928db5ef7bc Mon Sep 17 00:00:00 2001 From: ebocher Date: Wed, 5 Jun 2024 18:04:55 +0200 Subject: [PATCH] Fix test --- .../geoclimate/geoindicators/GenericIndicators.groovy | 1 - .../org/orbisgis/geoclimate/osm/WorkflowOSM.groovy | 10 +++++----- .../osmtools/utils/TransformUtilsTest.groovy | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/GenericIndicators.groovy b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/GenericIndicators.groovy index f91d1be043..ea07b9d45b 100644 --- a/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/GenericIndicators.groovy +++ b/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/GenericIndicators.groovy @@ -891,7 +891,6 @@ String gatherScales(JdbcDataSource datasource, String buildingTable, String bloc listRsuRename.add("a.$col AS rsu_$col") } } - //def listBuildCol = datasource.getTable(buildingTable).getColumns() def listBuildRename = [] for (col in buildIndicatorsColumns) { if (col != "ID_RSU" && col != "ID_BLOCK" && col != "ID_BUILD" && col != "THE_GEOM") { diff --git a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy index 3823a7dec6..1360a74932 100644 --- a/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy +++ b/osm/src/main/groovy/org/orbisgis/geoclimate/osm/WorkflowOSM.groovy @@ -1146,10 +1146,10 @@ def abstractModelTableBatchExportTable(JdbcDataSource output_datasource, def out int BATCH_MAX_SIZE = 100 ITable inputRes = prepareTableOutput(h2gis_table_to_save, filter, inputSRID, h2gis_datasource, output_table, outputSRID, output_datasource) if (inputRes) { - def outputColumns = output_datasource.getTable(output_table).getColumnsTypes() + def outputColumns = output_datasource.getColumnNamesTypes(output_table) def outputconnection = output_datasource.getConnection() try { - def inputColumns = inputRes.getColumnsTypes(); + def inputColumns = inputRes.getColumnNamesTypes(); //We check if the number of columns is not the same //If there is more columns in the input table we alter the output table def outPutColumnsNames = outputColumns.keySet() @@ -1255,7 +1255,7 @@ def abstractModelTableBatchExportTable(JdbcDataSource output_datasource, def out * @param outputSRID srid code used to reproject the output table * @return */ -def indicatorTableBatchExportTable(def output_datasource, def output_table, def id_zone, def h2gis_datasource, h2gis_table_to_save, def filter, def inputSRID, def outputSRID, def reproject) { +def indicatorTableBatchExportTable(JdbcDataSource output_datasource, def output_table, def id_zone, def h2gis_datasource, h2gis_table_to_save, def filter, def inputSRID, def outputSRID, def reproject) { if (output_table) { if (h2gis_table_to_save) { if (h2gis_datasource.hasTable(h2gis_table_to_save)) { @@ -1266,11 +1266,11 @@ def indicatorTableBatchExportTable(def output_datasource, def output_table, def int BATCH_MAX_SIZE = 100; ITable inputRes = prepareTableOutput(h2gis_table_to_save, filter, inputSRID, h2gis_datasource, output_table, outputSRID, output_datasource) if (inputRes) { - def outputColumns = output_datasource.getTable(output_table).getColumnsTypes(); + def outputColumns = output_datasource.getColumnNamesTypes(output_table) outputColumns.remove("gid") def outputconnection = output_datasource.getConnection() try { - def inputColumns = inputRes.getColumnsTypes(); + def inputColumns = inputRes.getColumnNamesTypes() //We check if the number of columns is not the same //If there is more columns in the input table we alter the output table def outPutColumnsNames = outputColumns.keySet() diff --git a/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/TransformUtilsTest.groovy b/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/TransformUtilsTest.groovy index 30ea453417..b5a1de343b 100644 --- a/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/TransformUtilsTest.groovy +++ b/osmtools/src/test/groovy/org/orbisgis/geoclimate/osmtools/utils/TransformUtilsTest.groovy @@ -514,7 +514,7 @@ ${osmTablesPrefix}_way_member, ${osmTablesPrefix}_way_not_taken_into_account, ${ def table = h2gis.getTable("output") assertNotNull table - def columns = table.columns + def columns = table.getColumnNames() assertEquals 4, columns.size() assertEquals 4, columns.intersect(["ID_NODE", "THE_GEOM", "build", "key1"]).size() assertFalse columns.contains("WATER") @@ -545,7 +545,7 @@ ${osmTablesPrefix}_way_member, ${osmTablesPrefix}_way_not_taken_into_account, ${ assertTrue OSMTools.TransformUtils.extractNodesAsPoints(h2gis, prefix, epsgCode, outTable, [], []) def table = h2gis.getTable("output") assertNotNull table - def columns = table.columns + def columns = table.getColumnNames() assertEquals 14, columns.size() assertEquals 14, columns.intersect(["ID_NODE", "THE_GEOM", "build", "building", "material", "road", "key", "key1", "key2",