From 49af6fd727bc4f83cbca8015d8b4a3d913f2c40d Mon Sep 17 00:00:00 2001 From: maroy Date: Thu, 28 Apr 2005 07:16:07 +0000 Subject: [PATCH] moved non-public API members from MetadaType to protected --- .../include/LiveSupport/Core/MetadataType.h | 27 ++++---- .../core/src/MetadataTypeContainerTest.cxx | 65 +------------------ .../core/src/MetadataTypeContainerTest.h | 13 +--- 3 files changed, 18 insertions(+), 87 deletions(-) diff --git a/livesupport/modules/core/include/LiveSupport/Core/MetadataType.h b/livesupport/modules/core/include/LiveSupport/Core/MetadataType.h index 5b661216d..933bfae9c 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/MetadataType.h +++ b/livesupport/modules/core/include/LiveSupport/Core/MetadataType.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/MetadataType.h,v $ ------------------------------------------------------------------------------*/ @@ -85,11 +85,13 @@ class MetadataTypeContainer; * * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see MetadataTypeContainer */ class MetadataType : public Configurable { + friend class MetadataTypeContainer; + private: /** * The name of the configuration XML element used by MetadataType. @@ -117,7 +119,7 @@ class MetadataType : public Configurable Ptr::Ref localizationKey; - public: + protected: /** * Default constructor. * @@ -141,15 +143,6 @@ class MetadataType : public Configurable Glib::ustring localizationKey) throw (); - - /** - * A virtual destructor, as this class has virtual functions. - */ - virtual - ~MetadataType(void) throw () - { - } - /** * Return the name of the XML element this object expects * to be sent to a call to configure(). @@ -173,6 +166,16 @@ class MetadataType : public Configurable configure(const xmlpp::Element &element) throw (std::invalid_argument); + + public: + /** + * A virtual destructor, as this class has virtual functions. + */ + virtual + ~MetadataType(void) throw () + { + } + /** * Return the Dublic Core name of the metadata type. * diff --git a/livesupport/modules/core/src/MetadataTypeContainerTest.cxx b/livesupport/modules/core/src/MetadataTypeContainerTest.cxx index a7da4607e..c9ee98691 100644 --- a/livesupport/modules/core/src/MetadataTypeContainerTest.cxx +++ b/livesupport/modules/core/src/MetadataTypeContainerTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataTypeContainerTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -198,69 +198,6 @@ MetadataTypeContainerTest :: firstTest(void) } -/*------------------------------------------------------------------------------ - * Test the MetadataType class - *----------------------------------------------------------------------------*/ -void -MetadataTypeContainerTest :: metadataTypeTest(void) - throw (CPPUNIT_NS::Exception) -{ - Ptr::Ref container; - - // create a container - try { - Ptr::Ref parser( - new xmlpp::DomParser(configFileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - container.reset(new MetadataTypeContainer(bundle)); - container->configure(*root); - - } catch (std::invalid_argument &e) { - CPPUNIT_FAIL(std::string("semantic error in configuration file:\n") - + e.what()); - } catch (xmlpp::exception &e) { - CPPUNIT_FAIL(std::string("XML error in configuration file:\n") - + e.what()); - } - - Ptr::Ref metadataType; - - // first check the trivial constructor - metadataType.reset(new MetadataType(container, - "dc:creator", - "TPE2", - "dc_creator")); - - CPPUNIT_ASSERT(*metadataType->getDcName() == "dc:creator"); - CPPUNIT_ASSERT(*metadataType->getId3Tag() == "TPE2"); - CPPUNIT_ASSERT(*metadataType->getLocalizationKey() == "dc_creator"); - metadataType.reset(); - - // test configuration from a configuration file - try { - Ptr::Ref parser( - new xmlpp::DomParser(metadataTypeConfigFileName, true)); - const xmlpp::Document * document = parser->get_document(); - const xmlpp::Element * root = document->get_root_node(); - - metadataType.reset(new MetadataType(container)); - metadataType->configure(*root); - - CPPUNIT_ASSERT(*metadataType->getDcName() == "dc:creator"); - CPPUNIT_ASSERT(*metadataType->getId3Tag() == "TPE2"); - CPPUNIT_ASSERT(*metadataType->getLocalizationKey() == "dc_creator"); - } catch (std::invalid_argument &e) { - CPPUNIT_FAIL(std::string("semantic error in configuration file:\n") - + e.what()); - } catch (xmlpp::exception &e) { - CPPUNIT_FAIL(std::string("XML error in configuration file:\n") - + e.what()); - } -} - - /*------------------------------------------------------------------------------ * Test the iterator feature of the container. *----------------------------------------------------------------------------*/ diff --git a/livesupport/modules/core/src/MetadataTypeContainerTest.h b/livesupport/modules/core/src/MetadataTypeContainerTest.h index 19f6ee56e..d34232f22 100644 --- a/livesupport/modules/core/src/MetadataTypeContainerTest.h +++ b/livesupport/modules/core/src/MetadataTypeContainerTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataTypeContainerTest.h,v $ ------------------------------------------------------------------------------*/ @@ -58,14 +58,13 @@ namespace Core { * Unit test for the MetadataTypeContainer class. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see MetadataTypeContainer */ class MetadataTypeContainerTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE(MetadataTypeContainerTest); CPPUNIT_TEST(firstTest); - CPPUNIT_TEST(metadataTypeTest); CPPUNIT_TEST(iteratorTest); CPPUNIT_TEST(localizedTest); CPPUNIT_TEST_SUITE_END(); @@ -85,14 +84,6 @@ class MetadataTypeContainerTest : public CPPUNIT_NS::TestFixture void firstTest(void) throw (CPPUNIT_NS::Exception); - /** - * Test the MetadataType class (which needs a container as well) - * - * @exception CPPUNIT_NS::Exception on test failures. - */ - void - metadataTypeTest(void) throw (CPPUNIT_NS::Exception); - /** * Testing the iterators available from the container. *