From 857921ee6bf2e1203a36722630e95c1fface004b Mon Sep 17 00:00:00 2001 From: Jelani Brandon Date: Thu, 2 Jul 2020 11:32:42 -0700 Subject: [PATCH] chore: rename digital-twin-model-id to model-id in mqtt (#829) --- device/transport/mqtt/devdoc/mqtt_requirements.md | 2 +- device/transport/mqtt/src/mqtt.ts | 6 +++--- device/transport/mqtt/test/_mqtt_test.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/device/transport/mqtt/devdoc/mqtt_requirements.md b/device/transport/mqtt/devdoc/mqtt_requirements.md index 967c23bf4..dc3f5bd96 100644 --- a/device/transport/mqtt/devdoc/mqtt_requirements.md +++ b/device/transport/mqtt/devdoc/mqtt_requirements.md @@ -229,7 +229,7 @@ The `reject` method is there for compatibility purposes with other transports bu **SRS_NODE_DEVICE_MQTT_06_002: [** The authentication providers `setTokenRenewalValues` method shall be invoked with the values provided in the tokenRenewal option. **]** -**SRS_NODE_DEVICE_MQTT_41_014: [** For a Plug and Play Device the modelId should be included as `&digital-twin-model-id=` after the api-version **]** +**SRS_NODE_DEVICE_MQTT_41_014: [** For a Plug and Play Device the modelId should be included as `&model-id=` after the api-version **]** ### onDeviceMethod(methodName, methodCallback) diff --git a/device/transport/mqtt/src/mqtt.ts b/device/transport/mqtt/src/mqtt.ts index b53045dcd..0bcfac32f 100644 --- a/device/transport/mqtt/src/mqtt.ts +++ b/device/transport/mqtt/src/mqtt.ts @@ -535,9 +535,9 @@ export class Mqtt extends EventEmitter implements DeviceTransport { /*Codes_SRS_NODE_DEVICE_MQTT_16_015: [The `setOptions` method shall throw an `ArgumentError` if the `cert` property is populated but the device uses symmetric key authentication.]*/ if (this._authenticationProvider.type === AuthenticationType.Token && options.cert) throw new errors.ArgumentError('Cannot set x509 options on a device that uses token authentication.'); - /*Codes_SRS_NODE_DEVICE_MQTT_41_XXX: [The MQTT transport should ] */ + /*Codes_SRS_NODE_DEVICE_MQTT_41_014: [For a Plug and Play Device the model id should be included as `&model-id=` after the api-version ] */ if (options.modelId) { - this._mid = '&digital-twin-model-id=' + options.modelId; + this._mid = '&model-id=' + options.modelId; } /*Codes_SRS_NODE_DEVICE_MQTT_41_001: [The MQTT transport should use the productInfo string in the `options` object if present]*/ if (options.productInfo) { @@ -741,7 +741,7 @@ export class Mqtt extends EventEmitter implements DeviceTransport { /*Codes_SRS_NODE_DEVICE_MQTT_18_054: [If a `gatewayHostName` is specified in the connection string, the Mqtt constructor shall initialize the `uri` property of the `config` object to `mqtts://`. ]*/ /*Codes_SRS_NODE_DEVICE_MQTT_18_055: [The Mqtt constructor shall initialize the `username` property of the `config` object to '//api-version=&DeviceClientType='. ]*/ /*Codes_SRS_NODE_DEVICE_MQTT_41_002: [The MQTT constructor shall append the productInfo to the `username` property of the `config` object.]*/ - /*Codes_SRS_NODE_DEVICE_MQTT_41_014: [For a Plug and Play Device the modelId should be included as `&digital-twin-model-id=` after the api-version]*/ + /*Codes_SRS_NODE_DEVICE_MQTT_41_014: [For a Plug and Play Device the modelId should be included as `&modelId=` after the api-version]*/ let baseConfig: MqttBaseTransportConfig = { uri: 'mqtts://' + (credentials.gatewayHostName || credentials.host), username: credentials.host + '/' + clientId + diff --git a/device/transport/mqtt/test/_mqtt_test.js b/device/transport/mqtt/test/_mqtt_test.js index 88b15c260..4927f66a7 100644 --- a/device/transport/mqtt/test/_mqtt_test.js +++ b/device/transport/mqtt/test/_mqtt_test.js @@ -634,10 +634,10 @@ describe('Mqtt', function () { }); }); - /* Tests_SRS_NODE_DEVICE_MQTT_41_014: [For a Plug and Play Device the modelId should be included as `&digital-twin-model-id=` after the api-version]*/ - /* Tests_SRS_NODE_DEVICE_MQTT_41_015: [If a modelId is provided, the device should use the PnP API String] */ + /* Tests_SRS_NODE_DEVICE_MQTT_41_014: [For a Plug and Play Device the modelId should be included as `&model-id=` after the api-version]*/ + /* Tests_SRS_NODE_DEVICE_MQTT_41_015: [If a model id is provided, the device should use the PnP API String] */ it('sets options for modelId', function (testCallback) { - const fakeModelId = '&digital-twin-model-id=fakeModelId'; + const fakeModelId = '&model-id=fakeModelId'; const fakeModel = { modelId: 'fakeModelId' }; let connectCallback; fakeMqttBase.connect = sinon.stub().callsFake(function (config, callback) {