From 39502d6e48aec30be6d00ca60575b9a4cf414733 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Fri, 11 Aug 2006 02:52:21 +0000 Subject: [PATCH] Remove some tracing, fix string compares. --- xmltoolingtest/ComplexXMLObjectTest.h | 2 -- xmltoolingtest/ExceptionTest.h | 2 -- xmltoolingtest/KeyInfoTest.h | 21 ++++----------------- xmltoolingtest/MarshallingTest.h | 8 +------- xmltoolingtest/SignatureTest.h | 4 ++-- xmltoolingtest/UnmarshallingTest.h | 14 ++------------ 6 files changed, 9 insertions(+), 42 deletions(-) diff --git a/xmltoolingtest/ComplexXMLObjectTest.h b/xmltoolingtest/ComplexXMLObjectTest.h index 73647b4..45af7a9 100644 --- a/xmltoolingtest/ComplexXMLObjectTest.h +++ b/xmltoolingtest/ComplexXMLObjectTest.h @@ -32,8 +32,6 @@ public: } void testComplexUnmarshalling() { - TS_TRACE("testComplexUnmarshalling"); - string path=data_path + "ComplexXMLObject.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(fs); diff --git a/xmltoolingtest/ExceptionTest.h b/xmltoolingtest/ExceptionTest.h index 70edcf4..d290fbe 100644 --- a/xmltoolingtest/ExceptionTest.h +++ b/xmltoolingtest/ExceptionTest.h @@ -23,8 +23,6 @@ class ExceptionTest : public CxxTest::TestSuite { public: void testException(void) { - TS_TRACE("testException"); - #define TEST(n,b,a) XMLToolingException e##n(b); \ TS_ASSERT(!strcmp(a,e##n.what())) diff --git a/xmltoolingtest/KeyInfoTest.h b/xmltoolingtest/KeyInfoTest.h index 8672906..64fb6c7 100644 --- a/xmltoolingtest/KeyInfoTest.h +++ b/xmltoolingtest/KeyInfoTest.h @@ -34,8 +34,6 @@ public: } void testKeyInfo1() { - TS_TRACE("testKeyInfo1"); - string path=data_path + "KeyInfo1.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getValidatingParser().parse(fs); @@ -44,9 +42,7 @@ public: const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement()); TS_ASSERT(b!=NULL); - auto_ptr kiObject( - dynamic_cast(b->buildFromDocument(doc)) - ); + auto_ptr kiObject(dynamic_cast(b->buildFromDocument(doc))); TS_ASSERT(kiObject.get()!=NULL); TSM_ASSERT_EQUALS("Number of child elements was not expected value", 3, kiObject->getOrderedChildren().size()); @@ -56,15 +52,12 @@ public: 1, kiObject->getX509Datas().front()->getX509Certificates().size()); auto_ptr_XMLCh expected("Public Key for CN=xmldap.org, OU=Domain Control Validated, O=xmldap.org"); - TSM_ASSERT_SAME_DATA("KeyName was not expected value", - expected.get(), kiObject->getKeyNames().front()->getName(), XMLString::stringLen(expected.get())); + TSM_ASSERT("KeyName was not expected value", XMLString::equals(expected.get(), kiObject->getKeyNames().front()->getName())); KeyInfoSchemaValidators.validate(kiObject.get()); } void testKeyInfo2() { - TS_TRACE("testKeyInfo2"); - string path=data_path + "KeyInfo2.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getValidatingParser().parse(fs); @@ -73,9 +66,7 @@ public: const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement()); TS_ASSERT(b!=NULL); - auto_ptr kiObject( - dynamic_cast(b->buildFromDocument(doc)) - ); + auto_ptr kiObject(dynamic_cast(b->buildFromDocument(doc))); TS_ASSERT(kiObject.get()!=NULL); TSM_ASSERT_EQUALS("Number of child elements was not expected value", 2, kiObject->getOrderedChildren().size()); @@ -88,8 +79,6 @@ public: } void testKeyInfo3() { - TS_TRACE("testKeyInfo3"); - string path=data_path + "KeyInfo3.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(fs); @@ -98,9 +87,7 @@ public: const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement()); TS_ASSERT(b!=NULL); - auto_ptr kiObject( - dynamic_cast(b->buildFromDocument(doc)) - ); + auto_ptr kiObject(dynamic_cast(b->buildFromDocument(doc))); TS_ASSERT(kiObject.get()!=NULL); TS_ASSERT_THROWS(KeyInfoSchemaValidators.validate(kiObject.get()),ValidationException); } diff --git a/xmltoolingtest/MarshallingTest.h b/xmltoolingtest/MarshallingTest.h index 0b3e056..1a5c53a 100644 --- a/xmltoolingtest/MarshallingTest.h +++ b/xmltoolingtest/MarshallingTest.h @@ -35,8 +35,6 @@ public: } void testMarshallingWithAttributes() { - TS_TRACE("testMarshallingWithAttributes"); - QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); auto_ptr sxObject(SimpleXMLObjectBuilder::newSimpleXMLObject()); TS_ASSERT(sxObject.get()!=NULL); @@ -55,8 +53,6 @@ public: } void testMarshallingWithElementContent() { - TS_TRACE("testMarshallingWithElementContent"); - QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); auto_ptr sxObject(SimpleXMLObjectBuilder::newSimpleXMLObject()); TS_ASSERT(sxObject.get()!=NULL); @@ -75,8 +71,6 @@ public: } void testMarshallingWithChildElements() { - TS_TRACE("testMarshallingWithChildElements"); - QName qname(SimpleXMLObject::NAMESPACE,SimpleXMLObject::LOCAL_NAME); const SimpleXMLObjectBuilder* b=dynamic_cast(XMLObjectBuilder::getBuilder(qname)); TS_ASSERT(b!=NULL); @@ -95,7 +89,7 @@ public: kids.begin()->setId(foo.get()); kids.at(2)->setValue(bar.get()); kids.erase(kids.begin()+1); - TS_ASSERT_SAME_DATA(kids.back()->getValue(), bar.get(), XMLString::stringLen(bar.get())); + TS_ASSERT(XMLString::equals(kids.back()->getValue(), bar.get())); QName qtype(SimpleXMLObject::NAMESPACE,SimpleXMLObject::TYPE_NAME,SimpleXMLObject::NAMESPACE_PREFIX); kids.push_back( diff --git a/xmltoolingtest/SignatureTest.h b/xmltoolingtest/SignatureTest.h index 8f3ec2c..c50b86f 100644 --- a/xmltoolingtest/SignatureTest.h +++ b/xmltoolingtest/SignatureTest.h @@ -48,7 +48,7 @@ class TestValidator : public SignatureValidator XMLCh* m_uri; public: - TestValidator(const XMLCh* uri, XSECCryptoKey* key) : SignatureValidator(new KeyResolver(key)) { + TestValidator(const XMLCh* uri) : SignatureValidator(XMLToolingConfig::getConfig().KeyResolverManager.newPlugin(INLINE_KEY_RESOLVER,NULL)) { m_uri=XMLString::replicate(uri); } @@ -157,7 +157,7 @@ public: TS_ASSERT(sxObject2->getSignature()!=NULL); try { - TestValidator tv(&chNull,m_resolver->getKey()); + TestValidator tv(&chNull); tv.validate(sxObject2->getSignature()); } catch (XMLToolingException& e) { diff --git a/xmltoolingtest/UnmarshallingTest.h b/xmltoolingtest/UnmarshallingTest.h index 3687ea3..b645f11 100644 --- a/xmltoolingtest/UnmarshallingTest.h +++ b/xmltoolingtest/UnmarshallingTest.h @@ -69,8 +69,6 @@ public: } void testUnmarshallingWithAttributes() { - TS_TRACE("testUnmarshallingWithAttributes"); - string path=data_path + "SimpleXMLObjectWithAttribute.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(fs); @@ -85,12 +83,10 @@ public: TS_ASSERT(sxObject.get()!=NULL); auto_ptr_XMLCh expected("Firefly"); - TSM_ASSERT_SAME_DATA("ID was not expected value", expected.get(), sxObject->getId(), XMLString::stringLen(expected.get())); + TSM_ASSERT("ID was not expected value", XMLString::equals(expected.get(), sxObject->getId())); } void testUnmarshallingWithElementContent() { - TS_TRACE("testUnmarshallingWithElementContent"); - string path=data_path + "SimpleXMLObjectWithContent.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(fs); @@ -105,12 +101,10 @@ public: TS_ASSERT(sxObject.get()!=NULL); auto_ptr_XMLCh expected("Sample Content"); - TSM_ASSERT_SAME_DATA("Element content was not expected value", expected.get(), sxObject->getValue(), XMLString::stringLen(expected.get())); + TSM_ASSERT("Element content was not expected value", XMLString::equals(expected.get(), sxObject->getValue())); } void testUnmarshallingWithChildElements() { - TS_TRACE("testUnmarshallingWithChildElements"); - string path=data_path + "SimpleXMLObjectWithChildren.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(fs); @@ -131,8 +125,6 @@ public: } void testUnmarshallingWithClone() { - TS_TRACE("testUnmarshallingWithClone"); - string path=data_path + "SimpleXMLObjectWithChildren.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(fs); @@ -156,8 +148,6 @@ public: } void testUnmarshallingWithUnknownChild() { - TS_TRACE("testUnmarshallingWithUnknownChild"); - string path=data_path + "SimpleXMLObjectWithUnknownChild.xml"; ifstream fs(path.c_str()); DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(fs); -- 2.1.4