diff options
author | Sandro Knauß <mail@sandroknauss.de> | 2014-11-12 17:13:33 (GMT) |
---|---|---|
committer | Sandro Knauß <mail@sandroknauss.de> | 2014-11-12 17:13:33 (GMT) |
commit | 7182b54ff7267f0577581f5f0e3c3f8bcf0d1e34 (patch) | |
tree | 680eefdf5d5b10381f92a3b06e60fa8958c6bfc6 | |
parent | 71d27eaa017f02d527479475205c3772b892ce46 (diff) | |
download | libkolabxml-7182b54ff7267f0577581f5f0e3c3f8bcf0d1e34.tar.gz |
Make version attribute not fixed.
Instead of a fixed value, we only use a default value.
Added tests to make sure that the 3.0dev is a valid version attribute.
KOLAB: #3896
-rw-r--r-- | schemas/kolabformat.xsd | 10 | ||||
-rw-r--r-- | testfiles/testnote.xml | 18 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/kolabconversationtest.cpp | 47 | ||||
-rw-r--r-- | tests/kolabconversationtest.h | 33 | ||||
-rw-r--r-- | tests/testfiles/testConfiguration.xml | 8 | ||||
-rw-r--r-- | tests/testfiles/testNote.xml | 11 |
7 files changed, 109 insertions, 27 deletions
diff --git a/schemas/kolabformat.xsd b/schemas/kolabformat.xsd index adbe422..e159560 100644 --- a/schemas/kolabformat.xsd +++ b/schemas/kolabformat.xsd @@ -4,14 +4,10 @@ xmlns="http://kolab.org" elementFormDefault="qualified"> + <xs:complexType name="KolabBase"> + <xs:attribute name="version" type="xs:string" default="3.0" /> + </xs:complexType> - - <xs:complexType name="KolabBase"> - <xs:attribute name="version" type="xs:string" fixed="3.0" /> - </xs:complexType> - - - <xs:complexType name="attachmentPropType"> <xs:sequence> <xs:element name="parameters"> diff --git a/testfiles/testnote.xml b/testfiles/testnote.xml deleted file mode 100644 index f7ad5b0..0000000 --- a/testfiles/testnote.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<note version="3.0dev1" xmlns="http://kolab.org"> - <!-- Common fields --> - <uid>uid</uid> - <body></body> - <categories></categories> - <creation-date>2004-05-04T15:00:00Z</creation-date> - <last-modification-date>2004-05-04T15:00:00Z</last-modification-date> - <sensitivity>public</sensitivity> - <inline-attachment></inline-attachment> - <link-attachment></link-attachment> - <product-id></product-id> - <!-- Note specific fields --> - <summary>summarytext</summary> - <background-color>#000000</background-color> - <foreground-color>#ffff00</foreground-color> -</note> - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 47f811a..69d2641 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,14 +26,19 @@ if (QT4_FOUND) add_test(conversiontest ${CMAKE_CURRENT_BINARY_DIR}/conversiontest) QT4_AUTOMOC(parsingtest.cpp) - add_executable(parsingtest parsingtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${CONVERSIONTEST_MOC}) + add_executable(parsingtest parsingtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${PARSINGTEST_MOC}) target_link_libraries(parsingtest ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} kolabxml ${XERCES_C}) add_test(parsingtest ${CMAKE_CURRENT_BINARY_DIR}/parsingtest) QT4_AUTOMOC(validationtest.cpp) - add_executable(validationtest validationtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${CONVERSIONTEST_MOC}) + add_executable(validationtest validationtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${VALIDATIONTEST_MOC}) target_link_libraries(validationtest ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} kolabxml ${XERCES_C}) add_test(validationtest ${CMAKE_CURRENT_BINARY_DIR}/validationtest) + + QT4_AUTOMOC(kolabconversationtest.cpp) + add_executable(kolabconversationtest kolabconversationtest.cpp ${CMAKE_CURRENT_BINARY_DIR}/${KOLABCONVERSATIONTEST_MOC}) + target_link_libraries(kolabconversationtest ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} kolabxml ${XERCES_C}) + add_test(kolabconversationtest ${CMAKE_CURRENT_BINARY_DIR}/kolabconversationtest) else() message(WARNING "Could not build tests because qt is missing") endif() diff --git a/tests/kolabconversationtest.cpp b/tests/kolabconversationtest.cpp new file mode 100644 index 0000000..6835533 --- /dev/null +++ b/tests/kolabconversationtest.cpp @@ -0,0 +1,47 @@ +/* + Copyright (C) 2014 Sandro Knauß <knauss@kolabsys.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "kolabconversationtest.h" + +#include <QTest> +#include <QDebug> +#include <iostream> + +#include "src/kolabconversions.h" + +void KolabConversationTest::configurationDeserialationTest() +{ + boost::shared_ptr <Kolab::Configuration> ptr = Kolab::KolabObjects::deserializeObject<Kolab::Configuration>(TEST_DATA_PATH "/testfiles/testConfiguration.xml", true); + QVERIFY(ptr); + QVERIFY(ptr->isValid()); + QCOMPARE(ptr->type(), Kolab::Configuration::TypeRelation); + +} + +void KolabConversationTest::noteDeserialationTest() +{ + boost::shared_ptr <Kolab::Note> ptr = Kolab::KolabObjects::deserializeObject<Kolab::Note>(TEST_DATA_PATH "/testfiles/testNote.xml", true); + QVERIFY(ptr); + QVERIFY(ptr->isValid()); + QCOMPARE(ptr->summary(), std::string("summarytext")); +} + + +QTEST_MAIN( KolabConversationTest ) + +#include "kolabconversationtest.moc" diff --git a/tests/kolabconversationtest.h b/tests/kolabconversationtest.h new file mode 100644 index 0000000..4308812 --- /dev/null +++ b/tests/kolabconversationtest.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2014 Sandro Knauß <knauss@kolabsys.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +#ifndef KOLABCONVERSATIONTEST_H +#define KOLABCONVERSATIONTEST_H + +#include <QObject> + +class KolabConversationTest: public QObject +{ + Q_OBJECT +private slots: + void configurationDeserialationTest(); + void noteDeserialationTest(); +}; + +#endif diff --git a/tests/testfiles/testConfiguration.xml b/tests/testfiles/testConfiguration.xml new file mode 100644 index 0000000..9398c96 --- /dev/null +++ b/tests/testfiles/testConfiguration.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<configuration xmlns="http://kolab.org" version="3.0dev1"> + <uid>6194e99c-69c0-11e4-9911-080027fe5a4c</uid> + <prodid>Roundcube-libkolab-1.1 Libkolabxml-1.1</prodid> + <creation-date>2014-11-11T16:32:51Z</creation-date> + <last-modification-date>2014-11-11T16:32:51Z</last-modification-date> + <type>relation</type> +</configuration> diff --git a/tests/testfiles/testNote.xml b/tests/testfiles/testNote.xml new file mode 100644 index 0000000..a8dc396 --- /dev/null +++ b/tests/testfiles/testNote.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<note version="3.0dev1" xmlns="http://kolab.org"> + <uid>uid</uid> + <prodid></prodid> + <creation-date>2014-11-11T16:32:51Z</creation-date> + <last-modification-date>2014-11-11T16:32:51Z</last-modification-date> + <classification>PUBLIC</classification> + <summary>summarytext</summary> + <color>#ffff00</color> +</note> + |