Enhance FileChannel purge setting.

This commit is contained in:
aaron0x
2015-09-26 23:31:30 +08:00
committed by Guenter Obiltschnig
parent 13b34666d9
commit 3066e66f32
4 changed files with 110 additions and 51 deletions

View File

@@ -518,6 +518,34 @@ void FileChannelTest::testPurgeCount()
}
void FileChannelTest::testWrongPurgeOption()
{
std::string name = filename();
AutoPtr<FileChannel> pChannel = new FileChannel(name);
pChannel->setProperty(FileChannel::PROP_PURGEAGE, "5 seconds");
try
{
pChannel->setProperty(FileChannel::PROP_PURGEAGE, "peace");
fail("must fail");
} catch (InvalidArgumentException)
{
assert(pChannel->getProperty(FileChannel::PROP_PURGEAGE) == "5 seconds");
}
try
{
pChannel->setProperty(FileChannel::PROP_PURGECOUNT, "peace");
fail("must fail");
} catch (InvalidArgumentException)
{
assert(pChannel->getProperty(FileChannel::PROP_PURGEAGE) == "5 seconds");
}
remove(name);
}
void FileChannelTest::setUp()
{
}
@@ -620,6 +648,7 @@ CppUnit::Test* FileChannelTest::suite()
CppUnit_addTest(pSuite, FileChannelTest, testCompress);
CppUnit_addTest(pSuite, FileChannelTest, testPurgeAge);
CppUnit_addTest(pSuite, FileChannelTest, testPurgeCount);
CppUnit_addTest(pSuite, FileChannelTest, testWrongPurgeOption);
return pSuite;
}

View File

@@ -45,6 +45,7 @@ public:
void testCompress();
void testPurgeAge();
void testPurgeCount();
void testWrongPurgeOption();
void setUp();
void tearDown();