59 lines
1.9 KiB
C++
59 lines
1.9 KiB
C++
#ifndef CONNECTED_TEST_H
|
|
#define CONNECTED_TEST_H
|
|
/*
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
* Version: MIT
|
|
*
|
|
* Copyright (c) 2010-2013 Alan Antonuk
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation
|
|
* files (the "Software"), to deal in the Software without
|
|
* restriction, including without limitation the rights to use, copy,
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
* of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
* ***** END LICENSE BLOCK *****
|
|
*/
|
|
|
|
#include <SimpleAmqpClient/SimpleAmqpClient.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
using namespace AmqpClient;
|
|
|
|
class connected_test : public ::testing::Test {
|
|
public:
|
|
virtual void SetUp() { channel = Channel::Open(GetTestOpenOpts()); }
|
|
|
|
Channel::ptr_t channel;
|
|
|
|
static Channel::OpenOpts GetTestOpenOpts() {
|
|
Channel::OpenOpts ret;
|
|
ret.host = GetBrokerHost();
|
|
ret.auth = Channel::OpenOpts::BasicAuth("guest", "guest");
|
|
return ret;
|
|
}
|
|
|
|
static std::string GetBrokerHost() {
|
|
const char *host = getenv("AMQP_BROKER");
|
|
if (NULL != host) {
|
|
return std::string(host);
|
|
}
|
|
return std::string("");
|
|
}
|
|
};
|
|
|
|
#endif // CONNECTED_TEST_H
|