Change ipaddress geocode to match the server signature

This commit is contained in:
Mario de Frutos 2015-11-24 09:25:21 +01:00
parent 963da6c5c7
commit b57dc82f42
5 changed files with 22 additions and 22 deletions

View File

@ -1,18 +1,18 @@
-- Mock the server functions
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_ip_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cdb_geocoder_server.geocode_ipaddress_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
RAISE NOTICE 'cdb_geocoder_server.geocode_ip_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
-- Exercise the public and the proxied function
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
NOTICE: cdb_geocoder_client._geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 9 at SQL statement
geocode_ipaddress_point
-------------------------
SELECT cdb_geocoder_client.geocode_ip_point('8.8.8.8');
NOTICE: cdb_geocoder_client._geocode_ip_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ip_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ip_point(session_user, user_config, geocoder_config, ip_address)"
PL/pgSQL function cdb_geocoder_client.geocode_ip_point(text) line 9 at SQL statement
geocode_ip_point
------------------
(1 row)

View File

@ -74,12 +74,12 @@ PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 9
(1 row)
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
NOTICE: cdb_geocoder_client._geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 9 at SQL statement
geocode_ipaddress_point
-------------------------
SELECT cdb_geocoder_client.geocode_ip_point('8.8.8.8');
NOTICE: cdb_geocoder_client._geocode_ip_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ip_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ip_point(session_user, user_config, geocoder_config, ip_address)"
PL/pgSQL function cdb_geocoder_client.geocode_ip_point(text) line 9 at SQL statement
geocode_ip_point
------------------
(1 row)
@ -100,5 +100,5 @@ SELECT cdb_geocoder_client._geocode_postalcode_polygon('evil_user', '{"is_organi
ERROR: permission denied for function _geocode_postalcode_polygon
SELECT cdb_geocoder_client._geocode_postalcode_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
ERROR: permission denied for function _geocode_postalcode_point
SELECT cdb_geocoder_client._geocode_ipaddress_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');
ERROR: permission denied for function _geocode_ipaddress_point
SELECT cdb_geocoder_client._geocode_ip_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');
ERROR: permission denied for function _geocode_ip_point

View File

@ -1,12 +1,12 @@
-- Mock the server functions
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
CREATE OR REPLACE FUNCTION cdb_geocoder_server.geocode_ip_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text)
RETURNS Geometry AS $$
BEGIN
RAISE NOTICE 'cdb_geocoder_server.geocode_ipaddress_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
RAISE NOTICE 'cdb_geocoder_server.geocode_ip_point invoked with params (%, %, %, %)', user_id, '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', ip_address;
RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';
-- Exercise the public and the proxied function
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
SELECT cdb_geocoder_client.geocode_ip_point('8.8.8.8');

View File

@ -11,7 +11,7 @@ SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia');
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
SELECT cdb_geocoder_client.geocode_postalcode_polygon('03204', 'Spain');
SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
SELECT cdb_geocoder_client.geocode_ip_point('8.8.8.8');
-- Check the regular user has no permissions on private functions
SELECT cdb_geocoder_client._geocode_admin0_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Hell');
@ -22,4 +22,4 @@ SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organiza
SELECT cdb_geocoder_client._geocode_namedplace_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', 'Sheol', 'Hell', 'Ugly world');
SELECT cdb_geocoder_client._geocode_postalcode_polygon('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
SELECT cdb_geocoder_client._geocode_postalcode_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '66666', 'Hell');
SELECT cdb_geocoder_client._geocode_ipaddress_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');
SELECT cdb_geocoder_client._geocode_ip_point('evil_user', '{"is_organization": false, "entity_name": "test_user"}', '{"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}', '8.8.8.8');

View File

@ -62,7 +62,7 @@
- { name: postal_code, type: text}
- { name: country_name, type: text}
- name: geocode_ipaddress_point
- name: geocode_ip_point
return_type: Geometry
user_config_key: user_config
geocoder_config_key: geocoder_config