moved non-public API members from MetadaType to protected

This commit is contained in:
maroy 2005-04-28 07:16:07 +00:00
parent 0ddee7f09a
commit 49af6fd727
3 changed files with 18 additions and 87 deletions

View file

@ -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<Glib::ustring>::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.
*

View file

@ -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<MetadataTypeContainer>::Ref container;
// create a container
try {
Ptr<xmlpp::DomParser>::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<MetadataType>::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<xmlpp::DomParser>::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.
*----------------------------------------------------------------------------*/

View file

@ -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.
*