summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-17 20:43:59 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-17 20:43:59 (GMT)
commitbd394cdb9f78715cf92ddaaef026b6b00d3d2bd9 (patch)
tree2ecf830f7e343af4d8f0439f43ae0cbdafd7b3ba
parent1c10bc4bf19c5ce73e3e10380e613da8bf93a1b0 (diff)
downloaduscxml-bd394cdb9f78715cf92ddaaef026b6b00d3d2bd9.zip
uscxml-bd394cdb9f78715cf92ddaaef026b6b00d3d2bd9.tar.gz
uscxml-bd394cdb9f78715cf92ddaaef026b6b00d3d2bd9.tar.bz2
Fixed setConfiguration and started MMI arch
-rw-r--r--CMakeLists.txt20
-rw-r--r--docs/CentOS.md21
-rw-r--r--src/uscxml/Factory.cpp4
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp2
-rw-r--r--src/uscxml/plugins/invoker/miles/SpatialAudio.cpp (renamed from src/uscxml/plugins/invoker/modality/miles/SpatialAudio.cpp)0
-rw-r--r--src/uscxml/plugins/invoker/miles/SpatialAudio.h (renamed from src/uscxml/plugins/invoker/modality/miles/SpatialAudio.h)7
-rw-r--r--src/uscxml/plugins/invoker/modality/MMIComponent.cpp42
-rw-r--r--src/uscxml/plugins/invoker/modality/MMIComponent.h109
-rw-r--r--src/uscxml/plugins/invoker/modality/UmundoComponent.cpp49
-rw-r--r--src/uscxml/plugins/invoker/modality/UmundoComponent.h30
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp30
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIComponent.h51
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp338
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.h280
-rw-r--r--test/CMakeLists.txt5
-rw-r--r--test/src/test-mmi.cpp475
-rw-r--r--test/src/test-url.cpp15
17 files changed, 1219 insertions, 259 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 62c865d..8abbe26 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -503,6 +503,24 @@ else()
endif()
+# mmi ioprocessor
+
+file(GLOB_RECURSE MMI_IOPROCESSOR
+ src/uscxml/plugins/ioprocessor/modality/*.cpp
+ src/uscxml/plugins/ioprocessor/modality/*.h
+)
+source_group("IOProcessor\\modality" FILES ${MMI_IOPROCESSOR})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ ioprocessor_mmi SHARED
+ ${MMI_IOPROCESSOR})
+ target_link_libraries(ioprocessor_mmi uscxml)
+ set_target_properties(ioprocessor_mmi PROPERTIES FOLDER "Plugin IOProcessor")
+else()
+ list (APPEND USCXML_FILES ${MMI_IOPROCESSOR})
+endif()
+
+
# Fetch element
file(GLOB_RECURSE FETCH_ELEMENT
@@ -923,7 +941,7 @@ endif()
# MILES modality components
find_package(MILES)
-if (MILES_FOUND)
+if (MILES_FOUND AND OFF)
include_directories(${MILES_INCLUDE_DIR})
# openal is only needed for miles
diff --git a/docs/CentOS.md b/docs/CentOS.md
index cb2045f..8a3424e 100644
--- a/docs/CentOS.md
+++ b/docs/CentOS.md
@@ -8,23 +8,16 @@ $ wget http://sourceforge.net/projects/boost/files/latest/download
$ tar xvjf boost*
$ cd boost*
$ ./bootstrap.sh
-$ ./b2 --layout=tagged install
-
-sudo yum install libtool-ltdl-devel
-sudo yum install libxml2-devel
-sudo yum install libpng-devel
-sudo yum install libjpeg-devel
-sudo yum install libtiff-devel
-sudo yum install libcurl-devel
-sudo yum install mesa-libGL-devel
-sudo yum install pcre-devel
+$ sudo ./b2 --layout=tagged install
+
+sudo yum install libtool-ltdl-devel libxml2-devel libpng-devel libjpeg-devel libtiff-devel libcurl-devel mesa-libGL-devel pcre-devel
sudo yum remove swig
$ wget http://sourceforge.net/projects/openvrml/files/latest/download
$ tar xvjf openvrml*
$ cd openvrml*
$ ./configure --disable-render-text-node --disable-script-node-javascript --disable-script-node-java --disable-gl-renderer --disable-xembed --disable-player --disable-examples --disable-mozilla-plugin
-$ make install
+$ sudo make install
$ wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
$ tar xvzf cmake-2.8.10.2.tar.gz
@@ -36,10 +29,10 @@ $ svn co http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGrap
$ cd OpenSceneGraph
$ mkdir build && cd build
$ cmake ..
-$ make
-$ make install
+$ make -j4
+$ sudo make install
-$ wget http://sourceforge.net/projects/boost/files/latest/download
+$ wget http://sourceforge.net/projects/swig/files/latest/download
$ tar xvjf swig*
$ cd swig*
$ ./configure
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 76da139..5c9b206 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -104,8 +104,8 @@ Factory::Factory() {
#ifdef MILES_FOUND
{
- MilesSessionInvoker* invoker = new MilesSessionInvoker();
- registerInvoker(invoker);
+// MilesSessionInvoker* invoker = new MilesSessionInvoker();
+// registerInvoker(invoker);
}
#endif
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
index ef40362..a15e9a4 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft6.cpp
@@ -81,7 +81,7 @@ void InterpreterDraft6::interpret() {
Arabica::XPath::NodeSet<std::string> initialStates;
if (_userDefinedStartConfiguration.size() > 0) {
// otherwise use user supplied config
- initialTransitions = getStates(_userDefinedStartConfiguration);
+ initialStates = getStates(_userDefinedStartConfiguration);
} else {
// or fetch per draft
initialStates = getInitialStates();
diff --git a/src/uscxml/plugins/invoker/modality/miles/SpatialAudio.cpp b/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp
index acc5c4b..acc5c4b 100644
--- a/src/uscxml/plugins/invoker/modality/miles/SpatialAudio.cpp
+++ b/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp
diff --git a/src/uscxml/plugins/invoker/modality/miles/SpatialAudio.h b/src/uscxml/plugins/invoker/miles/SpatialAudio.h
index 7632f52..bb0886f 100644
--- a/src/uscxml/plugins/invoker/modality/miles/SpatialAudio.h
+++ b/src/uscxml/plugins/invoker/miles/SpatialAudio.h
@@ -2,8 +2,7 @@
#define SPATIALAUDIO_H_EH11SAQC
#include <map>
-
-#include "../MMIComponent.h"
+#include <uscxml/Interpreter.h>
extern "C" {
# include "miles/audio.h"
@@ -13,9 +12,7 @@ extern "C" {
namespace uscxml {
-class Interpreter;
-
-class SpatialAudio : public MMIComponent {
+class SpatialAudio : public InvokerImpl {
public:
SpatialAudio();
virtual ~SpatialAudio();
diff --git a/src/uscxml/plugins/invoker/modality/MMIComponent.cpp b/src/uscxml/plugins/invoker/modality/MMIComponent.cpp
deleted file mode 100644
index 170f4bc..0000000
--- a/src/uscxml/plugins/invoker/modality/MMIComponent.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "MMIComponent.h"
-#include "uscxml/Interpreter.h"
-
-namespace uscxml {
-
-MMIComponent::MMIComponent() {
-}
-
-
-MMIComponent::~MMIComponent() {
-};
-
-Invoker* MMIComponent::create(Interpreter* interpreter) {
- MMIComponent* invoker = new MMIComponent();
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data MMIComponent::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void MMIComponent::send(SendRequest& req) {
-
-}
-
-void MMIComponent::cancel(const std::string sendId) {
- assert(false);
-}
-
-void MMIComponent::sendToParent(SendRequest& req) {
- req.invokeid = _invokeId;
- assert(false);
-}
-
-void MMIComponent::invoke(InvokeRequest& req) {
- _invokeId = req.invokeid;
-
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/modality/MMIComponent.h b/src/uscxml/plugins/invoker/modality/MMIComponent.h
deleted file mode 100644
index 96d796b..0000000
--- a/src/uscxml/plugins/invoker/modality/MMIComponent.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef MMICOMPONENT_H_MZ1I550N
-#define MMICOMPONENT_H_MZ1I550N
-
-#include "uscxml/Factory.h"
-
-namespace uscxml {
-
-class Interpreter;
-
-class MMIComponent : public Invoker {
-public:
-
- enum State {
- PAUSED,
- RUNNING,
- IDLE,
- TERMINATED
- };
-
- MMIComponent();
- virtual ~MMIComponent();
- virtual Invoker* create(Interpreter* interpreter);
-
- virtual Data getDataModelVariables();
- virtual void send(SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(InvokeRequest& req);
- virtual void sendToParent(SendRequest& req);
-
-protected:
- std::string _invokeId;
- Interpreter* _interpreter;
-
- State _state;
-};
-
-
-/** Base classes for MMI messages */
-
-class MMICoreMessage {
-public:
- std::string source;
- std::string target;
- std::string data;
- std::string requestId;
-};
-
-class MMICtxMessage : public MMICoreMessage {
-public:
- std::string context;
-};
-
-class MMIStartMessage : public MMICtxMessage {
-public:
- std::string content;
- std::string contentURL;
-};
-
-class MMISimpleStatusMessage : public MMICtxMessage {
-public:
- std::string status;
-};
-
-class MMIStatusMessage : public MMISimpleStatusMessage {
-public:
- std::string statusInfo;
-};
-
-/** Concrete MMI messages */
-
-class MMINewContextRequest : public MMICoreMessage {};
-
-/***/
-
-class MMIPauseRequest : public MMICtxMessage {};
-class MMIResumeRequest : public MMICtxMessage {};
-class MMICancelRequest : public MMICtxMessage {};
-class MMIClearContextRequest : public MMICtxMessage {};
-class MMIStatusRequest : public MMICtxMessage {};
-
-/***/
-
-class MMIStartRequest : public MMIStartMessage {};
-class MMIPrepareRequest : public MMIStartMessage {};
-
-/***/
-
-class MMIExtensionNotification : public MMICtxMessage {
- std::string name;
-};
-
-/***/
-
-class MMIStatusResponse : public MMISimpleStatusMessage {};
-
-/***/
-
-class MMIStartResponse : public MMIStatusMessage {};
-class MMIPrepareRespnse : public MMIStatusMessage {};
-class MMIPauseResponse : public MMIStatusMessage {};
-class MMIResumeResponse : public MMIStatusMessage {};
-class MMICancelResponse : public MMIStatusMessage {};
-class MMIDoneNotification : public MMIStatusMessage {};
-class MMINewContextResponse : public MMIStatusMessage {};
-class MMIClearContextResponse : public MMIStatusMessage {};
-
-}
-
-#endif /* end of include guard: MMICOMPONENT_H_MZ1I550N */
diff --git a/src/uscxml/plugins/invoker/modality/UmundoComponent.cpp b/src/uscxml/plugins/invoker/modality/UmundoComponent.cpp
deleted file mode 100644
index 10f23d4..0000000
--- a/src/uscxml/plugins/invoker/modality/UmundoComponent.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "UmundoComponent.h"
-#include "uscxml/Interpreter.h"
-
-namespace uscxml {
-
-UmundoComponent::UmundoComponent() {
-}
-
-
-UmundoComponent::~UmundoComponent() {
- delete _invokedInterpreter;
-};
-
-Invoker* UmundoComponent::create(Interpreter* interpreter) {
- UmundoComponent* invoker = new UmundoComponent();
- invoker->_parentInterpreter = interpreter;
- return invoker;
-}
-
-Data UmundoComponent::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void UmundoComponent::send(SendRequest& req) {
- assert(false);
-}
-
-void UmundoComponent::cancel(const std::string sendId) {
- assert(false);
-}
-
-void UmundoComponent::sendToParent(SendRequest& req) {
- req.invokeid = _invokeId;
- _parentInterpreter->receive(req);
-}
-
-void UmundoComponent::invoke(InvokeRequest& req) {
- _invokeId = req.invokeid;
- _invokedInterpreter = Interpreter::fromURI(req.src);
- DataModel* dataModel = _invokedInterpreter->getDataModel();
- if (dataModel != NULL) {
-
- }
- _invokedInterpreter->setInvoker(this);
- _invokedInterpreter->start();
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/modality/UmundoComponent.h b/src/uscxml/plugins/invoker/modality/UmundoComponent.h
deleted file mode 100644
index 69b3961..0000000
--- a/src/uscxml/plugins/invoker/modality/UmundoComponent.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef UMUNDOCOMPONENT_H_VMW54W1R
-#define UMUNDOCOMPONENT_H_VMW54W1R
-
-#include "MMIComponent.h"
-
-namespace uscxml {
-
-class Interpreter;
-
-class UmundoComponent : public MMIComponent {
-public:
- UmundoComponent();
- virtual ~UmundoComponent();
- virtual Invoker* create(Interpreter* interpreter);
-
- virtual Data getDataModelVariables();
- virtual void send(SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(InvokeRequest& req);
- virtual void sendToParent(SendRequest& req);
-
-protected:
- std::string _invokeId;
- Interpreter* _invokedInterpreter;
- Interpreter* _parentInterpreter;
-};
-
-}
-
-#endif /* end of include guard: UMUNDOCOMPONENT_H_VMW54W1R */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp
new file mode 100644
index 0000000..a38e275
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp
@@ -0,0 +1,30 @@
+#include "MMIComponent.h"
+//#include <glog/logging.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+namespace uscxml {
+
+MMIIOProcessor::MMIIOProcessor() {
+}
+
+MMIIOProcessor::~MMIIOProcessor() {
+}
+
+boost::shared_ptr<IOProcessorImpl> MMIIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<MMIIOProcessor> invoker = boost::shared_ptr<MMIIOProcessor>(new MMIIOProcessor());
+ invoker->_interpreter = interpreter;
+ return invoker;
+}
+
+Data MMIIOProcessor::getDataModelVariables() {
+ Data data;
+ return data;
+}
+
+void MMIIOProcessor::send(const SendRequest& req) {
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h
new file mode 100644
index 0000000..bee568b
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h
@@ -0,0 +1,51 @@
+#ifndef MMIIOPROCESSOR_H_W09J90F0
+#define MMIIOPROCESSOR_H_W09J90F0
+
+#include <uscxml/Interpreter.h>
+#include "MMIMessages.h"
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class MMIIOProcessor : public IOProcessorImpl {
+public:
+ MMIIOProcessor();
+ virtual ~MMIIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ return std::set<std::string>();
+ };
+
+ virtual Data getDataModelVariables();
+ virtual void send(const SendRequest& req);
+
+ /** Modality component */
+ virtual PrepareResponse prepare(const PrepareRequest&);
+ virtual StartResponse start(const StartRequest&);
+ virtual CancelResponse cancel(const CancelRequest&);
+ virtual PauseResponse pause(const PauseRequest&);
+ virtual ResumeResponse resume(const ResumeRequest&);
+ virtual ExtensionNotification extension(const ExtensionNotification&);
+ virtual ClearContextRequest clearContext(const ClearContextRequest&);
+ virtual StatusResponse status(const StatusRequest&);
+
+ /** Interaction Manager */
+ virtual NewContextResponse newContext(const NewContextRequest&);
+ virtual DoneNotification done(const DoneNotification&);
+// virtual ExtensionNotification extension(const ExtensionNotification&);
+
+
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(MMIIOProcessor, IOProcessorImpl);
+#endif
+
+}
+
+
+#endif /* end of include guard: MMIIOPROCESSOR_H_W09J90F0 */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
new file mode 100644
index 0000000..ed92fac
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
@@ -0,0 +1,338 @@
+#include "MMIMessages.h"
+
+#include <DOM/Simple/DOMImplementation.hpp>
+#include <DOM/io/Stream.hpp>
+#include <DOM/SAX2DOM/SAX2DOM.hpp>
+#include <SAX/helpers/InputSourceResolver.hpp>
+
+#include <boost/algorithm/string.hpp>
+
+namespace uscxml {
+
+using namespace Arabica::DOM;
+
+std::string MMIMessage::nameSpace = "http://www.w3.org/2008/04/mmi-arch";
+
+Arabica::DOM::Document<std::string> MMIMessage::toXML() {
+ Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
+ Document<std::string> doc = domFactory.createDocument(nameSpace, "", 0);
+ Element<std::string> mmiElem = doc.createElementNS(nameSpace, "mmi");
+ Element<std::string> msgElem = doc.createElementNS(nameSpace, tagName);
+ msgElem.setAttributeNS(nameSpace, "Source", source);
+ msgElem.setAttributeNS(nameSpace, "Target", target);
+ msgElem.setAttributeNS(nameSpace, "RequestID", requestId);
+
+ if (data.size() > 0) {
+ Element<std::string> dataElem = doc.createElementNS(nameSpace, "data");
+
+ // try to parse content
+ std::stringstream* ss = new std::stringstream();
+ (*ss) << data;
+ std::auto_ptr<std::istream> ssPtr(ss);
+ Arabica::SAX::InputSource<std::string> inputSource;
+ inputSource.setByteStream(ssPtr);
+
+ Arabica::SAX2DOM::Parser<std::string> parser;
+ if(parser.parse(inputSource)) {
+ Node<std::string> importedNode = doc.importNode(parser.getDocument().getDocumentElement(), true);
+ dataElem.appendChild(importedNode);
+ } else {
+ Text<std::string> textElem = doc.createTextNode(data);
+ dataElem.appendChild(textElem);
+ }
+ msgElem.appendChild(dataElem);
+ }
+
+ mmiElem.appendChild(msgElem);
+ doc.appendChild(mmiElem);
+ std::cout << doc;
+ return doc;
+}
+
+Arabica::DOM::Document<std::string> ContextualizedRequest::toXML() {
+ Document<std::string> doc = MMIMessage::toXML();
+ Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
+ msgElem.setAttributeNS(nameSpace, "Context", context);
+ return doc;
+}
+
+Arabica::DOM::Document<std::string> ContentRequest::toXML() {
+ Document<std::string> doc = ContextualizedRequest::toXML();
+ Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
+
+ if (contentURL.href.size() > 0) {
+ Element<std::string> contentURLElem = doc.createElementNS(nameSpace, "contentURL");
+ contentURLElem.setAttributeNS(nameSpace, "href", contentURL.href);
+ contentURLElem.setAttributeNS(nameSpace, "fetchtimeout", contentURL.fetchTimeout);
+ contentURLElem.setAttributeNS(nameSpace, "max-age", contentURL.maxAge);
+ msgElem.appendChild(contentURLElem);
+ }
+
+ if (content.size() > 0) {
+ Element<std::string> contentElem = doc.createElementNS(nameSpace, "content");
+
+ // try to parse content
+ std::stringstream* ss = new std::stringstream();
+ (*ss) << content;
+ std::auto_ptr<std::istream> ssPtr(ss);
+ Arabica::SAX::InputSource<std::string> inputSource;
+ inputSource.setByteStream(ssPtr);
+
+ Arabica::SAX2DOM::Parser<std::string> parser;
+ if(parser.parse(inputSource)) {
+ Node<std::string> importedNode = doc.importNode(parser.getDocument().getDocumentElement(), true);
+ contentElem.appendChild(importedNode);
+ } else {
+ Text<std::string> textElem = doc.createTextNode(content);
+ contentElem.appendChild(textElem);
+ }
+ msgElem.appendChild(contentElem);
+
+ }
+ return doc;
+}
+
+Arabica::DOM::Document<std::string> ExtensionNotification::toXML() {
+ Document<std::string> doc = ContextualizedRequest::toXML();
+ Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
+ msgElem.setAttributeNS(nameSpace, "Name", name);
+ return doc;
+}
+
+Arabica::DOM::Document<std::string> StatusResponse::toXML() {
+ Document<std::string> doc = ContextualizedRequest::toXML();
+ Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
+ if (status == ALIVE) {
+ msgElem.setAttributeNS(nameSpace, "Status", "alive");
+ } else if(status == DEAD) {
+ msgElem.setAttributeNS(nameSpace, "Status", "dead");
+ } else if(status == FAILURE) {
+ msgElem.setAttributeNS(nameSpace, "Status", "failure");
+ } else if(status == SUCCESS) {
+ msgElem.setAttributeNS(nameSpace, "Status", "success");
+ }
+ return doc;
+}
+
+Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() {
+ Document<std::string> doc = StatusResponse::toXML();
+ Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
+
+ Element<std::string> statusInfoElem = doc.createElementNS(nameSpace, "StatusInfo");
+ Text<std::string> statusInfoText = doc.createTextNode(statusInfo);
+ statusInfoElem.appendChild(statusInfoText);
+ msgElem.appendChild(statusInfoElem);
+
+ return doc;
+}
+
+Arabica::DOM::Document<std::string> StatusRequest::toXML() {
+ Document<std::string> doc = ContextualizedRequest::toXML();
+ Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
+
+ if (automaticUpdate) {
+ msgElem.setAttributeNS(nameSpace, "RequestAutomaticUpdate", "true");
+ } else {
+ msgElem.setAttributeNS(nameSpace, "RequestAutomaticUpdate", "false");
+ }
+
+ return doc;
+}
+
+MMIMessage MMIMessage::fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ MMIMessage msg;
+ Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ break;
+ node = node.getNextSibling();
+ }
+ Element<std::string> msgElem(node);
+ msg.source = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Source");
+ msg.target = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Target");
+// msg.data = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Data");
+ msg.requestId = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestID");
+ msg.tagName = msgElem.getLocalName();
+
+ Element<std::string> dataElem;
+ node = msgElem.getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ dataElem = Element<std::string>(node);
+ if (dataElem && boost::iequals(dataElem.getLocalName(), "data"))
+ break;
+ node = node.getNextSibling();
+ }
+
+ if (dataElem && boost::iequals(dataElem.getLocalName(), "data")) {
+ std::stringstream ss;
+ node = dataElem.getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE) {
+ ss << node;
+ break;
+ }
+ node = node.getNextSibling();
+ }
+ msg.data = ss.str();
+ }
+
+ return msg;
+}
+
+ContextualizedRequest ContextualizedRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ ContextualizedRequest msg(NewContextRequest::fromXML(doc));
+ Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ break;
+ node = node.getNextSibling();
+ }
+ Element<std::string> msgElem(node);
+ msg.context = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Context");
+ return msg;
+}
+
+ContentRequest ContentRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ ContentRequest msg(ContextualizedRequest::fromXML(doc));
+ Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ break;
+ node = node.getNextSibling();
+ }
+ Element<std::string> msgElem(node);
+ Element<std::string> contentElem;
+
+ node = msgElem.getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE) {
+ contentElem = Element<std::string>(node);
+ if (boost::iequals(contentElem.getLocalName(), "content") ||
+ boost::iequals(contentElem.getLocalName(), "contentURL"))
+ break;
+ }
+ node = node.getNextSibling();
+ }
+
+ if (contentElem) {
+ if(boost::iequals(contentElem.getLocalName(), "content")) {
+ std::stringstream ss;
+ node = contentElem.getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE) {
+ ss << node;
+ break;
+ }
+ node = node.getNextSibling();
+ }
+ msg.content = ss.str();
+ } else if(boost::iequals(contentElem.getLocalName(), "contentURL")) {
+ msg.contentURL.href = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "href");
+ msg.contentURL.maxAge = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "max-age");
+ msg.contentURL.fetchTimeout = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "fetchtimeout");
+ }
+ }
+
+ //msg.content = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Context");
+ return msg;
+}
+
+ExtensionNotification ExtensionNotification::fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ ExtensionNotification msg(ContextualizedRequest::fromXML(doc));
+ Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ break;
+ node = node.getNextSibling();
+ }
+ Element<std::string> msgElem(node);
+ msg.name = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Name");
+ return msg;
+}
+
+StatusResponse StatusResponse::fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ StatusResponse msg(ContextualizedRequest::fromXML(doc));
+ Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ break;
+ node = node.getNextSibling();
+ }
+ Element<std::string> msgElem(node);
+ std::string status = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Status");
+
+ if (boost::iequals(status, "ALIVE")) {
+ msg.status = ALIVE;
+ } else if(boost::iequals(status, "DEAD")) {
+ msg.status = DEAD;
+ } else if(boost::iequals(status, "FAILURE")) {
+ msg.status = FAILURE;
+ } else if(boost::iequals(status, "SUCCESS")) {
+ msg.status = SUCCESS;
+ }
+ return msg;
+}
+
+StatusInfoResponse StatusInfoResponse::fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ StatusInfoResponse msg(StatusResponse::fromXML(doc));
+ Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ break;
+ node = node.getNextSibling();
+ }
+ Element<std::string> msgElem(node);
+ Element<std::string> statusInfoElem;
+
+ node = msgElem.getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE) {
+ statusInfoElem = Element<std::string>(node);
+ if (statusInfoElem && boost::iequals(statusInfoElem.getLocalName(), "statusInfo"))
+ break;
+ }
+ node = node.getNextSibling();
+ }
+
+ if (statusInfoElem && boost::iequals(statusInfoElem.getLocalName(), "statusInfo")) {
+ node = statusInfoElem.getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::TEXT_NODE) {
+ msg.statusInfo = node.getNodeValue();
+ break;
+ }
+ node = node.getNextSibling();
+ }
+ }
+
+ return msg;
+}
+
+
+StatusRequest StatusRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ StatusRequest msg(ContextualizedRequest::fromXML(doc));
+ Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ while (node) {
+ if (node.getNodeType() == Node_base::ELEMENT_NODE)
+ break;
+ node = node.getNextSibling();
+ }
+ Element<std::string> msgElem(node);
+ std::string autoUpdate = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestAutomaticUpdate");
+
+ if (boost::iequals(autoUpdate, "true")) {
+ msg.automaticUpdate = true;
+ } else if(boost::iequals(autoUpdate, "on")) {
+ msg.automaticUpdate = true;
+ } else if(boost::iequals(autoUpdate, "yes")) {
+ msg.automaticUpdate = true;
+ } else if(boost::iequals(autoUpdate, "1")) {
+ msg.automaticUpdate = true;
+ } else {
+ msg.automaticUpdate = false;
+ }
+ return msg;
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
new file mode 100644
index 0000000..af31efe
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
@@ -0,0 +1,280 @@
+#ifndef MMIMESSAGES_H_OS0SE7H5
+#define MMIMESSAGES_H_OS0SE7H5
+
+#include <DOM/Node.hpp>
+#include <DOM/Document.hpp>
+
+namespace uscxml {
+
+class MMIMessage {
+public:
+ virtual Arabica::DOM::Document<std::string> toXML();
+ static MMIMessage fromXML(const Arabica::DOM::Document<std::string>& doc);
+
+ std::string source;
+ std::string target;
+ std::string data;
+ std::string requestId;
+ std::string tagName;
+
+ static std::string nameSpace;
+
+protected:
+ MMIMessage() {}
+};
+
+class NewContextRequest : public MMIMessage {
+public:
+ NewContextRequest() {
+ tagName = "NewContextRequest";
+ }
+ NewContextRequest(const MMIMessage& father) : MMIMessage(father) {}
+ static NewContextRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return MMIMessage::fromXML(doc);
+ }
+
+};
+
+class ContextualizedRequest : public NewContextRequest {
+public:
+ virtual Arabica::DOM::Document<std::string> toXML();
+ static ContextualizedRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
+
+ std::string context;
+protected:
+ ContextualizedRequest() {}
+ ContextualizedRequest(const NewContextRequest& father) : NewContextRequest(father) {}
+};
+
+class PauseRequest : public ContextualizedRequest {
+public:
+ PauseRequest() {
+ tagName = "PauseRequest";
+ }
+ PauseRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+ static PauseRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return ContextualizedRequest::fromXML(doc);
+ }
+};
+class ResumeRequest : public ContextualizedRequest {
+public:
+ ResumeRequest() {
+ tagName = "ResumeRequest";
+ }
+ ResumeRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+ static ResumeRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return ContextualizedRequest::fromXML(doc);
+ }
+
+};
+class CancelRequest : public ContextualizedRequest {
+public:
+ CancelRequest() {
+ tagName = "CancelRequest";
+ }
+ CancelRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+ static CancelRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return ContextualizedRequest::fromXML(doc);
+ }
+
+};
+class ClearContextRequest : public ContextualizedRequest {
+public:
+ ClearContextRequest() {
+ tagName = "ClearContextRequest";
+ }
+ ClearContextRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+ static ClearContextRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return ContextualizedRequest::fromXML(doc);
+ }
+
+};
+class StatusRequest : public ContextualizedRequest {
+public:
+ StatusRequest() {
+ tagName = "StatusRequest";
+ }
+ virtual Arabica::DOM::Document<std::string> toXML();
+ static StatusRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
+
+ bool automaticUpdate;
+protected:
+ StatusRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+};
+
+class ContentRequest : public ContextualizedRequest {
+public:
+ struct ContentURL {
+ std::string href;
+ std::string maxAge;
+ std::string fetchTimeout;
+ };
+
+ virtual Arabica::DOM::Document<std::string> toXML();
+ static ContentRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
+ std::string content;
+ ContentURL contentURL;
+protected:
+ ContentRequest() {}
+ ContentRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+};
+
+class PrepareRequest : public ContentRequest {
+public:
+ PrepareRequest() {
+ tagName = "PrepareRequest";
+ }
+ PrepareRequest(const ContentRequest& father) : ContentRequest(father) {}
+ static PrepareRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return ContentRequest::fromXML(doc);
+ }
+};
+
+class StartRequest : public ContentRequest {
+public:
+ StartRequest() {
+ tagName = "StartRequest";
+ }
+ StartRequest(const ContentRequest& father) : ContentRequest(father) {}
+ static StartRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return ContentRequest::fromXML(doc);
+ }
+
+};
+
+class ExtensionNotification : public ContextualizedRequest {
+public:
+ ExtensionNotification() {
+ tagName = "ExtensionNotification";
+ }
+ virtual Arabica::DOM::Document<std::string> toXML();
+ static ExtensionNotification fromXML(const Arabica::DOM::Document<std::string>& doc);
+
+ std::string name;
+protected:
+ ExtensionNotification(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+
+};
+
+class StatusResponse : public ContextualizedRequest {
+public:
+ enum Status {
+ ALIVE = 0,
+ DEAD = 1,
+ SUCCESS = 2,
+ FAILURE = 3
+ };
+
+ StatusResponse() {
+ tagName = "StatusResponse";
+ }
+ virtual Arabica::DOM::Document<std::string> toXML();
+ static StatusResponse fromXML(const Arabica::DOM::Document<std::string>& doc);
+ Status status;
+protected:
+ StatusResponse(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
+
+};
+
+class StatusInfoResponse : public StatusResponse {
+public:
+ virtual Arabica::DOM::Document<std::string> toXML();
+ static StatusInfoResponse fromXML(const Arabica::DOM::Document<std::string>& doc);
+ std::string statusInfo;
+protected:
+ StatusInfoResponse() {}
+ StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {}
+};
+
+class PrepareResponse : public StatusInfoResponse {
+public:
+ PrepareResponse() {
+ tagName = "PrepareResponse";
+ }
+ PrepareResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static PrepareResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+};
+
+class StartResponse : public StatusInfoResponse {
+public:
+ StartResponse() {
+ tagName = "StartResponse";
+ }
+ StartResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static StartResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+};
+
+class CancelResponse : public StatusInfoResponse {
+public:
+ CancelResponse() {
+ tagName = "CancelResponse";
+ }
+ CancelResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static CancelResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+};
+
+class PauseResponse : public StatusInfoResponse {
+public:
+ PauseResponse() {
+ tagName = "PauseResponse";
+ }
+ PauseResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static PauseResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+};
+
+class ResumeResponse : public StatusInfoResponse {
+public:
+ ResumeResponse() {
+ tagName = "ResumeResponse";
+ }
+ ResumeResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static ResumeResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+};
+
+class ClearContextResponse : public StatusInfoResponse {
+public:
+ ClearContextResponse() {
+ tagName = "ClearContextResponse";
+ }
+ ClearContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static ClearContextResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+};
+
+class NewContextResponse : public StatusInfoResponse {
+public:
+ NewContextResponse() {
+ tagName = "NewContextResponse";
+ }
+ NewContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static NewContextResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+
+};
+
+class DoneNotification : public StatusInfoResponse {
+public:
+ DoneNotification() {
+ tagName = "DoneNotification";
+ }
+ DoneNotification(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
+ static DoneNotification fromXML(const Arabica::DOM::Document<std::string>& doc) {
+ return StatusInfoResponse::fromXML(doc);
+ }
+};
+
+}
+
+#endif /* end of include guard: MMIMESSAGES_H_OS0SE7H5 */
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7439abc..0bf8065 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -58,6 +58,11 @@ target_link_libraries(test-url uscxml)
add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-url)
set_target_properties(test-url PROPERTIES FOLDER "Tests")
+add_executable(test-mmi src/test-mmi.cpp)
+target_link_libraries(test-mmi uscxml)
+add_test(test-url ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-mmi)
+set_target_properties(test-mmi PROPERTIES FOLDER "Tests")
+
add_executable(scxml-test-framework-client
src/scxml-test-framework-client.cpp)
target_link_libraries(scxml-test-framework-client uscxml)
diff --git a/test/src/test-mmi.cpp b/test/src/test-mmi.cpp
new file mode 100644
index 0000000..1b5702b
--- /dev/null
+++ b/test/src/test-mmi.cpp
@@ -0,0 +1,475 @@
+#include "uscxml/plugins/ioprocessor/modality/MMIMessages.h"
+
+#include <SAX/helpers/InputSourceResolver.hpp>
+#include <DOM/SAX2DOM/SAX2DOM.hpp>
+#include <DOM/io/Stream.hpp>
+
+#include <assert.h>
+#include <boost/algorithm/string.hpp>
+#include <iostream>
+
+using namespace uscxml;
+using namespace boost;
+
+Arabica::DOM::Document<std::string> xmlToDoc(const std::string& xml) {
+ std::stringstream* ss = new std::stringstream();
+ (*ss) << xml;
+ std::auto_ptr<std::istream> ssPtr(ss);
+ Arabica::SAX::InputSource<std::string> inputSource;
+ inputSource.setByteStream(ssPtr);
+
+ Arabica::SAX2DOM::Parser<std::string> parser;
+ parser.parse(inputSource);
+ return parser.getDocument();
+}
+
+int main(int argc, char** argv) {
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "NewContextRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.data, ""));
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "NewContextResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ assert(boost::iequals(msg.requestId, "request-1"));
+ assert(msg.status == StatusResponse::SUCCESS);
+ assert(boost::iequals(msg.statusInfo, ""));
+ assert(boost::iequals(msg.context, "URI-1"));
+ assert(boost::iequals(msg.data, ""));
+
+ NewContextResponse msg2 = NewContextResponse::fromXML(msg.toXML());
+ assert(boost::iequals(msg2.tagName, "NewContextResponse"));
+ assert(boost::iequals(msg2.source, "someURI"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(msg2.status == StatusResponse::SUCCESS);
+ assert(boost::iequals(msg2.statusInfo, ""));
+ assert(boost::iequals(msg2.context, "URI-1"));
+ assert(boost::iequals(msg2.data, ""));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "PrepareRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ assert(boost::iequals(msg.requestId, "request-1"));
+ assert(boost::iequals(msg.context, "URI-1"));
+ assert(boost::iequals(msg.data, ""));
+ assert(boost::iequals(msg.content, ""));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "URI-1"));
+ assert(boost::iequals(msg2.data, ""));
+ assert(boost::iequals(msg2.content, ""));
+ assert(boost::iequals(msg2.contentURL.href, "someContentURI"));
+ assert(boost::iequals(msg2.contentURL.maxAge, ""));
+ assert(boost::iequals(msg2.contentURL.fetchTimeout, "1s"));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "PrepareRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "URI-1"));
+ assert(msg2.content.size() > 0);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "PrepareResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(msg2.status == StatusResponse::SUCCESS);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "PrepareResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ assert(boost::iequals(msg.requestId, "request-1"));
+ assert(boost::iequals(msg.context, "someURI"));
+ assert(boost::iequals(msg.statusInfo, " NotAuthorized "));
+ assert(msg.status == StatusResponse::FAILURE);
+
+ PrepareResponse msg2 = PrepareResponse::fromXML(msg.toXML());
+ assert(boost::iequals(msg2.tagName, "PrepareResponse"));
+ assert(boost::iequals(msg2.source, "someURI"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(boost::iequals(msg2.statusInfo, " NotAuthorized "));
+ assert(msg2.status == StatusResponse::FAILURE);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "StartRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "URI-1"));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "StartResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ assert(boost::iequals(msg.requestId, "request-1"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(boost::iequals(msg2.statusInfo, " NotAuthorized "));
+ assert(msg2.status == StatusResponse::FAILURE);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "DoneNotification"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ assert(boost::iequals(msg.requestId, "request-1"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(msg2.data.size() > 0);
+ assert(msg2.status == StatusResponse::SUCCESS);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "DoneNotification"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ assert(boost::iequals(msg.requestId, "request-1"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(msg2.data.size() > 0);
+ assert(msg2.status == StatusResponse::SUCCESS);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "CancelRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ assert(boost::iequals(msg.requestId, "request-1"));
+ assert(boost::iequals(msg.context, "someURI"));
+
+ CancelRequest msg2 = CancelRequest::fromXML(msg.toXML());
+ assert(boost::iequals(msg2.tagName, "CancelRequest"));
+ assert(boost::iequals(msg2.source, "someURI"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "CancelResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(msg2.status == StatusResponse::SUCCESS);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "PauseRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "PauseResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(msg2.status == StatusResponse::SUCCESS);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "ResumeRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "ResumeResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(msg2.status == StatusResponse::SUCCESS);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "ExtensionNotification"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-1"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(boost::iequals(msg2.name, "appEvent"));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "ClearContextRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-2"));
+ assert(boost::iequals(msg2.context, "someURI"));
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "ClearContextResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-2"));
+ assert(boost::iequals(msg2.context, "someURI"));
+ assert(msg2.status == StatusResponse::SUCCESS);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "StatusRequest"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-3"));
+ assert(boost::iequals(msg2.context, "aToken"));
+ assert(msg2.automaticUpdate);
+
+ }
+
+ { // --- 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()));
+ assert(boost::iequals(msg.tagName, "StatusResponse"));
+ assert(boost::iequals(msg.source, "someURI"));
+ assert(boost::iequals(msg.target, "someOtherURI"));
+ 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"));
+ assert(boost::iequals(msg2.target, "someOtherURI"));
+ assert(boost::iequals(msg2.requestId, "request-3"));
+ assert(boost::iequals(msg2.context, "aToken"));
+ assert(msg2.status == StatusResponse::ALIVE);
+
+ }
+
+} \ No newline at end of file
diff --git a/test/src/test-url.cpp b/test/src/test-url.cpp
index c889f86..cd11ac5 100644
--- a/test/src/test-url.cpp
+++ b/test/src/test-url.cpp
@@ -46,6 +46,15 @@ int main(int argc, char** argv) {
exeName = exeName.substr(exeName.find_last_of("\\/") + 1);
{
+ Interpreter interpreter = Interpreter::fromURI("/Users/sradomski/Desktop/application_small.scxml");
+ assert(interpreter);
+ std::vector<std::string> states;
+ states.push_back("b");
+ interpreter.setConfiguration(states);
+ interpreter.interpret();
+ }
+
+ {
URL url(argv[0]);
assert(canResolve(argv[0]));
assert(canResolve(url.asString()));
@@ -55,12 +64,6 @@ int main(int argc, char** argv) {
exeUrl.toAbsolute(baseUrl);
assert(canResolve(exeUrl.asString()));
}
-
- {
-// Interpreter interpreter = Interpreter::fromURI("https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-execution.scxml");
-// assert(interpreter);
-// interpreter.interpret();
- }
{
TestServlet* testServlet1 = new TestServlet(false);