Created
January 9, 2013 16:14
-
-
Save sirkkalap/4494394 to your computer and use it in GitHub Desktop.
# Lataa ja tallenna metadata-osa testcases urleista
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Lataa ja tallenna metadata-osa testcases urleista | |
testcases=("01-lhtiedot-kunta_kunta=1_olotila=1|http://ceto.solita.fi:7080/kios-tp/tp/eraajo/lainhuutotiedot/kunta/xml?kunta=1&olotila=1" | |
"02-lhtiedot-kunta_kunta=5_olotila=1|http://ceto.solita.fi:7080/kios-tp/tp/eraajo/lainhuutotiedot/kunta/xml?kunta=5&olotila=1") | |
BASEDIR=$(cd "$(dirname "$0")"; pwd) | |
SUBPROJECT_HOME=$(cd "$BASEDIR/.."; pwd) | |
set -eu | |
runTest() { | |
local url=$1 | |
local dst_file=$2 | |
echo "Fetching metadata from: $url" | |
echo "Writing to file: $dst_file" | |
get $url | filter >$dst_file | |
} | |
get() { | |
#cat scripts/testdata/01-minimum-response.xml | |
curl -sS $1 | |
} | |
filter() { | |
sed -n -E 's/.*(<y:metatiedot)/\1/;s/(<\/y:metatiedot>).*/\1/p' | |
} | |
cd "$SUBPROJECT_HOME" | |
output=target | |
mkdir -p $output | |
for testcase in ${testcases[@]} ; do | |
testcase_name=${testcase%%|*} | |
url=${testcase##*|} | |
runTest $url ${output}/${testcase_name}-md.xml | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment