diff options
author | Tobias Markmann <tm@ayena.de> | 2012-10-08 21:59:42 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2012-10-08 22:04:15 (GMT) |
commit | 8f75cf3d9892a3ce2c58537f29c851392231e29c (patch) | |
tree | 5239ce98c3e24780ba46d328f383c90cb84b35c7 /Swiften/Parser/PayloadParsers/UnitTest | |
parent | 53b7a6ad2d12fc5edc6a98726cabf1ea0b496505 (diff) | |
download | swift-contrib-8f75cf3d9892a3ce2c58537f29c851392231e29c.zip swift-contrib-8f75cf3d9892a3ce2c58537f29c851392231e29c.tar.bz2 |
Update XEP-0234 implementation to version 0.15 of the standard.tobias/jingle
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp index 8719a5d..95423c1 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp @@ -35,9 +35,9 @@ class JingleParserTest : public CppUnit::TestFixture { CPPUNIT_TEST(testParse_Xep0234_Example3); CPPUNIT_TEST(testParse_Xep0234_Example5); CPPUNIT_TEST(testParse_Xep0234_Example8); - CPPUNIT_TEST(testParse_Xep0234_Example10); - CPPUNIT_TEST(testParse_Xep0234_Example11); CPPUNIT_TEST(testParse_Xep0234_Example12); + CPPUNIT_TEST(testParse_Xep0234_Example13); + CPPUNIT_TEST(testParse_Xep0234_Example14); CPPUNIT_TEST(testParse_Xep0260_Example1); CPPUNIT_TEST(testParse_Xep0260_Example3); @@ -229,13 +229,13 @@ class JingleParserTest : public CppUnit::TestFixture { " <content creator='initiator' name='a-file-offer'>\n" " <description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>\n" " <offer>\n" - " <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'\n" - " date='1969-07-21T02:56:15Z'\n" - " hash='552da749930852c69ae5d2141d3766b1'\n" - " name='test.txt'\n" - " size='1022'>\n" + " <file>\n" + " <date>1969-07-21T02:56:15Z</date>\n" " <desc>This is a test. If this were a real file...</desc>\n" + "............<name>test.txt</name>\n" " <range/>\n" + " <size>1022</size>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>\n" " </file>\n" " </offer>\n" " </description>\n" @@ -271,7 +271,7 @@ class JingleParserTest : public CppUnit::TestFixture { JingleFileTransferDescription::ref description = contents[0]->getDescription<JingleFileTransferDescription>(); - std::vector<StreamInitiationFileInfo> offers = description->getOffers(); + std::vector<JingleFileTransferFileInfo> offers = description->getOffers(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), offers.size()); CPPUNIT_ASSERT_EQUAL(std::string("test.txt"), offers[0].getName()); CPPUNIT_ASSERT_EQUAL(std::string("552da749930852c69ae5d2141d3766b1"), offers[0].getHash()); @@ -279,7 +279,7 @@ class JingleParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("This is a test. If this were a real file..."), offers[0].getDescription()); CPPUNIT_ASSERT_EQUAL(true, offers[0].getSupportsRangeRequests()); CPPUNIT_ASSERT(stringToDateTime("1969-07-21T02:56:15Z") == offers[0].getDate()); - CPPUNIT_ASSERT_EQUAL(std::string("md5"), offers[0].getAlgo()); + CPPUNIT_ASSERT_EQUAL(std::string("sha-1"), offers[0].getAlgo()); } // http://xmpp.org/extensions/xep-0234.html#example-3 @@ -293,14 +293,14 @@ class JingleParserTest : public CppUnit::TestFixture { " <content creator='initiator' name='a-file-offer'>\n" " <description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>\n" " <offer>\n" - " <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'\n" - " name='test.txt'\n" - " size='1022'\n" - " hash='552da749930852c69ae5d2141d3766b1'\n" - " date='1969-07-21T02:56:15Z'>\n" - " <desc>This is a test. If this were a real file...</desc>\n" - " <range/>\n" - " </file>\n" + " <file>\n" + " <date>1969-07-21T02:56:15Z</date>\n" + " <desc>This is a test. If this were a real file...</desc>\n" + "............<name>test.txt</name>\n" + " <range/>\n" + " <size>1022</size>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>\n" + " </file>\n" " </offer>\n" " </description>\n" " <transport xmlns='urn:xmpp:jingle:transports:s5b:1'\n" @@ -341,7 +341,7 @@ class JingleParserTest : public CppUnit::TestFixture { JingleFileTransferDescription::ref description = contents[0]->getDescription<JingleFileTransferDescription>(); - std::vector<StreamInitiationFileInfo> offers = description->getOffers(); + std::vector<JingleFileTransferFileInfo> offers = description->getOffers(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), offers.size()); CPPUNIT_ASSERT_EQUAL(std::string("test.txt"), offers[0].getName()); CPPUNIT_ASSERT_EQUAL(std::string("552da749930852c69ae5d2141d3766b1"), offers[0].getHash()); @@ -349,7 +349,7 @@ class JingleParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("This is a test. If this were a real file..."), offers[0].getDescription()); CPPUNIT_ASSERT_EQUAL(true, offers[0].getSupportsRangeRequests()); CPPUNIT_ASSERT(stringToDateTime("1969-07-21T02:56:15Z") == offers[0].getDate()); - CPPUNIT_ASSERT_EQUAL(std::string("md5"), offers[0].getAlgo()); + CPPUNIT_ASSERT_EQUAL(std::string("sha-1"), offers[0].getAlgo()); } // http://xmpp.org/extensions/xep-0234.html#example-5 @@ -395,9 +395,7 @@ class JingleParserTest : public CppUnit::TestFixture { " sid='a73sjjvkla37jfea'>\n" " <checksum xmlns='urn:xmpp:jingle:apps:file-transfer:3'>\n" " <file>\n" - " <hashes xmlns='urn:xmpp:hashes:0'>\n" - " <hash algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>\n" - " </hashes>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>\n" " </file>\n" " </checksum>\n" "</jingle>\n" @@ -414,8 +412,8 @@ class JingleParserTest : public CppUnit::TestFixture { } - // http://xmpp.org/extensions/xep-0234.html#example-10 - void testParse_Xep0234_Example10() { + // http://xmpp.org/extensions/xep-0234.html#example-12 + void testParse_Xep0234_Example12() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse( "<jingle xmlns='urn:xmpp:jingle:1'\n" @@ -425,9 +423,9 @@ class JingleParserTest : public CppUnit::TestFixture { " <content creator='initiator' name='a-file-request'>\n" " <description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>\n" " <request>\n" - " <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'\n" - " hash='552da749930852c69ae5d2141d3766b1'>\n" + " <file>\n" " <range offset='270336'/>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>\n" " </file>\n" " </request>\n" " </description>\n" @@ -466,14 +464,14 @@ class JingleParserTest : public CppUnit::TestFixture { JingleContentPayload::ref content = jingle->getPayload<JingleContentPayload>(); CPPUNIT_ASSERT(content); - StreamInitiationFileInfo file = content->getDescription<JingleFileTransferDescription>()->getRequests()[0]; + JingleFileTransferFileInfo file = content->getDescription<JingleFileTransferDescription>()->getRequests()[0]; CPPUNIT_ASSERT_EQUAL(std::string("552da749930852c69ae5d2141d3766b1"), file.getHash()); CPPUNIT_ASSERT_EQUAL(static_cast<boost::uintmax_t>(270336), file.getRangeOffset()); CPPUNIT_ASSERT_EQUAL(true, file.getSupportsRangeRequests()); } - // http://xmpp.org/extensions/xep-0234.html#example-11 - void testParse_Xep0234_Example11() { + // http://xmpp.org/extensions/xep-0234.html#example-13 + void testParse_Xep0234_Example13() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse( "<jingle xmlns='urn:xmpp:jingle:1'\n" @@ -483,21 +481,24 @@ class JingleParserTest : public CppUnit::TestFixture { " <content creator='initiator' name='a-file-offer'>\n" " <description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>\n" " <offer>\n" - " <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'\n" - " date='2011-06-01T15:58:15Z'\n" - " hash='a749930852c69ae5d2141d3766b1552d'\n" - " name='somefile.txt'\n" - " size='1234'/>\n" - " <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'\n" - " date='2011-06-01T15:58:15Z'\n" - " hash='930852c69ae5d2141d3766b1552da749'\n" - " name='anotherfile.txt'\n" - " size='2345'/>\n" - " <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'\n" - " date='2011-06-01T15:58:15Z'\n" - " hash='52c69ae5d2141d3766b1552da7499308'\n" - " name='yetanotherfile.txt'\n" - " size='3456'/>\n" + " <file>\n" + " <date>2011-06-01T15:58:15Z</date>\n" + " <name>somefile.txt</name>\n" + " <size>1234</size>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>a749930852c69ae5d2141d3766b1552d</hash>\n" + " </file>\n" + " <file>\n" + " <date>2011-06-01T15:58:15Z</date>\n" + " <name>somefile.txt</name>\n" + " <size>2345</size>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>a749930852c69ae5d2141d3766b1552d</hash>\n" + " </file>\n" + " <file>\n" + " <date>2011-06-01T15:58:15Z</date>\n" + " <name>yetanotherfile.txt</name>\n" + " <size>3456</size>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>52c69ae5d2141d3766b1552da7499308</hash>\n" + " </file>\n" " </offer>\n" " </description>\n" " <transport xmlns='urn:xmpp:jingle:transports:s5b:1'\n" @@ -531,12 +532,12 @@ class JingleParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(JingleContentPayload::InitiatorCreator, content->getCreator()); CPPUNIT_ASSERT_EQUAL(std::string("a-file-offer"), content->getName()); - std::vector<StreamInitiationFileInfo> offers = content->getDescription<JingleFileTransferDescription>()->getOffers(); + std::vector<JingleFileTransferFileInfo> offers = content->getDescription<JingleFileTransferDescription>()->getOffers(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), offers.size()); } - // http://xmpp.org/extensions/xep-0234.html#example-12 - void testParse_Xep0234_Example12() { + // http://xmpp.org/extensions/xep-0234.html#example-14 + void testParse_Xep0234_Example14() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse( "<jingle xmlns='urn:xmpp:jingle:1'\n" @@ -544,8 +545,9 @@ class JingleParserTest : public CppUnit::TestFixture { " initiator='romeo@montague.lit/orchard'\n" " sid='a73sjjvkla37jfea'>\n" " <received xmlns='urn:xmpp:jingle:apps:file-transfer:3'>\n" - " <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'\n" - " hash='a749930852c69ae5d2141d3766b1552d'/>\n" + " <file>\n" + " <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>a749930852c69ae5d2141d3766b1552d</hash>\n" + "....</file>" " </received>\n" "</jingle>\n" )); |