ItEr45S17CUServizoExportacionHoras: Added script to test the new service to export resource hours from command line.

This commit is contained in:
Manuel Rego Casasnovas 2010-01-26 12:18:36 +01:00 committed by Javier Moran Rua
parent 91dae0adbb
commit 381f339440
2 changed files with 62 additions and 0 deletions

View file

@ -49,6 +49,14 @@
- update-order.sh order-update-sample.xml (authenticate with
wswriter/wswriter)
* Export resources hours:
- export-resources-hours.sh 2010-01-01 2010-12-31 (authenticate with
wsreader/wsreader)
- export-resources-hours.sh 21654685 2010-01-01 2010-12-31 (authenticate
with wsreader/wsreader)
+ When working with the online demo add "--prod" argument to every command.
Example:

View file

@ -0,0 +1,54 @@
#!/bin/sh
. ./rest-common-env.sh
printf "Login name: "
read loginName
printf "Password: "
read password
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
certificate=$DEVELOPMENT_CERTIFICATE
if [ "$1" = "--prod" ]; then
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
certificate=$PRODUCTION_CERTIFICATE
if [ "$#" = 4 ]; then
resourceCode=$2
startDate=$3
endDate=$4
else
startDate=$2
endDate=$3
fi
else
if [ "$#" = 3 ]; then
resourceCode=$1
startDate=$2
endDate=$3
else
startDate=$1
endDate=$2
fi
fi
if [ "$startDate" = "" ]; then
printf "Missing start date\n" 1>&2
exit 1
fi
if [ "$endDate" = "" ]; then
printf "Missing end date\n" 1>&2
exit 1
fi
authorization=`./base64.sh $loginName:$password`
if [ "$resourceCode" = "" ]; then
serviceURIWithParams="$baseServiceURL/resourceshours/$startDate/$endDate/"
else
serviceURIWithParams="$baseServiceURL/resourceshours/$resourceCode/$startDate/$endDate/"
fi
curl -sv -X GET $certificate --header "Authorization: Basic $authorization" \
$serviceURIWithParams | tidy -xml -i -q -utf8