[tracker/rss-enclosures] functional-tests: Allow to change the ontologies directory in the system abstraction



commit 48b1e7a6008248cf15f48eb910e96518c8382f61
Author: Ivan Frade <ivan frade nokia com>
Date:   Thu Oct 14 11:05:06 2010 +0300

    functional-tests: Allow to change the ontologies directory in the system abstraction

 tests/functional-tests/common/utils/system.py |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 90859d3..8a2fa43 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -245,12 +245,12 @@ class TrackerWritebackLifeCycle():
 
 class TrackerSystemAbstraction:
 
-    def set_up_environment (self, confdir):
+    def set_up_environment (self, confdir, ontodir):
         """
         Sets up the XDG_*_HOME variables and make sure the directories exist
         """
         for var, directory in TEST_ENV_VARS.iteritems ():
-            print "Setting %s - %s" %(var, directory)
+            print "[Conf] Setting %s - %s" %(var, directory)
             self.__recreate_directory (directory)
             os.environ [var] = directory
 
@@ -275,15 +275,17 @@ class TrackerSystemAbstraction:
                 
         if (os.environ.has_key ("XDG_CONFIG_HOME")):
             del os.environ ["XDG_CONFIG_HOME"]
-        
 
-    def tracker_store_testing_start (self, confdir=None):
+        if (os.environ.has_key ("TRACKER_DB_ONTOLOGIES_DIR")):
+            del os.environ ["TRACKER_DB_ONTOLOGIES_DIR"]
+
+    def tracker_store_testing_start (self, confdir=None, ontodir=None):
         """
         Stops any previous instance of the store, calls set_up_environment,
         and starts a new instances of the store
         """
         self.__stop_tracker_processes ()
-        self.set_up_environment (confdir)
+        self.set_up_environment (confdir, ontodir)
         
         self.store = TrackerStoreLifeCycle ()
         self.store.start ()
@@ -291,6 +293,16 @@ class TrackerSystemAbstraction:
     def tracker_store_start (self):
         self.store.start ()
 
+    def tracker_store_restart_with_new_ontologies (self, ontodir):
+        self.store.stop ()
+        if ontodir:
+            print "[Conf] Setting %s - %s" % ("TRACKER_DB_ONTOLOGIES_DIR", ontodir)
+            os.environ ["TRACKER_DB_ONTOLOGIES_DIR"] = ontodir
+        try:
+            self.store.start ()
+        except dbus.DBusException, e:
+            raise UnableToBootException ("Unable to boot the store \n(" + str(e) + ")")
+
     def tracker_store_brutal_restart (self):
         self.store.kill ()
         self.store.start ()
@@ -337,7 +349,7 @@ class TrackerSystemAbstraction:
         and starts a new instance of the store and miner-fs
         """
         self.__stop_tracker_processes ()
-        self.set_up_environment (confdir)
+        self.set_up_environment (confdir, None)
 
         self.miner_fs = TrackerMinerFsLifeCycle ()
         self.miner_fs.start ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]