>From f00861e68e615dfa20b4b3a82f519fbc443c6ab1 Mon Sep 17 00:00:00 2001
From: "Thierry bordaz (tbordaz)" <tbordaz@redhat.com>
Date: Tue, 11 Feb 2014 17:51:09 +0100
Subject: [PATCH] Update test cases due to new modules: Schema, tasks, plugins
 and index

---
 dirsrvtests/tickets/ticket47490_test.py    | 42 +++++++++++++++---------------
 dirsrvtests/tickets/ticket47560_test.py    | 12 ++++-----
 dirsrvtests/tickets/ticket47573_test.py    | 16 ++++++------
 dirsrvtests/tickets/ticket47653MMR_test.py |  2 +-
 dirsrvtests/tickets/ticket47653_test.py    |  2 +-
 dirsrvtests/tickets/ticket47676_test.py    |  4 +--
 6 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/dirsrvtests/tickets/ticket47490_test.py b/dirsrvtests/tickets/ticket47490_test.py
index 58490d0..438723a 100644
--- a/dirsrvtests/tickets/ticket47490_test.py
+++ b/dirsrvtests/tickets/ticket47490_test.py
@@ -77,13 +77,13 @@ def _oc_definition(oid_ext, name, must=None, may=None):
 
 def add_OC(instance, oid_ext, name):
     new_oc = _oc_definition(oid_ext, name)
-    instance.addSchema('objectClasses', new_oc)
+    instance.schema.add_schema('objectClasses', new_oc)
 
 def mod_OC(instance, oid_ext, name, old_must=None, old_may=None, new_must=None, new_may=None):
     old_oc = _oc_definition(oid_ext, name, old_must, old_may)
     new_oc = _oc_definition(oid_ext, name, new_must, new_may)
-    instance.delSchema('objectClasses', old_oc)
-    instance.addSchema('objectClasses', new_oc)
+    instance.schema.del_schema('objectClasses', old_oc)
+    instance.schema.add_schema('objectClasses', new_oc)
     
 def trigger_schema_push(topology):
     """
@@ -316,8 +316,8 @@ def test_ticket47490_one(topology):
     add_OC(topology.master, 2, 'masterNewOCA')
     
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was updated on the consumer
     log.debug("test_ticket47490_one master_schema_csn=%s", master_schema_csn)
@@ -353,8 +353,8 @@ def test_ticket47490_two(topology):
     
     # now push the scheam
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was NOT updated on the consumer
     log.debug("test_ticket47490_two master_schema_csn=%s", master_schema_csn)
@@ -387,8 +387,8 @@ def test_ticket47490_three(topology):
     
     # now push the scheam
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was NOT updated on the consumer
     log.debug("test_ticket47490_three master_schema_csn=%s", master_schema_csn)
@@ -420,8 +420,8 @@ def test_ticket47490_four(topology):
     
         
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was updated on the consumer
     log.debug("test_ticket47490_four master_schema_csn=%s", master_schema_csn)
@@ -462,8 +462,8 @@ def test_ticket47490_five(topology):
     add_OC(topology.master, 4, 'masterNewOCC')
         
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was NOT updated on the consumer
     log.debug("test_ticket47490_five master_schema_csn=%s", master_schema_csn)
@@ -508,8 +508,8 @@ def test_ticket47490_six(topology):
     mod_OC(topology.master, 1, 'consumerNewOCA', old_must=MUST_OLD, new_must=MUST_NEW, old_may=MAY_OLD, new_may=MAY_OLD)
         
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was NOT updated on the consumer
     log.debug("test_ticket47490_six master_schema_csn=%s", master_schema_csn)
@@ -547,8 +547,8 @@ def test_ticket47490_seven(topology):
     
         
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was updated on the consumer
     log.debug("test_ticket47490_seven master_schema_csn=%s", master_schema_csn)
@@ -589,8 +589,8 @@ def test_ticket47490_eight(topology):
     mod_OC(topology.master, 4, 'masterNewOCC', old_must=MUST_OLD, new_must=MUST_OLD, old_may=MAY_OLD, new_may=MAY_NEW)
         
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was not updated on the consumer
     log.debug("test_ticket47490_eight master_schema_csn=%s", master_schema_csn)
@@ -635,8 +635,8 @@ def test_ticket47490_nine(topology):
     mod_OC(topology.master, 1, 'consumerNewOCA', old_must=MUST_NEW, new_must=MUST_NEW, old_may=MAY_OLD, new_may=MAY_NEW)
         
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was updated on the consumer
     log.debug("test_ticket47490_nine master_schema_csn=%s", master_schema_csn)
diff --git a/dirsrvtests/tickets/ticket47560_test.py b/dirsrvtests/tickets/ticket47560_test.py
index c11233c..67d83e8 100644
--- a/dirsrvtests/tickets/ticket47560_test.py
+++ b/dirsrvtests/tickets/ticket47560_test.py
@@ -144,11 +144,12 @@ def test_ticket47560(topology):
         """
         # enable/disable the mbo plugin
         if value != 'on':
-           value = 'off'
+            topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+        else:
+            topology.standalone.plugins.disable(name=PLUGIN_MEMBER_OF)
+
         log.debug("-------------> _enable_disable_mbo(%s)" % value)
-        MEMBEROF_PLUGIN_DN = 'cn=MemberOf Plugin,cn=plugins,cn=config'
-        replace = [(ldap.MOD_REPLACE, 'nsslapd-pluginEnabled', value)]
-        topology.standalone.modify_s(MEMBEROF_PLUGIN_DN, replace)
+        
         topology.standalone.stop(timeout=120)
         time.sleep(1)
         topology.standalone.start(timeout=120)
