moved non-public API members from MetadaType to protected
This commit is contained in:
parent
0ddee7f09a
commit
49af6fd727
3 changed files with 18 additions and 87 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
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 $
|
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 $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.2 $
|
||||||
* @see MetadataTypeContainer
|
* @see MetadataTypeContainer
|
||||||
*/
|
*/
|
||||||
class MetadataType : public Configurable
|
class MetadataType : public Configurable
|
||||||
{
|
{
|
||||||
|
friend class MetadataTypeContainer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The name of the configuration XML element used by MetadataType.
|
* The name of the configuration XML element used by MetadataType.
|
||||||
|
@ -117,7 +119,7 @@ class MetadataType : public Configurable
|
||||||
Ptr<Glib::ustring>::Ref localizationKey;
|
Ptr<Glib::ustring>::Ref localizationKey;
|
||||||
|
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*
|
*
|
||||||
|
@ -141,15 +143,6 @@ class MetadataType : public Configurable
|
||||||
Glib::ustring localizationKey)
|
Glib::ustring localizationKey)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A virtual destructor, as this class has virtual functions.
|
|
||||||
*/
|
|
||||||
virtual
|
|
||||||
~MetadataType(void) throw ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name of the XML element this object expects
|
* Return the name of the XML element this object expects
|
||||||
* to be sent to a call to configure().
|
* to be sent to a call to configure().
|
||||||
|
@ -173,6 +166,16 @@ class MetadataType : public Configurable
|
||||||
configure(const xmlpp::Element &element)
|
configure(const xmlpp::Element &element)
|
||||||
throw (std::invalid_argument);
|
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.
|
* Return the Dublic Core name of the metadata type.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
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 $
|
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.
|
* Test the iterator feature of the container.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
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 $
|
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.
|
* Unit test for the MetadataTypeContainer class.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.2 $
|
||||||
* @see MetadataTypeContainer
|
* @see MetadataTypeContainer
|
||||||
*/
|
*/
|
||||||
class MetadataTypeContainerTest : public CPPUNIT_NS::TestFixture
|
class MetadataTypeContainerTest : public CPPUNIT_NS::TestFixture
|
||||||
{
|
{
|
||||||
CPPUNIT_TEST_SUITE(MetadataTypeContainerTest);
|
CPPUNIT_TEST_SUITE(MetadataTypeContainerTest);
|
||||||
CPPUNIT_TEST(firstTest);
|
CPPUNIT_TEST(firstTest);
|
||||||
CPPUNIT_TEST(metadataTypeTest);
|
|
||||||
CPPUNIT_TEST(iteratorTest);
|
CPPUNIT_TEST(iteratorTest);
|
||||||
CPPUNIT_TEST(localizedTest);
|
CPPUNIT_TEST(localizedTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
@ -85,14 +84,6 @@ class MetadataTypeContainerTest : public CPPUNIT_NS::TestFixture
|
||||||
void
|
void
|
||||||
firstTest(void) throw (CPPUNIT_NS::Exception);
|
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.
|
* Testing the iterators available from the container.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue