summaryrefslogtreecommitdiffstats
path: root/test/src/test-mmi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/test-mmi.cpp')
-rw-r--r--test/src/test-mmi.cpp99
1 files changed, 60 insertions, 39 deletions
diff --git a/test/src/test-mmi.cpp b/test/src/test-mmi.cpp
index 1b5702b..2b34a82 100644
--- a/test/src/test-mmi.cpp
+++ b/test/src/test-mmi.cpp
@@ -24,7 +24,8 @@ Arabica::DOM::Document<std::string> xmlToDoc(const std::string& xml) {
}
int main(int argc, char** argv) {
- { // --- NewContextRequest
+ {
+ // --- NewContextRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"><mmi:NewContextRequest mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:RequestID=\"request-1\"></mmi:NewContextRequest></mmi:mmi>";
NewContextRequest msg = NewContextRequest::fromXML(xmlToDoc(ss.str()));
@@ -33,7 +34,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.target, "someOtherURI"));
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.data, ""));
-
+
NewContextRequest msg2 = NewContextRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "NewContextRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -41,8 +42,9 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg2.requestId, "request-1"));
assert(boost::iequals(msg2.data, ""));
}
-
- { // --- NewContextResponse
+
+ {
+ // --- NewContextResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:NewContextResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:RequestID=\"request-1\" mmi:Status=\"success\" mmi:Context=\"URI-1\"> </mmi:NewContextResponse></mmi:mmi>";
NewContextResponse msg = NewContextResponse::fromXML(xmlToDoc(ss.str()));
@@ -67,7 +69,8 @@ int main(int argc, char** argv) {
}
- { // --- PrepareRequest
+ {
+ // --- PrepareRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:PrepareRequest mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"URI-1\" mmi:RequestID=\"request-1\"> <mmi:ContentURL mmi:href=\"someContentURI\" mmi:max-age=\"\" mmi:fetchtimeout=\"1s\"/> </mmi:PrepareRequest></mmi:mmi>";
PrepareRequest msg = PrepareRequest::fromXML(xmlToDoc(ss.str()));
@@ -81,7 +84,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.contentURL.href, "someContentURI"));
assert(boost::iequals(msg.contentURL.maxAge, ""));
assert(boost::iequals(msg.contentURL.fetchTimeout, "1s"));
-
+
PrepareRequest msg2 = PrepareRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "PrepareRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -96,7 +99,8 @@ int main(int argc, char** argv) {
}
- { // --- PrepareRequest
+ {
+ // --- PrepareRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\" xmlns:vxml=\"http://www.w3.org/2001/vxml\"> <mmi:PrepareRequest mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"URI-1\" mmi:RequestID=\"request-1\" > <mmi:content> <vxml:vxml version=\"2.0\"> <vxml:form> <vxml:block>Hello World!</vxml:block> </vxml:form> </vxml:vxml> </mmi:content> </mmi:PrepareRequest></mmi:mmi>";
PrepareRequest msg = PrepareRequest::fromXML(xmlToDoc(ss.str()));
@@ -106,7 +110,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "URI-1"));
assert(msg.content.size() > 0);
-
+
PrepareRequest msg2 = PrepareRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "PrepareRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -117,7 +121,8 @@ int main(int argc, char** argv) {
}
- { // --- PrepareResponse
+ {
+ // --- PrepareResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:PrepareResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\" mmi:Status=\"success\"/></mmi:mmi>";
PrepareResponse msg = PrepareResponse::fromXML(xmlToDoc(ss.str()));
@@ -127,7 +132,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "someURI"));
assert(msg.status == StatusResponse::SUCCESS);
-
+
PrepareResponse msg2 = PrepareResponse::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "PrepareResponse"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -138,7 +143,8 @@ int main(int argc, char** argv) {
}
- { // --- PrepareResponse
+ {
+ // --- PrepareResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:PrepareResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\" mmi:Status=\"failure\"> <mmi:statusInfo> NotAuthorized </mmi:statusInfo> </mmi:PrepareResponse></mmi:mmi>";
PrepareResponse msg = PrepareResponse::fromXML(xmlToDoc(ss.str()));
@@ -161,7 +167,8 @@ int main(int argc, char** argv) {
}
- { // --- StartRequest
+ {
+ // --- StartRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:StartRequest mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"URI-1\" mmi:RequestID=\"request-1\"> <mmi:ContentURL mmi:href=\"someContentURI\" mmi:max-age=\"\" mmi:fetchtimeout=\"1s\"/> </mmi:StartRequest></mmi:mmi>";
StartRequest msg = StartRequest::fromXML(xmlToDoc(ss.str()));
@@ -170,7 +177,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.target, "someOtherURI"));
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "URI-1"));
-
+
StartRequest msg2 = StartRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "StartRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -180,7 +187,8 @@ int main(int argc, char** argv) {
}
- { // --- StartResponse
+ {
+ // --- StartResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:StartResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\" mmi:Status=\"failure\"> <mmi:statusInfo> NotAuthorized </mmi:statusInfo> </mmi:StartResponse></mmi:mmi>";
StartResponse msg = StartResponse::fromXML(xmlToDoc(ss.str()));
@@ -191,7 +199,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.context, "someURI"));
assert(boost::iequals(msg.statusInfo, " NotAuthorized "));
assert(msg.status == StatusResponse::FAILURE);
-
+
StartResponse msg2 = StartResponse::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "StartResponse"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -203,7 +211,8 @@ int main(int argc, char** argv) {
}
- { // --- DoneNotification
+ {
+ // --- DoneNotification
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\" xmlns:emma=\"http://www.w3.org/2003/04/emma\"> <mmi:DoneNotification mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:Status=\"success\" mmi:RequestID=\"request-1\" mmi:Confidential=\"true\"> <mmi:Data> <emma:emma version=\"1.0\"> <emma:interpretation id=\"int1\" emma:medium=\"acoustic\" emma:confidence=\".75\" emma:mode=\"voice\" emma:tokens=\"flights from boston to denver\"> <origin>Boston</origin> <destination>Denver</destination> </emma:interpretation> </emma:emma> </mmi:Data> </mmi:DoneNotification></mmi:mmi>";
DoneNotification msg = DoneNotification::fromXML(xmlToDoc(ss.str()));
@@ -214,7 +223,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.context, "someURI"));
assert(msg.data.size() > 0);
assert(msg.status == StatusResponse::SUCCESS);
-
+
DoneNotification msg2 = DoneNotification::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "DoneNotification"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -226,7 +235,8 @@ int main(int argc, char** argv) {
}
- { // --- DoneNotification
+ {
+ // --- DoneNotification
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\" xmlns:emma=\"http://www.w3.org/2003/04/emma\"> <mmi:DoneNotification mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:Status=\"success\" mmi:RequestID=\"request-1\" > <mmi:Data> <emma:emma version=\"1.0\"> <emma:interpretation id=\"int1\" emma:no-input=\"true\"/> </emma:emma> </mmi:Data> </mmi:DoneNotification></mmi:mmi>";
DoneNotification msg = DoneNotification::fromXML(xmlToDoc(ss.str()));
@@ -249,7 +259,8 @@ int main(int argc, char** argv) {
}
- { // --- CancelRequest
+ {
+ // --- CancelRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:CancelRequest mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\"/></mmi:mmi>";
CancelRequest msg = CancelRequest::fromXML(xmlToDoc(ss.str()));
@@ -268,7 +279,8 @@ int main(int argc, char** argv) {
}
- { // --- CancelResponse
+ {
+ // --- CancelResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:CancelResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\" mmi:Status=\"success\"/></mmi:mmi>";
CancelResponse msg = CancelResponse::fromXML(xmlToDoc(ss.str()));
@@ -278,7 +290,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "someURI"));
assert(msg.status == StatusResponse::SUCCESS);
-
+
CancelResponse msg2 = CancelResponse::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "CancelResponse"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -289,7 +301,8 @@ int main(int argc, char** argv) {
}
- { // --- PauseRequest
+ {
+ // --- PauseRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:PauseRequest mmi:Context=\"someURI\" mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:RequestID=\"request-1\"/></mmi:mmi>";
PauseRequest msg = PauseRequest::fromXML(xmlToDoc(ss.str()));
@@ -298,7 +311,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.target, "someOtherURI"));
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "someURI"));
-
+
PauseRequest msg2 = PauseRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "PauseRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -308,7 +321,8 @@ int main(int argc, char** argv) {
}
- { // --- PauseResponse
+ {
+ // --- PauseResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:PauseResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\" mmi:Status=\"success\"/></mmi:mmi>";
PauseResponse msg = PauseResponse::fromXML(xmlToDoc(ss.str()));
@@ -318,7 +332,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "someURI"));
assert(msg.status == StatusResponse::SUCCESS);
-
+
PauseResponse msg2 = PauseResponse::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "PauseResponse"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -329,7 +343,8 @@ int main(int argc, char** argv) {
}
- { // --- ResumeRequest
+ {
+ // --- ResumeRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:ResumeRequest mmi:Context=\"someURI\" mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:RequestID=\"request-1\"/></mmi:mmi>";
ResumeRequest msg = ResumeRequest::fromXML(xmlToDoc(ss.str()));
@@ -338,7 +353,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.target, "someOtherURI"));
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "someURI"));
-
+
ResumeRequest msg2 = ResumeRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "ResumeRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -348,7 +363,8 @@ int main(int argc, char** argv) {
}
- { // --- ResumeResponse
+ {
+ // --- ResumeResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:ResumeResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\" mmi:Status=\"success\"/></mmi:mmi>";
ResumeResponse msg = ResumeResponse::fromXML(xmlToDoc(ss.str()));
@@ -358,7 +374,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "someURI"));
assert(msg.status == StatusResponse::SUCCESS);
-
+
ResumeResponse msg2 = ResumeResponse::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "ResumeResponse"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -369,7 +385,8 @@ int main(int argc, char** argv) {
}
- { // --- ExtensionNotification
+ {
+ // --- ExtensionNotification
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:ExtensionNotification mmi:Name=\"appEvent\" mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-1\"> </mmi:ExtensionNotification></mmi:mmi>";
ExtensionNotification msg = ExtensionNotification::fromXML(xmlToDoc(ss.str()));
@@ -379,7 +396,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-1"));
assert(boost::iequals(msg.context, "someURI"));
assert(boost::iequals(msg.name, "appEvent"));
-
+
ExtensionNotification msg2 = ExtensionNotification::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "ExtensionNotification"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -390,7 +407,8 @@ int main(int argc, char** argv) {
}
- { // --- ClearContextRequest
+ {
+ // --- ClearContextRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:ClearContextRequest mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-2\"/></mmi:mmi>";
ClearContextRequest msg = ClearContextRequest::fromXML(xmlToDoc(ss.str()));
@@ -399,7 +417,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.target, "someOtherURI"));
assert(boost::iequals(msg.requestId, "request-2"));
assert(boost::iequals(msg.context, "someURI"));
-
+
ClearContextRequest msg2 = ClearContextRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "ClearContextRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -409,7 +427,8 @@ int main(int argc, char** argv) {
}
- { // --- ClearContextResponse
+ {
+ // --- ClearContextResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:ClearContextResponse mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:Context=\"someURI\" mmi:RequestID=\"request-2\" mmi:Status=\"success\"/></mmi:mmi>";
ClearContextResponse msg = ClearContextResponse::fromXML(xmlToDoc(ss.str()));
@@ -419,7 +438,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-2"));
assert(boost::iequals(msg.context, "someURI"));
assert(msg.status == StatusResponse::SUCCESS);
-
+
ClearContextResponse msg2 = ClearContextResponse::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "ClearContextResponse"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -430,7 +449,8 @@ int main(int argc, char** argv) {
}
- { // --- StatusRequest
+ {
+ // --- StatusRequest
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:StatusRequest mmi:RequestAutomaticUpdate=\"true\" mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:RequestID=\"request-3\" mmi:Context=\"aToken\"/></mmi:mmi>";
StatusRequest msg = StatusRequest::fromXML(xmlToDoc(ss.str()));
@@ -440,7 +460,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-3"));
assert(boost::iequals(msg.context, "aToken"));
assert(msg.automaticUpdate);
-
+
StatusRequest msg2 = StatusRequest::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "StatusRequest"));
assert(boost::iequals(msg2.source, "someURI"));
@@ -451,7 +471,8 @@ int main(int argc, char** argv) {
}
- { // --- StatusResponse
+ {
+ // --- StatusResponse
std::stringstream ss;
ss << "<mmi:mmi xmlns:mmi=\"http://www.w3.org/2008/04/mmi-arch\" version=\"1.0\"> <mmi:StatusResponse mmi:AutomaticUpdate=\"true\" mmi:Status=\"alive\" mmi:Source=\"someURI\" mmi:Target=\"someOtherURI\" mmi:RequestID=\"request-3\" mmi:Context=\"aToken\"/> </mmi:mmi>";
StatusResponse msg = StatusResponse::fromXML(xmlToDoc(ss.str()));
@@ -461,7 +482,7 @@ int main(int argc, char** argv) {
assert(boost::iequals(msg.requestId, "request-3"));
assert(boost::iequals(msg.context, "aToken"));
assert(msg.status == StatusResponse::ALIVE);
-
+
StatusResponse msg2 = StatusResponse::fromXML(msg.toXML());
assert(boost::iequals(msg2.tagName, "StatusResponse"));
assert(boost::iequals(msg2.source, "someURI"));