本文整理汇总了Python中interface.services.coi.iorg_management_service.OrgManagementServiceClient.get_marine_facility_extension方法的典型用法代码示例。如果您正苦于以下问题:Python OrgManagementServiceClient.get_marine_facility_extension方法的具体用法?Python OrgManagementServiceClient.get_marine_facility_extension怎么用?Python OrgManagementServiceClient.get_marine_facility_extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.services.coi.iorg_management_service.OrgManagementServiceClient
的用法示例。
在下文中一共展示了OrgManagementServiceClient.get_marine_facility_extension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.coi.iorg_management_service import OrgManagementServiceClient [as 别名]
# 或者: from interface.services.coi.iorg_management_service.OrgManagementServiceClient import get_marine_facility_extension [as 别名]
#.........这里部分代码省略.........
parsed_pdict_id = self.dataset_management.read_parameter_dictionary_by_name('ctd_parsed_param_dict',
id_only=True)
parsed_stream_def_id = self.pubsubcli.create_stream_definition(name='parsed',
parameter_dictionary_id=parsed_pdict_id)
tdom, sdom = time_series_domain()
sdom = sdom.dump()
tdom = tdom.dump()
dp_obj = IonObject(RT.DataProduct,
name='the parsed data',
description='ctd stream test',
temporal_domain = tdom,
spatial_domain = sdom)
data_product_id1 = self.dpclient.create_data_product(data_product=dp_obj,
stream_definition_id=parsed_stream_def_id)
self.damsclient.assign_data_product(input_resource_id=stuff.instrument_device_id,
data_product_id=data_product_id1)
#Create a user to be used as regular member
member_actor_obj = IonObject(RT.ActorIdentity, name='org member actor')
member_actor_id,_ = self.RR.create(member_actor_obj)
assert(member_actor_id)
member_actor_header = get_actor_header(member_actor_id)
member_user_obj = IonObject(RT.UserInfo, name='org member user')
member_user_id,_ = self.RR.create(member_user_obj)
assert(member_user_id)
self.RR.create_association(subject=member_actor_id, predicate=PRED.hasInfo, object=member_user_id)
#Build the Service Agreement Proposal to enroll a user actor
sap = IonObject(OT.EnrollmentProposal,consumer=member_actor_id, provider=stuff.org_id )
sap_response = self.org_management_service.negotiate(sap, headers=member_actor_header )
#enroll the member without using negotiation
self.org_management_service.enroll_member(org_id=stuff.org_id, actor_id=member_actor_id)
#--------------------------------------------------------------------------------
# Get the extended Site (platformSite)
#--------------------------------------------------------------------------------
extended_site = self.OMS.get_site_extension(stuff.platform_site_id)
log.debug("extended_site: %s ", str(extended_site))
self.assertEqual(1, len(extended_site.platform_devices))
self.assertEqual(1, len(extended_site.platform_models))
self.assertEqual(stuff.platform_device_id, extended_site.platform_devices[0]._id)
self.assertEqual(stuff.platform_model_id, extended_site.platform_models[0]._id)
log.debug("verify that PlatformDeviceb is linked to PlatformDevice with hasNetworkParent link")
associations = self.RR.find_associations(subject=stuff.platform_deviceb_id, predicate=PRED.hasNetworkParent, object=stuff.platform_device_id, id_only=True)
self.assertIsNotNone(associations, "PlatformDevice child not connected to PlatformDevice parent.")
#--------------------------------------------------------------------------------
# Get the extended Org
#--------------------------------------------------------------------------------
#test the extended resource
extended_org = self.org_management_service.get_marine_facility_extension(stuff.org_id)
log.debug("test_observatory_org_extended: extended_org: %s ", str(extended_org))
#self.assertEqual(2, len(extended_org.instruments_deployed) )
#self.assertEqual(1, len(extended_org.platforms_not_deployed) )
self.assertEqual(2, extended_org.number_of_platforms)
self.assertEqual(2, len(extended_org.platform_models) )
self.assertEqual(2, extended_org.number_of_instruments)
self.assertEqual(2, len(extended_org.instrument_models) )
self.assertEqual(1, len(extended_org.members))
self.assertEqual(1, len(extended_org.open_requests))
#test the extended resource of the ION org
ion_org_id = self.org_management_service.find_org()
extended_org = self.org_management_service.get_marine_facility_extension(ion_org_id._id, user_id=12345)
log.debug("test_observatory_org_extended: extended_ION_org: %s ", str(extended_org))
self.assertEqual(1, len(extended_org.members))
self.assertEqual(0, extended_org.number_of_platforms)
#self.assertEqual(1, len(extended_org.sites))
#--------------------------------------------------------------------------------
# Get the extended Site
#--------------------------------------------------------------------------------
#create device state events to use for op /non-op filtering in extended
t = get_ion_ts()
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device_id, state=ResourceAgentState.STREAMING )
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device2_id, state=ResourceAgentState.INACTIVE )
extended_site = self.OMS.get_site_extension(stuff.instrument_site2_id)
log.debug("test_observatory_org_extended: extended_site: %s ", str(extended_site))
self.dpclient.delete_data_product(data_product_id1)
开发者ID:jamie-cyber1,项目名称:coi-services,代码行数:104,代码来源:test_observatory_management_service_integration.py
示例2: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.coi.iorg_management_service import OrgManagementServiceClient [as 别名]
# 或者: from interface.services.coi.iorg_management_service.OrgManagementServiceClient import get_marine_facility_extension [as 别名]
#.........这里部分代码省略.........
#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...")
@attr('EXT')
def test_observatory_org_extended(self):
stuff = self._make_associations()
parsed_pdict_id = self.dataset_management.read_parameter_dictionary_by_name('ctd_parsed_param_dict',
id_only=True)
parsed_stream_def_id = self.pubsubcli.create_stream_definition(name='parsed',
parameter_dictionary_id=parsed_pdict_id)
tdom, sdom = time_series_domain()
sdom = sdom.dump()
tdom = tdom.dump()
dp_obj = IonObject(RT.DataProduct,
name='the parsed data',
description='ctd stream test',
temporal_domain = tdom,
spatial_domain = sdom)
data_product_id1 = self.dpclient.create_data_product(data_product=dp_obj,
stream_definition_id=parsed_stream_def_id)
self.damsclient.assign_data_product(input_resource_id=stuff.instrument_device_id,
data_product_id=data_product_id1)
#--------------------------------------------------------------------------------
# Get the extended Site (platformSite)
#--------------------------------------------------------------------------------
extended_site = self.OMS.get_site_extension(stuff.platform_site_id)
log.debug("extended_site: %s ", str(extended_site))
self.assertEqual(1, len(extended_site.platform_devices))
self.assertEqual(1, len(extended_site.platform_models))
self.assertEqual(stuff.platform_device_id, extended_site.platform_devices[0]._id)
self.assertEqual(stuff.platform_model_id, extended_site.platform_models[0]._id)
#--------------------------------------------------------------------------------
# Get the extended Org
#--------------------------------------------------------------------------------
#test the extended resource
extended_org = self.org_management_service.get_marine_facility_extension(stuff.org_id)
log.debug("test_observatory_org_extended: extended_org: %s ", str(extended_org))
#self.assertEqual(2, len(extended_org.instruments_deployed) )
#self.assertEqual(1, len(extended_org.platforms_not_deployed) )
self.assertEqual(2, extended_org.number_of_platforms)
self.assertEqual(2, len(extended_org.platform_models) )
self.assertEqual(2, extended_org.number_of_instruments)
self.assertEqual(2, len(extended_org.instrument_models) )
#test the extended resource of the ION org
ion_org_id = self.org_management_service.find_org()
extended_org = self.org_management_service.get_marine_facility_extension(ion_org_id._id)
log.debug("test_observatory_org_extended: extended_ION_org: %s ", str(extended_org))
self.assertEqual(0, len(extended_org.members))
self.assertEqual(0, extended_org.number_of_platforms)
#self.assertEqual(1, len(extended_org.sites))
#--------------------------------------------------------------------------------
# Get the extended Site
#--------------------------------------------------------------------------------
#create device state events to use for op /non-op filtering in extended
t = get_ion_ts()
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device_id, state=ResourceAgentState.STREAMING )
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device2_id, state=ResourceAgentState.INACTIVE )
extended_site = self.OMS.get_site_extension(stuff.instrument_site2_id)
log.debug("test_observatory_org_extended: extended_site: %s ", str(extended_site))
self.dpclient.delete_data_product(data_product_id1)
开发者ID:blazetopher,项目名称:coi-services,代码行数:104,代码来源:test_observatory_management_service_integration.py
示例3: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.coi.iorg_management_service import OrgManagementServiceClient [as 别名]
# 或者: from interface.services.coi.iorg_management_service.OrgManagementServiceClient import get_marine_facility_extension [as 别名]
#.........这里部分代码省略.........
# 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...")
def test_observatory_org_extended(self):
org_obj = IonObject(RT.Org,
name='TestOrg',
description='some new mf org')
org_id = self.OMS.create_marine_facility(org_obj)
observatory_obj = IonObject(RT.Observatory,
name='TestObservatory',
description='some new obs')
observatory_id = self.OMS.create_observatory(observatory_obj)
#make association
self.OMS.assign_resource_to_observatory_org(observatory_id, org_id)
log.debug("test_observatory_org_extended: org_id: %s ", str(org_id))
#create a PlatformSite with parent Observatory
subsite_obj = IonObject(RT.PlatformSite,
name= 'PlatformSite1',
description = 'sample PlatformSite')
pltfrm_site_id = self.OMS.create_platform_site(subsite_obj, observatory_id)
self.assertIsNotNone(pltfrm_site_id, "PlatformSite not created.")
self.OMS.assign_resource_to_observatory_org(resource_id=pltfrm_site_id, org_id=org_id)
#create a InstrumentSite with parent Observatory
subsite_obj = IonObject(RT.InstrumentSite,
name= 'InstrumentSite1',
description = 'sample InstrumentSite')
inst_site_id = self.OMS.create_instrument_site(subsite_obj, pltfrm_site_id)
self.assertIsNotNone(inst_site_id, "InstrumentSite not created.")
self.OMS.assign_resource_to_observatory_org(resource_id=inst_site_id, org_id=org_id)
# create two PLATFORM devices, one deployed and one not
platfrmDevice1_obj = IonObject(RT.PlatformDevice,
name='PlatformDevice1',
description="PlatformDevice1")
platfrmDevice1_id = self.instrument_management_service.create_platform_device(platfrmDevice1_obj)
self.OMS.assign_resource_to_observatory_org(resource_id=platfrmDevice1_id, org_id=org_id)
self.RR.create_association(subject=pltfrm_site_id, predicate=PRED.hasDevice, object=platfrmDevice1_id)
platfrmDevice2_obj = IonObject(RT.PlatformDevice,
name='PlatformDevice2',
description="PlatformDevice2")
platfrmDevice2_id = self.instrument_management_service.create_platform_device(platfrmDevice2_obj)
self.OMS.assign_resource_to_observatory_org(resource_id=platfrmDevice2_id, org_id=org_id)
# create two INSTRUMENT devices, one deployed and one not
instDevice1_obj = IonObject(RT.InstrumentDevice,
name='SBE37IMDevice1',
description="SBE37IMDevice1",
serial_number="1" )
instDevice1_id = self.instrument_management_service.create_instrument_device(instrument_device=instDevice1_obj)
self.OMS.assign_resource_to_observatory_org(resource_id=instDevice1_id, org_id=org_id)
self.RR.create_association(subject=inst_site_id, predicate=PRED.hasDevice, object=instDevice1_id)
instDevice2_obj = IonObject(RT.InstrumentDevice,
name='SBE37IMDevice2',
description="SBE37IMDevice2",
serial_number="2" )
instDevice2_id = self.instrument_management_service.create_instrument_device(instrument_device=instDevice2_obj)
self.OMS.assign_resource_to_observatory_org(resource_id=instDevice2_id, org_id=org_id)
#test the extended resource
extended_org = self.org_management_service.get_marine_facility_extension(org_id)
#log.debug("test_observatory_org_extended: extended_org: %s ", str(extended_org))
self.assertEqual(1, len(extended_org.instruments_deployed) )
self.assertEqual(1, len(extended_org.platforms_not_deployed) )
self.assertEqual(0, len(extended_org.platform_models) )