Skip to content

Commit

Permalink
Bring updates from previews/pnpApi to preview (#2062)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhipsaMisra authored Jul 2, 2021
1 parent 8c6e84d commit f6def99
Show file tree
Hide file tree
Showing 83 changed files with 680 additions and 2,706 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Please follow the instructions and template below to save us time requesting add

Below is a generic bug report format. We recommend you use it as a template and replace the information below each header with your own.

Note that bugs that only affect unsupported platforms will likely be treated as feature requests, and may be closed as "won't fix" if we have no plans to support that platform. See [this document](../../supported_platforms.md) for details on which platforms are officially supported.

------------------------------- delete above -------------------------------


Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Thank you for raising a feature request! To get started, here's a few things to

As an open source project, we welcome PRs for new features, and we don't want to reject any hard work you've done to contribute. **So propose your solution through an issue first** so we can discuss the changes, and if things look good we will ask you submit a PR to implement the changes.

Note that feature requests that only affect unsupported platforms may be closed as "won't fix" if we have no plans to support that platform. See [this document](../../supported_platforms.md) for details on which platforms are officially supported.

------------------------------- delete above -------------------------------

**Is your feature request related to a problem? Please describe.**
Expand Down
20 changes: 0 additions & 20 deletions azureiot.sln
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Devices.Shared.Tests", "shared\tests\Microsoft.Azure.Devices.Shared.Tests.csproj", "{CEEE435F-32FC-4DE5-8735-90F6AC950A01}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{2368415A-9C09-4F47-9636-FDCA4B85C88C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "convention-based-samples", "convention-based-samples", "{22318FE4-1453-41BF-A38D-9401C4F16023}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thermostat", "iothub\device\samples\convention-based-samples\Thermostat\Thermostat.csproj", "{5658A5DF-EDEF-4561-9F0B-A37EEABC8135}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TemperatureController", "iothub\device\samples\convention-based-samples\TemperatureController\TemperatureController.csproj", "{B557FCFE-015C-4A65-81B6-B4987E07BFB7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -158,14 +150,6 @@ Global
{CEEE435F-32FC-4DE5-8735-90F6AC950A01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEEE435F-32FC-4DE5-8735-90F6AC950A01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEEE435F-32FC-4DE5-8735-90F6AC950A01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5658A5DF-EDEF-4561-9F0B-A37EEABC8135}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5658A5DF-EDEF-4561-9F0B-A37EEABC8135}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5658A5DF-EDEF-4561-9F0B-A37EEABC8135}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5658A5DF-EDEF-4561-9F0B-A37EEABC8135}.Release|Any CPU.Build.0 = Release|Any CPU
{B557FCFE-015C-4A65-81B6-B4987E07BFB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B557FCFE-015C-4A65-81B6-B4987E07BFB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B557FCFE-015C-4A65-81B6-B4987E07BFB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B557FCFE-015C-4A65-81B6-B4987E07BFB7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -200,10 +184,6 @@ Global
{275DEE86-1EEA-47C4-A9C5-797DF20EC8A7} = {3AA089A9-A035-439E-BAF6-C3975A334379}
{8E25CDE3-992D-4942-8C38-51A0D8E8EB70} = {9C260BF0-1CCA-45A2-AAB8-6419291B8B88}
{CEEE435F-32FC-4DE5-8735-90F6AC950A01} = {3AA089A9-A035-439E-BAF6-C3975A334379}
{2368415A-9C09-4F47-9636-FDCA4B85C88C} = {A48437BA-3C5B-431E-9B2F-96C850E9E1A5}
{22318FE4-1453-41BF-A38D-9401C4F16023} = {2368415A-9C09-4F47-9636-FDCA4B85C88C}
{5658A5DF-EDEF-4561-9F0B-A37EEABC8135} = {22318FE4-1453-41BF-A38D-9401C4F16023}
{B557FCFE-015C-4A65-81B6-B4987E07BFB7} = {22318FE4-1453-41BF-A38D-9401C4F16023}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AF61665D-340A-494B-9705-571456BDC752}
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/Helpers/StorageContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected virtual void Dispose(bool disposing)

