|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +set -eu |
| 4 | + |
| 5 | +RET=0 |
| 6 | + |
| 7 | +PGUSER=postgres |
| 8 | +DB=tinyows_demo |
| 9 | + |
| 10 | +for i in demo/tests/input/*; do |
| 11 | + echo "Running $i" |
| 12 | + QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt |
| 13 | + if ! diff -u /tmp/output.txt demo/tests/expected/$(basename $i); then |
| 14 | + mkdir -p demo/tests/got |
| 15 | + mv /tmp/output.txt demo/tests/got/$(basename $i) |
| 16 | + echo "Result got put in demo/tests/got/$(basename $i)" |
| 17 | + RET=1 |
| 18 | + fi |
| 19 | +done |
| 20 | + |
| 21 | +if test "$RET" -eq "0"; then |
| 22 | + echo "Tests OK !" |
| 23 | +else |
| 24 | + echo "Tests failed !" |
| 25 | + exit $RET |
| 26 | +fi |
| 27 | + |
| 28 | +i=demo/tests/transactions/input/wfst10_france_insert.xml |
| 29 | +echo "Running $i" |
| 30 | +QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false) |
| 31 | +cat /tmp/output.txt | grep SUCCESS || (cat /tmp/output.txt && /bin/false) |
| 32 | +echo "select st_astext(geom) from france where id_geofla = -1234;" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2171610 802820,2171611 802820,2171611 802821,2171610 802820)))" |
| 33 | +echo "delete from france where id_geofla = -1234" | su $PGUSER -c "psql $DB" |
| 34 | + |
| 35 | + |
| 36 | +i=demo/tests/transactions/input/wfst10_world_insert.xml |
| 37 | +echo "Running $i" |
| 38 | +QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false) |
| 39 | +cat /tmp/output.txt | grep SUCCESS || (cat /tmp/output.txt && /bin/false) |
| 40 | +echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))" |
| 41 | +echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB" |
| 42 | + |
| 43 | + |
| 44 | +i=demo/tests/transactions/input/wfst11_france_insert.xml |
| 45 | +echo "Running $i" |
| 46 | +QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false) |
| 47 | +cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false) |
| 48 | +echo "select st_astext(geom) from france where id_geofla = -1234;" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2171610 802820,2171611 802820,2171611 802821,2171610 802820)))" |
| 49 | +echo "delete from france where id_geofla = -1234" | su $PGUSER -c "psql $DB" |
| 50 | + |
| 51 | + |
| 52 | +i=demo/tests/transactions/input/wfst11_world_insert.xml |
| 53 | +echo "Running $i" |
| 54 | +QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false) |
| 55 | +cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false) |
| 56 | +echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))" |
| 57 | +echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB" |
| 58 | + |
| 59 | + |
| 60 | +i=demo/tests/transactions/input/wfst11_world_insert_srsname_in_wfsinsert.xml |
| 61 | +echo "Running $i" |
| 62 | +QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false) |
| 63 | +cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false) |
| 64 | +echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))" |
| 65 | +echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB" |
| 66 | + |
| 67 | + |
| 68 | +i=demo/tests/transactions/input/wfst11_geometry_less_insert.xml |
| 69 | +echo "Running $i" |
| 70 | +QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false) |
| 71 | +cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false) |
| 72 | +echo "select textcol from geometry_less where intcol = -1234;" | su $PGUSER -c "psql -t $DB" | grep "minus 1234" |
| 73 | +echo "delete from geometry_less where intcol = -1234" | su $PGUSER -c "psql $DB" |
0 commit comments