SEBA-405 Update openstack synchronizer to use synchronizer library

Change-Id: I9adae42fa7eec94ee496b728c32a7ce5db3c39e0
diff --git a/xos/synchronizer/tests/unit_test_common.py b/xos/synchronizer/tests/unit_test_common.py
index 68f6743..c2cdde8 100644
--- a/xos/synchronizer/tests/unit_test_common.py
+++ b/xos/synchronizer/tests/unit_test_common.py
@@ -18,15 +18,14 @@
 
 def setup_sync_unit_test(test_path, globals_dict, models, config_fn="test_config.yaml"):
     """ Perform the common steps associated with setting up a synchronizer unit test.
-           1) Add synchronizers/new_base to sys.path
-           2) Import xosconfig.Config and set it up to test_config.yaml in the current dir
-           3) Build the mock modelaccessor and import it
-           4) Import all model accessor classes into global space
+           1) Import xosconfig.Config and set it up to test_config.yaml in the current dir
+           2) Build the mock modelaccessor and import it
+           3) Import all model accessor classes into global space
 
         Arguments:
             test_path - path to the test case that is being run
             globals_dict - a dictionary to add global models to
-            models - a list of pairs (service_name, xproto_name,
+            models - a list of pairs (service_name, xproto_name)
             config_fn - filename of config file)
 
         Returns:
@@ -37,39 +36,23 @@
                 xos_dir: xos directory
                 services_dir: services directory
     """
-    def get_models_fn(services_dir, service_name, xproto_name):
-        name = os.path.join(service_name, "xos", xproto_name)
-        if os.path.exists(os.path.join(services_dir, name)):
-            return name
-        else:
-            name = os.path.join(service_name, "xos", "synchronizer", "models", xproto_name)
-            if os.path.exists(os.path.join(services_dir, name)):
-                return name
-        raise Exception("Unable to find service=%s xproto=%s" % (service_name, xproto_name))
-
     sys_path_save = sys.path
 
-    xos_dir = os.path.join(test_path, "../../..")
-    if not os.path.exists(os.path.join(test_path, "new_base")):
-        xos_dir = os.path.join(test_path, "../../../../../../orchestration/xos/xos")
-        services_dir = os.path.join(xos_dir, "../../xos_services")
-    sys.path.append(xos_dir)
-    sys.path.append(os.path.join(xos_dir, 'synchronizers', 'new_base'))
-
     # Setting up the config module
     from xosconfig import Config
     config = os.path.join(test_path, config_fn)
     Config.clear()
     Config.init(config, "synchronizer-config-schema.yaml")
 
-    xprotos = []
-    for (service_name, xproto_name) in models:
-        xprotos.append(get_models_fn(services_dir, service_name, xproto_name))
+    from xossynchronizer.mock_modelaccessor_build import mock_modelaccessor_config
+    mock_modelaccessor_config(test_path, models)
 
-    from synchronizers.new_base.mock_modelaccessor_build import build_mock_modelaccessor
-    build_mock_modelaccessor(xos_dir, services_dir, xprotos)
-    import synchronizers.new_base.modelaccessor
-    from synchronizers.new_base.modelaccessor import model_accessor
+    import xossynchronizer.modelaccessor
+    reload(xossynchronizer.modelaccessor)  # in case nose2 loaded it in a previous testp
+
+    from xossynchronizer.modelaccessor import model_accessor
+
+    # modelaccessor.py will have ensure mock_modelaccessor is in sys.path
     from mock_modelaccessor import MockObjectList
 
     # import all class names to globals
@@ -79,6 +62,4 @@
     return {"sys_path_save": sys_path_save,
             "model_accessor": model_accessor,
             "Config": Config,
-            "xos_dir": xos_dir,
-            "services_dir": services_dir,
             "MockObjectList": MockObjectList}