private async Task InitializeAsync()
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Configuration.Storage.ConnectionString);
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(TestConfiguration.Storage.ConnectionString);
CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer = cloudBlobClient.GetContainerReference(ContainerName);
await CloudBlobContainer.CreateIfNotExistsAsync().ConfigureAwait(false);
Expand Down
14 changes: 7 additions & 7 deletions e2e/test/Helpers/TestDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static async Task<TestDevice> CreateDeviceAsync(TestDeviceType type, str
string deviceName = "E2E_" + prefix + Guid.NewGuid();

// Delete existing devices named this way and create a new one.
using RegistryManager rm = RegistryManager.CreateFromConnectionString(Configuration.IoTHub.ConnectionString);
using RegistryManager rm = RegistryManager.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString);
s_logger.Trace($"{nameof(GetTestDeviceAsync)}: Creating device {deviceName} with type {type}.");

Client.IAuthenticationMethod auth = null;
Expand All @@ -89,12 +89,12 @@ private static async Task<TestDevice> CreateDeviceAsync(TestDeviceType type, str
{
X509Thumbprint = new X509Thumbprint
{
PrimaryThumbprint = Configuration.IoTHub.GetCertificateWithPrivateKey().Thumbprint
PrimaryThumbprint = TestConfiguration.IoTHub.GetCertificateWithPrivateKey().Thumbprint
}
};

#pragma warning disable CA2000 // Dispose objects before losing scope - X509Certificate and DeviceAuthenticationWithX509Certificate are disposed when TestDevice is disposed.
authCertificate = Configuration.IoTHub.GetCertificateWithPrivateKey();
authCertificate = TestConfiguration.IoTHub.GetCertificateWithPrivateKey();
auth = new DeviceAuthenticationWithX509Certificate(deviceName, authCertificate);
#pragma warning restore CA2000 // Dispose objects before losing scope - X509Certificate and DeviceAuthenticationWithX509Certificate are disposed when TestDevice is disposed.
}
Expand Down Expand Up @@ -129,15 +129,15 @@ public string ConnectionString
{
get
{
string iotHubHostName = GetHostName(Configuration.IoTHub.ConnectionString);
string iotHubHostName = GetHostName(TestConfiguration.IoTHub.ConnectionString);
return $"HostName={iotHubHostName};DeviceId={Device.Id};SharedAccessKey={Device.Authentication.SymmetricKey.PrimaryKey}";
}
}

/// <summary>
/// Used in conjunction with DeviceClient.Create()
/// </summary>
public string IoTHubHostName => GetHostName(Configuration.IoTHub.ConnectionString);
public string IoTHubHostName => GetHostName(TestConfiguration.IoTHub.ConnectionString);

/// <summary>
/// Device Id
Expand Down Expand Up @@ -182,7 +182,7 @@ public DeviceClient CreateDeviceClient(ITransportSettings[] transportSettings, C
}
else
{
deviceClient = DeviceClient.CreateFromConnectionString(Configuration.IoTHub.ConnectionString, Device.Id, transportSettings, options);
deviceClient = DeviceClient.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString, Device.Id, transportSettings, options);
s_logger.Trace($"{nameof(CreateDeviceClient)}: Created {nameof(DeviceClient)} {Device.Id} from IoTHub connection string: ID={TestLogger.IdOf(deviceClient)}");
}
}
Expand All @@ -197,7 +197,7 @@ public DeviceClient CreateDeviceClient(ITransportSettings[] transportSettings, C

public async Task RemoveDeviceAsync()
{
using var rm = RegistryManager.CreateFromConnectionString(Configuration.IoTHub.ConnectionString);
using var rm = RegistryManager.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString);
await rm.RemoveDeviceAsync(Id).ConfigureAwait(false);
}

Expand Down
4 changes: 2 additions & 2 deletions e2e/test/Helpers/TestModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static async Task<TestModule> GetTestModuleAsync(string deviceNamePrefix,
string deviceName = testDevice.Id;
string moduleName = "E2E_" + moduleNamePrefix + Guid.NewGuid();

using var rm = RegistryManager.CreateFromConnectionString(Configuration.IoTHub.ConnectionString);
using var rm = RegistryManager.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString);
logger.Trace($"{nameof(GetTestModuleAsync)}: Creating module for device {deviceName}.");

