Skip to content

v0.2.53..v0.2.54 changeset ServiceConflateDiffTest.sh.off

Garret Voltz edited this page Mar 31, 2020 · 1 revision
diff --git a/test-files/cmd/glacial/serial/ServiceConflateDiffTest.sh.off b/test-files/cmd/glacial/serial/ServiceConflateDiffTest.sh.off
new file mode 100755
index 0000000..b3ab056
--- /dev/null
+++ b/test-files/cmd/glacial/serial/ServiceConflateDiffTest.sh.off
@@ -0,0 +1,86 @@
+#!/bin/bash
+set -e
+
+# Test conflates two inputs and then generates a changeset between the reference and the conflated output. The point of the test is to ensure 
+# there are no more create/delete statements generated than what there should be.
+
+TEST_NAME=ServiceConflateDiffTest
+IN_DIR=/home/vagrant/hoot/tmp/3851
+#IN_DIR=/home/vagrant/hoot/tmp/3895
+OUT_DIR=$IN_DIR
+#CROP_BOUNDS="-94.5395,39.1037,-94.5379,39.1046"
+
+CONFIG="--info -C ReferenceConflation.conf -C UnifyingAlgorithm.conf -C Testing.conf -D writer.include.debug.tags=true -D uuid.helper.repeatable=true -D debug.maps.write=false -D api.db.email=OsmApiDbHootApiDbConflate@hoottestcpp.org -D hootapi.db.writer.create.user=true -D hootapi.db.writer.overwrite.map=true -D changeset.user.id=1"
+#-D reader.keep.status.tag=true -D reader.use.file.status=true -D reader.add.source.datetime=false
+#CONFIG+="-D log.class.filter=RemoveEmptyAreasVisitor"
+#CONFIG+=" -D match.creators=hoot::HighwayMatchCreator -D merger.creators=hoot::HighwayMergerCreator"
+
+rm -f $OUT_DIR/ref.osm
+rm -f $OUT_DIR/sec.osm
+rm -f $OUT_DIR/conflated.osm
+rm -f $OUT_DIR/diff.osc.sql
+rm -f $OUT_DIR/diff.osc
+rm -f $OUT_DIR/changeset-applied.osm
+
+echo "Creating the OSM API DB..."
+source conf/database/DatabaseConfig.sh
+export OSM_API_DB_URL="osmapidb://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME_OSMAPI"
+export OSM_API_DB_AUTH="-h $DB_HOST -p $DB_PORT -U $DB_USER"
+export PGPASSWORD=$DB_PASSWORD_OSMAPI
+REF_DB_INPUT=$OSM_API_DB_URL
+scripts/database/CleanAndInitializeOsmApiDb.sh
+
+REF_FILE=$IN_DIR/NOME_40429e.osm
+REF_FILE_CROPPED=$IN_DIR/NOME_40429e-cropped.osm
+#REF_FILE=$IN_DIR/NOME.osm
+#REF_FILE_CROPPED=$IN_DIR/NOME-cropped.osm
+
+if [[ "$CROP_BOUNDS" == "" ]]; then
+  echo "Skipping cropping the ref..."
+else
+  echo "Cropping the ref..."
+  hoot crop -D debug.maps.filename=$IN_DIR/debug-ref-crop.osm $REF_FILE $REF_FILE_CROPPED $CROP_BOUNDS
+  REF_FILE=$REF_FILE_CROPPED
+fi
+
+echo "Loading the OSM API DB with ref..."
+hoot convert $CONFIG -D debug.maps.filename=$IN_DIR/debug-ref-load.osm $REF_FILE $OSM_API_DB_URL
+# pull the ref out for viewing
+hoot convert $CONFIG $OSM_API_DB_URL $OUT_DIR/ref.osm
+
+SEC_FILE=$IN_DIR/OSM_40429e.osm 
+SEC_FILE_CROPPED=$IN_DIR/OSM_40429e-cropped.osm 
+#SEC_FILE=$IN_DIR/OSM.osm 
+#SEC_FILE_CROPPED=$IN_DIR/OSM-cropped.osm 
+
+if [[ "$CROP_BOUNDS" == "" ]]; then
+  echo "Skipping cropping the sec..."
+else
+  echo "Cropping the sec..."
+  hoot crop -D debug.maps.filename=$IN_DIR/debug-ref-crop.osm $SEC_FILE $SEC_FILE_CROPPED $CROP_BOUNDS
+  SEC_FILE=$SEC_FILE_CROPPED
+fi
+
+echo "Loading the HOOT API DB with sec..."
+HOOT_DB_URL="hootapidb://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME"
+hoot convert $CONFIG -D debug.maps.filename=$IN_DIR/debug-sec-load.osm $SEC_FILE "$HOOT_DB_URL/$TEST_NAME-sec"
+# pull the sec out for viewing
+hoot convert $CONFIG "$HOOT_DB_URL/$TEST_NAME-sec" $OUT_DIR/sec.osm
+
+echo "Conflating ref with sec..."
+hoot conflate $CONFIG -D debug.maps.filename=$IN_DIR/debug-conflate.osm $OSM_API_DB_URL "$HOOT_DB_URL/$TEST_NAME-sec" "$HOOT_DB_URL/$TEST_NAME-sec-conflated"
+# pull the conflated out for viewing
+hoot convert $CONFIG "$HOOT_DB_URL/$TEST_NAME-sec-conflated" $OUT_DIR/conflated.osm
+
+echo "Deriving a changeset between ref and conflated..."
+# derive the sql version b/c that's what we must apply
+hoot changeset-derive $CONFIG -D debug.maps.filename=$IN_DIR/debug-changeset-derivation.osm $OSM_API_DB_URL "$HOOT_DB_URL/$TEST_NAME-sec-conflated" $OUT_DIR/diff.osc.sql $OSM_API_DB_URL
+# derive an xml version for viewing
+hoot changeset-derive $CONFIG $OSM_API_DB_URL "$HOOT_DB_URL/$TEST_NAME-sec-conflated" $OUT_DIR/diff.osc --stats
+
+echo "Applying the changeset to ref..."
+hoot changeset-apply $CONFIG -D debug.maps.filename=$IN_DIR/debug-changeset-application.osm $OUT_DIR/diff.osc.sql $OSM_API_DB_URL
+
+echo "Reading out the final map for comparison with expected map..."
+hoot convert $CONFIG -D debug.maps.filename=$IN_DIR/debug-final-map.osm $OSM_API_DB_URL $OUT_DIR/changeset-applied.osm
+#hoot diff $CONFIG $IN_DIR/changeset-applied.osm $OUT_DIR/changeset-applied.osm
Clone this wiki locally