summaryrefslogtreecommitdiff
path: root/src/testing/initialize_taler_system.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/initialize_taler_system.sh')
-rwxr-xr-xsrc/testing/initialize_taler_system.sh62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/testing/initialize_taler_system.sh b/src/testing/initialize_taler_system.sh
index 3970fb8d..1f8caafc 100755
--- a/src/testing/initialize_taler_system.sh
+++ b/src/testing/initialize_taler_system.sh
@@ -43,9 +43,39 @@ function cleanup()
do
kill $n 2> /dev/null || true
done
- rm -rf $CONF $WALLET_DB $TMP_DIR $LAST_RESPONSE
wait
+ rm -rf $CONF $WALLET_DB $TMP_DIR $LAST_RESPONSE
+ # kill euFin
+ kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
+ kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
+}
+
+NEXUS_PORT=8082
+SANDBOX_URL=http://localhost:1$NEXUS_PORT/demobanks/default
+export BANK_URL=$SANDBOX_URL
+function get_payto_uri() {
+ export LIBEUFIN_SANDBOX_USERNAME=$1
+ export LIBEUFIN_SANDBOX_PASSWORD=$2
+ export LIBEUFIN_SANDBOX_URL=$SANDBOX_URL
+ libeufin-cli sandbox demobank info --bank-account $1 | jq --raw-output '.paytoUri'
+}
+export get_payto_uri
+
+function get_bankaccount_balance() {
+ export LIBEUFIN_SANDBOX_USERNAME=$1
+ export LIBEUFIN_SANDBOX_PASSWORD=$2
+ export LIBEUFIN_SANDBOX_URL=$SANDBOX_URL
+ libeufin-cli sandbox demobank info --bank-account $1 | jq --raw-output '.balance.amount'
+}
+export get_bankaccount_balance
+
+function get_bankaccount_transactions() {
+ export LIBEUFIN_SANDBOX_USERNAME=$1
+ export LIBEUFIN_SANDBOX_PASSWORD=$2
+ export LIBEUFIN_SANDBOX_URL=$SANDBOX_URL
+ libeufin-cli sandbox demobank list-transactions --bank-account $1
}
+export get_bankaccount_transactions
# Exchange configuration file will be edited, so we create one
# from the template.
@@ -69,8 +99,8 @@ taler-exchange-httpd -h > /dev/null || exit_skip " taler-exchange required"
taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant required"
echo " FOUND"
-echo -n "Testing for taler-bank-manage"
-taler-bank-manage --help >/dev/null </dev/null || exit_skip " MISSING"
+echo -n "Testing for libeufin-cli"
+libeufin-cli --help >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
echo -n "Testing for taler-wallet-cli"
taler-wallet-cli -v >/dev/null </dev/null 2> /dev/null || exit_skip " MISSING"
@@ -90,8 +120,6 @@ MASTER_PUB=`gnunet-ecc -p ${MASTER_PRIV_FILE}`
EXCHANGE_URL=`taler-config -c $CONF -s EXCHANGE -o BASE_URL`
MERCHANT_PORT=`taler-config -c $CONF -s MERCHANT -o PORT`
MERCHANT_URL=http://localhost:${MERCHANT_PORT}/
-BANK_PORT=`taler-config -c $CONF -s BANK -o HTTP_PORT`
-BANK_URL=http://localhost:${BANK_PORT}/
AUDITOR_URL=http://localhost:8083/
AUDITOR_PRIV_FILE=`taler-config -f -c $CONF -s AUDITOR -o AUDITOR_PRIV_FILE`
AUDITOR_PRIV_DIR=`dirname $AUDITOR_PRIV_FILE`
@@ -106,7 +134,7 @@ taler-config -c $CONF -s merchant-exchange-default -o MASTER_KEY -V $MASTER_PUB
taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V postgres:///$TALER_DB
taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TALER_DB
taler-config -c $CONF -s merchantdb-postgres -o CONFIG -V postgres:///$TALER_DB
-taler-config -c $CONF -s bank -o database -V postgres:///$TALER_DB
+BANK_DB="jdbc:sqlite:$TMP_DIR/$TALER_DB"
taler-config -c $CONF -s exchange -o KEYDIR -V "${TMP_DIR}/keydir/"
taler-config -c $CONF -s exchange -o REVOCATION_DIR -V "${TMP_DIR}/revdir/"
@@ -118,9 +146,17 @@ echo -n "taler-wallet-cli "
taler-wallet-cli --version
taler-exchange-httpd --version
taler-merchant-httpd --version
+libeufin-cli --version
+echo " OK"
+# euFin before the exchange, because must set
+# the PAYTO_URI config option (with unguessable IBAN)
+# before the exchange starts.
+echo "Setting up euFin ..."
+# reset eufin database
+rm $TALER_DB
+taler-bank-manage-testing $NEXUS_PORT $TALER_DB $EXCHANGE_URL $CONF
echo -n "Setting up exchange ..."
-
# reset database
dropdb $TALER_DB >/dev/null 2>/dev/null || true
createdb $TALER_DB || exit_skip "Could not create database $TALER_DB"
@@ -128,12 +164,6 @@ taler-exchange-dbinit -c $CONF
taler-merchant-dbinit -c $CONF
taler-auditor-dbinit -c $CONF
taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL
-
-echo " OK"
-
-# Launch services
-echo -n "Launching taler services ..."
-taler-bank-manage-testing $CONF postgres:///$TALER_DB serve > taler-bank.log 2> taler-bank.err &
taler-exchange-secmod-eddsa -c $CONF -L DEBUG 2> taler-exchange-secmod-eddsa.log &
taler-exchange-secmod-rsa -c $CONF -L DEBUG 2> taler-exchange-secmod-rsa.log &
taler-exchange-secmod-cs -c $CONF -L DEBUG 2> taler-exchange-secmod-cs.log &
@@ -144,8 +174,8 @@ MERCHANT_HTTPD_PID=$!
taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &
WIREWATCH_PID=$!
taler-auditor-httpd -L INFO -c $CONF 2> taler-auditor-httpd.log &
-
echo " OK"
+# Launch services
echo -n "Waiting for the bank"
# Wait for bank to be available (usually the slowest)
@@ -218,9 +248,9 @@ echo -n "Setting up keys ..."
taler-exchange-offline -c $CONF \
download \
sign \
- enable-account payto://x-taler-bank/localhost/Exchange \
+ enable-account `taler-config -c $CONF -s exchange-account-1 -o PAYTO_URI` \
enable-auditor $AUDITOR_PUB $AUDITOR_URL "TESTKUDOS Auditor" \
- wire-fee now x-taler-bank TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 \
+ wire-fee now iban TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 \
global-fee now TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 1h 1h 1year 5 \
upload &> taler-exchange-offline.log