test(issue38): show another example of issue #38 working
This commit is contained in:
parent
8109e5343c
commit
3b4f6d7709
|
|
@ -23,6 +23,7 @@ private Q_SLOTS:
|
|||
void validateUri_data();
|
||||
void validateUri();
|
||||
void issue38();
|
||||
void issue38_take2();
|
||||
|
||||
public Q_SLOTS: // temporarily disabled
|
||||
void autoReconnect();
|
||||
|
|
@ -255,5 +256,55 @@ void tst_QAMQPClient::issue38()
|
|||
issue38_helper(&client);
|
||||
}
|
||||
|
||||
void tst_QAMQPClient::issue38_take2()
|
||||
{
|
||||
QAmqpClient client;
|
||||
client.connectToHost();
|
||||
QVERIFY(waitForSignal(&client, SIGNAL(connected())));
|
||||
QAmqpExchange *exchange = client.createExchange("myexchange");
|
||||
exchange->declare(QAmqpExchange::Topic);
|
||||
QVERIFY(waitForSignal(exchange, SIGNAL(declared())));
|
||||
QAmqpQueue *queue = client.createQueue();
|
||||
queue->declare();
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(declared())));
|
||||
queue->bind(exchange, "routingKeyin");
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(bound())));
|
||||
queue->consume(QAmqpQueue::coNoAck);
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(consuming(QString))));
|
||||
exchange->publish("test message", "routingKeyout");
|
||||
|
||||
// delete everything
|
||||
queue->unbind(exchange, "routingKeyin");
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(unbound())));
|
||||
queue->close();
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(closed())));
|
||||
queue->deleteLater();
|
||||
|
||||
exchange->close();
|
||||
QVERIFY(waitForSignal(exchange, SIGNAL(closed())));
|
||||
exchange->deleteLater();
|
||||
|
||||
client.disconnectFromHost();
|
||||
QVERIFY(waitForSignal(&client,SIGNAL(disconnected())));
|
||||
|
||||
// repeat the connection and create again here
|
||||
client.connectToHost();
|
||||
QVERIFY(waitForSignal(&client, SIGNAL(connected())));
|
||||
exchange = client.createExchange("myexchange");
|
||||
exchange->declare(QAmqpExchange::Topic);
|
||||
QVERIFY(waitForSignal(exchange, SIGNAL(declared())));
|
||||
queue = client.createQueue();
|
||||
queue->declare();
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(declared())));
|
||||
queue->bind(exchange, "routingKeyin");
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(bound())));
|
||||
queue->consume(QAmqpQueue::coNoAck);
|
||||
QVERIFY(waitForSignal(queue, SIGNAL(consuming(QString))));
|
||||
exchange->publish("test message", "routingKeyout");
|
||||
client.disconnectFromHost();
|
||||
QVERIFY(waitForSignal(&client,SIGNAL(disconnected())));
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN(tst_QAMQPClient)
|
||||
#include "tst_qamqpclient.moc"
|
||||
|
|
|
|||
Loading…
Reference in New Issue