From: <ba...@us...> - 2008-10-21 23:03:44
|
Revision: 1118 http://omc.svn.sourceforge.net/omc/?rev=1118&view=rev Author: bartw Date: 2008-10-21 23:03:37 +0000 (Tue, 21 Oct 2008) Log Message: ----------- delete stale subscriptions before starting the test Modified Paths: -------------- cmpi-bindings/trunk/test/python/TestIndications.py Modified: cmpi-bindings/trunk/test/python/TestIndications.py =================================================================== --- cmpi-bindings/trunk/test/python/TestIndications.py 2008-10-21 20:09:08 UTC (rev 1117) +++ cmpi-bindings/trunk/test/python/TestIndications.py 2008-10-21 23:03:37 UTC (rev 1118) @@ -75,6 +75,26 @@ filtercop = ch.CreateInstance(filterinst) return filtercop +def deleteAllSubs(ch, destination='http://localhost:%s' % _port, + ns=_interop_ns): + subs = ch.EnumerateInstanceNames('CIM_IndicationSubscription', + namespace=ns) + num = 0 + for sub in subs: + handler_name = sub['Handler'] + try: + handler = ch.GetInstance(handler_name, PropertyList=['Destination']) + except pywbem.CIMError, args: + print "** Error fetching handler instance: %s %s" % \ + (handler_name, args) + continue + if handler['Destination'] == destination: + deleteSubscription(ch, sub) + num+= 1 + if num > 0: + print '** deleted %d subscriptions' % num + + def createDest( ch, destination='http://localhost:%s' % _port, ns=_interop_ns, in_name=None): @@ -173,6 +193,8 @@ cl = CIMListener(callback=cb, http_port=5309) + deleteAllSubs(conn, ns=_interop_ns) + def threadfunc(): try: time.sleep(1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |