mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-22 21:58:08 +00:00
Fixed Content Manager tester
This commit is contained in:
parent
707d9b6a43
commit
acf44578ad
1 changed files with 77 additions and 3 deletions
|
|
@ -27,7 +27,7 @@
|
|||
using namespace LinphonePrivate;
|
||||
using namespace std;
|
||||
|
||||
static const char* multipart = \
|
||||
static const char* source_multipart = \
|
||||
"-----------------------------14737809831466499882746641449\r\n" \
|
||||
"Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n\r\n" \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" \
|
||||
|
|
@ -95,6 +95,78 @@ static const char* multipart = \
|
|||
"</presence>" \
|
||||
"-----------------------------14737809831466499882746641449--\r\n";
|
||||
|
||||
static const char* generated_multipart = \
|
||||
"-----------------------------14737809831466499882746641449\r\n" \
|
||||
"Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n\r\n" \
|
||||
"Content-Length:582" \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" \
|
||||
"<list xmlns=\"urn:ietf:params:xml:ns:rlmi\" fullState=\"false\" uri=\"sip:rls@sip.linphone.org\" version=\"1\">" \
|
||||
" <resource uri=\"sip:+YYYYYYYYYY@sip.linphone.org;user=phone\">" \
|
||||
" <instance cid=\"LO3VOS4@sip.linphone.org\" id=\"1\" state=\"active\"/>" \
|
||||
" </resource>" \
|
||||
" <resource uri=\"sip:+XXXXXXXXXX@sip.linphone.org;user=phone\">" \
|
||||
" <instance cid=\"5v6tTNM@sip.linphone.org\" id=\"1\" state=\"active\"/>" \
|
||||
" </resource>" \
|
||||
" <resource uri=\"sip:+ZZZZZZZZZZ@sip.linphone.org;user=phone\">" \
|
||||
" <instance cid=\"P2WAj~Y@sip.linphone.org\" id=\"1\" state=\"active\"/>" \
|
||||
" </resource>" \
|
||||
"</list>" \
|
||||
"-----------------------------14737809831466499882746641449\r\n" \
|
||||
"Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n\r\n" \
|
||||
"Content-Length:561" \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" \
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" entity=\"sip:+YYYYYYYYYY@sip.linphone.org;user=phone\" xmlns:p1=\"urn:ietf:params:xml:ns:pidf:data-model\">" \
|
||||
" <tuple id=\"qmht-9\">" \
|
||||
" <status>" \
|
||||
" <basic>open</basic>" \
|
||||
" </status>" \
|
||||
" <contact>sip:+YYYYYYYYYY@sip.linphone.org;user=phone</contact>" \
|
||||
" <timestamp>2017-10-25T13:18:26</timestamp>" \
|
||||
" </tuple>" \
|
||||
" <p1:person id=\"sip:+YYYYYYYYYY@sip.linphone.org;user=phone\" xmlns:p2=\"urn:ietf:params:xml:ns:pidf:rpid\">" \
|
||||
" <p2:activities>" \
|
||||
" <p2:away/>" \
|
||||
" </p2:activities>" \
|
||||
" </p1:person>" \
|
||||
"</presence>" \
|
||||
"-----------------------------14737809831466499882746641449\r\n" \
|
||||
"Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n\r\n" \
|
||||
"Content-Length:561" \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" \
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" entity=\"sip:+XXXXXXXXXX@sip.linphone.org;user=phone\" xmlns:p1=\"urn:ietf:params:xml:ns:pidf:data-model\">" \
|
||||
" <tuple id=\"szohvt\">" \
|
||||
" <status>" \
|
||||
" <basic>open</basic>" \
|
||||
" </status>" \
|
||||
" <contact>sip:+XXXXXXXXXX@sip.linphone.org;user=phone</contact>" \
|
||||
" <timestamp>2017-10-25T13:18:26</timestamp>" \
|
||||
" </tuple>" \
|
||||
" <p1:person id=\"sip:+XXXXXXXXXX@sip.linphone.org;user=phone\" xmlns:p2=\"urn:ietf:params:xml:ns:pidf:rpid\">" \
|
||||
" <p2:activities>" \
|
||||
" <p2:away/>" \
|
||||
" </p2:activities>" \
|
||||
" </p1:person>" \
|
||||
"</presence>" \
|
||||
"-----------------------------14737809831466499882746641449\r\n" \
|
||||
"Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n\r\n" \
|
||||
"Content-Length:546" \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" \
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" entity=\"sip:+ZZZZZZZZZZ@sip.linphone.org;user=phone\" xmlns:p1=\"urn:ietf:params:xml:ns:pidf:data-model\">" \
|
||||
" <tuple id=\"oc3e08\">" \
|
||||
" <status>" \
|
||||
" <basic>open</basic>" \
|
||||
" </status>" \
|
||||
" <contact>sip:someone@sip.linphone.org</contact>" \
|
||||
" <timestamp>2017-10-25T13:18:26</timestamp>" \
|
||||
" </tuple>" \
|
||||
" <p1:person id=\"sip:+ZZZZZZZZZZ@sip.linphone.org;user=phone\" xmlns:p2=\"urn:ietf:params:xml:ns:pidf:rpid\">" \
|
||||
" <p2:activities>" \
|
||||
" <p2:away/>" \
|
||||
" </p2:activities>" \
|
||||
" </p1:person>" \
|
||||
"</presence>" \
|
||||
"-----------------------------14737809831466499882746641449--\r\n";
|
||||
|
||||
static const char* part1 = \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>" \
|
||||
"<list xmlns=\"urn:ietf:params:xml:ns:rlmi\" fullState=\"false\" uri=\"sip:rls@sip.linphone.org\" version=\"1\">" \
|
||||
|
|
@ -162,7 +234,7 @@ static const char* part4 = \
|
|||
|
||||
void multipart_to_list () {
|
||||
Content multipartContent;
|
||||
multipartContent.setBody(multipart);
|
||||
multipartContent.setBody(source_multipart);
|
||||
multipartContent.setContentType(ContentType("multipart", "related"));
|
||||
|
||||
list<Content> contents = ContentManager::multipartToContentList(multipartContent);
|
||||
|
|
@ -246,6 +318,8 @@ void list_to_multipart () {
|
|||
Content content1;
|
||||
content1.setBody(part1);
|
||||
content1.setContentType(contentType);
|
||||
contentType = ContentType("application", "pidf+xml");
|
||||
contentType.addParameter("charset", "\"UTF-8\"");
|
||||
Content content2;
|
||||
content2.setBody(part2);
|
||||
content2.setContentType(contentType);
|
||||
|
|
@ -258,7 +332,7 @@ void list_to_multipart () {
|
|||
list<Content *> contents = {&content1, &content2, &content3, &content4};
|
||||
|
||||
Content multipartContent = ContentManager::contentListToMultipart(contents);
|
||||
string originalStr(multipart);
|
||||
string originalStr(generated_multipart);
|
||||
originalStr.erase(std::remove(originalStr.begin(), originalStr.end(), ' '), originalStr.end());
|
||||
originalStr.erase(std::remove(originalStr.begin(), originalStr.end(), '\t'), originalStr.end());
|
||||
originalStr.erase(std::remove(originalStr.begin(), originalStr.end(), '\r'), originalStr.end());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue