本文整理匯總了Python中interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient.prepare_instrument_device_support方法的典型用法代碼示例。如果您正苦於以下問題:Python InstrumentManagementServiceClient.prepare_instrument_device_support方法的具體用法?Python InstrumentManagementServiceClient.prepare_instrument_device_support怎麽用?Python InstrumentManagementServiceClient.prepare_instrument_device_support使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient
的用法示例。
在下文中一共展示了InstrumentManagementServiceClient.prepare_instrument_device_support方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestInstrumentManagementServiceIntegration
# 需要導入模塊: from interface.services.sa.iinstrument_management_service import InstrumentManagementServiceClient [as 別名]
# 或者: from interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient import prepare_instrument_device_support [as 別名]
#.........這裏部分代碼省略.........
#create a parsed product for this instrument output
dp_obj = IonObject(RT.DataProduct,
name='the parsed data',
description='ctd stream test',
processing_level_code='Parsed_Canonical')
pdict_id = self.DSC.read_parameter_dictionary_by_name('ctd_parsed_param_dict', id_only=True)
parsed_stream_def_id = self.PSC.create_stream_definition(name='parsed', parameter_dictionary_id=pdict_id)
data_product_id1 = self.DP.create_data_product(data_product=dp_obj, stream_definition_id=parsed_stream_def_id)
log.debug( 'new dp_id = %s', data_product_id1)
self.DAMS.assign_data_product(input_resource_id=instrument_device_id, data_product_id=data_product_id1)
def addInstOwner(inst_id, subject):
actor_identity_obj = any_old(RT.ActorIdentity, {"name": subject})
user_id = self.IDS.create_actor_identity(actor_identity_obj)
user_info_obj = any_old(RT.UserInfo)
user_info_id = self.IDS.create_user_info(user_id, user_info_obj)
self.RR.create_association(inst_id, PRED.hasOwner, user_id)
#Testing multiple instrument owners
addInstOwner(instrument_device_id, "/DC=org/DC=cilogon/C=US/O=ProtectNetwork/CN=Roger Unwin A254")
addInstOwner(instrument_device_id, "/DC=org/DC=cilogon/C=US/O=ProtectNetwork/CN=Bob Cumbers A256")
def ion_object_encoder(obj):
return obj.__dict__
#First call to create
instrument_data = self.IMS.prepare_instrument_device_support()
#print simplejson.dumps(instrument_data, default=ion_object_encoder, indent=2)
self.assertEqual(instrument_data._id, '')
self.assertEqual(instrument_data.type_, OT.InstrumentDevicePrepareSupport)
self.assertEqual(len(instrument_data.associations['InstrumentModel'].resources), 1)
self.assertEqual(instrument_data.associations['InstrumentModel'].resources[0]._id, instrument_model_id)
self.assertEqual(len(instrument_data.associations['InstrumentAgentInstance'].resources), 1)
self.assertEqual(instrument_data.associations['InstrumentAgentInstance'].resources[0]._id, instrument_agent_instance_id)
self.assertEqual(len(instrument_data.associations['InstrumentModel'].associated_resources), 0)
self.assertEqual(len(instrument_data.associations['InstrumentAgentInstance'].associated_resources), 0)
self.assertEqual(len(instrument_data.associations['SensorDevice'].resources), 0)
#Next call to update
instrument_data = self.IMS.prepare_instrument_device_support(instrument_device_id)
#print 'Update results'
#print simplejson.dumps(instrument_data, default=ion_object_encoder, indent=2)
self.assertEqual(instrument_data._id, instrument_device_id)
self.assertEqual(instrument_data.type_, OT.InstrumentDevicePrepareSupport)
self.assertEqual(len(instrument_data.associations['InstrumentModel'].resources), 1)
self.assertEqual(instrument_data.associations['InstrumentModel'].resources[0]._id, instrument_model_id)
self.assertEqual(len(instrument_data.associations['InstrumentAgentInstance'].resources), 1)
self.assertEqual(instrument_data.associations['InstrumentAgentInstance'].resources[0]._id, instrument_agent_instance_id)
self.assertEqual(len(instrument_data.associations['InstrumentModel'].associated_resources), 1)
self.assertEqual(instrument_data.associations['InstrumentModel'].associated_resources[0].s, instrument_device_id)
self.assertEqual(instrument_data.associations['InstrumentModel'].associated_resources[0].o, instrument_model_id)
self.assertEqual(len(instrument_data.associations['InstrumentAgentInstance'].associated_resources), 1)
示例2: TestInstrumentManagementServiceIntegration
# 需要導入模塊: from interface.services.sa.iinstrument_management_service import InstrumentManagementServiceClient [as 別名]
# 或者: from interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient import prepare_instrument_device_support [as 別名]
#.........這裏部分代碼省略.........
dp_obj = IonObject(RT.DataProduct,
name='the parsed data',
description='ctd stream test',
processing_level_code='Parsed_Canonical',
temporal_domain = tdom,
spatial_domain = sdom)
pdict_id = self.DSC.read_parameter_dictionary_by_name('ctd_parsed_param_dict', id_only=True)
parsed_stream_def_id = self.PSC.create_stream_definition(name='parsed', parameter_dictionary_id=pdict_id)
data_product_id1 = self.DP.create_data_product(data_product=dp_obj, stream_definition_id=parsed_stream_def_id)
log.debug( 'new dp_id = %s', data_product_id1)
self.DAMS.assign_data_product(input_resource_id=instrument_device_id, data_product_id=data_product_id1)
def addInstOwner(inst_id, subject):
actor_identity_obj = any_old(RT.ActorIdentity, {"name": subject})
user_id = self.IDS.create_actor_identity(actor_identity_obj)
user_info_obj = any_old(RT.UserInfo)
user_info_id = self.IDS.create_user_info(user_id, user_info_obj)
self.RR.create_association(inst_id, PRED.hasOwner, user_id)
#Testing multiple instrument owners
addInstOwner(instrument_device_id, "/DC=org/DC=cilogon/C=US/O=ProtectNetwork/CN=Roger Unwin A254")
addInstOwner(instrument_device_id, "/DC=org/DC=cilogon/C=US/O=ProtectNetwork/CN=Bob Cumbers A256")
def ion_object_encoder(obj):
return obj.__dict__
#First call to create
instrument_data = self.IMS.prepare_instrument_device_support()
self.assertEqual(instrument_data._id, '')
self.assertEqual(instrument_data.type_, OT.InstrumentDevicePrepareSupport)
self.assertEqual(len(instrument_data.instrument_models), 1)
self.assertEqual(instrument_data.instrument_models[0]._id, instrument_model_id)
self.assertEqual(len(instrument_data.instrument_agents), 1)
self.assertEqual(instrument_data.instrument_agents[0]._id, instrument_agent_id)
self.assertEqual(len(instrument_data.instrument_device_model), 0)
self.assertEqual(len(instrument_data.instrument_agent_models), 1)
self.assertEqual(instrument_data.instrument_agent_models[0].o, instrument_model_id)
self.assertEqual(instrument_data.instrument_agent_models[0].s, instrument_agent_id)
self.assertEqual(len(instrument_data.sensor_devices), 1)
self.assertEqual(instrument_data.sensor_devices[0]._id, sensor_device_id)
#Next call to update
instrument_data = self.IMS.prepare_instrument_device_support(instrument_device_id)
self.assertEqual(instrument_data._id, instrument_device_id)
self.assertEqual(instrument_data.type_, OT.InstrumentDevicePrepareSupport)
self.assertEqual(len(instrument_data.instrument_models), 1)
self.assertEqual(instrument_data.instrument_models[0]._id, instrument_model_id)
self.assertEqual(len(instrument_data.instrument_agents), 1)
self.assertEqual(instrument_data.instrument_agents[0]._id, instrument_agent_id)
self.assertEqual(len(instrument_data.instrument_device_model), 1)
self.assertEqual(instrument_data.instrument_device_model[0].s, instrument_device_id)
self.assertEqual(instrument_data.instrument_device_model[0].o, instrument_model_id)
self.assertEqual(len(instrument_data.instrument_agent_models), 1)
self.assertEqual(instrument_data.instrument_agent_models[0].o, instrument_model_id)
self.assertEqual(instrument_data.instrument_agent_models[0].s, instrument_agent_id)
self.assertEqual(len(instrument_data.sensor_devices), 1)
self.assertEqual(instrument_data.sensor_devices[0]._id, sensor_device_id)