[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [nepomuk-core/testLibrary] test: Fixup the test
From: Vishesh Handa <handa.vish () gmail ! com>
Date: 2012-07-03 12:25:25
Message-ID: 20120703122525.27C40A60E2 () git ! kde ! org
[Download RAW message or body]
Git commit 511af5d72da830f982ec590ed668e6db1c226495 by Vishesh Handa.
Committed on 12/03/2012 at 14:03.
Pushed by vhanda into branch 'testLibrary'.
Fixup the test
Make it work with ctest, and also make it pass
M +4 -4 test/CMakeLists.txt
M +17 -5 test/identificationtest.cpp
http://commits.kde.org/nepomuk-core/511af5d72da830f982ec590ed668e6db1c226495
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b78adca..96e1064 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,7 +3,7 @@ project(nepomuksync_tests)
find_package(KDE4 REQUIRED)
find_package(Nepomuk REQUIRED)
-include( NepomukTestLibMacros )
+include(NepomukTestLibMacros)
include_directories(
${QT_INCLUDES}
@@ -22,9 +22,7 @@ add_definitions(-DDISABLE_NEPOMUK_LEGACY=1)
set(nepomuksynctests_SRCS identificationtest.cpp )
-kde4_add_executable( nepomuksynctest ${nepomuksynctests_SRCS} )
-add_nepomuk_test(nepomuksynctest ${CMAKE_CURRENT_BINARY_DIR}/nepomuksynctest)
-
+kde4_add_executable(nepomuksynctest ${nepomuksynctests_SRCS})
target_link_libraries(nepomuksynctest
${QT_QTCORE_LIBRARY}
${QT_QTDBUS_LIBRARY}
@@ -37,5 +35,7 @@ target_link_libraries(nepomuksynctest
nepomukdatamanagement
)
+add_nepomuk_test(NepomukSyncTest ${CMAKE_CURRENT_BINARY_DIR}/nepomuksynctest)
+
diff --git a/test/identificationtest.cpp b/test/identificationtest.cpp
index aacb600..34b4c1e 100644
--- a/test/identificationtest.cpp
+++ b/test/identificationtest.cpp
@@ -37,6 +37,7 @@
#include <Soprano/Model>
#include <Soprano/StatementIterator>
#include <Soprano/Vocabulary/NAO>
+#include <Soprano/QueryResultIterator>
#include <Nepomuk/Vocabulary/NIE>
#include "nepomuk/datamanagement.h"
@@ -44,17 +45,24 @@
using namespace Soprano::Vocabulary;
using namespace Nepomuk::Vocabulary;
+void listResources() {
+ Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
+ const QString query = QString::fromLatin1("select distinct ?r where { ?r ?p ?o . "
+ "FILTER(regex(str(?r), '^nepomuk:/res/')) . }");
+ Soprano::QueryResultIterator it = model->executeQuery( query, Soprano::Query::QueryLanguageSparql );
+ while( it.next() ) {
+ kDebug() << it[0];
+ }
+}
+
void NepomukSyncTests::basicIdentification()
{
- Soprano::Model *model = Nepomuk::ResourceManager::instance()->mainModel();
- kDebug() << "num: " << model->statementCount();
+ listResources();
KTemporaryFile file;
QVERIFY(file.open());
QUrl fileUrl = KUrl(file.fileName());
- kDebug() << "File Url: " << fileUrl;
-
Nepomuk::Resource res( fileUrl );
res.setRating( 5 );
@@ -67,11 +75,15 @@ void NepomukSyncTests::basicIdentification()
if( job->error() ) {
kWarning() << job->errorString();
}
-
+ QVERIFY(!job->error());
QVERIFY( res.rating() == 2 );
+ listResources();
resetRepository();
+ listResources();
+ // This is required as resetRepository works on a the models
+ Nepomuk::ResourceManager::instance()->clearCache();
QVERIFY( !res.exists() );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic