#!/bin/bash # # Usage: setup-test-env-amqp.sh # where AMQP1_BACKEND is the AMQP 1.0 intermediary to use. Valid # values are "qdrouterd" for router and "qpidd" for broker. set -e # router requires qdrouterd, sasl2-bin/cyrus-sasl-plain+cyrus-sasl-lib # broker requires qpidd, qpid-tools sasl2-bin/cyrus-sasl-plain+cyrus-sasl-lib . tools/functions.sh DATADIR=$(mktemp -d /tmp/OSLOMSG-${AMQP1_BACKEND}.XXXXX) trap "clean_exit $DATADIR" EXIT function _setup_qdrouterd_user { echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qdrouterd.sasldb stackqpid } function _setup_qpidd_user { echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qpidd.sasldb -u QPID stackqpid } function _configure_qdrouterd { # create a stand alone router cat > ${DATADIR}/qdrouterd.conf <> ${DATADIR}/qdrouterd.conf <> ${DATADIR}/qdrouterd.conf <> ${DATADIR}/qdrouterd.conf < ${DATADIR}/sasl2/qdrouterd.conf < ${DATADIR}/qpidd.conf </dev/null) --help | grep -q "sasl-service-name"`; then echo "This version of $QPIDD does not support SASL authentication with AMQP 1.0" cat >> ${DATADIR}/qpidd.conf <> ${DATADIR}/qpidd.conf <> ${DATADIR}/qpidd.conf < ${DATADIR}/qpidd.acl < ${DATADIR}/sasl2/qpidd.conf < ${SITEDIR}/dispatch.pth </dev/null) mkfifo ${DATADIR}/out $QDR --config ${DATADIR}/qdrouterd.conf & wait_for_line "Router .*started" "error" ${DATADIR}/out rm ${SITEDIR}/dispatch.pth } function _start_qpidd { QPIDD=$(which qpidd 2>/dev/null) mkfifo ${DATADIR}/out $QPIDD --log-enable trace+ --log-to-file ${DATADIR}/out --config ${DATADIR}/qpidd.conf & wait_for_line "Broker .*running" "error" ${DATADIR}/out } _configure_${AMQP1_BACKEND} _setup_${AMQP1_BACKEND}_user _start_${AMQP1_BACKEND} $*