var requestModule = new Module(deviceName, moduleName);
Expand All @@ -49,7 +49,7 @@ public string ConnectionString
{
get
{
string iotHubHostName = GetHostName(Configuration.IoTHub.ConnectionString);
string iotHubHostName = GetHostName(TestConfiguration.IoTHub.ConnectionString);
return $"HostName={iotHubHostName};DeviceId={_module.DeviceId};ModuleId={_module.Id};SharedAccessKey={_module.Authentication.SymmetricKey.PrimaryKey}";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Microsoft.Azure.Devices.E2ETests
{
public static partial class Configuration
public static partial class TestConfiguration
{
public static class AzureSecurityCenterForIoTLogAnalytics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Microsoft.Azure.Devices.E2ETests
{
public static partial class Configuration
public static partial class TestConfiguration
{
public static partial class IoTHub
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Microsoft.Azure.Devices.E2ETests
{
public static partial class Configuration
public static partial class TestConfiguration
{
public static partial class Provisioning
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.Azure.Devices.E2ETests
{
public static partial class Configuration
public static partial class TestConfiguration
{
public static class Storage
{
Expand All @@ -17,7 +17,7 @@ public static class Storage

static Storage()
{
ConnectionString = Configuration.GetValue("STORAGE_ACCOUNT_CONNECTION_STRING");
ConnectionString = TestConfiguration.GetValue("STORAGE_ACCOUNT_CONNECTION_STRING");
Name = s_saName.Match(ConnectionString).Value;
Key = s_saKey.Match(ConnectionString).Value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Microsoft.Azure.Devices.E2ETests
{
public static partial class Configuration
public static partial class TestConfiguration
{
private static string GetValue(string envName, string defaultValue = null)
{
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/iothub/CombinedClientOperationsPoolAmqpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private async Task DeviceCombinedClientOperationsAsync(
ConnectionStringAuthScope authScope = ConnectionStringAuthScope.Device)
{
// Initialize service client for service-side operations
using var serviceClient = ServiceClient.CreateFromConnectionString(Configuration.IoTHub.ConnectionString);
using var serviceClient = ServiceClient.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString);

// Message payload and properties for C2D operation
var messagesSent = new Dictionary<string, Tuple<Message, string>>();
Expand Down
6 changes: 3 additions & 3 deletions e2e/test/iothub/ConnectionStatusChangeHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private async Task DeviceClient_Gives_ConnectionStatus_DeviceDisabled_Base(
using TestDevice testDevice = await TestDevice.GetTestDeviceAsync(Logger, DevicePrefix + $"_{Guid.NewGuid()}").ConfigureAwait(false);
string deviceConnectionString = testDevice.ConnectionString;

var config = new Configuration.IoTHub.ConnectionStringParser(deviceConnectionString);
var config = new TestConfiguration.IoTHub.ConnectionStringParser(deviceConnectionString);
string deviceId = config.DeviceID;

ConnectionStatus? status = null;
Expand Down Expand Up @@ -139,7 +139,7 @@ private async Task DeviceClient_Gives_ConnectionStatus_DeviceDisabled_Base(
Assert.IsNotNull(twin);

// Delete/disable the device in IoT Hub. This should trigger the ConnectionStatusChangesHandler.
using (RegistryManager registryManager = RegistryManager.CreateFromConnectionString(Configuration.IoTHub.ConnectionString))
using (RegistryManager registryManager = RegistryManager.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString))
{
await registryManagerOperation(registryManager, deviceId).ConfigureAwait(false);
}
Expand Down Expand Up @@ -198,7 +198,7 @@ private async Task ModuleClient_Gives_ConnectionStatus_DeviceDisabled_Base(
Assert.IsNotNull(twin);

// Delete/disable the device in IoT Hub.
using (RegistryManager registryManager = RegistryManager.CreateFromConnectionString(Configuration.IoTHub.ConnectionString))
using (RegistryManager registryManager = RegistryManager.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString))
{
await registryManagerOperation(registryManager, testModule.DeviceId).ConfigureAwait(false);
}
Expand Down
22 changes: 11 additions & 11 deletions e2e/test/iothub/DeviceClientX509AuthenticationE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ namespace Microsoft.Azure.Devices.E2ETests
public class DeviceClientX509AuthenticationE2ETests : E2EMsTestBase
{
private static readonly string s_devicePrefix = $"{nameof(DeviceClientX509AuthenticationE2ETests)}_";
private static X509Certificate2 s_selfSignedCertificateWithPrivateKey = Configuration.IoTHub.GetCertificateWithPrivateKey();
private static X509Certificate2 s_chainCertificateWithPrivateKey = Configuration.IoTHub.GetChainDeviceCertificateWithPrivateKey();
private static X509Certificate2 s_selfSignedCertificateWithPrivateKey = TestConfiguration.IoTHub.GetCertificateWithPrivateKey();
private static X509Certificate2 s_chainCertificateWithPrivateKey = TestConfiguration.IoTHub.GetChainDeviceCertificateWithPrivateKey();
private readonly string _hostName;

public DeviceClientX509AuthenticationE2ETests()
{
_hostName = GetHostName(Configuration.IoTHub.ConnectionString);
_hostName = GetHostName(TestConfiguration.IoTHub.ConnectionString);
}

[LoggedTestMethod]
Expand Down Expand Up @@ -151,12 +151,12 @@ public async Task X509_Cert_Chain_Install_Test_MQTT_TCP()
// arrange
var chainCerts = new X509Certificate2Collection
{
Configuration.IoTHub.GetRootCACertificate(),
Configuration.IoTHub.GetIntermediate1Certificate(),
Configuration.IoTHub.GetIntermediate2Certificate()
TestConfiguration.IoTHub.GetRootCACertificate(),
TestConfiguration.IoTHub.GetIntermediate1Certificate(),
TestConfiguration.IoTHub.GetIntermediate2Certificate()
};
using var auth = new DeviceAuthenticationWithX509Certificate(
Configuration.IoTHub.X509ChainDeviceName,
TestConfiguration.IoTHub.X509ChainDeviceName,
s_chainCertificateWithPrivateKey,
chainCerts);
using DeviceClient deviceClient = DeviceClient.Create(
Expand All @@ -178,12 +178,12 @@ public async Task X509_Cert_Chain_Install_Test_AMQP_TCP()
// arrange
var chainCerts = new X509Certificate2Collection
{
Configuration.IoTHub.GetRootCACertificate(),
Configuration.IoTHub.GetIntermediate1Certificate(),
Configuration.IoTHub.GetIntermediate2Certificate()
TestConfiguration.IoTHub.GetRootCACertificate(),
TestConfiguration.IoTHub.GetIntermediate1Certificate(),
TestConfiguration.IoTHub.GetIntermediate2Certificate()
};
using var auth = new DeviceAuthenticationWithX509Certificate(
Configuration.IoTHub.X509ChainDeviceName,
TestConfiguration.IoTHub.X509ChainDeviceName,
s_chainCertificateWithPrivateKey,
chainCerts);
using DeviceClient deviceClient = DeviceClient.Create(
Expand Down
6 changes: 3 additions & 3 deletions e2e/test/iothub/DeviceTokenRefreshE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task DeviceClient_Not_Exist_AMQP()
{
using TestDevice testDevice = await TestDevice.GetTestDeviceAsync(Logger, DevicePrefix).ConfigureAwait(false);

var config = new Configuration.IoTHub.ConnectionStringParser(testDevice.ConnectionString);
var config = new TestConfiguration.IoTHub.ConnectionStringParser(testDevice.ConnectionString);
using (DeviceClient deviceClient = DeviceClient.CreateFromConnectionString($"HostName={config.IotHubHostName};DeviceId=device_id_not_exist;SharedAccessKey={config.SharedAccessKey}", Client.TransportType.Amqp_Tcp_Only))
{
await deviceClient.OpenAsync().ConfigureAwait(false);
Expand All @@ -43,7 +43,7 @@ public async Task DeviceClient_Bad_Credentials_AMQP()
{
using TestDevice testDevice = await TestDevice.GetTestDeviceAsync(Logger, DevicePrefix).ConfigureAwait(false);

var config = new Configuration.IoTHub.ConnectionStringParser(testDevice.ConnectionString);
var config = new TestConfiguration.IoTHub.ConnectionStringParser(testDevice.ConnectionString);
string invalidKey = Convert.ToBase64String(Encoding.UTF8.GetBytes("invalid_key"));
using (DeviceClient deviceClient = DeviceClient.CreateFromConnectionString($"HostName={config.IotHubHostName};DeviceId={config.DeviceID};SharedAccessKey={invalidKey}", Client.TransportType.Amqp_Tcp_Only))
{
Expand Down Expand Up @@ -82,7 +82,7 @@ public async Task DeviceClient_TokenConnectionDoubleRelease_Ok()

string deviceConnectionString = testDevice.ConnectionString;

var config = new Configuration.IoTHub.ConnectionStringParser(deviceConnectionString);
var config = new TestConfiguration.IoTHub.ConnectionStringParser(deviceConnectionString);
string iotHub = config.IotHubHostName;
string deviceId = config.DeviceID;
string key = config.SharedAccessKey;
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/iothub/FaultInjectionPoolAmqpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ namespace Microsoft.Azure.Devices.E2ETests
[TestCategory("LongRunning")]
public partial class FaultInjectionPoolAmqpTests : E2EMsTestBase
{
private static readonly string s_proxyServerAddress = Configuration.IoTHub.ProxyServerAddress;
private static readonly string s_proxyServerAddress = TestConfiguration.IoTHub.ProxyServerAddress;
}
}
Loading

0 comments on commit f6def99

Please sign in to comment.