mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 02:53:10 +01:00
Committing more work ...
This commit is contained in:
@@ -25,7 +25,7 @@ using namespace Poco::Redis;
|
||||
|
||||
|
||||
bool RedisTest::_connected = false;
|
||||
Poco::Redis::Connection RedisTest::_redis;
|
||||
Poco::Redis::Client RedisTest::_redis;
|
||||
|
||||
|
||||
RedisTest::RedisTest(const std::string& name):
|
||||
@@ -98,16 +98,55 @@ void RedisTest::testPing()
|
||||
Array command;
|
||||
command.add("PING");
|
||||
|
||||
std::string result;
|
||||
_redis.sendCommand(command, result);
|
||||
RedisType::Ptr result = _redis.sendCommand(command);
|
||||
}
|
||||
|
||||
void RedisTest::testSet()
|
||||
{
|
||||
if (!_connected)
|
||||
{
|
||||
std::cout << "Not connected, test skipped." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Array command;
|
||||
command.add("SET");
|
||||
command.add("mykey");
|
||||
command.add("Hello");
|
||||
command.add("NX");
|
||||
|
||||
RedisType::Ptr result = _redis.sendCommand(command);
|
||||
}
|
||||
|
||||
void RedisTest::testPipelining()
|
||||
{
|
||||
if (!_connected)
|
||||
{
|
||||
std::cout << "Not connected, test skipped." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Array> commands;
|
||||
|
||||
Array ping;
|
||||
ping.add("PING");
|
||||
commands.push_back(ping);
|
||||
commands.push_back(ping);
|
||||
|
||||
std::vector<RedisType::Ptr> result;
|
||||
_redis.sendCommands(commands, result);
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* RedisTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("RedisTest");
|
||||
|
||||
CppUnit_addTest(pSuite, RedisTest, testEcho);
|
||||
CppUnit_addTest(pSuite, RedisTest, testPing);
|
||||
CppUnit_addTest(pSuite, RedisTest, testSet);
|
||||
|
||||
CppUnit_addTest(pSuite, RedisTest, testPipelining);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
|
||||
void testEcho();
|
||||
void testPing();
|
||||
void testSet();
|
||||
void testPipelining();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
@@ -43,7 +45,7 @@ private:
|
||||
std::string _host;
|
||||
unsigned _port;
|
||||
static bool _connected;
|
||||
static Poco::Redis::Connection _redis;
|
||||
static Poco::Redis::Client _redis;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user