Merged marshalling/unmarshalling methods into core interface.
[shibboleth/cpp-xmltooling.git] / xmltoolingtest / MarshallingTest.h
index b5f0814..79dfaf1 100644 (file)
@@ -25,14 +25,10 @@ public:
 \r
     void setUp() {\r
         XMLObjectBuilder::registerBuilder(m_qname, new SimpleXMLObjectBuilder());\r
-        Marshaller::registerMarshaller(m_qname, new SimpleXMLObjectMarshaller());\r
-        Unmarshaller::registerUnmarshaller(m_qname, new SimpleXMLObjectUnmarshaller());\r
     }\r
 \r
     void tearDown() {\r
         XMLObjectBuilder::deregisterBuilder(m_qname);\r
-        Marshaller::deregisterMarshaller(m_qname);\r
-        Unmarshaller::deregisterUnmarshaller(m_qname);\r
     }\r
 \r
     void testMarshallingWithAttributes() {\r
@@ -43,7 +39,7 @@ public:
         TS_ASSERT(sxObject.get()!=NULL);\r
         sxObject->setId(expected.get());\r
         \r
-        DOMElement* rootElement = Marshaller::getMarshaller(sxObject.get())->marshall(sxObject.get());\r
+        DOMElement* rootElement = sxObject->marshall();\r
 \r
         string path=data_path + "SimpleXMLObjectWithAttribute.xml";\r
         ifstream fs(path.c_str());\r
@@ -62,7 +58,7 @@ public:
         TS_ASSERT(sxObject.get()!=NULL);\r
         sxObject->setValue(expected.get());\r
         \r
-        DOMElement* rootElement = Marshaller::getMarshaller(sxObject.get())->marshall(sxObject.get());\r
+        DOMElement* rootElement = sxObject->marshall();\r
 \r
         string path=data_path + "SimpleXMLObjectWithContent.xml";\r
         ifstream fs(path.c_str());\r
@@ -76,15 +72,15 @@ public:
     void testMarshallingWithChildElements() {\r
         TS_TRACE("testMarshallingWithChildElements");\r
 \r
-        const XMLObjectBuilder* b=XMLObjectBuilder::getBuilder(m_qname);\r
+        const SimpleXMLObjectBuilder* b=dynamic_cast<const SimpleXMLObjectBuilder*>(XMLObjectBuilder::getBuilder(m_qname));\r
         TS_ASSERT(b!=NULL);\r
         \r
-        auto_ptr<SimpleXMLObject> sxObject(dynamic_cast<SimpleXMLObject*>(b->buildObject()));\r
+        auto_ptr<SimpleXMLObject> sxObject(b->buildObject());\r
         TS_ASSERT(sxObject.get()!=NULL);\r
         VectorOf(SimpleXMLObject) kids=sxObject->getSimpleXMLObjects();\r
-        kids.push_back(dynamic_cast<SimpleXMLObject*>(b->buildObject()));\r
-        kids.push_back(dynamic_cast<SimpleXMLObject*>(b->buildObject()));\r
-        kids.push_back(dynamic_cast<SimpleXMLObject*>(b->buildObject()));\r
+        kids.push_back(b->buildObject());\r
+        kids.push_back(b->buildObject());\r
+        kids.push_back(b->buildObject());\r
         \r
         // Test some collection stuff\r
         auto_ptr_XMLCh foo("Foo");\r
@@ -94,7 +90,7 @@ public:
         kids.erase(kids.begin()+1);\r
         TS_ASSERT_SAME_DATA(kids.back()->getValue(), bar.get(), XMLString::stringLen(bar.get()));\r
         \r
-        DOMElement* rootElement = Marshaller::getMarshaller(sxObject.get())->marshall(sxObject.get());\r
+        DOMElement* rootElement = sxObject->marshall();\r
 \r
         string path=data_path + "SimpleXMLObjectWithChildren.xml";\r
         ifstream fs(path.c_str());\r