@@ -258,7 +259,7 @@ def test_ticket47560(topology):
     log.debug( "Unfixed entry %r\n" % ent)
         
     # run the fixup task
-    topology.standalone.fixupMemberOf(SUFFIX, verbose=False)
+    topology.standalone.tasks.fixupMemberOf(suffix=SUFFIX, args={TASK_WAIT: True})
         
     ents = topology.standalone.search_s(member_DN, ldap.SCOPE_BASE, filt)
     assert len(ents) == 1
@@ -298,7 +299,6 @@ def run_isolated():
     test_ticket47560(topo)
     test_ticket47560_final(topo)
 
-
 if __name__ == '__main__':
     run_isolated()
 
diff --git a/dirsrvtests/tickets/ticket47573_test.py b/dirsrvtests/tickets/ticket47573_test.py
index 565d521..a85fc10 100644
--- a/dirsrvtests/tickets/ticket47573_test.py
+++ b/dirsrvtests/tickets/ticket47573_test.py
@@ -78,13 +78,13 @@ def _oc_definition(oid_ext, name, must=None, may=None):
 
 def add_OC(instance, oid_ext, name):
     new_oc = _oc_definition(oid_ext, name)
-    instance.addSchema('objectClasses', new_oc)
+    instance.schema.add_schema('objectClasses', new_oc)
 
 def mod_OC(instance, oid_ext, name, old_must=None, old_may=None, new_must=None, new_may=None):
     old_oc = _oc_definition(oid_ext, name, old_must, old_may)
     new_oc = _oc_definition(oid_ext, name, new_must, new_may)
-    instance.delSchema('objectClasses', old_oc)
-    instance.addSchema('objectClasses', new_oc)
+    instance.schema.del_schema('objectClasses', old_oc)
+    instance.schema.add_schema('objectClasses', new_oc)
     
 def trigger_schema_push(topology):
     """
@@ -314,12 +314,12 @@ def test_ticket47573_one(topology):
     new_oc = _oc_definition(2, 'OCwithMayAttr', 
                             must = MUST_OLD, 
                             may  = MAY_OLD)
-    topology.master.addSchema('objectClasses', new_oc)
+    topology.master.schema.add_schema('objectClasses', new_oc)
 
     
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was updated on the consumer
     log.debug("test_ticket47573_one master_schema_csn=%s", master_schema_csn)
@@ -348,8 +348,8 @@ def test_ticket47573_two(topology):
 
     # now push the scheam
     trigger_schema_push(topology)
-    master_schema_csn = topology.master.getSchemaCSN()
-    consumer_schema_csn = topology.consumer.getSchemaCSN()
+    master_schema_csn = topology.master.schema.get_schema_csn()
+    consumer_schema_csn = topology.consumer.schema.get_schema_csn()
     
     # Check the schemaCSN was NOT updated on the consumer
     log.debug("test_ticket47573_two master_schema_csn=%s", master_schema_csn)
diff --git a/dirsrvtests/tickets/ticket47653MMR_test.py b/dirsrvtests/tickets/ticket47653MMR_test.py
index 1f221c6..5d86888 100644
--- a/dirsrvtests/tickets/ticket47653MMR_test.py
+++ b/dirsrvtests/tickets/ticket47653MMR_test.py
@@ -258,7 +258,7 @@ def test_ticket47653_init(topology):
     
     topology.master1.log.info("Add %s that allows 'member' attribute" % OC_NAME)
     new_oc = _oc_definition(2, OC_NAME, must = MUST, may  = MAY) 
-    topology.master1.addSchema('objectClasses', new_oc)
+    topology.master1.schema.add_schema('objectClasses', new_oc)
     
     
     # entry used to bind with
diff --git a/dirsrvtests/tickets/ticket47653_test.py b/dirsrvtests/tickets/ticket47653_test.py
index 2693093..9f4e757 100644
--- a/dirsrvtests/tickets/ticket47653_test.py
+++ b/dirsrvtests/tickets/ticket47653_test.py
@@ -155,7 +155,7 @@ def test_ticket47653_init(topology):
     
     topology.standalone.log.info("Add %s that allows 'member' attribute" % OC_NAME)
     new_oc = _oc_definition(2, OC_NAME, must = MUST, may  = MAY) 
-    topology.standalone.addSchema('objectClasses', new_oc)
+    topology.standalone.schema.add_schema('objectClasses', new_oc)
     
     
     # entry used to bind with
diff --git a/dirsrvtests/tickets/ticket47676_test.py b/dirsrvtests/tickets/ticket47676_test.py
index 8ba5956..1d7f0b1 100644
--- a/dirsrvtests/tickets/ticket47676_test.py
+++ b/dirsrvtests/tickets/ticket47676_test.py
@@ -270,7 +270,7 @@ def test_ticket47676_init(topology):
     
     topology.master1.log.info("Add %s that allows 'member' attribute" % OC_NAME)
     new_oc = _oc_definition(OC_OID_EXT, OC_NAME, must = MUST, may  = MAY) 
-    topology.master1.addSchema('objectClasses', new_oc)
+    topology.master1.schema.add_schema('objectClasses', new_oc)
     
     
     # entry used to bind with
@@ -372,7 +372,7 @@ def test_ticket47676_reject_action(topology):
     # Add a new OC on M1 so that schema CSN will change and M1 will try to push the schema
     topology.master1.log.info("Add %s on M1" % OC2_NAME)
     new_oc = _oc_definition(OC2_OID_EXT, OC2_NAME, must = MUST, may  = MAY) 
-    topology.master1.addSchema('objectClasses', new_oc)
+    topology.master1.schema.add_schema('objectClasses', new_oc)
     
     # Safety checking that the schema has been updated on M1
     topology.master1.log.info("Check %s is in M1" % OC2_NAME)
-- 
1.7.11.7

