当前位置: 首页>>代码示例>>Python>>正文


Python InstrumentManagementServiceClient.prepare_platform_device_support方法代码示例

本文整理汇总了Python中interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient.prepare_platform_device_support方法的典型用法代码示例。如果您正苦于以下问题:Python InstrumentManagementServiceClient.prepare_platform_device_support方法的具体用法?Python InstrumentManagementServiceClient.prepare_platform_device_support怎么用?Python InstrumentManagementServiceClient.prepare_platform_device_support使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient的用法示例。


在下文中一共展示了InstrumentManagementServiceClient.prepare_platform_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_platform_device_support [as 别名]

#.........这里部分代码省略.........
        self.assertEqual(instrument_agent_data.type_, OT.InstrumentAgentInstancePrepareSupport)
        self.assertEqual(len(instrument_agent_data.associations['InstrumentDevice'].resources), 3)
        self.assertEqual(len(instrument_agent_data.associations['InstrumentAgent'].resources), 1)
        self.assertEqual(instrument_agent_data.associations['InstrumentAgent'].resources[0]._id, instrument_agent_id)
        self.assertEqual(len(instrument_agent_data.associations['InstrumentDevice'].associated_resources), 1)
        self.assertEqual(instrument_agent_data.associations['InstrumentDevice'].associated_resources[0].s, instrument_device_id)
        self.assertEqual(instrument_agent_data.associations['InstrumentDevice'].associated_resources[0].o, instrument_agent_instance_id)
        self.assertEqual(len(instrument_agent_data.associations['InstrumentAgent'].associated_resources), 1)
        self.assertEqual(instrument_agent_data.associations['InstrumentAgent'].associated_resources[0].o, instrument_agent_id)
        self.assertEqual(instrument_agent_data.associations['InstrumentAgent'].associated_resources[0].s, instrument_agent_instance_id)
        self.assertEqual(instrument_agent_data.associations['InstrumentAgent'].assign_request.request_parameters['instrument_agent_instance_id'], instrument_agent_instance_id)


        #test prepare for update of data product to see if it is associated with the instrument that was created
        data_product_data = self.DP.prepare_data_product_support(data_product_id1)

        #print simplejson.dumps(data_product_data, default=ion_object_encoder, indent=2)

        self.assertEqual(data_product_data._id, data_product_id1)
        self.assertEqual(data_product_data.type_, OT.DataProductPrepareSupport)
        self.assertEqual(len(data_product_data.associations['StreamDefinition'].resources), 1)

        self.assertEqual(len(data_product_data.associations['Dataset'].resources), 0)

        self.assertEqual(len(data_product_data.associations['StreamDefinition'].associated_resources), 1)
        self.assertEqual(data_product_data.associations['StreamDefinition'].associated_resources[0].s, data_product_id1)

        self.assertEqual(len(data_product_data.associations['Dataset'].associated_resources), 0)

        self.assertEqual(len(data_product_data.associations['InstrumentDeviceHasOutputProduct'].resources), 3)

        self.assertEqual(len(data_product_data.associations['InstrumentDeviceHasOutputProduct'].associated_resources), 1)
        self.assertEqual(data_product_data.associations['InstrumentDeviceHasOutputProduct'].associated_resources[0].s, instrument_device_id)
        self.assertEqual(data_product_data.associations['InstrumentDeviceHasOutputProduct'].associated_resources[0].o, data_product_id1)

        self.assertEqual(len(data_product_data.associations['PlatformDevice'].resources), 2)


        platform_data = self.IMS.prepare_platform_device_support()

        #print simplejson.dumps(platform_data, default=ion_object_encoder, indent=2)

        self.assertEqual(platform_data._id, '')
        self.assertEqual(platform_data.type_, OT.PlatformDevicePrepareSupport)
        self.assertEqual(len(platform_data.associations['PlatformModel'].resources), 1)
        self.assertEqual(platform_data.associations['PlatformModel'].resources[0]._id, platform_model_id)
        self.assertEqual(len(platform_data.associations['PlatformAgentInstance'].resources), 1)
        self.assertEqual(platform_data.associations['PlatformAgentInstance'].resources[0]._id, platform_agent_instance_id)
        self.assertEqual(len(platform_data.associations['PlatformModel'].associated_resources), 0)
        self.assertEqual(len(platform_data.associations['PlatformAgentInstance'].associated_resources), 0)
        self.assertEqual(len(platform_data.associations['InstrumentDevice'].resources), 1)

        platform_data = self.IMS.prepare_platform_device_support(platform_device_id)

        #print simplejson.dumps(platform_data, default=ion_object_encoder, indent=2)

        self.assertEqual(platform_data._id, platform_device_id)
        self.assertEqual(platform_data.type_, OT.PlatformDevicePrepareSupport)
        self.assertEqual(len(platform_data.associations['PlatformModel'].resources), 1)
        self.assertEqual(platform_data.associations['PlatformModel'].resources[0]._id, platform_model_id)
        self.assertEqual(len(platform_data.associations['PlatformAgentInstance'].resources), 1)
        self.assertEqual(platform_data.associations['PlatformAgentInstance'].resources[0]._id, platform_agent_instance_id)
        self.assertEqual(len(platform_data.associations['PlatformModel'].associated_resources), 1)
        self.assertEqual(platform_data.associations['PlatformModel'].associated_resources[0].s, platform_device_id)
        self.assertEqual(platform_data.associations['PlatformModel'].associated_resources[0].o, platform_model_id)
        self.assertEqual(len(platform_data.associations['PlatformAgentInstance'].associated_resources), 1)
        self.assertEqual(platform_data.associations['PlatformAgentInstance'].associated_resources[0].o, platform_agent_instance_id)
        self.assertEqual(platform_data.associations['PlatformAgentInstance'].associated_resources[0].s, platform_device_id)
        self.assertEqual(len(platform_data.associations['InstrumentDevice'].resources), 2)
        #self.assertEqual(len(platform_data.associations['InstrumentDevice'].associated_resources), 1)
        #self.assertEqual(platform_data.associations['InstrumentDevice'].associated_resources[0].s, platform_device_id)
        #self.assertEqual(platform_data.associations['InstrumentDevice'].associated_resources[0].o, instrument_device_id)
        self.assertEqual(platform_data.associations['PlatformModel'].assign_request.request_parameters['platform_device_id'], platform_device_id)


        # cleanup
        c = DotDict()
        c.resource_registry = self.RR
        self.RR2.pluck(instrument_agent_id)
        self.RR2.pluck(instrument_model_id)
        self.RR2.pluck(instrument_device_id)
        self.RR2.pluck(platform_agent_id)
        self.RR2.pluck(sensor_device_id)
        self.RR2.pluck(sensor_device2_id)
        self.IMS.force_delete_instrument_agent(instrument_agent_id)
        self.IMS.force_delete_instrument_model(instrument_model_id)
        self.IMS.force_delete_instrument_device(instrument_device_id)
        self.IMS.force_delete_instrument_device(instrument_device2_id)
        self.IMS.force_delete_platform_agent_instance(platform_agent_instance_id)
        self.IMS.force_delete_platform_agent(platform_agent_id)
        self.IMS.force_delete_platform_device(platform_device_id)
        self.IMS.force_delete_platform_device(platform_device2_id)
        self.IMS.force_delete_platform_model(platform_model_id)
        self.IMS.force_delete_sensor_device(sensor_device_id)
        self.IMS.force_delete_sensor_device(sensor_device2_id)
        self.IMS.force_delete_sensor_model(sensor_model_id)

        #stuff we associate to
        self.RR.delete(data_producer_id)
        self.RR.delete(org_id)
