mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-23 13:32:11 +01:00
merge some changes from develop branch; modernize and clean-up code; remove support for compiling without POCO_WIN32_UTF8
This commit is contained in:
@@ -127,17 +127,17 @@ void SyslogTest::testListener()
|
||||
channel->open();
|
||||
Poco::AutoPtr<RemoteSyslogListener> listener = new RemoteSyslogListener(51400);
|
||||
listener->open();
|
||||
CachingChannel cl;
|
||||
listener->addChannel(&cl);
|
||||
assertTrue (cl.getCurrentSize() == 0);
|
||||
auto pCL = Poco::makeAuto<CachingChannel>();
|
||||
listener->addChannel(pCL);
|
||||
assertTrue (pCL->getCurrentSize() == 0);
|
||||
Poco::Message msg("asource", "amessage", Poco::Message::PRIO_CRITICAL);
|
||||
channel->log(msg);
|
||||
Poco::Thread::sleep(1000);
|
||||
listener->close();
|
||||
channel->close();
|
||||
assertTrue (cl.getCurrentSize() == 1);
|
||||
assertTrue (pCL->getCurrentSize() == 1);
|
||||
std::vector<Poco::Message> msgs;
|
||||
cl.getMessages(msgs, 0, 10);
|
||||
pCL->getMessages(msgs, 0, 10);
|
||||
assertTrue (msgs.size() == 1);
|
||||
assertTrue (msgs[0].getSource() == "asource");
|
||||
assertTrue (msgs[0].getText() == "amessage");
|
||||
@@ -152,14 +152,14 @@ void SyslogTest::testChannelOpenClose()
|
||||
channel->open();
|
||||
Poco::AutoPtr<RemoteSyslogListener> listener = new RemoteSyslogListener(51400);
|
||||
listener->open();
|
||||
CachingChannel cl;
|
||||
listener->addChannel(&cl);
|
||||
auto pCL = Poco::makeAuto<CachingChannel>();
|
||||
listener->addChannel(pCL);
|
||||
|
||||
assertTrue (cl.getCurrentSize() == 0);
|
||||
assertTrue (pCL->getCurrentSize() == 0);
|
||||
Poco::Message msg1("source1", "message1", Poco::Message::PRIO_CRITICAL);
|
||||
channel->log(msg1);
|
||||
Poco::Thread::sleep(1000);
|
||||
assertTrue (cl.getCurrentSize() == 1);
|
||||
assertTrue (pCL->getCurrentSize() == 1);
|
||||
|
||||
channel->close(); // close and re-open channel
|
||||
channel->open();
|
||||
@@ -167,11 +167,11 @@ void SyslogTest::testChannelOpenClose()
|
||||
Poco::Message msg2("source2", "message2", Poco::Message::PRIO_ERROR);
|
||||
channel->log(msg2);
|
||||
Poco::Thread::sleep(1000);
|
||||
assertTrue (cl.getCurrentSize() == 2);
|
||||
assertTrue (pCL->getCurrentSize() == 2);
|
||||
|
||||
listener->close();
|
||||
std::vector<Poco::Message> msgs;
|
||||
cl.getMessages(msgs, 0, 10);
|
||||
pCL->getMessages(msgs, 0, 10);
|
||||
assertTrue (msgs.size() == 2);
|
||||
|
||||
assertTrue (msgs[1].getSource() == "source1");
|
||||
@@ -192,17 +192,17 @@ void SyslogTest::testOldBSD()
|
||||
channel->open();
|
||||
Poco::AutoPtr<RemoteSyslogListener> listener = new RemoteSyslogListener(51400);
|
||||
listener->open();
|
||||
CachingChannel cl;
|
||||
listener->addChannel(&cl);
|
||||
assertTrue (cl.getCurrentSize() == 0);
|
||||
auto pCL = Poco::makeAuto<CachingChannel>();
|
||||
listener->addChannel(pCL);
|
||||
assertTrue (pCL->getCurrentSize() == 0);
|
||||
Poco::Message msg("asource", "amessage", Poco::Message::PRIO_CRITICAL);
|
||||
channel->log(msg);
|
||||
Poco::Thread::sleep(1000);
|
||||
listener->close();
|
||||
channel->close();
|
||||
assertTrue (cl.getCurrentSize() == 1);
|
||||
assertTrue (pCL->getCurrentSize() == 1);
|
||||
std::vector<Poco::Message> msgs;
|
||||
cl.getMessages(msgs, 0, 10);
|
||||
pCL->getMessages(msgs, 0, 10);
|
||||
assertTrue (msgs.size() == 1);
|
||||
// the source is lost with old BSD messages: we only send the local host name!
|
||||
assertTrue (msgs[0].getSource() == Poco::Net::DNS::thisHost().name());
|
||||
@@ -218,9 +218,9 @@ void SyslogTest::testStructuredData()
|
||||
channel->open();
|
||||
Poco::AutoPtr<RemoteSyslogListener> listener = new RemoteSyslogListener(51400);
|
||||
listener->open();
|
||||
CachingChannel cl;
|
||||
listener->addChannel(&cl);
|
||||
assertTrue (cl.getCurrentSize() == 0);
|
||||
auto pCL = Poco::makeAuto<CachingChannel>();
|
||||
listener->addChannel(pCL);
|
||||
assertTrue (pCL->getCurrentSize() == 0);
|
||||
Poco::Message msg1("asource", "amessage", Poco::Message::PRIO_CRITICAL);
|
||||
msg1.set("structured-data", "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]");
|
||||
channel->log(msg1);
|
||||
@@ -230,9 +230,9 @@ void SyslogTest::testStructuredData()
|
||||
Poco::Thread::sleep(1000);
|
||||
listener->close();
|
||||
channel->close();
|
||||
assertTrue (cl.getCurrentSize() == 2);
|
||||
assertTrue (pCL->getCurrentSize() == 2);
|
||||
std::vector<Poco::Message> msgs;
|
||||
cl.getMessages(msgs, 0, 10);
|
||||
pCL->getMessages(msgs, 0, 10);
|
||||
assertTrue (msgs.size() == 2);
|
||||
|
||||
assertTrue (msgs[0].getSource() == "asource");
|
||||
|
||||
Reference in New Issue
Block a user