本文整理汇总了Python中interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient.unassign_resource_from_observatory_org方法的典型用法代码示例。如果您正苦于以下问题:Python ObservatoryManagementServiceClient.unassign_resource_from_observatory_org方法的具体用法?Python ObservatoryManagementServiceClient.unassign_resource_from_observatory_org怎么用?Python ObservatoryManagementServiceClient.unassign_resource_from_observatory_org使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient
的用法示例。
在下文中一共展示了ObservatoryManagementServiceClient.unassign_resource_from_observatory_org方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import unassign_resource_from_observatory_org [as 别名]
#.........这里部分代码省略.........
site_lp_assoc = self.RR.get_association(subsite_id, PRED.hasSite, platform_site_id)
self.assertIsNotNone(site_lp_assoc, "PlatformSite not connected to Site.")
# add the PlatformSite as a resource of this Observatory
self.OMS.assign_resource_to_observatory_org(resource_id=platform_site_id, org_id=org_id)
# verify that PlatformSite is linked to Org
org_lp_assoc = self.RR.get_association(org_id, PRED.hasResource, platform_site_id)
self.assertIsNotNone(org_lp_assoc, "PlatformSite not connected as resource to Org.")
#create a logical instrument with parent logical platform
instrument_site_obj = IonObject(RT.InstrumentSite,
name= 'TestInstrumentSite',
description = 'sample logical instrument')
instrument_site_id = self.OMS.create_instrument_site(instrument_site_obj, platform_site_id)
self.assertIsNotNone(instrument_site_id, "InstrumentSite not created.")
# verify that InstrumentSite is linked to PlatformSite
li_lp_assoc = self.RR.get_association(platform_site_id, PRED.hasSite, instrument_site_id)
self.assertIsNotNone(li_lp_assoc, "InstrumentSite not connected to PlatformSite.")
# add the InstrumentSite as a resource of this Observatory
self.OMS.assign_resource_to_observatory_org(resource_id=instrument_site_id, org_id=org_id)
# verify that InstrumentSite is linked to Org
org_li_assoc = self.RR.get_association(org_id, PRED.hasResource, instrument_site_id)
self.assertIsNotNone(org_li_assoc, "InstrumentSite not connected as resource to Org.")
# remove the InstrumentSite as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(instrument_site_id, org_id)
# verify that InstrumentSite is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.InstrumentSite, id_only=True )
self.assertEqual(len(assocs), 0)
# remove the InstrumentSite
self.OMS.delete_instrument_site(instrument_site_id)
assocs, _ = self.RR.find_objects(platform_site_id, PRED.hasSite, RT.InstrumentSite, id_only=True )
self.assertEqual(len(assocs), 1)
#todo: remove the dangling association
# remove the PlatformSite as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(platform_site_id, org_id)
# verify that PlatformSite is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.PlatformSite, id_only=True )
self.assertEqual(len(assocs), 0)
# remove the Site as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(subsite_id, org_id)
# verify that Site is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.Subsite, id_only=True )
self.assertEqual(len(assocs), 0)
self.RR.delete(org_id)
self.OMS.force_delete_observatory(observatory_id)
self.OMS.force_delete_subsite(subsite_id)
self.OMS.force_delete_platform_site(platform_site_id)
self.OMS.force_delete_instrument_site(instrument_site_id)
#@unittest.skip("in development...")
示例2: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import unassign_resource_from_observatory_org [as 别名]
#.........这里部分代码省略.........
site_lp_assoc = self.RR.get_association(subsite_id, PRED.hasSite, platform_site_id)
self.assertIsNotNone(site_lp_assoc, "PlatformSite not connected to Site.")
log.debug("add the PlatformSite as a resource of this Observatory")
self.OMS.assign_resource_to_observatory_org(resource_id=platform_site_id, org_id=org_id)
log.debug("verify that PlatformSite is linked to Org")
org_lp_assoc = self.RR.get_association(org_id, PRED.hasResource, platform_site_id)
self.assertIsNotNone(org_lp_assoc, "PlatformSite not connected as resource to Org.")
log.debug("create a logical instrument with parent logical platform")
instrument_site_obj = IonObject(RT.InstrumentSite,
name= 'TestInstrumentSite',
description = 'sample logical instrument')
instrument_site_id = self.OMS.create_instrument_site(instrument_site_obj, platform_site_id)
self.assertIsNotNone(instrument_site_id, "InstrumentSite not created.")
log.debug("verify that InstrumentSite is linked to PlatformSite")
li_lp_assoc = self.RR.get_association(platform_site_id, PRED.hasSite, instrument_site_id)
self.assertIsNotNone(li_lp_assoc, "InstrumentSite not connected to PlatformSite.")
log.debug("add the InstrumentSite as a resource of this Observatory")
self.OMS.assign_resource_to_observatory_org(resource_id=instrument_site_id, org_id=org_id)
log.debug("verify that InstrumentSite is linked to Org")
org_li_assoc = self.RR.get_association(org_id, PRED.hasResource, instrument_site_id)
self.assertIsNotNone(org_li_assoc, "InstrumentSite not connected as resource to Org.")
log.debug("remove the InstrumentSite as a resource of this Observatory")
self.OMS.unassign_resource_from_observatory_org(instrument_site_id, org_id)
log.debug("verify that InstrumentSite is linked to Org")
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.InstrumentSite, id_only=True )
self.assertEqual(0, len(assocs))
log.debug("remove the InstrumentSite, association should drop automatically")
self.OMS.delete_instrument_site(instrument_site_id)
assocs, _ = self.RR.find_objects(platform_site_id, PRED.hasSite, RT.InstrumentSite, id_only=True )
self.assertEqual(0, len(assocs))
log.debug("remove the PlatformSite as a resource of this Observatory")
self.OMS.unassign_resource_from_observatory_org(platform_site_id, org_id)
log.debug("verify that PlatformSite is linked to Org")
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.PlatformSite, id_only=True )
self.assertEqual(0, len(assocs))
log.debug("remove the Site as a resource of this Observatory")
self.OMS.unassign_resource_from_observatory_org(subsite_id, org_id)
log.debug("verify that Site is linked to Org")
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.Subsite, id_only=True )
self.assertEqual(0, len(assocs))
self.RR.delete(org_id)
self.OMS.force_delete_observatory(observatory_id)
self.OMS.force_delete_subsite(subsite_id)
self.OMS.force_delete_platform_site(platform_site_id)
self.OMS.force_delete_instrument_site(instrument_site_id)
@attr('EXT')
def test_observatory_extensions(self):
示例3: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import unassign_resource_from_observatory_org [as 别名]
#.........这里部分代码省略.........
observatory_id = self.OMS.create_observatory(observatory_obj)
#make association
self.OMS.assign_resource_to_observatory_org(observatory_id, org_id)
#find association
org_objs = self.OMS.find_org_by_observatory(observatory_id)
self.assertEqual(1, len(org_objs))
self.assertEqual(org_id, org_objs[0]._id)
print("org_id=<" + org_id + ">")
#create a subsite with parent Observatory
subsite_obj = IonObject(RT.Subsite,
name= 'TestSubsite',
description = 'sample subsite')
subsite_id = self.OMS.create_subsite(subsite_obj, observatory_id)
self.assertIsNotNone(subsite_id, "Subsite not created.")
# verify that Subsite is linked to Observatory
mf_subsite_assoc = self.RR.get_association(observatory_id, PRED.hasSite, subsite_id)
self.assertIsNotNone(mf_subsite_assoc, "Subsite not connected to Observatory.")
# add the Subsite as a resource of this Observatory
self.OMS.assign_resource_to_observatory_org(resource_id=subsite_id, org_id=org_id)
# verify that Subsite is linked to Org
org_subsite_assoc = self.RR.get_association(org_id, PRED.hasResource, subsite_id)
self.assertIsNotNone(org_subsite_assoc, "Subsite not connected as resource to Org.")
#create a logical platform with parent Subsite
platform_site_obj = IonObject(RT.PlatformSite,
name= 'TestPlatformSite',
description = 'sample logical platform')
platform_site_id = self.OMS.create_platform_site(platform_site_obj, subsite_id)
self.assertIsNotNone(platform_site_id, "PlatformSite not created.")
# verify that PlatformSite is linked to Site
site_lp_assoc = self.RR.get_association(subsite_id, PRED.hasSite, platform_site_id)
self.assertIsNotNone(site_lp_assoc, "PlatformSite not connected to Site.")
# add the PlatformSite as a resource of this Observatory
self.OMS.assign_resource_to_observatory_org(resource_id=platform_site_id, org_id=org_id)
# verify that PlatformSite is linked to Org
org_lp_assoc = self.RR.get_association(org_id, PRED.hasResource, platform_site_id)
self.assertIsNotNone(org_lp_assoc, "PlatformSite not connected as resource to Org.")
#create a logical instrument with parent logical platform
instrument_site_obj = IonObject(RT.InstrumentSite,
name= 'TestInstrumentSite',
description = 'sample logical instrument')
instrument_site_id = self.OMS.create_instrument_site(instrument_site_obj, platform_site_id)
self.assertIsNotNone(instrument_site_id, "InstrumentSite not created.")
# verify that InstrumentSite is linked to PlatformSite
li_lp_assoc = self.RR.get_association(platform_site_id, PRED.hasSite, instrument_site_id)
self.assertIsNotNone(li_lp_assoc, "InstrumentSite not connected to PlatformSite.")
# add the InstrumentSite as a resource of this Observatory
self.OMS.assign_resource_to_observatory_org(resource_id=instrument_site_id, org_id=org_id)
# verify that InstrumentSite is linked to Org
org_li_assoc = self.RR.get_association(org_id, PRED.hasResource, instrument_site_id)
self.assertIsNotNone(org_li_assoc, "InstrumentSite not connected as resource to Org.")
# remove the InstrumentSite as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(instrument_site_id, org_id)
# verify that InstrumentSite is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.InstrumentSite, id_only=True )
self.assertEqual(len(assocs), 0)
# remove the InstrumentSite
self.OMS.delete_instrument_site(instrument_site_id)
assocs, _ = self.RR.find_objects(platform_site_id, PRED.hasSite, RT.InstrumentSite, id_only=True )
self.assertEqual(len(assocs), 1)
#todo: remove the dangling association
# remove the PlatformSite as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(platform_site_id, org_id)
# verify that PlatformSite is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.PlatformSite, id_only=True )
self.assertEqual(len(assocs), 0)
# remove the Site as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(subsite_id, org_id)
# verify that Site is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.Subsite, id_only=True )
self.assertEqual(len(assocs), 0)
开发者ID:pombredanne,项目名称:coi-services,代码行数:104,代码来源:test_observatory_management_service_integration.py