开发者ID:ednad,项目名称:coi-services,代码行数:104,代码来源:test_instrument_management_service_integration.py

示例2: TestInstrumentManagementServiceIntegration

# 需要导入模块: from interface.services.sa.iinstrument_management_service import InstrumentManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient import prepare_platform_device_support [as 别名]

#.........这里部分代码省略.........

        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)
        self.assertEqual(instrument_data.assign_instrument_model_request.request_parameters['instrument_device_id'], instrument_device_id)


        platform_data = self.IMS.prepare_platform_device_support()

        self.assertEqual(platform_data._id, '')
        self.assertEqual(platform_data.type_, OT.PlatformDevicePrepareSupport)
        self.assertEqual(len(platform_data.platform_models), 1)
        self.assertEqual(platform_data.platform_models[0]._id, platform_model_id)
        self.assertEqual(len(platform_data.platform_agents), 1)
        self.assertEqual(platform_data.platform_agents[0]._id, platform_agent_id)
        self.assertEqual(len(platform_data.platform_device_model), 0)
        self.assertEqual(len(platform_data.platform_agent_models), 1)
        self.assertEqual(platform_data.platform_agent_models[0].o, platform_model_id)
        self.assertEqual(platform_data.platform_agent_models[0].s, platform_agent_id)
        self.assertEqual(len(platform_data.instrument_devices), 1)
        self.assertEqual(platform_data.instrument_devices[0]._id, instrument_device_id)


        platform_data = self.IMS.prepare_platform_device_support(platform_device_id)

        #print simplejson.dumps(platform_data, default=ion_object_encoder, indent= 2)


        self.assertEqual(platform_data._id, platform_device_id)
        self.assertEqual(platform_data.type_, OT.PlatformDevicePrepareSupport)
        self.assertEqual(len(platform_data.platform_models), 1)
        self.assertEqual(platform_data.platform_models[0]._id, platform_model_id)
        self.assertEqual(len(platform_data.platform_agents), 1)
        self.assertEqual(platform_data.platform_agents[0]._id, platform_agent_id)
        self.assertEqual(len(platform_data.platform_device_model), 1)
        self.assertEqual(platform_data.platform_device_model[0].s, platform_device_id)
        self.assertEqual(platform_data.platform_device_model[0].o, platform_model_id)
        self.assertEqual(len(platform_data.platform_agent_models), 1)
        self.assertEqual(platform_data.platform_agent_models[0].o, platform_model_id)
        self.assertEqual(platform_data.platform_agent_models[0].s, platform_agent_id)
        self.assertEqual(len(platform_data.instrument_devices), 1)
        self.assertEqual(platform_data.instrument_devices[0]._id, instrument_device_id)
        self.assertEqual(platform_data.assign_platform_model_request.request_parameters['platform_device_id'], platform_device_id)

        # cleanup
        c = DotDict()
        c.resource_registry = self.RR
        self.RR2.pluck(instrument_agent_id)
        self.RR2.pluck(instrument_model_id)
        self.RR2.pluck(instrument_device_id)
        self.RR2.pluck(platform_agent_id)
        self.RR2.pluck(sensor_device_id)
        self.IMS.force_delete_instrument_agent(instrument_agent_id)
        self.IMS.force_delete_instrument_model(instrument_model_id)
        self.IMS.force_delete_instrument_device(instrument_device_id)
        self.IMS.force_delete_platform_agent_instance(platform_agent_instance_id)
        self.IMS.force_delete_platform_agent(platform_agent_id)
        self.IMS.force_delete_platform_device(platform_device_id)
        self.IMS.force_delete_platform_model(platform_model_id)
        self.IMS.force_delete_sensor_device(sensor_device_id)
        self.IMS.force_delete_sensor_model(sensor_model_id)

        #stuff we associate to
        self.RR.delete(data_producer_id)
        self.RR.delete(org_id)
开发者ID:jamie-cyber1,项目名称:coi-services,代码行数:104,代码来源:test_instrument_management_service_integration.py


注:本文中的interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient.prepare_platform_device_support方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。