From e81f005ce9fd9ef5565c73c777092d2ecd252bc1 Mon Sep 17 00:00:00 2001 From: John Krauss Date: Thu, 12 Jan 2017 21:22:45 +0000 Subject: [PATCH] adding server tests, interface to generate client sql code --- client/renderer/interface.yaml | 34 ++++++++++++++++++- .../expected/100_data_observatory_test.out | 34 +++++++++++++++++++ .../test/sql/100_data_observatory_test.sql | 21 ++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/client/renderer/interface.yaml b/client/renderer/interface.yaml index 3b9ff7c..fa7c257 100644 --- a/client/renderer/interface.yaml +++ b/client/renderer/interface.yaml @@ -261,6 +261,38 @@ - { name: boundary_id, type: text} - { name: time_span, type: text, default: 'NULL'} +- name: obs_getdata + return_type: TABLE(id int, data json) + multi_row: true + multi_field: true + table_fields: + - { name: id, type: integer } + - { name: data, type: json } + params: + - { name: geomvals, type: "geomval[]" } + - { name: params, type: json } + - { name: merge, type: boolean, default: true } + +- name: obs_getdata + return_type: TABLE(id text, data json) + multi_row: true + multi_field: true + table_fields: + - { name: id, type: text } + - { name: data, type: json } + params: + - { name: geomrefs, type: "text[]" } + - { name: params, type: json } + +- name: obs_getmeta + return_type: json + params: + - { name: geom_ref, type: "Geometry(Geometry, 4326)" } + - { name: params, type: json } + - { name: max_timespan_rank, type: integer, default: 'NULL' } + - { name: max_score_rank, type: integer, default: 'NULL' } + - { name: target_geoms, type: integer, default: 'NULL' } + - name: obs_getcategory return_type: text params: @@ -388,4 +420,4 @@ return_type: BOOLEAN params: - { name: service, type: TEXT } - - { name: input_size, type: NUMERIC } \ No newline at end of file + - { name: input_size, type: NUMERIC } diff --git a/server/extension/test/expected/100_data_observatory_test.out b/server/extension/test/expected/100_data_observatory_test.out index 23cd4e1..7fc17a2 100644 --- a/server/extension/test/expected/100_data_observatory_test.out +++ b/server/extension/test/expected/100_data_observatory_test.out @@ -141,6 +141,40 @@ SELECT exists(SELECT * t (1 row) +SELECT exists(SELECT * + FROM pg_proc p + INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) + WHERE ns.nspname = 'cdb_dataservices_server' + AND proname = 'obs_getmeta' + AND oidvectortypes(p.proargtypes) = 'text, text, geometry, json, integer, integer, integer'); + exists +-------- + t +(1 row) + +SELECT exists(SELECT * + FROM pg_proc p + INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) + WHERE ns.nspname = 'cdb_dataservices_server' + AND proname = 'obs_getdata' + AND oidvectortypes(p.proargtypes) = 'text, text, geomval[], json, boolean'); + exists +-------- + t +(1 row) + +SELECT exists(SELECT * + FROM pg_proc p + INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) + WHERE ns.nspname = 'cdb_dataservices_server' + AND proname = 'obs_getdata' + AND oidvectortypes(p.proargtypes) = 'text, text, text[], json'); + exists +-------- + t +(1 row) + + SELECT exists(SELECT * FROM pg_proc p INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) diff --git a/server/extension/test/sql/100_data_observatory_test.sql b/server/extension/test/sql/100_data_observatory_test.sql index 945448d..caabb11 100644 --- a/server/extension/test/sql/100_data_observatory_test.sql +++ b/server/extension/test/sql/100_data_observatory_test.sql @@ -89,6 +89,27 @@ SELECT exists(SELECT * AND proname = 'obs_getboundarybyid' AND oidvectortypes(p.proargtypes) = 'text, text, text, text, text'); +SELECT exists(SELECT * + FROM pg_proc p + INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) + WHERE ns.nspname = 'cdb_dataservices_server' + AND proname = 'obs_getmeta' + AND oidvectortypes(p.proargtypes) = 'text, text, geometry, json, integer, integer, integer'); + +SELECT exists(SELECT * + FROM pg_proc p + INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) + WHERE ns.nspname = 'cdb_dataservices_server' + AND proname = 'obs_getdata' + AND oidvectortypes(p.proargtypes) = 'text, text, geomval[], json, boolean'); + +SELECT exists(SELECT * + FROM pg_proc p + INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid) + WHERE ns.nspname = 'cdb_dataservices_server' + AND proname = 'obs_getdata' + AND oidvectortypes(p.proargtypes) = 'text, text, text[], json'); + SELECT exists(SELECT * FROM pg_proc p INNER JOIN pg_namespace ns ON (p.pronamespace = ns.oid)