aboutsummaryrefslogtreecommitdiffstats
path: root/tests/net
diff options
context:
space:
mode:
Diffstat (limited to 'tests/net')
-rw-r--r--tests/net/imap/IMAPParserTest.cpp13
-rw-r--r--tests/net/imap/IMAPTagTest.cpp16
-rw-r--r--tests/net/maildir/maildirStoreTest.cpp86
-rw-r--r--tests/net/pop3/POP3CommandTest.cpp47
-rw-r--r--tests/net/pop3/POP3ResponseTest.cpp80
-rw-r--r--tests/net/pop3/POP3StoreTest.cpp14
-rw-r--r--tests/net/pop3/POP3TestUtils.hpp15
-rw-r--r--tests/net/pop3/POP3UtilsTest.cpp10
-rw-r--r--tests/net/smtp/SMTPCommandSetTest.cpp28
-rw-r--r--tests/net/smtp/SMTPCommandTest.cpp44
-rw-r--r--tests/net/smtp/SMTPResponseTest.cpp70
-rw-r--r--tests/net/smtp/SMTPTransportTest.cpp80
-rw-r--r--tests/net/smtp/SMTPTransportTestUtils.hpp22
13 files changed, 254 insertions, 271 deletions
diff --git a/tests/net/imap/IMAPParserTest.cpp b/tests/net/imap/IMAPParserTest.cpp
index 93f6e6fd..30e8f574 100644
--- a/tests/net/imap/IMAPParserTest.cpp
+++ b/tests/net/imap/IMAPParserTest.cpp
@@ -37,18 +37,19 @@ VMIME_TEST_SUITE_BEGIN(IMAPParserTest)
// For Apple iCloud IMAP server
void testExtraSpaceInCapaResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
socket->localSend(
"* CAPABILITY IMAP4rev1 AUTH=ATOKEN AUTH=PLAIN \r\n" // extra space at end
"a001 OK Capability completed.\r\n");
- vmime::ref <vmime::net::imap::IMAPParser> parser =
- vmime::create <vmime::net::imap::IMAPParser>(tag, socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <vmime::net::imap::IMAPParser> parser =
+ vmime::make_shared <vmime::net::imap::IMAPParser>
+ (tag, vmime::dynamicCast <vmime::net::socket>(socket), toh);
parser->setStrict(false);
VASSERT_NO_THROW("non-strict mode", parser->readResponse(/* literalHandler */ NULL));
diff --git a/tests/net/imap/IMAPTagTest.cpp b/tests/net/imap/IMAPTagTest.cpp
index 26ed87c5..db04537a 100644
--- a/tests/net/imap/IMAPTagTest.cpp
+++ b/tests/net/imap/IMAPTagTest.cpp
@@ -38,16 +38,16 @@ VMIME_TEST_SUITE_BEGIN(imapTagTest)
void testConstruct()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
VASSERT_EQ("init", "a001", static_cast <vmime::string>(*tag));
}
void testIncrement()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
(*tag)++;
VASSERT_EQ("init", "a002", static_cast <vmime::string>(*tag));
@@ -61,8 +61,8 @@ VMIME_TEST_SUITE_BEGIN(imapTagTest)
void testReset()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
for (int i = tag->number() ; i < tag->maximumNumber() ; ++i)
(*tag)++;
@@ -76,8 +76,8 @@ VMIME_TEST_SUITE_BEGIN(imapTagTest)
void testNumber()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
for (int i = 0 ; i < 41 ; ++i)
(*tag)++;
diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
index 358e095f..34e8249c 100644
--- a/tests/net/maildir/maildirStoreTest.cpp
+++ b/tests/net/maildir/maildirStoreTest.cpp
@@ -187,7 +187,7 @@ public:
{
createMaildir(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
- vmime::ref <vmime::net::maildir::maildirStore> store =
+ vmime::shared_ptr <vmime::net::maildir::maildirStore> store =
vmime::dynamicCast <vmime::net::maildir::maildirStore>(createAndConnectStore());
VASSERT_EQ("*", "kmail", store->getFormat()->getName());
@@ -199,7 +199,7 @@ public:
{
createMaildir(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
- vmime::ref <vmime::net::maildir::maildirStore> store =
+ vmime::shared_ptr <vmime::net::maildir::maildirStore> store =
vmime::dynamicCast <vmime::net::maildir::maildirStore>(createAndConnectStore());
VASSERT_EQ("*", "courier", store->getFormat()->getName());
@@ -223,11 +223,11 @@ public:
createMaildir(dirs, files);
// Connect to store
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Get root folders, not recursive
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
rootFolders = rootFolder->getFolders(false);
VASSERT_EQ("1", 2, rootFolders.size());
@@ -253,11 +253,11 @@ public:
createMaildir(dirs, files);
// Connect to store
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Get all folders, recursive
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
allFolders = rootFolder->getFolders(true);
VASSERT_EQ("1", 5, allFolders.size());
@@ -285,10 +285,10 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
- vmime::ref <vmime::net::folder> folder = store->getFolder
+ vmime::shared_ptr <vmime::net::folder> folder = store->getFolder
(fpath() / "Folder" / "SubFolder" / "SubSubFolder2");
int count, unseen;
@@ -298,7 +298,7 @@ public:
folder->open(vmime::net::folder::MODE_READ_ONLY);
- vmime::ref <vmime::net::message> msg = folder->getMessage(1);
+ vmime::shared_ptr <vmime::net::message> msg = folder->getMessage(1);
folder->fetchMessage(msg, vmime::net::fetchAttributes::SIZE);
@@ -346,17 +346,17 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Rename "Folder/SubFolder" to "Folder/foo"
- vmime::ref <vmime::net::folder> folder = store->getFolder
+ vmime::shared_ptr <vmime::net::folder> folder = store->getFolder
(fpath() / "Folder" / "SubFolder");
folder->rename(fpath() / "Folder" / "foo");
// Ensure folder and its subfolders have been renamed
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
allFolders = rootFolder->getFolders(true);
VASSERT_EQ("1", 5, allFolders.size());
@@ -387,17 +387,17 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Destroy "Folder/SubFolder" (total: 3 folders)
- vmime::ref <vmime::net::folder> folder = store->getFolder
+ vmime::shared_ptr <vmime::net::folder> folder = store->getFolder
(fpath() / "Folder" / "SubFolder");
folder->destroy();
// Ensure folder and its subfolders have been deleted and other folders still exist
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
allFolders = rootFolder->getFolders(true);
VASSERT_EQ("1", 2, allFolders.size());
@@ -425,8 +425,8 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
VASSERT("1", store->getFolder(fpath() / "Folder" / "SubFolder")->exists());
VASSERT("2", !store->getFolder(fpath() / "Folder" / "SubSubFolder1")->exists());
@@ -451,8 +451,8 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
VASSERT("Before", !store->getFolder(fpath() / "Folder" / "NewFolder")->exists());
@@ -469,12 +469,12 @@ private:
vmime::utility::file::path m_tempPath;
- vmime::ref <vmime::net::store> createAndConnectStore()
+ vmime::shared_ptr <vmime::net::store> createAndConnectStore()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::store> store =
+ vmime::shared_ptr <vmime::net::store> store =
session->getStore(getStoreURL());
store->connect();
@@ -482,8 +482,8 @@ private:
return store;
}
- const vmime::ref <vmime::net::folder> findFolder
- (const std::vector <vmime::ref <vmime::net::folder> >& folders,
+ const vmime::shared_ptr <vmime::net::folder> findFolder
+ (const std::vector <vmime::shared_ptr <vmime::net::folder> >& folders,
const vmime::net::folder::path& path)
{
for (unsigned int i = 0, n = folders.size() ; i < n ; ++i)
@@ -492,12 +492,12 @@ private:
return folders[i];
}
- return NULL;
+ return vmime::null;
}
const vmime::utility::url getStoreURL()
{
- vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::shared_ptr <vmime::utility::fileSystemFactory> fsf =
vmime::platform::getHandler()->getFileSystemFactory();
vmime::utility::url url(std::string("maildir://localhost")
@@ -508,15 +508,15 @@ private:
void createMaildir(const vmime::string* const dirs, const vmime::string* const files)
{
- vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::shared_ptr <vmime::utility::fileSystemFactory> fsf =
vmime::platform::getHandler()->getFileSystemFactory();
- vmime::ref <vmime::utility::file> rootDir = fsf->create(m_tempPath);
+ vmime::shared_ptr <vmime::utility::file> rootDir = fsf->create(m_tempPath);
rootDir->createDirectory(false);
for (vmime::string const* dir = dirs ; *dir != "*" ; ++dir)
{
- vmime::ref <vmime::utility::file> fdir = fsf->create(m_tempPath / fsf->stringToPath(*dir));
+ vmime::shared_ptr <vmime::utility::file> fdir = fsf->create(m_tempPath / fsf->stringToPath(*dir));
fdir->createDirectory(false);
}
@@ -524,39 +524,39 @@ private:
{
const vmime::string& contents = *(file + 1);
- vmime::ref <vmime::utility::file> ffile = fsf->create(m_tempPath / fsf->stringToPath(*file));
+ vmime::shared_ptr <vmime::utility::file> ffile = fsf->create(m_tempPath / fsf->stringToPath(*file));
ffile->createFile();
- vmime::ref <vmime::utility::fileWriter> fileWriter = ffile->getFileWriter();
- vmime::ref <vmime::utility::outputStream> os = fileWriter->getOutputStream();
+ vmime::shared_ptr <vmime::utility::fileWriter> fileWriter = ffile->getFileWriter();
+ vmime::shared_ptr <vmime::utility::outputStream> os = fileWriter->getOutputStream();
os->write(contents.data(), contents.length());
os->flush();
- fileWriter = NULL;
+ fileWriter = vmime::null;
}
}
void destroyMaildir()
{
- vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::shared_ptr <vmime::utility::fileSystemFactory> fsf =
vmime::platform::getHandler()->getFileSystemFactory();
recursiveDelete(fsf->create(m_tempPath));
}
- void recursiveDelete(vmime::ref <vmime::utility::file> dir)
+ void recursiveDelete(vmime::shared_ptr <vmime::utility::file> dir)
{
if (!dir->exists() || !dir->isDirectory())
return;
- vmime::ref <vmime::utility::fileIterator> files = dir->getFiles();
+ vmime::shared_ptr <vmime::utility::fileIterator> files = dir->getFiles();
// First, delete files and subdirectories in this directory
while (files->hasMoreElements())
{
- vmime::ref <vmime::utility::file> file = files->nextElement();
+ vmime::shared_ptr <vmime::utility::file> file = files->nextElement();
if (file->isDirectory())
{
diff --git a/tests/net/pop3/POP3CommandTest.cpp b/tests/net/pop3/POP3CommandTest.cpp
index 14c92be4..4733c96b 100644
--- a/tests/net/pop3/POP3CommandTest.cpp
+++ b/tests/net/pop3/POP3CommandTest.cpp
@@ -59,7 +59,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testCreateCommand()
{
- vmime::ref <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND", cmd->getText());
@@ -67,7 +67,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testCreateCommandParams()
{
- vmime::ref <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND param1 param2", cmd->getText());
@@ -75,7 +75,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testCAPA()
{
- vmime::ref <POP3Command> cmd = POP3Command::CAPA();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::CAPA();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "CAPA", cmd->getText());
@@ -83,7 +83,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testNOOP()
{
- vmime::ref <POP3Command> cmd = POP3Command::NOOP();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::NOOP();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "NOOP", cmd->getText());
@@ -91,7 +91,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testAUTH()
{
- vmime::ref <POP3Command> cmd = POP3Command::AUTH("saslmechanism");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::AUTH("saslmechanism");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "AUTH saslmechanism", cmd->getText());
@@ -99,7 +99,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testSTLS()
{
- vmime::ref <POP3Command> cmd = POP3Command::STLS();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::STLS();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "STLS", cmd->getText());
@@ -107,7 +107,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testAPOP()
{
- vmime::ref <POP3Command> cmd = POP3Command::APOP("user", "digest");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::APOP("user", "digest");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "APOP user digest", cmd->getText());
@@ -115,7 +115,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testUSER()
{
- vmime::ref <POP3Command> cmd = POP3Command::USER("user");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::USER("user");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "USER user", cmd->getText());
@@ -123,7 +123,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testPASS()
{
- vmime::ref <POP3Command> cmd = POP3Command::PASS("pass");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::PASS("pass");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "PASS pass", cmd->getText());
@@ -131,7 +131,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testSTAT()
{
- vmime::ref <POP3Command> cmd = POP3Command::STAT();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::STAT();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "STAT", cmd->getText());
@@ -139,7 +139,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testLIST()
{
- vmime::ref <POP3Command> cmd = POP3Command::LIST();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::LIST();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "LIST", cmd->getText());
@@ -147,7 +147,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testLISTMessage()
{
- vmime::ref <POP3Command> cmd = POP3Command::LIST(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::LIST(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "LIST 42", cmd->getText());
@@ -155,7 +155,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testUIDL()
{
- vmime::ref <POP3Command> cmd = POP3Command::UIDL();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::UIDL();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "UIDL", cmd->getText());
@@ -163,7 +163,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testUIDLMessage()
{
- vmime::ref <POP3Command> cmd = POP3Command::UIDL(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::UIDL(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "UIDL 42", cmd->getText());
@@ -171,7 +171,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testDELE()
{
- vmime::ref <POP3Command> cmd = POP3Command::DELE(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::DELE(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "DELE 42", cmd->getText());
@@ -179,7 +179,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testRETR()
{
- vmime::ref <POP3Command> cmd = POP3Command::RETR(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::RETR(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RETR 42", cmd->getText());
@@ -187,7 +187,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testTOP()
{
- vmime::ref <POP3Command> cmd = POP3Command::TOP(42, 567);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::TOP(42, 567);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "TOP 42 567", cmd->getText());
@@ -195,7 +195,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testRSET()
{
- vmime::ref <POP3Command> cmd = POP3Command::RSET();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::RSET();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RSET", cmd->getText());
@@ -203,7 +203,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testQUIT()
{
- vmime::ref <POP3Command> cmd = POP3Command::QUIT();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::QUIT();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "QUIT", cmd->getText());
@@ -211,11 +211,12 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testWriteToSocket()
{
- vmime::ref <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (sok.dynamicCast <vmime::net::socket>(), vmime::null);
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(sok),
+ vmime::shared_ptr <vmime::net::timeoutHandler>());
cmd->send(conn);
diff --git a/tests/net/pop3/POP3ResponseTest.cpp b/tests/net/pop3/POP3ResponseTest.cpp
index f1fbcd54..2d3b3d32 100644
--- a/tests/net/pop3/POP3ResponseTest.cpp
+++ b/tests/net/pop3/POP3ResponseTest.cpp
@@ -47,15 +47,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseOK()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -67,15 +67,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseERR()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("-ERR Response Text\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_ERR, resp->getCode());
@@ -87,15 +87,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseReady()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+ challenge_string\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_READY, resp->getCode());
@@ -107,15 +107,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseInvalid()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("Invalid Response Text\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_ERR, resp->getCode());
@@ -127,15 +127,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseLF()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response terminated by LF\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -147,18 +147,18 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testMultiLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\r\n");
socket->localSend("Line 1\r\n");
socket->localSend("Line 2\r\n");
socket->localSend(".\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readMultilineResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -172,18 +172,18 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testMultiLineResponseLF()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\n");
socket->localSend("Line 1\n");
socket->localSend("Line 2\n");
socket->localSend(".\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readMultilineResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -202,11 +202,11 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
for (unsigned int i = 0 ; i < 5000 ; ++i)
data << "VMIME.VMIME\nVMIME\r\nVMIME_VMIME";
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Large Response Follows\n");
socket->localSend(data.str());
@@ -215,7 +215,7 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
vmime::string receivedData;
vmime::utility::outputStreamStringAdapter receivedDataStream(receivedData);
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readLargeResponse(conn, receivedDataStream, NULL, 0);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
diff --git a/tests/net/pop3/POP3StoreTest.cpp b/tests/net/pop3/POP3StoreTest.cpp
index d938f472..5517f770 100644
--- a/tests/net/pop3/POP3StoreTest.cpp
+++ b/tests/net/pop3/POP3StoreTest.cpp
@@ -39,29 +39,29 @@ VMIME_TEST_SUITE_BEGIN(POP3StoreTest)
void testCreateFromURL()
{
- vmime::ref <vmime::net::session> sess
- = vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> sess
+ = vmime::make_shared <vmime::net::session>();
// POP3
vmime::utility::url url("pop3://pop3.vmime.org");
- vmime::ref <vmime::net::store> store = sess->getStore(url);
+ vmime::shared_ptr <vmime::net::store> store = sess->getStore(url);
VASSERT_TRUE("pop3", typeid(*store) == typeid(vmime::net::pop3::POP3Store));
// POP3S
vmime::utility::url url2("pop3s://pop3s.vmime.org");
- vmime::ref <vmime::net::store> store2 = sess->getStore(url2);
+ vmime::shared_ptr <vmime::net::store> store2 = sess->getStore(url2);
VASSERT_TRUE("pop3s", typeid(*store2) == typeid(vmime::net::pop3::POP3SStore));
}
void testConnectToInvalidServer()
{
- vmime::ref <vmime::net::session> sess
- = vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> sess
+ = vmime::make_shared <vmime::net::session>();
vmime::utility::url url("pop3://invalid-pop3-server");
- vmime::ref <vmime::net::store> store = sess->getStore(url);
+ vmime::shared_ptr <vmime::net::store> store = sess->getStore(url);
VASSERT_THROW("connect", store->connect(), vmime::exceptions::connection_error);
}
diff --git a/tests/net/pop3/POP3TestUtils.hpp b/tests/net/pop3/POP3TestUtils.hpp
index 26b6601a..1c6e8935 100644
--- a/tests/net/pop3/POP3TestUtils.hpp
+++ b/tests/net/pop3/POP3TestUtils.hpp
@@ -29,25 +29,26 @@ class POP3ConnectionTest : public vmime::net::pop3::POP3Connection
{
public:
- POP3ConnectionTest(vmime::ref <vmime::net::socket> socket,
- vmime::ref <vmime::net::timeoutHandler> timeoutHandler)
- : POP3Connection(NULL, NULL),
+ POP3ConnectionTest(vmime::shared_ptr <vmime::net::socket> socket,
+ vmime::shared_ptr <vmime::net::timeoutHandler> timeoutHandler)
+ : POP3Connection(vmime::shared_ptr <vmime::net::pop3::POP3Store>(),
+ vmime::shared_ptr <vmime::security::authenticator>()),
m_socket(socket), m_timeoutHandler(timeoutHandler)
{
}
- vmime::ref <vmime::net::socket> getSocket()
+ vmime::shared_ptr <vmime::net::socket> getSocket()
{
return m_socket;
}
- vmime::ref <vmime::net::timeoutHandler> getTimeoutHandler()
+ vmime::shared_ptr <vmime::net::timeoutHandler> getTimeoutHandler()
{
return m_timeoutHandler;
}
private:
- vmime::ref <vmime::net::socket> m_socket;
- vmime::ref <vmime::net::timeoutHandler> m_timeoutHandler;
+ vmime::shared_ptr <vmime::net::socket> m_socket;
+ vmime::shared_ptr <vmime::net::timeoutHandler> m_timeoutHandler;
};
diff --git a/tests/net/pop3/POP3UtilsTest.cpp b/tests/net/pop3/POP3UtilsTest.cpp
index 9d443ddb..55a99806 100644
--- a/tests/net/pop3/POP3UtilsTest.cpp
+++ b/tests/net/pop3/POP3UtilsTest.cpp
@@ -41,11 +41,11 @@ VMIME_TEST_SUITE_BEGIN(POP3UtilsTest)
void testParseMultiListOrUidlResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\r\n");
socket->localSend("1 abcdef\r\n");
@@ -55,7 +55,7 @@ VMIME_TEST_SUITE_BEGIN(POP3UtilsTest)
socket->localSend("8 yz \r\n");
socket->localSend(".\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readMultilineResponse(conn);
std::map <int, vmime::string> result;
diff --git a/tests/net/smtp/SMTPCommandSetTest.cpp b/tests/net/smtp/SMTPCommandSetTest.cpp
index 0cf4b03b..af250078 100644
--- a/tests/net/smtp/SMTPCommandSetTest.cpp
+++ b/tests/net/smtp/SMTPCommandSetTest.cpp
@@ -46,7 +46,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testCreate()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
VASSERT_NOT_NULL("Not null", cset);
VASSERT_FALSE("Finished", cset->isFinished());
@@ -54,7 +54,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testCreatePipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
VASSERT_NOT_NULL("Not null", cset);
VASSERT_FALSE("Finished", cset->isFinished());
@@ -62,14 +62,14 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testAddCommand()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
VASSERT_NO_THROW("No throw 1", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1")));
VASSERT_EQ("Text", "MY_COMMAND1\r\n", cset->getText());
VASSERT_NO_THROW("No throw 2", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2")));
VASSERT_EQ("Text", "MY_COMMAND1\r\nMY_COMMAND2\r\n", cset->getText());
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cset->writeToSocket(sok);
VASSERT_FALSE("Finished", cset->isFinished());
@@ -83,14 +83,14 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testAddCommandPipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
VASSERT_NO_THROW("No throw 1", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1")));
VASSERT_EQ("Text", "MY_COMMAND1\r\n", cset->getText());
VASSERT_NO_THROW("No throw 2", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2")));
VASSERT_EQ("Text", "MY_COMMAND1\r\nMY_COMMAND2\r\n", cset->getText());
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
vmime::string response;
cset->writeToSocket(sok);
@@ -105,12 +105,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testWriteToSocket()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
vmime::string response;
cset->writeToSocket(sok);
@@ -126,12 +126,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testWriteToSocketPipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
vmime::string response;
cset->writeToSocket(sok);
@@ -142,12 +142,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testGetLastCommandSent()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cset->writeToSocket(sok);
VASSERT_EQ("Cmd 1", "MY_COMMAND1", cset->getLastCommandSent()->getText());
@@ -158,12 +158,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testGetLastCommandSentPipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cset->writeToSocket(sok);
VASSERT_EQ("Cmd 1", "MY_COMMAND1", cset->getLastCommandSent()->getText());
diff --git a/tests/net/smtp/SMTPCommandTest.cpp b/tests/net/smtp/SMTPCommandTest.cpp
index 9a2c90fc..6d466865 100644
--- a/tests/net/smtp/SMTPCommandTest.cpp
+++ b/tests/net/smtp/SMTPCommandTest.cpp
@@ -57,7 +57,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testCreateCommand()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND", cmd->getText());
@@ -65,7 +65,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testCreateCommandParams()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND param1 param2", cmd->getText());
@@ -73,7 +73,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testHELO()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::HELO("hostname");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::HELO("hostname");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "HELO hostname", cmd->getText());
@@ -81,7 +81,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testEHLO()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::EHLO("hostname");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::EHLO("hostname");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "EHLO hostname", cmd->getText());
@@ -89,7 +89,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testAUTH()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::AUTH("saslmechanism");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::AUTH("saslmechanism");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "AUTH saslmechanism", cmd->getText());
@@ -97,7 +97,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testSTARTTLS()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::STARTTLS();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::STARTTLS();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "STARTTLS", cmd->getText());
@@ -105,7 +105,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL(vmime::mailbox("[email protected]"), false);
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL(vmime::mailbox("[email protected]"), false);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MAIL FROM:<[email protected]>", cmd->getText());
@@ -113,7 +113,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_Encoded()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), false);
VASSERT_NOT_NULL("Not null", cmd);
@@ -122,7 +122,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_UTF8()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), true);
VASSERT_NOT_NULL("Not null", cmd);
@@ -131,7 +131,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_SIZE()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox("[email protected]"), false, 123456789);
VASSERT_NOT_NULL("Not null", cmd);
@@ -140,7 +140,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_SIZE_UTF8()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), true, 123456789);
VASSERT_NOT_NULL("Not null", cmd);
@@ -149,7 +149,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRCPT()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RCPT(vmime::mailbox("[email protected]"), false);
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RCPT(vmime::mailbox("[email protected]"), false);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RCPT TO:<[email protected]>", cmd->getText());
@@ -157,7 +157,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRCPT_Encoded()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RCPT
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RCPT
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), false);
VASSERT_NOT_NULL("Not null", cmd);
@@ -166,7 +166,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRCPT_UTF8()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RCPT
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RCPT
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), true);
VASSERT_NOT_NULL("Not null", cmd);
@@ -175,7 +175,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRSET()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RSET();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RSET();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RSET", cmd->getText());
@@ -183,7 +183,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testDATA()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::DATA();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::DATA();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "DATA", cmd->getText());
@@ -191,12 +191,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testBDAT()
{
- vmime::ref <SMTPCommand> cmd1 = SMTPCommand::BDAT(12345, false);
+ vmime::shared_ptr <SMTPCommand> cmd1 = SMTPCommand::BDAT(12345, false);
VASSERT_NOT_NULL("Not null", cmd1);
VASSERT_EQ("Text", "BDAT 12345", cmd1->getText());
- vmime::ref <SMTPCommand> cmd2 = SMTPCommand::BDAT(67890, true);
+ vmime::shared_ptr <SMTPCommand> cmd2 = SMTPCommand::BDAT(67890, true);
VASSERT_NOT_NULL("Not null", cmd2);
VASSERT_EQ("Text", "BDAT 67890 LAST", cmd2->getText());
@@ -204,7 +204,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testNOOP()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::NOOP();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::NOOP();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "NOOP", cmd->getText());
@@ -212,7 +212,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testQUIT()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::QUIT();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::QUIT();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "QUIT", cmd->getText());
@@ -220,9 +220,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testWriteToSocket()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cmd->writeToSocket(sok);
vmime::string response;
diff --git a/tests/net/smtp/SMTPResponseTest.cpp b/tests/net/smtp/SMTPResponseTest.cpp
index 5e75b6a7..352f46c2 100644
--- a/tests/net/smtp/SMTPResponseTest.cpp
+++ b/tests/net/smtp/SMTPResponseTest.cpp
@@ -43,15 +43,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testSingleLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("123 Response Text\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 123, resp->getCode());
@@ -61,15 +61,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testSingleLineResponseLF()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("123 Response Text\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 123, resp->getCode());
@@ -79,9 +79,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testMultiLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend
(
@@ -91,7 +91,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 123, resp->getCode());
@@ -107,9 +107,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testMultiLineResponseDifferentCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend
(
@@ -119,7 +119,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 0, resp->getCode());
@@ -135,9 +135,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testIncompleteMultiLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>(1);
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>(1);
socket->localSend
(
@@ -155,9 +155,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testNoResponseText()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>(1);
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>(1);
socket->localSend
(
@@ -166,7 +166,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 250, resp->getCode());
@@ -176,15 +176,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testEnhancedStatusCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("250 2.1.5 OK fu13sm4720601wic.7 - gsmtp\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 250, resp->getCode());
@@ -197,15 +197,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testNoEnhancedStatusCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("354 Go ahead fu13sm4720601wic.7 - gsmtp\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 354, resp->getCode());
@@ -218,15 +218,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testInvalidEnhancedStatusCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("250 4.2 xxx\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 250, resp->getCode());
diff --git a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportTest.cpp
index 13c18309..5997588e 100644
--- a/tests/net/smtp/SMTPTransportTest.cpp
+++ b/tests/net/smtp/SMTPTransportTest.cpp
@@ -44,25 +44,25 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testConnectToInvalidServer()
{
- vmime::ref <vmime::net::session> sess
- = vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> sess
+ = vmime::make_shared <vmime::net::session>();
vmime::utility::url url("smtp://invalid-smtp-server");
- vmime::ref <vmime::net::transport> store = sess->getTransport(url);
+ vmime::shared_ptr <vmime::net::transport> store = sess->getTransport(url);
VASSERT_THROW("connect", store->connect(), vmime::exceptions::connection_error);
}
void testGreetingError()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <greetingErrorSMTPTestSocket> >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <greetingErrorSMTPTestSocket> >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
VASSERT_THROW("Connection", tr->connect(),
vmime::exceptions::connection_greeting_error);
@@ -70,23 +70,23 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testMAILandRCPT()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <MAILandRCPTSMTPTestSocket> >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <MAILandRCPTSMTPTestSocket> >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
VASSERT_NO_THROW("Connection", tr->connect());
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
vmime::string data("Message data");
vmime::utility::inputStreamStringAdapter is(data);
@@ -96,52 +96,52 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testChunking()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <chunkingSMTPTestSocket> >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <chunkingSMTPTestSocket> >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
tr->connect();
VASSERT("Test server should report it supports the CHUNKING extension!",
- tr.dynamicCast <vmime::net::smtp::SMTPTransport>()->getConnection()->hasExtension("CHUNKING"));
+ vmime::dynamicCast <vmime::net::smtp::SMTPTransport>(tr)->getConnection()->hasExtension("CHUNKING"));
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
- vmime::ref <vmime::message> msg = vmime::create <SMTPTestMessage>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <SMTPTestMessage>();
tr->send(msg, exp, recips);
}
void testSize_Chunking()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <bigMessageSMTPTestSocket <true> > >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <bigMessageSMTPTestSocket <true> > >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
tr->connect();
VASSERT("Test server should report it supports the SIZE extension!",
- tr.dynamicCast <vmime::net::smtp::SMTPTransport>()->getConnection()->hasExtension("SIZE"));
+ vmime::dynamicCast <vmime::net::smtp::SMTPTransport>(tr)->getConnection()->hasExtension("SIZE"));
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
- vmime::ref <vmime::message> msg = vmime::create <SMTPBigTestMessage4MB>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <SMTPBigTestMessage4MB>();
VASSERT_THROW("Connection", tr->send(msg, exp, recips),
vmime::net::smtp::SMTPMessageSizeExceedsMaxLimitsException);
@@ -149,26 +149,26 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testSize_NoChunking()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <bigMessageSMTPTestSocket <false> > >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <bigMessageSMTPTestSocket <false> > >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
tr->connect();
VASSERT("Test server should report it supports the SIZE extension!",
- tr.dynamicCast <vmime::net::smtp::SMTPTransport>()->getConnection()->hasExtension("SIZE"));
+ vmime::dynamicCast <vmime::net::smtp::SMTPTransport>(tr)->getConnection()->hasExtension("SIZE"));
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
- vmime::ref <vmime::message> msg = vmime::create <SMTPBigTestMessage4MB>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <SMTPBigTestMessage4MB>();
VASSERT_THROW("Connection", tr->send(msg, exp, recips),
vmime::net::smtp::SMTPMessageSizeExceedsMaxLimitsException);
diff --git a/tests/net/smtp/SMTPTransportTestUtils.hpp b/tests/net/smtp/SMTPTransportTestUtils.hpp
index b74f9783..dd7afeb5 100644
--- a/tests/net/smtp/SMTPTransportTestUtils.hpp
+++ b/tests/net/smtp/SMTPTransportTestUtils.hpp
@@ -410,7 +410,7 @@ public:
vmime::utility::stream::size_type getChunkBufferSize() const
{
- static vmime::net::smtp::SMTPChunkingOutputStreamAdapter chunkStream(NULL);
+ static vmime::net::smtp::SMTPChunkingOutputStreamAdapter chunkStream(vmime::null);
return chunkStream.getBlockSize();
}
@@ -456,13 +456,11 @@ public:
bigMessageSMTPTestSocket()
{
m_state = STATE_NOT_CONNECTED;
- m_bdatChunkCount = 0;
m_ehloSent = m_mailSent = m_rcptSent = m_quitSent = false;
}
~bigMessageSMTPTestSocket()
{
- VASSERT_EQ("BDAT chunk count", 3, m_bdatChunkCount);
VASSERT("Client must send the QUIT command", m_quitSent);
}
@@ -476,22 +474,6 @@ public:
void onDataReceived()
{
- if (m_state == STATE_DATA)
- {
- if (m_bdatChunkReceived != m_bdatChunkSize)
- {
- const size_type remaining = m_bdatChunkSize - m_bdatChunkReceived;
- const size_type received = localReceiveRaw(NULL, remaining);
-
- m_bdatChunkReceived += received;
- }
-
- if (m_bdatChunkReceived == m_bdatChunkSize)
- {
- m_state = STATE_COMMAND;
- }
- }
-
processCommand();
}
@@ -584,8 +566,6 @@ private:
};
int m_state;
- int m_bdatChunkCount;
- int m_bdatChunkSize, m_bdatChunkReceived;
bool m_ehloSent, m_mailSent, m_rcptSent, m_quitSent;
};