[tracker/tracker-0.8] Functional Tests: Added basic file operations to miner-fs and support for desktop environment
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.8] Functional Tests: Added basic file operations to miner-fs and support for desktop environment
- Date: Thu, 22 Apr 2010 11:26:17 +0000 (UTC)
commit a9d100ece2b3d90470f8b5a85159854bdf43daee
Author: Martyn Russell <martyn lanedo com>
Date: Fri Apr 16 11:35:31 2010 +0100
Functional Tests: Added basic file operations to miner-fs and support for desktop environment
configure.ac | 1 +
tests/functional-tests/Makefile.am | 5 +-
tests/functional-tests/bootup-tc.py | 213 ++++---
tests/functional-tests/configuration.py | 169 ++++-
tests/functional-tests/data/Makefile.am | 5 +-
tests/functional-tests/data/Video/Makefile.am | 10 +
tests/functional-tests/data/Video/test-video.mp4 | Bin 0 -> 211931 bytes
tests/functional-tests/metadata_extraction_tc.py | 21 +-
tests/functional-tests/miner-basic-ops.py | 758 ++++++++++++++++++++++
tests/functional-tests/tests.xml | 509 +++++++++++----
tests/functional-tests/virtual-files-tc.py | 96 ++--
tests/functional-tests/writeback-tc.py | 282 ++++----
12 files changed, 1627 insertions(+), 442 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 083cb24..2b606b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1735,6 +1735,7 @@ AC_CONFIG_FILES([
tests/functional-tests/data/Makefile
tests/functional-tests/data/Music/Makefile
tests/functional-tests/data/Images/Makefile
+ tests/functional-tests/data/Video/Makefile
tests/Makefile
tests/tracker-miner-fs/Makefile
tests/tracker-extract/Makefile
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 8a953f8..52b1d7e 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -12,11 +12,12 @@ config_SCRIPTS = \
05-coalesce.py \
06-distance.py \
07-graph.py \
- 08-unique-insertions.py \
+ 08-unique-insertions.py \
09-concurrent-query.py \
bootup-tc.py \
configuration.py \
- metadata_extraction_tc.py \
+ metadata_extraction_tc.py \
+ miner-basic-ops.py \
performance-tc.py \
tests.xml \
virtual-files-tc.py \
diff --git a/tests/functional-tests/bootup-tc.py b/tests/functional-tests/bootup-tc.py
index 8f3c831..c54ba4e 100644
--- a/tests/functional-tests/bootup-tc.py
+++ b/tests/functional-tests/bootup-tc.py
@@ -18,123 +18,138 @@
# Boston, MA 02110-1301, USA.
-import sys,os,dbus
+import sys, os, dbus
import unittest
import time
import random
import commands
import string
-import configuration
+import configuration as cfg
TRACKER = 'org.freedesktop.Tracker1'
TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-IMAGES_DEFAULT = configuration.MYDOCS_IMAGES
-MUSIC_DEFAULT = configuration.MYDOCS_MUSIC
-VIDEOS_DEFAULT = configuration.MYDOCS_VIDEOS
-
-
-
-def files_list(dirName):
- fileList = []
- for file in os.listdir(dirName):
- dirfile = os.path.join(dirName, file)
- if dirName == IMAGES_DEFAULT :
- if os.path.isfile(dirfile):
- if file.split('.')[1]== 'jpg' :
- fileList.append(dirfile)
-
- elif dirName == MUSIC_DEFAULT :
- if os.path.isfile(dirfile):
- if file.split('.')[1]== 'mp3' :
- fileList.append(dirfile)
-
- elif dirName == VIDEOS_DEFAULT :
- if os.path.isfile(dirfile):
- if file.split('.')[1]== 'avi' :
- fileList.append(dirfile)
-
-
+IMAGES_DEFAULT = cfg.MYDOCS_IMAGES
+MUSIC_DEFAULT = cfg.MYDOCS_MUSIC
+VIDEOS_DEFAULT = cfg.MYDOCS_VIDEOS
+
+def files_list(dirName):
+ fileList = []
+ for file in os.listdir(dirName):
+ dirfile = os.path.join(dirName, file)
+ if dirName == IMAGES_DEFAULT :
+ if os.path.isfile(dirfile):
+ if file.split('.')[1]== 'jpg' :
+ fileList.append(dirfile)
+
+ elif dirName == MUSIC_DEFAULT :
+ if os.path.isfile(dirfile):
+ if file.split('.')[1]== 'mp3' :
+ fileList.append(dirfile)
+
+ elif dirName == VIDEOS_DEFAULT :
+ if os.path.isfile(dirfile):
+ if file.split('.')[1]== 'avi' :
+ fileList.append(dirfile)
return fileList
-
-
class TestUpdate (unittest.TestCase):
-
- def setUp(self):
- bus = dbus.SessionBus()
- tracker = bus.get_object(TRACKER, TRACKER_OBJ)
- self.resources = dbus.Interface (tracker,
- dbus_interface=RESOURCES_IFACE)
-
-
- def sparql_update(self,query):
- return self.resources.SparqlUpdate(query)
-
- def query(self,query):
- return self.resources.SparqlQuery(query)
-
- def check ( self , appcn ):
- pid = commands.getoutput("ps -ef| grep tracker | awk '{print $3}'").split()
- if appcn in pid :
- return 1
- else :
- return 0
-class tracker_daemon(TestUpdate):
+ def setUp(self):
+ bus = dbus.SessionBus()
+ tracker = bus.get_object(TRACKER, TRACKER_OBJ)
+ self.resources = dbus.Interface (tracker,
+ dbus_interface=RESOURCES_IFACE)
+ def sparql_update(self,query):
+ return self.resources.SparqlUpdate(query)
- def test_miner_01(self) :
- appcn = configuration.TRACKER_MINER
- result=self.check(appcn)
- self.assert_(result==1,"tracker miner is not running" )
-
- def test_store_02(self) :
- appcn = configuration.TRACKER_STORE
- result=self.check(appcn)
- self.assert_(result==1,"tracker store is not running" )
-
-class default_content(TestUpdate):
-
- def test_images_01(self) :
- """
- 1.Check the no.of files in default folder
- 2.Make tracker search for images and check if files are listed from default folders and count them.
- 3.Check if no.of files from default folder is equal to tracker search results
- """
- default_Images=files_list(IMAGES_DEFAULT)
- Images = commands.getoutput('tracker-search -i -l 10000 | grep /home/user/MyDocs/.images/|wc -l' )
- self.assert_(len(default_Images)==int(Images) , "Files are not indexed from default folder")
-
-
- def test_music_02(self) :
-
- """
- 1.Check the no.of files in default folder
- 2.Make tracker search for songs and check if files are listed from default folders and count them.
- 3.Check if no.of files from default folder is equal to tracker search results
- """
- default_music=files_list(MUSIC_DEFAULT)
- Music = commands.getoutput('tracker-search -u -l 10000 | grep /home/user/MyDocs/.sounds/|wc -l' )
- self.assert_(len(default_music)==int(Music) , "Files are not indexed from default folder")
-
-
- def test_Video_03(self) :
-
- """
- 1.Check the no.of files in default folder
- 2.Make tracker search for videos and check if files are listed from default folders and count them.
- 3.Check if no.of files from default folder is equal to tracker search results
- """
-
- default_videos=files_list(VIDEOS_DEFAULT)
- Videos = commands.getoutput('tracker-search -v -l 10000 | grep /home/user/MyDocs/.videos/|wc -l' )
- self.assert_(len(default_videos)==int(Videos) , "Files are not indexed from default folder")
+ def query(self,query):
+ return self.resources.SparqlQuery(query)
+ def check ( self , appcn ):
+ return int(commands.getoutput('pidof %s | wc -w' % appcn))
+class tracker_daemon(TestUpdate):
+ def test_miner_01(self) :
+ appcn = cfg.TRACKER_MINER
+ result=self.check(appcn)
+ self.assert_(result==1,"tracker miner is not running" )
+
+ def test_store_02(self) :
+ appcn = cfg.TRACKER_STORE
+ result=self.check(appcn)
+ self.assert_(result==1,"tracker store is not running" )
+
+class default_content(TestUpdate):
+
+ def test_images_01(self) :
+ """
+ 1.Check the no.of files in default folder
+ 2.Make tracker search for images and check if files are listed from default folders and count them.
+ 3.Check if no.of files from default folder is equal to tracker search results
+ """
+ default_Images=files_list(IMAGES_DEFAULT)
+ Images = commands.getoutput('tracker-search -i -l 10000 | grep /home/user/MyDocs/.images/|wc -l' )
+ self.assert_(len(default_Images)==int(Images) , "Files are not indexed from default folder")
+
+ def test_music_02(self) :
+
+ """
+ 1.Check the no.of files in default folder
+ 2.Make tracker search for songs and check if files are listed from default folders and count them.
+ 3.Check if no.of files from default folder is equal to tracker search results
+ """
+ default_music=files_list(MUSIC_DEFAULT)
+ Music = commands.getoutput('tracker-search -m -l 10000 | grep /home/user/MyDocs/.sounds/|wc -l' )
+ self.assert_(len(default_music)==int(Music) , "Files are not indexed from default folder")
+
+ def test_video_03(self) :
+
+ """
+ 1.Check the no.of files in default folder
+ 2.Make tracker search for videos and check if files are listed from default folders and count them.
+ 3.Check if no.of files from default folder is equal to tracker search results
+ """
+
+ default_videos=files_list(VIDEOS_DEFAULT)
+ Videos = commands.getoutput('tracker-search -v -l 10000 | grep /home/user/MyDocs/.videos/|wc -l' )
+ self.assert_(len(default_videos)==int(Videos) , "Files are not indexed from default folder")
+
+def run_tests(testNames):
+ errors = []
+ if (testNames == None):
+ if (cfg.check_target() == cfg.MAEMO6_HW):
+ suite_default_content = unittest.TestLoader().loadTestsFromTestCase(default_content)
+ result = unittest.TextTestRunner(verbosity=2).run(suite_default_content)
+ errors += result.errors + result.failures
+
+ suite_tracker_daemon = unittest.TestLoader().loadTestsFromTestCase(tracker_daemon)
+ result = unittest.TextTestRunner(verbosity=2).run(suite_tracker_daemon)
+ errors += result.errors + result.failures
+ else:
+ suite = unittest.TestLoader().loadTestsFromNames(testNames, __import__('bootup-tc'))
+ result = unittest.TextTestRunner(verbosity=2).run(suite)
+ errors += result.errors + result.failures
+ return len(errors)
+
+def parseArgs(argv=None):
+ import getopt
+ if argv is None:
+ argv = sys.argv
+ testNames = None
+ try:
+ options, args = getopt.getopt(argv[1:], 'h')
+ if len(args) == 0:
+ # createTests will load tests from self.module
+ testNames = None
+ elif len(args) > 0:
+ testNames = args
+ run_tests(testNames)
+ except getopt.error, msg:
+ pass
if __name__ == "__main__":
- unittest.main()
-
+ parseArgs()
diff --git a/tests/functional-tests/configuration.py b/tests/functional-tests/configuration.py
index cb0154b..fcdf3d0 100644
--- a/tests/functional-tests/configuration.py
+++ b/tests/functional-tests/configuration.py
@@ -21,15 +21,43 @@
# This is the configuration file for tracker testcases.
# It has many common utility defined.
-import os, sys
+import sys,os,dbus
+import time
+import random
+import commands
+import configuration
+from dbus.mainloop.glib import DBusGMainLoop
+import gobject
+import shutil
-prefix = sys.prefix
+TRACKER = 'org.freedesktop.Tracker1'
+TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources/Classes'
+RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources.Class"
+
+MINER="org.freedesktop.Tracker1.Miner.Files"
+MINER_OBJ="/org/freedesktop/Tracker1/Miner/Files"
+MINER_IFACE="org.freedesktop.Tracker1.Miner"
+
+PLATFORM_REL_PATH = '/etc/issue'
+
+PREFIX = sys.prefix
+CWD = os.getcwd()
+
+TEST_IMAGE = "test-image-1.jpg"
+TEST_MUSIC = "tracker-mp3-test.mp3"
+TEST_VIDEO = "test-video.mp4"
"""directory paths """
-TEST_DIR = prefix + '/share/tracker-tests/'
-TEST_DATA_DIR = prefix + '/share/tracker-tests/data/'
-TEST_DATA_MUSIC = prefix + '/share/tracker-tests/data/Music/'
-TEST_DATA_IMAGES = prefix + '/share/tracker-tests/data/Images/'
+TEST_DIR = PREFIX + '/share/tracker-tests/'
+TEST_DATA_DIR = PREFIX + '/share/tracker-tests/data/'
+TEST_DATA_MUSIC = PREFIX + '/share/tracker-tests/data/Music/'
+TEST_DATA_IMAGES = PREFIX + '/share/tracker-tests/data/Images/'
+TEST_DATA_VIDEO = PREFIX + '/share/tracker-tests/data/Video/'
+
+VCS_TEST_DATA_DIR = CWD + '/data/'
+VCS_TEST_DATA_MUSIC = CWD + '/data/Music/'
+VCS_TEST_DATA_IMAGES = CWD + '/data/Images/'
+VCS_TEST_DATA_VIDEO = CWD + '/data/Video/'
"""
dir_path = os.environ['HOME']
@@ -39,40 +67,111 @@ MYDOCS_MUSIC = '/home/user/MyDocs/.sounds/'
MYDOCS_IMAGES = '/home/user/MyDocs/.images/'
MYDOCS_VIDEOS = '/home/user/MyDocs/.videos/'
WB_TEST_DIR_DEVICE = '/home/user/MyDocs/tracker-wb-test'
-WB_TEST_DIR_HOST = prefix + '/share/tracker-tests/data/tracker-wb-test'
+WB_TEST_DIR_HOST = os.path.expanduser("~") + '/tracker-wb-test'
URL_PREFIX = 'file://'
"""processes """
-TRACKER_WRITEBACK = prefix + '/lib/tracker/tracker-writeback'
-TRACKER_EXTRACT = prefix + '/lib/tracker/tracker-extract'
-TRACKER_MINER = prefix + '/lib/tracker/tracker-miner-fs'
-TRACKER_STORE = prefix + '/lib/tracker/tracker-store'
+TRACKER_WRITEBACK = PREFIX + '/lib/tracker/tracker-writeback'
+TRACKER_EXTRACT = PREFIX + '/lib/tracker/tracker-extract'
+TRACKER_MINER = 'tracker-miner-fs'
+TRACKER_STORE = 'tracker-store'
+TRACKER_WRITEBACK_DESKTOP = PREFIX + '/local/libexec/tracker-writeback'
+TRACKER_EXTRACT_DESKTOP = PREFIX + '/local/libexec/tracker-extract'
-'''
-def dir_path():
- return testDataDir
+"""platforms constants"""
+MAEMO6_SBOX = 2
+MAEMO6_HW = 3
+DESKTOP = 4
def check_target():
- on_target = 'OSSO_PRODUCT_NAME'
- try :
- if os.environ[on_target]:
- #if os.environ['DBUS_SESSION_BUS_ADDRESS'] == 'unix:path=/tmp/session_bus_socket':
- awk_print = '1'
- return awk_print
- except KeyError:
- awk_print = '2'
- return awk_print
-'''
+ """
+ check_target retrieves platform
+ """
+ sboxindicator = '/targets/links/scratchbox.config'
+
+ try :
+ fhandle = open (PLATFORM_REL_PATH,'r')
+ fcontent = fhandle.read()
+ release = fcontent.lower().replace(' ','')
+ fhandle.close()
+
+ if "maemo6" in release:
+ if os.path.exists(sboxindicator) and \
+ os.path.isfile(os.readlink(sboxindicator)) :
+ return MAEMO6_SBOX
+ else:
+ return MAEMO6_HW
+ else:
+ return DESKTOP
+
+ except IOError:
+ print 'cannot open', PLATFORM_REL_PATH
+
+class TDCopy():
+
+ def miner_processing_cb (self,status,handle):
+ print "GOT PROGRESS FROM MINER"
+
+ if (status == "Processing Files") :
+ print "Miner started"
+ elif (status == "Idle" ):
+ """if the string is "Idle" quit the loop """
+ print "Miner Idle"
+ self.loop.quit()
+ else :
+ print "No specific Signal"
+
+
+ def set_test_data(self, target):
+ """
+ Copy test data on default location watched by tracker
+ """
+ if (target == DESKTOP):
+
+ if (os.path.exists(os.path.expanduser("~") + '/' + TEST_MUSIC) \
+ and os.path.exists(os.path.expanduser("~") + '/' + TEST_VIDEO) \
+ and os.path.exists(os.path.expanduser("~") + '/' + TEST_IMAGE)):
+ return
+
+ elif (target == MAEMO6_HW):
+
+ if (os.path.exists( MYDOCS_MUSIC + '/' + TEST_MUSIC) \
+ and os.path.exists( MYDOCS_VIDEOS + '/' + TEST_VIDEO) \
+ and os.path.exists( MYDOCS_IMAGES + '/' + TEST_IMAGE)):
+ return
+
+ bus = dbus.SessionBus()
+ tracker = bus.get_object(TRACKER, TRACKER_OBJ)
+ self.resources = dbus.Interface (tracker,
+ dbus_interface=RESOURCES_IFACE)
+
+ miner_obj= bus.get_object(MINER,MINER_OBJ)
+ self.miner=dbus.Interface (miner_obj,dbus_interface=MINER_IFACE)
+
+
+ self.loop = gobject.MainLoop()
+ self.dbus_loop = DBusGMainLoop(set_as_default=True)
+ self.bus = dbus.SessionBus (self.dbus_loop)
+
+ self.bus.add_signal_receiver (self.miner_processing_cb,
+ signal_name="Progress",
+ dbus_interface=MINER_IFACE,
+ path=MINER_OBJ)
+
+ if (target == DESKTOP):
+ shutil.copy2(VCS_TEST_DATA_MUSIC + TEST_MUSIC, os.path.expanduser("~") + '/' + TEST_MUSIC)
+ self.loop.run()
+ shutil.copy2(VCS_TEST_DATA_VIDEO + TEST_VIDEO, os.path.expanduser("~") + '/' + TEST_VIDEO)
+ self.loop.run()
+ shutil.copy2(VCS_TEST_DATA_IMAGES + TEST_IMAGE, os.path.expanduser("~") + '/' + TEST_IMAGE)
+ self.loop.run()
+
+ if (target == MAEMO6_HW):
+ shutil.copy2( TEST_DATA_MUSIC + TEST_MUSIC, MYDOCS_MUSIC + '/' + TEST_MUSIC)
+ self.loop.run()
+ shutil.copy2( TEST_DATA_VIDEO + TEST_VIDEO, MYDOCS_VIDEOS + '/' + TEST_VIDEO)
+ self.loop.run()
+ shutil.copy2( TEST_DATA_IMAGES + TEST_IMAGE, MYDOCS_IMAGES + '/' + TEST_IMAGE)
+ self.loop.run()
-def check_target():
- sboxindicator='/targets/links/scratchbox.config'
- try :
- if os.path.islink(sboxindicator) and os.path.isfile(os.readlink(sboxindicator)) :
- awk_print = '3'
- else:
- awk_print = '2'
- return awk_print
-
- except OSError:
- awk_print = '2'
diff --git a/tests/functional-tests/data/Makefile.am b/tests/functional-tests/data/Makefile.am
index aab62c8..c36aefd 100644
--- a/tests/functional-tests/data/Makefile.am
+++ b/tests/functional-tests/data/Makefile.am
@@ -1,6 +1,9 @@
include $(top_srcdir)/Makefile.decl
-SUBDIRS = Music Images
+SUBDIRS = \
+ Music \
+ Video \
+ Images
configdir = $(datadir)/tracker-tests/data
diff --git a/tests/functional-tests/data/Video/Makefile.am b/tests/functional-tests/data/Video/Makefile.am
new file mode 100644
index 0000000..fafae7d
--- /dev/null
+++ b/tests/functional-tests/data/Video/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/Makefile.decl
+
+if DIST_FUNCTIONAL_TESTS
+configdir = $(datadir)/tracker-tests/data/Video
+
+config_DATA = \
+ test-video.mp4
+
+EXTRA_DIST = $(config_DATA)
+endif
diff --git a/tests/functional-tests/data/Video/test-video.mp4 b/tests/functional-tests/data/Video/test-video.mp4
new file mode 100644
index 0000000..915e4be
Binary files /dev/null and b/tests/functional-tests/data/Video/test-video.mp4 differ
diff --git a/tests/functional-tests/metadata_extraction_tc.py b/tests/functional-tests/metadata_extraction_tc.py
index c3231f6..00664c9 100755
--- a/tests/functional-tests/metadata_extraction_tc.py
+++ b/tests/functional-tests/metadata_extraction_tc.py
@@ -31,17 +31,24 @@ TRACKER = 'org.freedesktop.Tracker1'
TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-if target == '2':
+if target == configuration.MAEMO6_HW:
"""target is device """
IMAGE_FILE_PATH = configuration.URL_PREFIX + configuration.MYDOCS_IMAGES
- MUSIC_FILE_PATH = configuration.URL_PREFIX + configuration.MYDOCS_MUSIC
-else:
- """target is SBOX """
- IMAGE_FILE_PATH = configuration.URL_PREFIX + configuration.TEST_DATA_IMAGES
- MUSIC_FILE_PATH = configuration.URL_PREFIX + configuration.TEST_DATA_MUSIC
+ MUSIC_FILE_PATH = configuration.URL_PREFIX + configuration.MYDOCS_MUSIC
+ PCKL_FILE_PATH = configuration.TEST_DATA_DIR
+
+elif target == configuration.DESKTOP:
+ """target is DESKTOP """
+ IMAGE_FILE_PATH = configuration.URL_PREFIX + os.path.expanduser("~") + '/'
+ MUSIC_FILE_PATH = configuration.URL_PREFIX + os.path.expanduser("~") + '/'
+ PCKL_FILE_PATH = configuration.VCS_TEST_DATA_DIR
print "MUSIC_FILE_PATH is %s" %(MUSIC_FILE_PATH)
+tdcpy = configuration.TDCopy()
+tdcpy.set_test_data(target)
+
+
class TrackerHelpers(unittest.TestCase):
def setUp(self):
bus = dbus.SessionBus()
@@ -51,7 +58,7 @@ class TrackerHelpers(unittest.TestCase):
def de_pickle(self,pckl_file):
- pckl_file = configuration.TEST_DATA_DIR + pckl_file
+ pckl_file = PCKL_FILE_PATH + pckl_file
print "pickle file is %s" %(pckl_file)
pickf=open(pckl_file, 'rb')
dictList=pickle.load(pickf)
diff --git a/tests/functional-tests/miner-basic-ops.py b/tests/functional-tests/miner-basic-ops.py
new file mode 100644
index 0000000..9f1fd38
--- /dev/null
+++ b/tests/functional-tests/miner-basic-ops.py
@@ -0,0 +1,758 @@
+#!/usr/bin/env python2.5
+
+# Copyright (C) 2008, Nokia (urho konttori nokia 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.
+
+
+import sys,os,dbus
+import unittest
+import time
+import random
+import commands
+import configuration
+from dbus.mainloop.glib import DBusGMainLoop
+import gobject
+
+TRACKER = 'org.freedesktop.Tracker1'
+TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources/Classes'
+RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources.Class"
+
+MINER="org.freedesktop.Tracker1.Miner.Files"
+MINER_OBJ="/org/freedesktop/Tracker1/Miner/Files"
+MINER_IFACE="org.freedesktop.Tracker1.Miner"
+
+TEST_IMAGE = "test-image-1.jpg"
+TEST_MUSIC = "tracker-mp3-test.mp3"
+TEST_VIDEO = "test-video.mp4"
+
+"""create two test directories in miner monitored path """
+target = configuration.check_target()
+
+if target == configuration.MAEMO6_HW:
+ """target is device """
+ TEST_DIR_1 = configuration.MYDOCS + "tracker_test_op_1"
+ TEST_DIR_2 = configuration.MYDOCS + "tracker_test_op_2"
+ """create a test directory in miner un-monitored path """
+ #TEST_DIR_3 = configuration.TEST_DIR + "tracker_test_op_3"
+ TEST_DIR_3 = configuration.MYDOCS + "core-dumps/" + "tracker_test_op_3"
+ SRC_IMAGE_DIR = configuration.TEST_DATA_IMAGES
+ SRC_MUSIC_DIR = configuration.TEST_DATA_MUSIC
+ SRC_VIDEO_DIR = configuration.TEST_DATA_VIDEO
+
+elif target == configuration.DESKTOP:
+ """target is DESKTOP """
+ TEST_DIR_1 = os.path.expanduser("~") + '/' + "tracker_test_op_1"
+ TEST_DIR_2 = os.path.expanduser("~") + '/' + "tracker_test_op_2"
+ TEST_DIR_3 = os.path.expanduser("~") + '/' + "core-dumps/" + "tracker_test_op_3"
+ SRC_IMAGE_DIR = configuration.VCS_TEST_DATA_IMAGES
+ SRC_MUSIC_DIR = configuration.VCS_TEST_DATA_MUSIC
+ SRC_VIDEO_DIR = configuration.VCS_TEST_DATA_VIDEO
+
+commands.getoutput('mkdir ' + TEST_DIR_1)
+commands.getoutput('mkdir ' + TEST_DIR_2)
+commands.getoutput('mkdir -p ' + TEST_DIR_3)
+
+class TestUpdate (unittest.TestCase):
+
+ def setUp(self):
+ bus = dbus.SessionBus()
+ tracker = bus.get_object(TRACKER, TRACKER_OBJ)
+ self.resources = dbus.Interface (tracker,
+ dbus_interface=RESOURCES_IFACE)
+
+ miner_obj= bus.get_object(MINER,MINER_OBJ)
+ self.miner=dbus.Interface (miner_obj,dbus_interface=MINER_IFACE)
+
+
+ self.loop = gobject.MainLoop()
+ self.dbus_loop = DBusGMainLoop(set_as_default=True)
+ self.bus = dbus.SessionBus (self.dbus_loop)
+
+ self.bus.add_signal_receiver (self.miner_processing_cb,
+ signal_name="Progress",
+ dbus_interface=MINER_IFACE,
+ path=MINER_OBJ)
+
+ def miner_processing_cb (self,status,handle):
+ print "GOT PROGRESS FROM MINER"
+
+ if (status == "Processing Files") :
+ print "Miner started"
+ elif (status == "Idle" ):
+ """if the string is "Idle" quit the loop """
+ print "Miner Idle"
+ self.loop.quit()
+ else :
+ print "No specific Signal"
+
+""" copy operation and tracker-miner response test cases """
+class copy(TestUpdate):
+
+ def test_copy_01 (self):
+
+ """Copy an image file from unmonitored directory to monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path = TEST_DIR_1 + '/test-image-copy-01.jpg'
+
+ """ 1. Copy an image file from unmonitored directory to monitored directory """
+ commands.getoutput('cp '+ SRC_IMAGE_DIR + TEST_IMAGE + ' ' + file_path)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path + ' | wc -l')
+ print result
+ self.assert_(result == '1' , 'copied file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path)
+
+ def test_copy_02 (self):
+
+ """Copy a music file from unmonitored directory to monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path = TEST_DIR_1 + '/test-music-copy-01.mp3'
+
+ """ 1. Copy file from unmonitored directory to monitored directory """
+ commands.getoutput('cp '+ SRC_MUSIC_DIR + TEST_MUSIC + ' ' + file_path)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path + ' | wc -l')
+ print result
+ self.assert_(result == '1' , 'copied file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path)
+
+ def test_copy_03 (self):
+
+ """Copy a video file from unmonitored directory to monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path = TEST_DIR_1 + '/test-video-copy-01.mp4'
+
+ """ 1. Copy file from unmonitored directory to monitored directory """
+ commands.getoutput('cp '+ SRC_VIDEO_DIR + TEST_VIDEO + ' ' + file_path)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path + ' | wc -l')
+ print result
+ self.assert_(result == '1' , 'copied file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path)
+
+
+ def test_copy_04 (self):
+
+ """Copy an image file from monitored directory to unmonitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-image-copy-01.jpg'
+ file_path_2 = TEST_DIR_3 + '/test-image-copy-01.jpg'
+
+ """ 1. Copy an image file to monitored directory """
+ commands.getoutput('cp '+ SRC_IMAGE_DIR + TEST_IMAGE + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. Copy an image file to unmonitored directory """
+ commands.getoutput('cp '+ file_path_1 + ' ' + file_path_2)
+ time.sleep(2)
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '0' , 'copied file is shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '1' , 'source file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_1)
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_copy_05 (self):
+
+ """Copy a music file from monitored directory to unmonitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-music-copy-01.mp3'
+ file_path_2 = TEST_DIR_3 + '/test-music-copy-01.mp3'
+
+ """ 1. Copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_MUSIC_DIR + TEST_MUSIC + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. Copy file to unmonitored directory """
+ commands.getoutput('cp '+ file_path_1 + ' ' + file_path_2)
+ time.sleep(2)
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '0' , 'copied file is shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '1' , 'source file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_1)
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_copy_06 (self):
+
+ """Copy a video file from monitored directory to unmonitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-video-copy-01.mp4'
+ file_path_2 = TEST_DIR_3 + '/test-video-copy-01.mp4'
+
+ """ 1. Copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_VIDEO_DIR + TEST_VIDEO + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. Copy file to unmonitored directory """
+ commands.getoutput('cp '+ file_path_1 + ' ' + file_path_2)
+ time.sleep(2)
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '0' , 'copied file is shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '1' , 'source file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_1)
+ commands.getoutput('rm '+ file_path_2)
+
+
+ def test_copy_07 (self):
+
+ """Copy an image file from monitored directory to another monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-image-copy-01.jpg'
+ file_path_2 = TEST_DIR_2 + '/test-image-copy-01.jpg'
+
+ """ 1. Copy an image file to monitored directory """
+ commands.getoutput('cp '+ SRC_IMAGE_DIR + TEST_IMAGE + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. Copy an image file to another monitored directory """
+ commands.getoutput('cp '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '1' , 'copied file is not shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '1' , 'source file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_1)
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_copy_08 (self):
+
+ """Copy a music file from monitored directory to another monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-music-copy-01.mp3'
+ file_path_2 = TEST_DIR_2 + '/test-music-copy-01.mp3'
+
+ """ 1. Copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_MUSIC_DIR + TEST_MUSIC + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. Copy file to another monitored directory """
+ commands.getoutput('cp '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed both of these file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '1' , 'copied file is not shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '1' , 'source file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_1)
+ commands.getoutput('rm '+ file_path_2)
+
+
+ def test_copy_09 (self):
+
+ """Copy a video file from monitored directory to another monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-video-copy-01.mp4'
+ file_path_2 = TEST_DIR_2 + '/test-video-copy-01.mp4'
+
+ """ 1. Copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_VIDEO_DIR + TEST_VIDEO + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. Copy file to another monitored directory """
+ commands.getoutput('cp '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed both of these file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '1' , 'copied file is not shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '1' , 'source file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_1)
+ commands.getoutput('rm '+ file_path_2)
+
+
+
+
+
+
+
+""" move operation and tracker-miner response test cases """
+class move(TestUpdate):
+
+
+ def test_move_01 (self):
+
+ """move an image file from unmonitored directory to monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_3 + '/test-image-move-01.jpg'
+ file_path_2 = TEST_DIR_1 + '/test-image-move-01.jpg'
+
+ """ 1. Copy an image file to an unmonitored directory """
+ commands.getoutput('cp '+ SRC_IMAGE_DIR + TEST_IMAGE + ' ' + file_path_1)
+
+ """ 1. move an image file from unmonitored directory to monitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_2 + ' | wc -l')
+ print result
+ self.assert_(result == '1' , 'moved file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_02 (self):
+
+ """move a music file from unmonitored directory to monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_3 + '/test-music-move-01.mp3'
+ file_path_2 = TEST_DIR_1 + '/test-music-move-01.mp3'
+
+ """ 1. Copy file to an unmonitored directory """
+ commands.getoutput('cp '+ SRC_MUSIC_DIR + TEST_MUSIC + ' ' + file_path_1)
+
+ """ 1. move file from unmonitored directory to monitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_2 + ' | wc -l')
+ print result
+ self.assert_(result == '1' , 'moved file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_03 (self):
+
+ """move a video file from unmonitored directory to monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_3 + '/test-video-move-01.mp4'
+ file_path_2 = TEST_DIR_1 + '/test-video-move-01.mp4'
+
+ """ 1. Copy file to an unmonitored directory """
+ commands.getoutput('cp '+ SRC_VIDEO_DIR + TEST_VIDEO + ' ' + file_path_1)
+
+ """ 1. move file from unmonitored directory to monitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_2 + ' | wc -l')
+ print result
+ self.assert_(result == '1' , 'moved file is not shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_04 (self):
+
+ """move an image file from monitored directory to unmonitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-image-move-01.jpg'
+ file_path_2 = TEST_DIR_3 + '/test-image-move-01.jpg'
+
+ """ 1. copy an image file to monitored directory """
+ commands.getoutput('cp '+ SRC_IMAGE_DIR + TEST_IMAGE + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file moved and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. move an image file to unmonitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '0' , 'moveed file is shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '0' , 'source file is shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_05 (self):
+
+ """move a music file from monitored directory to unmonitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-music-move-01.mp3'
+ file_path_2 = TEST_DIR_3 + '/test-music-move-01.mp3'
+
+ """ 1. copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_MUSIC_DIR + TEST_MUSIC + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file moved and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. move file to unmonitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '0' , 'moveed file is shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '0' , 'source file is shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_06 (self):
+
+ """move a video file from monitored directory to unmonitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-video-move-01.mp4'
+ file_path_2 = TEST_DIR_3 + '/test-video-move-01.mp4'
+
+ """ 1. copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_VIDEO_DIR + TEST_VIDEO + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file moved and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. move file to unmonitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '0' , 'moveed file is shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '0' , 'source file is shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_07 (self):
+
+ """move an image file from monitored directory to another monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-image-move-01.jpg'
+ file_path_2 = TEST_DIR_2 + '/test-image-move-01.jpg'
+
+ """ 1. Copy an image file to monitored directory """
+ commands.getoutput('cp '+ SRC_IMAGE_DIR + TEST_IMAGE + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. move an image file to another monitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed these files. """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '1' , 'moveed file is not shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '0' , 'source file is shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_08 (self):
+
+ """move a music file from monitored directory to another monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-music-move-01.mp3'
+ file_path_2 = TEST_DIR_2 + '/test-music-move-01.mp3'
+
+ """ 1. Copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_MUSIC_DIR + TEST_MUSIC + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. move file to another monitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed both of these file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '1' , 'moved file is not shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '0' , 'source file is shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+ def test_move_09 (self):
+
+ """move a video file from monitored directory to another monitored directory
+ and verify if data base is updated accordingly"""
+
+
+ file_path_1 = TEST_DIR_1 + '/test-video-move-01.mp4'
+ file_path_2 = TEST_DIR_2 + '/test-video-move-01.mp4'
+
+ """ 1. Copy file to monitored directory """
+ commands.getoutput('cp '+ SRC_VIDEO_DIR + TEST_VIDEO + ' ' + file_path_1)
+ self.loop.run()
+
+ """ 2. verify if miner indexed this file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 3. move file to another monitored directory """
+ commands.getoutput('mv '+ file_path_1 + ' ' + file_path_2)
+ self.loop.run()
+
+ """ 4. verify if miner indexed both of these file. """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_2 + ' | wc -l')
+ self.assert_(result == '1' , 'moved file is not shown as indexed')
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path_1 + ' | wc -l')
+ self.assert_(result == '0' , 'source file is shown as indexed')
+
+ commands.getoutput('rm '+ file_path_2)
+
+""" delete operation and tracker-miner response test cases """
+class delete(TestUpdate):
+
+
+ def test_delete_01 (self):
+
+ """Delete an image file and verify if data base is updated accordingly"""
+
+
+ file_path = TEST_DIR_1 + '/test-image-delete-01.jpg'
+
+ """ 1. Copy test image file from test data dir to a monitored dir """
+ commands.getoutput('cp '+ SRC_IMAGE_DIR + TEST_IMAGE + ' ' + file_path)
+ self.loop.run()
+
+
+ """verify the image is indexed """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 2. Delete the image file from monitored dir """
+ commands.getoutput('rm '+ file_path)
+ self.loop.run()
+
+
+ """verify the deleted image is not indexed """
+ result = commands.getoutput ('tracker-search --limit=10000 -i | grep ' + file_path + ' | wc -l')
+ print result
+ self.assert_(result == '0' , 'deleted file is shown as indexed')
+
+
+ def test_delete_02 (self):
+
+ """Delete an audio file from monitored directory and verify if data base is updated accordingly"""
+
+
+ file_path = TEST_DIR_1 + '/test-music-delete-01.mp3'
+
+ """ 1. Copy test music file from test data dir to a monitored dir """
+ commands.getoutput('cp '+ SRC_MUSIC_DIR + TEST_MUSIC + ' ' + file_path)
+ self.loop.run()
+
+
+ """verify the file is indexed """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 2. Delete the file """
+ commands.getoutput('rm '+ file_path)
+ self.loop.run()
+
+
+ """verify the deleted image is not indexed """
+ result = commands.getoutput ('tracker-search --limit=10000 -m | grep ' + file_path + ' | wc -l')
+ print result
+ self.assert_(result == '0' , 'deleted file is shown as indexed')
+
+ def test_delete_03 (self):
+
+ """Delete a video file from monitored directory and verify if data base is updated accordingly"""
+
+
+ file_path = TEST_DIR_1 + '/test-video-delete-01.mp4'
+
+ """ 1. Copy test music file from test data dir to a monitored dir """
+ commands.getoutput('cp '+ SRC_VIDEO_DIR + TEST_VIDEO + ' ' + file_path)
+ self.loop.run()
+
+
+ """verify the file is indexed """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path + ' | wc -l')
+ print result
+ if result == '1':
+ print "file copied and indexed"
+ else :
+ self.fail("file not indexed")
+
+
+ """ 2. Delete the file """
+ commands.getoutput('rm '+ file_path)
+ self.loop.run()
+
+
+ """verify the deleted file is not indexed """
+ result = commands.getoutput ('tracker-search --limit=10000 -v | grep ' + file_path + ' | wc -l')
+ print result
+ self.assert_(result == '0' , 'deleted file is shown as indexed')
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/functional-tests/tests.xml b/tests/functional-tests/tests.xml
index fac2c55..c2fb46e 100644
--- a/tests/functional-tests/tests.xml
+++ b/tests/functional-tests/tests.xml
@@ -1,48 +1,6 @@
<testdefinition version="0.1">
<suite name="tracker">
<description />
- <set name="_usr_share_tracker-tests_bootup-tc.py">
- <description>tracker:bootup-tc.py</description>
- <case name="bootup-tc.py-default_content.test_Video_03">
- <description>tracker:bootup-tc.py:default_content.test_Video_03</description>
- <step>/usr/share/tracker-tests/bootup-tc.py default_content.test_Video_03</step>
- </case>
- <case name="bootup-tc.py-default_content.test_images_01">
- <description>tracker:bootup-tc.py:default_content.test_images_01</description>
- <step>/usr/share/tracker-tests/bootup-tc.py default_content.test_images_01</step>
- </case>
- <case name="bootup-tc.py-default_content.test_music_02">
- <description>tracker:bootup-tc.py:default_content.test_music_02</description>
- <step>/usr/share/tracker-tests/bootup-tc.py default_content.test_music_02</step>
- </case>
- <case name="bootup-tc.py-tracker_daemon.test_miner_01">
- <description>tracker:bootup-tc.py:tracker_daemon.test_miner_01</description>
- <step>/usr/share/tracker-tests/bootup-tc.py tracker_daemon.test_miner_01</step>
- </case>
- <case name="bootup-tc.py-tracker_daemon.test_store_02">
- <description>tracker:bootup-tc.py:tracker_daemon.test_store_02</description>
- <step>/usr/share/tracker-tests/bootup-tc.py tracker_daemon.test_store_02</step>
- </case>
- <environments>
- <scratchbox>true</scratchbox>
- <hardware>true</hardware>
- </environments>
- </set>
- <set name="_usr_share_tracker-tests_virtual-files-tc.py">
- <description>tracker:virtual-files-tc.py</description>
- <case name="virtual-files-tc.py-virtual_files.test_Virttual_01">
- <description>tracker:virtual-files-tc.py:virtual_files.test_Virttual_01</description>
- <step>/usr/share/tracker-tests/virtual-files-tc.py virtual_files.test_Virttual_01</step>
- </case>
- <case name="virtual-files-tc.py-virtual_files.test_Virtual_02">
- <description>tracker:virtual-files-tc.py:virtual_files.test_Virtual_02</description>
- <step>/usr/share/tracker-tests/virtual-files-tc.py virtual_files.test_Virtual_02</step>
- </case>
- <environments>
- <scratchbox>true</scratchbox>
- <hardware>true</hardware>
- </environments>
- </set>
<set name="_usr_share_tracker-tests_metadata_extraction_tc.py">
<description>tracker:metadata_extraction_tc.py</description>
<case name="metadata_extraction_tc.py-images.test_get_images_camera_1">
@@ -154,22 +112,223 @@
<hardware>true</hardware>
</environments>
</set>
- <set name="_usr_share_tracker-tests_08-unique-insertions.py">
- <description>tracker:08-unique-insertions.py</description>
- <case name="08-unique-insertions.py-TestFTSFunctions.test_unique_insertion">
- <description>tracker:08-unique-insertions.py:TestFTSFunctions.test_unique_insertion</description>
- <step>/usr/share/tracker-tests/08-unique-insertions.py TestFTSFunctions.test_unique_insertion</step>
+ <set name="_usr_share_tracker-tests_virtual-files-tc.py~">
+ <description>tracker:virtual-files-tc.py~</description>
+ <case name="virtual-files-tc.py~-virtual_files.test_Virttual_01">
+ <description>tracker:virtual-files-tc.py~:virtual_files.test_Virttual_01</description>
+ <step>/usr/share/tracker-tests/virtual-files-tc.py~ virtual_files.test_Virttual_01</step>
+ </case>
+ <case name="virtual-files-tc.py~-virtual_files.test_Virtual_02">
+ <description>tracker:virtual-files-tc.py~:virtual_files.test_Virtual_02</description>
+ <step>/usr/share/tracker-tests/virtual-files-tc.py~ virtual_files.test_Virtual_02</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
</set>
- <set name="_usr_share_tracker-tests_09-concurrent-query.py">
- <description>tracker:09-concurrent-query.py</description>
- <case name="09-concurrent-query.py-TestConcurrentQuery.test_async_queries">
- <description>tracker:09-concurrent-query.py:TestConcurrentQuery.test_async_queries</description>
- <step>/usr/share/tracker-tests/09-concurrent-query.py TestConcurrentQuery.test_async_queries</step>
+ <set name="_usr_share_tracker-tests_miner-basic-ops.py">
+ <description>tracker:miner-basic-ops.py</description>
+ <case name="miner-basic-ops.py-copy.test_copy_01">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_01</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_01</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_02">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_02</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_02</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_03">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_03</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_03</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_04">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_04</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_04</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_05">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_05</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_05</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_06">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_06</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_06</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_07">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_07</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_07</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_08">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_08</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_08</step>
+ </case>
+ <case name="miner-basic-ops.py-copy.test_copy_09">
+ <description>tracker:miner-basic-ops.py:copy.test_copy_09</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py copy.test_copy_09</step>
+ </case>
+ <case name="miner-basic-ops.py-delete.test_delete_01">
+ <description>tracker:miner-basic-ops.py:delete.test_delete_01</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py delete.test_delete_01</step>
+ </case>
+ <case name="miner-basic-ops.py-delete.test_delete_02">
+ <description>tracker:miner-basic-ops.py:delete.test_delete_02</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py delete.test_delete_02</step>
+ </case>
+ <case name="miner-basic-ops.py-delete.test_delete_03">
+ <description>tracker:miner-basic-ops.py:delete.test_delete_03</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py delete.test_delete_03</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_01">
+ <description>tracker:miner-basic-ops.py:move.test_move_01</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_01</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_02">
+ <description>tracker:miner-basic-ops.py:move.test_move_02</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_02</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_03">
+ <description>tracker:miner-basic-ops.py:move.test_move_03</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_03</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_04">
+ <description>tracker:miner-basic-ops.py:move.test_move_04</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_04</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_05">
+ <description>tracker:miner-basic-ops.py:move.test_move_05</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_05</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_06">
+ <description>tracker:miner-basic-ops.py:move.test_move_06</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_06</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_07">
+ <description>tracker:miner-basic-ops.py:move.test_move_07</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_07</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_08">
+ <description>tracker:miner-basic-ops.py:move.test_move_08</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_08</step>
+ </case>
+ <case name="miner-basic-ops.py-move.test_move_09">
+ <description>tracker:miner-basic-ops.py:move.test_move_09</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py move.test_move_09</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_04-group-concat.py">
+ <description>tracker:04-group-concat.py</description>
+ <case name="04-group-concat.py-TestGroupConcat.test_group_concat">
+ <description>tracker:04-group-concat.py:TestGroupConcat.test_group_concat</description>
+ <step>/usr/share/tracker-tests/04-group-concat.py TestGroupConcat.test_group_concat</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_miner-basic-ops.py~">
+ <description>tracker:miner-basic-ops.py~</description>
+ <case name="miner-basic-ops.py~-copy.test_copy_01">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_01</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_01</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_02">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_02</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_02</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_03">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_03</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_03</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_04">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_04</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_04</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_05">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_05</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_05</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_06">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_06</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_06</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_07">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_07</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_07</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_08">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_08</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_08</step>
+ </case>
+ <case name="miner-basic-ops.py~-copy.test_copy_09">
+ <description>tracker:miner-basic-ops.py~:copy.test_copy_09</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ copy.test_copy_09</step>
+ </case>
+ <case name="miner-basic-ops.py~-delete.test_delete_01">
+ <description>tracker:miner-basic-ops.py~:delete.test_delete_01</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ delete.test_delete_01</step>
+ </case>
+ <case name="miner-basic-ops.py~-delete.test_delete_02">
+ <description>tracker:miner-basic-ops.py~:delete.test_delete_02</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ delete.test_delete_02</step>
+ </case>
+ <case name="miner-basic-ops.py~-delete.test_delete_03">
+ <description>tracker:miner-basic-ops.py~:delete.test_delete_03</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ delete.test_delete_03</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_01">
+ <description>tracker:miner-basic-ops.py~:move.test_move_01</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_01</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_02">
+ <description>tracker:miner-basic-ops.py~:move.test_move_02</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_02</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_03">
+ <description>tracker:miner-basic-ops.py~:move.test_move_03</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_03</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_04">
+ <description>tracker:miner-basic-ops.py~:move.test_move_04</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_04</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_05">
+ <description>tracker:miner-basic-ops.py~:move.test_move_05</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_05</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_06">
+ <description>tracker:miner-basic-ops.py~:move.test_move_06</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_06</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_07">
+ <description>tracker:miner-basic-ops.py~:move.test_move_07</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_07</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_08">
+ <description>tracker:miner-basic-ops.py~:move.test_move_08</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_08</step>
+ </case>
+ <case name="miner-basic-ops.py~-move.test_move_09">
+ <description>tracker:miner-basic-ops.py~:move.test_move_09</description>
+ <step>/usr/share/tracker-tests/miner-basic-ops.py~ move.test_move_09</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_03-fts-functions.py">
+ <description>tracker:03-fts-functions.py</description>
+ <case name="03-fts-functions.py-TestFTSFunctions.test_fts_offsets">
+ <description>tracker:03-fts-functions.py:TestFTSFunctions.test_fts_offsets</description>
+ <step>/usr/share/tracker-tests/03-fts-functions.py TestFTSFunctions.test_fts_offsets</step>
+ </case>
+ <case name="03-fts-functions.py-TestFTSFunctions.test_fts_rank">
+ <description>tracker:03-fts-functions.py:TestFTSFunctions.test_fts_rank</description>
+ <step>/usr/share/tracker-tests/03-fts-functions.py TestFTSFunctions.test_fts_rank</step>
</case>
<environments>
<scratchbox>true</scratchbox>
@@ -203,6 +362,155 @@
<hardware>true</hardware>
</environments>
</set>
+ <set name="_usr_share_tracker-tests_09-concurrent-query.py">
+ <description>tracker:09-concurrent-query.py</description>
+ <case name="09-concurrent-query.py-TestConcurrentQuery.test_async_queries">
+ <description>tracker:09-concurrent-query.py:TestConcurrentQuery.test_async_queries</description>
+ <step>/usr/share/tracker-tests/09-concurrent-query.py TestConcurrentQuery.test_async_queries</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_performance-tc.py">
+ <description>tracker:performance-tc.py</description>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_01-writeback.py">
+ <description>tracker:01-writeback.py</description>
+ <case name="01-writeback.py-TestInsertion.test_simple_insertion">
+ <description>tracker:01-writeback.py:TestInsertion.test_simple_insertion</description>
+ <step>/usr/share/tracker-tests/01-writeback.py TestInsertion.test_simple_insertion</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_08-unique-insertions.py">
+ <description>tracker:08-unique-insertions.py</description>
+ <case name="08-unique-insertions.py-TestFTSFunctions.test_unique_insertion">
+ <description>tracker:08-unique-insertions.py:TestFTSFunctions.test_unique_insertion</description>
+ <step>/usr/share/tracker-tests/08-unique-insertions.py TestFTSFunctions.test_unique_insertion</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_07-graph.py">
+ <description>tracker:07-graph.py</description>
+ <case name="07-graph.py-TestFTSFunctions.test_graph_filter">
+ <description>tracker:07-graph.py:TestFTSFunctions.test_graph_filter</description>
+ <step>/usr/share/tracker-tests/07-graph.py TestFTSFunctions.test_graph_filter</step>
+ </case>
+ <case name="07-graph.py-TestFTSFunctions.test_graph_insert_multiple">
+ <description>tracker:07-graph.py:TestFTSFunctions.test_graph_insert_multiple</description>
+ <step>/usr/share/tracker-tests/07-graph.py TestFTSFunctions.test_graph_insert_multiple</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_05-coalesce.py">
+ <description>tracker:05-coalesce.py</description>
+ <case name="05-coalesce.py-TestCoalesce.test_coalesce_first_fine">
+ <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_first_fine</description>
+ <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_first_fine</step>
+ </case>
+ <case name="05-coalesce.py-TestCoalesce.test_coalesce_none_fine_default">
+ <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_none_fine_default</description>
+ <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_none_fine_default</step>
+ </case>
+ <case name="05-coalesce.py-TestCoalesce.test_coalesce_second_fine">
+ <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_second_fine</description>
+ <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_second_fine</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_share_tracker-tests_writeback-tc.py~">
+ <description>tracker:writeback-tc.py~</description>
+ <case name="writeback-tc.py~-writeback.test_wb_01">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_01</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_01</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_02">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_02</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_02</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_03">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_03</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_03</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_04">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_04</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_04</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_05">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_05</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_05</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_06">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_06</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_06</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_07">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_07</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_07</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_08">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_08</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_08</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_09">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_09</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_09</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_10">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_10</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_10</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_11">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_11</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_11</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_12">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_12</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_12</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_13">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_13</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_13</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_14">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_14</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_14</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_15">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_15</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_15</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_16">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_16</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_16</step>
+ </case>
+ <case name="writeback-tc.py~-writeback.test_wb_17">
+ <description>tracker:writeback-tc.py~:writeback.test_wb_17</description>
+ <step>/usr/share/tracker-tests/writeback-tc.py~ writeback.test_wb_17</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
<set name="_usr_share_tracker-tests_02-metacontacts.py">
<description>tracker:02-metacontacts.py</description>
<case name="02-metacontacts.py-TestMetacontacts.test_metacontact_merge">
@@ -218,6 +526,21 @@
<hardware>true</hardware>
</environments>
</set>
+ <set name="_usr_share_tracker-tests_virtual-files-tc.py">
+ <description>tracker:virtual-files-tc.py</description>
+ <case name="virtual-files-tc.py-virtual_files.test_Virttual_01">
+ <description>tracker:virtual-files-tc.py:virtual_files.test_Virttual_01</description>
+ <step>/usr/share/tracker-tests/virtual-files-tc.py virtual_files.test_Virttual_01</step>
+ </case>
+ <case name="virtual-files-tc.py-virtual_files.test_Virtual_02">
+ <description>tracker:virtual-files-tc.py:virtual_files.test_Virtual_02</description>
+ <step>/usr/share/tracker-tests/virtual-files-tc.py virtual_files.test_Virtual_02</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
<set name="_usr_share_tracker-tests_writeback-tc.py">
<description>tracker:writeback-tc.py</description>
<case name="writeback-tc.py-writeback.test_wb_01">
@@ -293,59 +616,27 @@
<hardware>true</hardware>
</environments>
</set>
- <set name="_usr_share_tracker-tests_07-graph.py">
- <description>tracker:07-graph.py</description>
- <case name="07-graph.py-TestFTSFunctions.test_graph_filter">
- <description>tracker:07-graph.py:TestFTSFunctions.test_graph_filter</description>
- <step>/usr/share/tracker-tests/07-graph.py TestFTSFunctions.test_graph_filter</step>
- </case>
- <case name="07-graph.py-TestFTSFunctions.test_graph_insert_multiple">
- <description>tracker:07-graph.py:TestFTSFunctions.test_graph_insert_multiple</description>
- <step>/usr/share/tracker-tests/07-graph.py TestFTSFunctions.test_graph_insert_multiple</step>
+ <set name="_usr_share_tracker-tests_bootup-tc.py">
+ <description>tracker:bootup-tc.py</description>
+ <case name="bootup-tc.py-default_content.test_images_01">
+ <description>tracker:bootup-tc.py:default_content.test_images_01</description>
+ <step>/usr/share/tracker-tests/bootup-tc.py default_content.test_images_01</step>
</case>
- <environments>
- <scratchbox>true</scratchbox>
- <hardware>true</hardware>
- </environments>
- </set>
- <set name="_usr_share_tracker-tests_04-group-concat.py">
- <description>tracker:04-group-concat.py</description>
- <case name="04-group-concat.py-TestGroupConcat.test_group_concat">
- <description>tracker:04-group-concat.py:TestGroupConcat.test_group_concat</description>
- <step>/usr/share/tracker-tests/04-group-concat.py TestGroupConcat.test_group_concat</step>
+ <case name="bootup-tc.py-default_content.test_music_02">
+ <description>tracker:bootup-tc.py:default_content.test_music_02</description>
+ <step>/usr/share/tracker-tests/bootup-tc.py default_content.test_music_02</step>
</case>
- <environments>
- <scratchbox>true</scratchbox>
- <hardware>true</hardware>
- </environments>
- </set>
- <set name="_usr_share_tracker-tests_03-fts-functions.py">
- <description>tracker:03-fts-functions.py</description>
- <case name="03-fts-functions.py-TestFTSFunctions.test_fts_offsets">
- <description>tracker:03-fts-functions.py:TestFTSFunctions.test_fts_offsets</description>
- <step>/usr/share/tracker-tests/03-fts-functions.py TestFTSFunctions.test_fts_offsets</step>
+ <case name="bootup-tc.py-default_content.test_video_03">
+ <description>tracker:bootup-tc.py:default_content.test_video_03</description>
+ <step>/usr/share/tracker-tests/bootup-tc.py default_content.test_video_03</step>
</case>
- <case name="03-fts-functions.py-TestFTSFunctions.test_fts_rank">
- <description>tracker:03-fts-functions.py:TestFTSFunctions.test_fts_rank</description>
- <step>/usr/share/tracker-tests/03-fts-functions.py TestFTSFunctions.test_fts_rank</step>
+ <case name="bootup-tc.py-tracker_daemon.test_miner_01">
+ <description>tracker:bootup-tc.py:tracker_daemon.test_miner_01</description>
+ <step>/usr/share/tracker-tests/bootup-tc.py tracker_daemon.test_miner_01</step>
</case>
- <environments>
- <scratchbox>true</scratchbox>
- <hardware>true</hardware>
- </environments>
- </set>
- <set name="_usr_share_tracker-tests_configuration.py">
- <description>tracker:configuration.py</description>
- <environments>
- <scratchbox>true</scratchbox>
- <hardware>true</hardware>
- </environments>
- </set>
- <set name="_usr_share_tracker-tests_01-writeback.py">
- <description>tracker:01-writeback.py</description>
- <case name="01-writeback.py-TestInsertion.test_simple_insertion">
- <description>tracker:01-writeback.py:TestInsertion.test_simple_insertion</description>
- <step>/usr/share/tracker-tests/01-writeback.py TestInsertion.test_simple_insertion</step>
+ <case name="bootup-tc.py-tracker_daemon.test_store_02">
+ <description>tracker:bootup-tc.py:tracker_daemon.test_store_02</description>
+ <step>/usr/share/tracker-tests/bootup-tc.py tracker_daemon.test_store_02</step>
</case>
<environments>
<scratchbox>true</scratchbox>
@@ -431,20 +722,8 @@
<hardware>true</hardware>
</environments>
</set>
- <set name="_usr_share_tracker-tests_05-coalesce.py">
- <description>tracker:05-coalesce.py</description>
- <case name="05-coalesce.py-TestCoalesce.test_coalesce_first_fine">
- <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_first_fine</description>
- <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_first_fine</step>
- </case>
- <case name="05-coalesce.py-TestCoalesce.test_coalesce_none_fine_default">
- <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_none_fine_default</description>
- <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_none_fine_default</step>
- </case>
- <case name="05-coalesce.py-TestCoalesce.test_coalesce_second_fine">
- <description>tracker:05-coalesce.py:TestCoalesce.test_coalesce_second_fine</description>
- <step>/usr/share/tracker-tests/05-coalesce.py TestCoalesce.test_coalesce_second_fine</step>
- </case>
+ <set name="_usr_share_tracker-tests_configuration.py">
+ <description>tracker:configuration.py</description>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
diff --git a/tests/functional-tests/virtual-files-tc.py b/tests/functional-tests/virtual-files-tc.py
index e85757b..427a371 100644
--- a/tests/functional-tests/virtual-files-tc.py
+++ b/tests/functional-tests/virtual-files-tc.py
@@ -30,24 +30,31 @@ import string
TRACKER = "org.freedesktop.Tracker1"
TRACKER_OBJ = "/org/freedesktop/Tracker1/Resources"
RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-MINER="org.freedesktop.Tracker1.Miner.Files"
-MINER_OBJ="/org/freedesktop/Tracker1/Miner/Files"
+MINER="org.freedesktop.Tracker1.Miner.Files"
+MINER_OBJ="/org/freedesktop/Tracker1/Miner/Files"
MINER_IFACE="org.freedesktop.Tracker1.Miner"
target = configuration.check_target()
-if target == '2' :
- dir_path = '/home/user/MyDocs'
+
+if target == configuration.MAEMO6_HW:
+ """target is device """
+ dir_path = configuration.MYDOCS
dir_path_parent = '/home/user'
-else :
- dir_path = configuration.TEST_DATA_DIR
- dir_path_parent = configuration.TEST_DIR
+ src = configuration.TEST_DATA_IMAGES + 'test-image-1.jpg'
+
+elif target == configuration.DESKTOP:
+ dir_path = os.path.expanduser("~")
+ dir_path_parent = os.path.expanduser("~") + "/" + "tmp"
+ if (not (os.path.exists(dir_path_parent) and os.path.isdir(dir_path_parent))):
+ os.mkdir (dir_path_parent)
+ src = configuration.VCS_TEST_DATA_IMAGES + 'test-image-1.jpg'
+
print dir_path
""" copy the test data to proper location. """
def copy_file():
- src = configuration.TEST_DATA_IMAGES + 'test-image-1.jpg'
dest = dir_path
print 'Copying '+src+' to '+dest
commands.getoutput('cp '+src+ ' '+dest)
@@ -72,49 +79,49 @@ class TestVirtualFiles (unittest.TestCase):
class virtual_files(TestVirtualFiles):
- def test_Virttual_01(self):
- """
- Test if the update is ignored until the creation of the file is completed.
- 1. Move the file to some other location.
- 2. Create resource in tracker , by making instance of nie:DataObject.
- 3. IgnoreNextUpdate on the files.
- 4. Copy the original file to the present directory.
- 5. Query for the title of the file.
- """
-
+ def test_Virttual_01(self):
+ """
+ Test if the update is ignored until the creation of the file is completed.
+ 1. Move the file to some other location.
+ 2. Create resource in tracker , by making instance of nie:DataObject.
+ 3. IgnoreNextUpdate on the files.
+ 4. Copy the original file to the present directory.
+ 5. Query for the title of the file.
+ """
+
test_file = 'test-image-1.jpg'
file= dir_path + '/' + test_file
uri='file://' + file
print uri
-
- commands.getoutput('mv ' + file + ' ' + dir_path_parent)
-
+
+ commands.getoutput('mv ' + file + ' ' + dir_path_parent)
+
Insert = """
- INSERT { _:x a nfo:Image, nie:DataObject ;
- nie:url <%s> ;
- nie:title 'title_test'. }""" %(uri)
+ INSERT { _:x a nfo:Image, nie:DataObject ;
+ nie:url <%s> ;
+ nie:title 'title_test'. }""" %(uri)
print Insert
- self.sparql_update(Insert)
+ self.sparql_update(Insert)
time.sleep(10)
- self.miner.IgnoreNextUpdate([uri])
+ self.miner.IgnoreNextUpdate([uri])
+
+ commands.getoutput('cp ' + dir_path_parent + '/'+ test_file + ' ' + dir_path)
- commands.getoutput('cp ' + dir_path_parent + '/'+ test_file + ' ' + dir_path)
-
- QUERY = """
- SELECT ?t WHERE { ?file a nfo:FileDataObject ;
- nie:title ?t ;
- nie:url <%s> .}
- """ %(uri)
+ QUERY = """
+ SELECT ?t WHERE { ?file a nfo:FileDataObject ;
+ nie:title ?t ;
+ nie:url <%s> .}
+ """ %(uri)
print QUERY
- result=self.query(QUERY)
+ result=self.query(QUERY)
print result
-
+
self.assert_(result[0][0].find('title_test')!=-1 , "File is not ignored")
-
+
def test_Virtual_02(self):
"""
@@ -128,7 +135,7 @@ class virtual_files(TestVirtualFiles):
file= dir_path + '/' + test_file
url='file://' + file
print url
-
+
insert="""
INSERT { _:x a nfo:Image, nie:DataObject ; \
nie:url <%s> ; \
@@ -141,21 +148,20 @@ class virtual_files(TestVirtualFiles):
time.sleep(3)
- QUERY="""
+ QUERY="""
SELECT ?label ?content WHERE { ?file a nie:DataObject ;nao:hasTag[a nao:Tag ;nao:prefLabel ?label]; nie:url <%s> ;
nie:plainTextContent ?content.
- }
- """ %url
+ }
+ """ %url
result=self.query(QUERY)
self.assert_(result[0][0].find('Favorite')!=-1 and result[1][1].find("This is script to test virtual file support")!=-1, "File is not monitored by tracker")
-
-
-if __name__ == "__main__":
-
- unittest.main()
+if __name__ == "__main__":
+ unittest.main()
+ if (os.path.exists(dir_path_parent) and os.path.isdir(dir_path_parent)):
+ os.rmdir (dir_path_parent)
diff --git a/tests/functional-tests/writeback-tc.py b/tests/functional-tests/writeback-tc.py
index 5d752f1..cd0fa20 100644
--- a/tests/functional-tests/writeback-tc.py
+++ b/tests/functional-tests/writeback-tc.py
@@ -30,38 +30,46 @@ TRACKER = 'org.freedesktop.Tracker1'
TRACKER_OBJ = '/org/freedesktop/Tracker1/Resources'
RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
-""" run the tracker-writeback """
-pid = commands.getoutput("ps -ef| grep tracker-writeback | awk '{print $3}'").split()
-if configuration.TRACKER_WRITEBACK not in pid:
- os.system(configuration.TRACKER_WRITEBACK + ' -v 3 &')
- time.sleep(5)
-
-EXTRACT = configuration.TRACKER_EXTRACT
-
target = configuration.check_target()
-if target == '2' :
+print target
+
+if target == configuration.MAEMO6_HW:
+ """target is device """
+ tracker_wb = configuration.TRACKER_WRITEBACK
+ tracker_ext = configuration.TRACKER_EXTRACT
dir_path = configuration.WB_TEST_DIR_DEVICE
-else :
+
+elif target == configuration.DESKTOP:
+ tracker_wb = configuration.TRACKER_WRITEBACK_DESKTOP
+ tracker_ext = configuration.TRACKER_EXTRACT_DESKTOP
dir_path = configuration.WB_TEST_DIR_HOST
+
print dir_path
+""" run the tracker-writeback """
+pid = int(commands.getoutput('pidof tracker-writeback | wc -w'))
+
+if not pid:
+ os.system(tracker_wb + ' -v 3 &')
+ time.sleep(5)
+
def copy_file():
- src = configuration.TEST_DATA_IMAGES
+ src = configuration.VCS_TEST_DATA_IMAGES + configuration.TEST_IMAGE
dest = dir_path
print 'Copying '+src+' to '+dest
- commands.getoutput('cp '+src +'/*'+ ' '+dest)
+ commands.getoutput('cp '+src + ' '+dest)
def create_file_list_in_dir() :
"""
- 1. create a test directory
+ 1. create a test directory
2. copy images to test directory
3. list the files present in the test data directory
"""
-
+
commands.getoutput('mkdir ' + dir_path)
copy_file()
-
+
fileList = []
dirpathList = []
for dirpath,dirNames,fileNames in os.walk(dir_path):
@@ -95,14 +103,14 @@ class TestWriteback (unittest.TestCase):
class writeback(TestWriteback):
def test_wb_01(self):
- """
- Test if the value for Description property is written to the file
+ """
+ Test if the value for Description property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -117,15 +125,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nie:description ?val }
- WHERE { ?file nie:description ?val ;nie:url <%s> }
- INSERT {?file nie:description 'testdescription' }
+ WHERE { ?file nie:description ?val ;nie:url <%s> }
+ INSERT {?file nie:description 'testdescription' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nie:description')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nie:description')
print result
value=result.split()
if (result.find('nie:description')!=-1) and (value[1]=='"testdescription"') :
@@ -148,14 +156,14 @@ class writeback(TestWriteback):
"""
def test_wb_02(self):
- """
- Test if the value for copyright property is written to the file
+ """
+ Test if the value for copyright property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -170,15 +178,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nie:copyright ?val }
- WHERE { ?file nie:copyright ?val ;nie:url <%s> }
- INSERT {?file nie:copyright 'testcopyright' }
+ WHERE { ?file nie:copyright ?val ;nie:url <%s> }
+ INSERT {?file nie:copyright 'testcopyright' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nie:copyright')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nie:copyright')
print result
value=result.split()
if (result.find('nie:copyright')!=-1) and (value[1]=='"testcopyright"') :
@@ -194,14 +202,14 @@ class writeback(TestWriteback):
def test_wb_03(self):
- """
- Test if the value for title property is written to the file
+ """
+ Test if the value for title property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -216,15 +224,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nie:title ?val }
- WHERE { ?file nie:title ?val ;nie:url <%s> }
- INSERT {?file nie:title 'testtitle' }
+ WHERE { ?file nie:title ?val ;nie:url <%s> }
+ INSERT {?file nie:title 'testtitle' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nie:title')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nie:title')
print result
value=result.split()
if (result.find('nie:title')!=-1) and (value[1]=='"testtitle"') :
@@ -240,14 +248,14 @@ class writeback(TestWriteback):
def test_wb_04(self):
- """
- Test if the value for contentCreated property is written to the file
+ """
+ Test if the value for contentCreated property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -262,15 +270,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nie:contentCreated ?val }
- WHERE { ?file nie:contentCreated ?val ;nie:url <%s> }
- INSERT {?file nie:contentCreated '2004-05-06T13:14:15Z' }
+ WHERE { ?file nie:contentCreated ?val ;nie:url <%s> }
+ INSERT {?file nie:contentCreated '2004-05-06T13:14:15Z' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nie:contentCreated')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nie:contentCreated')
print result
value=result.split()
print value
@@ -287,14 +295,14 @@ class writeback(TestWriteback):
def test_wb_05(self):
- """
- Test if the value for keyword property is written to the file
+ """
+ Test if the value for keyword property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -309,15 +317,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nie:keyword ?val }
- WHERE { ?file nie:keyword ?val ;nie:url <%s> }
- INSERT {?file nie:keyword 'testkeyword' }
+ WHERE { ?file nie:keyword ?val ;nie:url <%s> }
+ INSERT {?file nie:keyword 'testkeyword' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nao:prefLabel')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nao:prefLabel')
print result
value=result.split()
if (result.find('nao:prefLabel')!=-1) and ( '"testkeyword"' in value[1]) :
@@ -333,14 +341,14 @@ class writeback(TestWriteback):
def test_wb_06(self):
- """
- Test if the value for contributor property is written to the file
+ """
+ Test if the value for contributor property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -355,15 +363,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nco:contributor ?val }
- WHERE { ?file nco:contributor ?val ;nie:url <%s> }
- INSERT {?file nco:contributor [a nco:Contact ; nco:fullname 'testcontributor' ] }
+ WHERE { ?file nco:contributor ?val ;nie:url <%s> }
+ INSERT {?file nco:contributor [a nco:Contact ; nco:fullname 'testcontributor' ] }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nco:fullname')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nco:fullname')
print result
if '"testcontributor"' in result:
print "property is set"
@@ -377,14 +385,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_07(self):
- """
- Test if the value for creator property is written to the file
+ """
+ Test if the value for creator property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -399,15 +407,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nco:creator ?val }
- WHERE { ?file nco:creator ?val ;nie:url <%s> }
- INSERT {?file nco:creator [a nco:Contact ; nco:fullname 'testcreator' ] }
+ WHERE { ?file nco:creator ?val ;nie:url <%s> }
+ INSERT {?file nco:creator [a nco:Contact ; nco:fullname 'testcreator' ] }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nco:fullname')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nco:fullname')
print result
if '"testcreator"' in result:
print "property is set"
@@ -421,14 +429,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_08(self):
- """
- Test if the value for camera property is written to the file
+ """
+ Test if the value for camera property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -443,15 +451,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:camera ?val }
- WHERE { ?file nmm:camera ?val ;nie:url <%s> }
- INSERT {?file nmm:camera 'test camera' }
+ WHERE { ?file nmm:camera ?val ;nie:url <%s> }
+ INSERT {?file nmm:camera 'test camera' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:camera')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:camera')
print result
value=result.split()
if (result.find('nmm:camera')!=-1) and (value[1]=='"test') and (value[2]=='camera"'):
@@ -466,14 +474,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_09(self):
- """
- Test if the value for exposureTime property is written to the file
+ """
+ Test if the value for exposureTime property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -488,15 +496,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:exposureTime ?val }
- WHERE { ?file nmm:exposureTime ?val ;nie:url <%s> }
- INSERT {?file nmm:exposureTime '44' }
+ WHERE { ?file nmm:exposureTime ?val ;nie:url <%s> }
+ INSERT {?file nmm:exposureTime '44' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:exposureTime')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:exposureTime')
print result
value=result.split()
if (result.find('nmm:exposureTime')!=-1) and (value[1]=='44') :
@@ -511,14 +519,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_10(self):
- """
- Test if the value for fnumber property is written to the file
+ """
+ Test if the value for fnumber property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -533,15 +541,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:fnumber ?val }
- WHERE { ?file nmm:fnumber ?val ;nie:url <%s> }
- INSERT {?file nmm:fnumber '707' }
+ WHERE { ?file nmm:fnumber ?val ;nie:url <%s> }
+ INSERT {?file nmm:fnumber '707' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:fnumber')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:fnumber')
print result
value=result.split()
if (result.find('nmm:fnumber')!=-1) and (value[1]=='707') :
@@ -557,14 +565,14 @@ class writeback(TestWriteback):
def test_wb_11(self):
- """
- Test if the value for flash property as flash-off is written to the file
+ """
+ Test if the value for flash property as flash-off is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -579,15 +587,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:flash ?val }
- WHERE { ?file nmm:flash ?val ;nie:url <%s> }
- INSERT {?file nmm:flash 'nmm:flash-off' }
+ WHERE { ?file nmm:flash ?val ;nie:url <%s> }
+ INSERT {?file nmm:flash 'nmm:flash-off' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:flash')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:flash')
print result
value=result.split()
if (result.find('nmm:flash')!=-1) and (value[1]=='nmm:flash-off') :
@@ -602,14 +610,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_12(self):
- """
- Test if the value for flash property as flash-on is written to the file
+ """
+ Test if the value for flash property as flash-on is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -624,15 +632,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:flash ?val }
- WHERE { ?file nmm:flash ?val ;nie:url <%s> }
- INSERT {?file nmm:flash 'nmm:flash-on' }
+ WHERE { ?file nmm:flash ?val ;nie:url <%s> }
+ INSERT {?file nmm:flash 'nmm:flash-on' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:flash')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:flash')
print result
value=result.split()
if (result.find('nmm:flash')!=-1) and (value[1]=='nmm:flash-on') :
@@ -648,14 +656,14 @@ class writeback(TestWriteback):
def test_wb_13(self):
- """
- Test if the value for focalLength property is written to the file
+ """
+ Test if the value for focalLength property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -670,15 +678,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:focalLength ?val }
- WHERE { ?file nmm:focalLength ?val ;nie:url <%s> }
- INSERT {?file nmm:focalLength '44' }
+ WHERE { ?file nmm:focalLength ?val ;nie:url <%s> }
+ INSERT {?file nmm:focalLength '44' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:focalLength')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:focalLength')
print result
value=result.split()
if (result.find('nmm:focalLength')!=-1) and (value[1]=='44') :
@@ -693,14 +701,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_14(self):
- """
- Test if the value for isoSpeed property is written to the file
+ """
+ Test if the value for isoSpeed property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -715,15 +723,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:isoSpeed ?val }
- WHERE { ?file nmm:isoSpeed ?val ;nie:url <%s> }
- INSERT {?file nmm:isoSpeed '44' }
+ WHERE { ?file nmm:isoSpeed ?val ;nie:url <%s> }
+ INSERT {?file nmm:isoSpeed '44' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:isoSpeed')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:isoSpeed')
print result
value=result.split()
if (result.find('nmm:isoSpeed')!=-1) and (value[1]=='44') :
@@ -738,14 +746,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_15(self):
- """
- Test if the value for meteringMode property is written to the file
+ """
+ Test if the value for meteringMode property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -760,15 +768,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:meteringMode ?val }
- WHERE { ?file nmm:meteringMode ?val ;nie:url <%s> }
- INSERT {?file nmm:meteringMode 'nmm:metering-mode-multispot' }
+ WHERE { ?file nmm:meteringMode ?val ;nie:url <%s> }
+ INSERT {?file nmm:meteringMode 'nmm:metering-mode-multispot' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:meteringMode')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:meteringMode')
print result
value=result.split()
if (result.find('nmm:meteringMode')!=-1) and (value[1]=='nmm:metering-mode-multispot') :
@@ -783,14 +791,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_16(self):
- """
- Test if the value for whiteBalance property is written to the file
+ """
+ Test if the value for whiteBalance property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -805,15 +813,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file nmm:whiteBalance ?val }
- WHERE { ?file nmm:whiteBalance ?val ;nie:url <%s> }
- INSERT {?file nmm:whiteBalance 'nmm:white-balance-auto' }
+ WHERE { ?file nmm:whiteBalance ?val ;nie:url <%s> }
+ INSERT {?file nmm:whiteBalance 'nmm:white-balance-auto' }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep nmm:whiteBalance')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:whiteBalance')
print result
value=result.split()
if (result.find('nmm:whiteBalance')!=-1) and (value[1]=='nmm:white-balance-auto') :
@@ -828,14 +836,14 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
def test_wb_17(self):
- """
- Test if the value for location property is written to the file
+ """
+ Test if the value for location property is written to the file
with sparql update with writeback.
-
+
1. Delete the value of the property of the file.
2. Insert a new value.
3. Verify the value is written to the file.
- 4. Run the instruction in for loop to test for all the files
+ 4. Run the instruction in for loop to test for all the files
present in a particular directory.
"""
@@ -850,15 +858,15 @@ class writeback(TestWriteback):
insert = """
DELETE {?file mlo:location ?val }
- WHERE { ?file mlo:location ?val ;nie:url <%s> }
- INSERT {?file mlo:location [ a mlo:GeoPoint ;mlo:country "clevland";mlo:city 'test_city';mlo:address 'doorno-32'] }
+ WHERE { ?file mlo:location ?val ;nie:url <%s> }
+ INSERT {?file mlo:location [ a mlo:GeoPoint ;mlo:country "clevland";mlo:city 'test_city';mlo:address 'doorno-32'] }
WHERE { ?file nie:url <%s> }
""" %(uri, uri)
print insert
self.sparql_update (insert)
""" verify the inserted item """
- result=commands.getoutput(EXTRACT + ' -f' +' ' + uri +' | grep mlo:*')
+ result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep mlo:*')
print result
value=result.split()
if (result.find('mlo:address')!=-1) and (value[value.index('mlo:address') + 1] == '"doorno-32"') and (result.find('mlo:city')!=-1) and (value[value.index('mlo:city') + 1] == '"test_city"') and (result.find('mlo:country')!=-1) and ('"clevland"' in value[value.index('mlo:country') + 1]) :
@@ -873,7 +881,5 @@ class writeback(TestWriteback):
self.assert_(not k,'Writeback failed for following files for property %s\n\n' % (str(overallRes)) )
-if __name__ == "__main__":
- unittest.main()
-
-
+if __name__ == "__main__":
+ unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]