]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 10 Sep 2014 19:47:52 +0000 (21:47 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 10 Sep 2014 19:47:52 +0000 (21:47 +0200)
Makefile.am
osm2pgsql
sql/functions.sql
tests/README.md
tests/features/db/update/simple.feature
tests/features/osm2pgsql/import/simple.feature
tests/steps/terrain.py

index 3f57590c331becf83530d69fb8772946dde209bf..2ade09a5fdf328cea5e0306db814288aba831dcf 100644 (file)
@@ -10,18 +10,18 @@ install:
        @echo Nominatim needs to be executed directly from this directory. No install necessary.
 
 test:
-       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only
+       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} lettuce -t -Fail -t -poldi-only
 
 test-fast:
-       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only
+       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 lettuce -t -Fail -t -poldi-only
 
 test-db:
-       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only -t DB
+       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} lettuce -t -Fail -t -poldi-only features/db
 
 test-db-fast:
-       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only -t DB
+       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 lettuce -t -Fail -t -poldi-only features/db
 
 test-api:
-       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only features/api
+       cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} lettuce -t -Fail -t -poldi-only features/api
 
 .PHONY: test test-fast test-db test-db-fast test-api
index 13c11f8842146a79cb0629b603e5acdfbb0bfd58..8fc89648fa877674e889cd26014815a3f029e039 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit 13c11f8842146a79cb0629b603e5acdfbb0bfd58
+Subproject commit 8fc89648fa877674e889cd26014815a3f029e039
index 7b06b450ac54f6f61c32eb5f169e50f5e5a3a908..10e0091db467eee5b259c89c473dfc2416668097 100644 (file)
@@ -2100,8 +2100,8 @@ BEGIN
   -- Handle a place changing type by removing the old data
   -- My generated 'place' types are causing havok because they overlap with real keys
   -- TODO: move them to their own special purpose key/class to avoid collisions
-  IF existing.osm_type IS NULL AND (NEW.type not in ('postcode','house','houses')) THEN
-    DELETE FROM place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type not in ('postcode','house','houses');
+  IF existing.osm_type IS NULL THEN
+    DELETE FROM place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class;
   END IF;
 
   --DEBUG: RAISE WARNING 'Existing: %',existing.osm_id;
index 2e8cfa22cca655144996b9447c20141c96a4dba4..9b053e157560b4988cd3c369383533e4cd799555 100644 (file)
@@ -40,6 +40,10 @@ The tests can be configured with a set of environment variables:
                                 the next run. This speeds up tests considerably
                                 but might lead to outdated errors for some
                                 changes in the database layout.
+ * `NOMINATIM_KEEP_SCENARIO_DB` - if defined, the test database will not be
+                                  dropped after a test is finished. Should
+                                  only be used if one single scenario is run,
+                                  otherwise the result is undefined.
  * `LOGLEVEL` - set to 'debug' to get more verbose output (only works properly
                 when output to a logfile is configured)
  * `LOGFILE` - sends debug output to the given file
index 4493bffba1f89b926320d74a055d54124b63766f..c7874ea0b96099fccf5c4817ab89067ceaf7c0bf 100644 (file)
@@ -53,3 +53,35 @@ Feature: Update of simple objects
         When marking for delete R1,W1
         Then table placex has no entry for W1
         Then table placex has no entry for R1
+
+
+    Scenario: type mutation
+        Given the place nodes
+          | osm_id | class | type | geometry
+          | 3      | shop  | toys | 1 -1
+        When importing
+        Then table placex contains
+          | object | class | type
+          | N3     | shop  | toys
+        When updating place nodes
+          | osm_id | class | type    | geometry
+          | 3      | shop  | grocery | 1 -1
+        Then table placex contains
+          | object | class | type
+          | N3     | shop  | grocery
+
+
+    Scenario: remove postcode place when house number is added
+        Given the place nodes
+          | osm_id | class | type     | postcode | geometry
+          | 3      | place | postcode | 12345    | 1 -1
+        When importing
+        Then table placex contains
+          | object | class | type
+          | N3     | place | postcode
+        When updating place nodes
+          | osm_id | class | type  | postcode | housenumber | geometry
+          | 3      | place | house | 12345    | 13          | 1 -1
+        Then table placex contains
+          | object | class | type
+          | N3     | place | house
index 053c853c398a414c25fe76526d8608940f90ccce..447dab0d0b23d29f202e0fd8aad6f20cd4f4bab8 100644 (file)
@@ -1,6 +1,6 @@
 @DB
 Feature: Import of simple objects by osm2pgsql
-    Testing basic functions of osm2pgsql.
+    Testing basic tagging in osm2pgsql imports.
 
     Scenario: Import simple objects
         Given the osm nodes:
@@ -15,11 +15,11 @@ Feature: Import of simple objects by osm2pgsql
           | 201 | 0 1
           | 202 | 1 1
           | 203 | 1 0
-        Given the osm ways:
+        And the osm ways:
           | id | tags                             | nodes
           | 1  | 'shop' : 'toys', 'name' : 'tata' | 100 101 102
           | 2  | 'ref' : '45'                     | 200 201 202 203 200
-        Given the osm relations:
+        And the osm relations:
           | id | tags                                                        | members
           | 1  | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | N1,W2
         When loading osm data
@@ -47,3 +47,22 @@ Feature: Import of simple objects by osm2pgsql
         Then table place contains
           | object | class | type
           | N1     | place | house
+
+     Scenario: Landuses are only imported when named
+        Given the osm nodes:
+          | id  | geometry
+          | 100 | 0 0
+          | 101 | 0 0.1
+          | 102 | 0.1 0.1
+          | 200 | 0 0
+          | 202 | 1 1
+          | 203 | 1 0
+        And the osm ways:
+          | id | tags                                          | nodes
+          | 1  | 'landuse' : 'residential', 'name' : 'rainbow' | 100 101 102 100
+          | 2  | 'landuse' : 'residential'                     | 200 202 203 200
+        When loading osm data
+        Then table place contains
+          | object | class   | type
+          | W1     | landuse | residential
+        And table place has no entry for W2
index 52b7e31e4e3d6f02ce7f7178e23717e327925c25..cfd243db4cada7443f5b1ee031e09cd2e0d17f97 100644 (file)
@@ -23,7 +23,7 @@ class NominatimConfig:
             logging.basicConfig(level=loglevel)
         # Nominatim test setup
         self.base_url = os.environ.get('NOMINATIM_SERVER', 'http://localhost/nominatim')
-        self.source_dir = os.path.abspath(os.environ.get('NOMINATIM_DIR', '../Nominatim'))
+        self.source_dir = os.path.abspath(os.environ.get('NOMINATIM_DIR', '..'))
         self.template_db = os.environ.get('TEMPLATE_DB', 'test_template_nominatim')
         self.test_db = os.environ.get('TEST_DB', 'test_nominatim')
         self.local_settings_file = os.environ.get('NOMINATIM_SETTINGS', '/tmp/nominatim_settings.php')