Skip to content

v0.2.53..v0.2.54 changeset ServiceGrailDiffTest.sh.off

Garret Voltz edited this page Mar 31, 2020 · 1 revision
diff --git a/test-files/cmd/glacial/serial/ServiceGrailDiffTest.sh.off b/test-files/cmd/glacial/serial/ServiceGrailDiffTest.sh.off
new file mode 100755
index 0000000..bbe70eb
--- /dev/null
+++ b/test-files/cmd/glacial/serial/ServiceGrailDiffTest.sh.off
@@ -0,0 +1,83 @@
+#!/bin/bash
+set -e
+
+# This test simulates the HG diff as run from the UI.
+
+TEST_NAME=ServiceGrailDiffTest
+IN_DIR=/home/vagrant/hoot/tmp/3923
+OUT_DIR=$IN_DIR
+#CROP_BOUNDS="-94.5466,39.0990,-94.5357,39.1097"
+
+CONFIG="--info -C DifferentialConflation.conf -C NetworkAlgorithm.conf -D differential.snap.unconnected.roads=true -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"
+# -C Testing.conf
+#-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::NetworkMatchCreator -D merger.creators=hoot::NetworkMergerCreator"
+
+rm -f $OUT_DIR/ref.osm
+rm -f $OUT_DIR/sec.osm
+rm -f $OUT_DIR/diff.osc.sql
+rm -f $OUT_DIR/diff.osc
+rm -f $OUT_DIR/diff.tags.osc.sql
+rm -f $OUT_DIR/diff.tags.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.osm
+REF_FILE_CROPPED=$IN_DIR/NOME-cropped.osm
+#REF_FILE=$IN_DIR/NOME-full.osm
+#REF_FILE_CROPPED=$IN_DIR/NOME-full-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.osm 
+SEC_FILE_CROPPED=$IN_DIR/OSM-cropped.osm 
+#SEC_FILE=$IN_DIR/OSM-full.osm 
+#SEC_FILE_CROPPED=$IN_DIR/OSM-full-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 "Generating differential changeset w/ tags between ref and sec (xml)..."
+hoot conflate $CONFIG -D debug.maps.filename=$IN_DIR/debug-conflate.osm $OSM_API_DB_URL "$HOOT_DB_URL/$TEST_NAME-sec" $OUT_DIR/diff.osc --differential --include-tags --separate-output
+echo "Generating differential changeset w/ tags between ref and sec (sql)..."
+hoot conflate $CONFIG -D debug.maps.filename=$IN_DIR/debug-conflate-sql.osm $OSM_API_DB_URL "$HOOT_DB_URL/$TEST_NAME-sec" $OUT_DIR/diff.osc.sql $OSM_API_DB_URL --differential --include-tags --separate-output
+
+echo "Applying the geometry 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 "Applying the tags changeset to ref..."
+hoot changeset-apply $CONFIG -D debug.maps.filename=$IN_DIR/debug-changeset-application-tags.osm $OUT_DIR/diff.tags.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