Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring pnp updates to preview #2301

Merged
merged 79 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
0405522
feat(shared): Add common resources for convention-based operations
abhipsaMisra May 19, 2021
3bdd814
feat(iot-device): Add support for convention-based telemetry operation
abhipsaMisra May 18, 2021
5285c79
feat(iot-device): Add support for convention-based command operations
abhipsaMisra May 20, 2021
88c2155
* feat(iot-device): Add support for convention-based properties opera…
abhipsaMisra May 21, 2021
fda54b8
feat(e2e-tests): Add telemetry E2E tests
jamdavi May 22, 2021
531f204
feat(e2e-tests): Add command E2E tests
jamdavi May 22, 2021
e2d88e4
fix(iot-device): Updating client property collection to handle no con…
jamdavi May 24, 2021
ecaaaeb
feat(samples): Add thermostat and temperature controller sample
abhipsaMisra May 25, 2021
36125ee
fix(doc, samples): Update API design doc and move SystemTextJson help…
abhipsaMisra May 25, 2021
739a9df
fix(iot-device): Separate out root-level and component-level property…
abhipsaMisra Jun 3, 2021
3c14bcd
feat(tests): Add unit tests for ClientPropertyCollection
jamdavi Jun 4, 2021
ef1df70
feat(e2e-tests): Add properties E2E tests
jamdavi Jun 4, 2021
08dfff3
feat(e2e-tests): Add fault injection tests for properties operations …
abhipsaMisra Jun 5, 2021
50ac3b8
fix(iot-device, shared, samples): Rename StatusCodes to CommonClientR…
abhipsaMisra Jun 5, 2021
63cdbd4
fix(iot-device): Fix enumerator implementation to return key-value pairs
abhipsaMisra Jun 7, 2021
ce9029d
fix(iot-device): Make ClientOptions.PayloadConvention readonly
abhipsaMisra Jun 8, 2021
913b88f
Merge branch 'master' into abmisr/masterToPreviewsPnP
abhipsaMisra Jun 9, 2021
63e8666
fix(shared): Fix from merge conflict
abhipsaMisra Jun 9, 2021
e59b56d
Merge pull request #2023 from Azure/abmisr/masterToPreviewsPnP
abhipsaMisra Jun 10, 2021
59f4a6d
fix(samples): Update the pnp samples readme (#2025)
abhipsaMisra Jun 11, 2021
be43890
refactor(samples): Move preview samples to samples repository (#2057)
abhipsaMisra Jul 1, 2021
23a24fc
Merge branch 'master' into abmisr/masterToPreviewPnp
abhipsaMisra Jul 1, 2021
72b470b
fix(e2e-tests): Fix file renaming Configutaion to TestConfiguration
abhipsaMisra Jul 1, 2021
50c1d23
Merge pull request #2059 from Azure/abmisr/masterToPreviewPnp
abhipsaMisra Jul 1, 2021
058035b
refactor(iot-device): Rename property add method
abhipsaMisra Jul 15, 2021
22fb865
* fix(iot-device): TryGetValue methods should check for the component…
abhipsaMisra Jul 20, 2021
35f8f57
refactor(iot-device): Separate client reported properties into a sepa…
abhipsaMisra Jul 20, 2021
fef30ff
fix(iot-device): Add checks to verify that client property update res…
abhipsaMisra Jul 21, 2021
bea49ae
Merge branch 'master' into abmisr/masterToPnpPreview
abhipsaMisra Aug 25, 2021
48a31cc
Merge pull request #2156 from Azure/abmisr/masterToPnpPreview
abhipsaMisra Aug 25, 2021
47c2621
refactor(iot-device): Update the internal method names as per functio…
abhipsaMisra Aug 25, 2021
fc774ff
feat(iot-device): Add convenience method for acknowledging writable p…
abhipsaMisra Aug 31, 2021
0be2fe7
fix(iot-device): Update PayloadCollection to accept dictionary of val…
abhipsaMisra Sep 20, 2021
900717a
refactor(iot-device): Merge flows for twin and client property operat…
abhipsaMisra Oct 7, 2021
78c580a
Merge branch 'main' into abmisr/mergeFromMaster
abhipsaMisra Oct 7, 2021
90622b6
fix(e2e-tests): Update E2E tests to initialize and dispose resources …
abhipsaMisra Oct 7, 2021
469ba65
Merge pull request #2195 from Azure/abmisr/mergeFromMaster
abhipsaMisra Oct 7, 2021
4564243
doc(client, service): Update documents about the Proxy property for v…
jamdavi Dec 8, 2021
27685d1
Cleanup IDE warnings. From 442 down to 31. (#2254)
azabbasi Dec 8, 2021
2cf35f3
Fix documented exception types thrown by methods in device client. (#…
azabbasi Dec 9, 2021
4618ef3
(Fix: DeviceClient): Fix the concurrency issue in MQTT stack (#2234)
azabbasi Dec 9, 2021
5245797
Update RegistryManager bulk API unit tests (#2258)
Dec 9, 2021
d22f9f3
feat(hub-svc): add support and tests for configurations export (#2250)
Dec 15, 2021
2b05e47
Temporarily disable import devices/configs test (#2263)
Jan 6, 2022
89973ed
fix(iot-svc): update debug assert (#2264)
Jan 6, 2022
0582733
Consolidate keyvault writes, and fix error about null (#2266)
Jan 6, 2022
4de5519
Cleanup code in Hub RTAC (#2268)
Jan 7, 2022
8f9d565
fix(deviceClient): Fix issue with AMQP connection pool and TokenRefer…
azabbasi Jan 7, 2022
f8b92fc
Move more LA steps under conditional (#2270)
Jan 10, 2022
823fbec
Disable import/export of config until bug fix (#2273)
Jan 10, 2022
7a26eda
Adding RBAC support for provisioning SDK (#2262)
dylanbulfinMS Jan 10, 2022
7508dd2
Adding Common 0.7.1 (#2272)
jamdavi Jan 11, 2022
49e0854
Fix doc comment list bullets (#2275)
Jan 11, 2022
f811e08
sdl(all): Create SBOM for net packages (#2261)
jamdavi Jan 11, 2022
f072c94
Streamline an RBAC test (#2274)
Jan 11, 2022
1229b72
Exclude low pri .net targets in PR builds (#2277)
Jan 11, 2022
4066e85
Merge branch 'main' into abmisr/mainToPnp
abhipsaMisra Jan 11, 2022
cc82629
fix(tests): Fix device client test to use updated API
abhipsaMisra Jan 12, 2022
b98adbe
Merge pull request #2279 from Azure/abmisr/mainToPnp
abhipsaMisra Jan 12, 2022
84f513a
Merge branch 'main' into abmisr/mainPnp
abhipsaMisra Jan 12, 2022
94ffe0a
Merge pull request #2280 from Azure/abmisr/mainPnp
abhipsaMisra Jan 12, 2022
cbbad60
Update IDeviceIdentity interface to add doc comments. (#2282)
azabbasi Jan 13, 2022
80cf26e
PnP doc comment updates (#2278)
Jan 13, 2022
313d885
Fix remaining doc comment bullets (#2285)
Jan 14, 2022
65749c2
Give e2e appId permission on the DPS instance (#2283)
Jan 14, 2022
f114662
fix(DeviceClient): Avoid NRE after client dispose (#2286)
azabbasi Jan 18, 2022
44ad460
refactor(iot-device): Update API surface for property callback API
abhipsaMisra Jan 11, 2022
0acf298
refactor(iot-device): Update API surface for command callback API
abhipsaMisra Jan 11, 2022
846fe99
fix(e2e-tests): Update E2E tests to use fluent assertions
abhipsaMisra Jan 13, 2022
717f662
fix(iot-device): Update API surface to remove redundant private setters
abhipsaMisra Jan 13, 2022
5e522cd
Revert "Adding RBAC support for provisioning SDK (#2262)" (#2289)
azabbasi Jan 26, 2022
6cce47a
Version bump for 2021-01-26 release (#2291)
azabbasi Jan 26, 2022
5a05eb3
Update service clients instantiation doc comments (#2290)
Jan 27, 2022
d20e5bd
Fix class field constants casing (#2292)
Jan 27, 2022
89f83b9
Disable checks for config in import e2e test (#2293)
Jan 27, 2022
e4ef736
Update iteration path in vsts.yaml (#2296)
Feb 1, 2022
2d673e2
Merge branch 'main' into abmisr/updatePnp
abhipsaMisra Feb 7, 2022
1d886cb
Merge pull request #2300 from Azure/abmisr/updatePnp
abhipsaMisra Feb 7, 2022
303c0c0
Merge branch 'previews/pnpApi' into abmisr/pnpToPreview
abhipsaMisra Feb 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion common/src/Logging.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ public static void DumpBuffer(object thisOrContextObject, byte[] buffer, int off
/// <param name="count">The number of bytes to log.</param>
/// <param name="memberName">The calling member.</param>
[NonEvent]
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "Parameters 'thisOrContextObject' and 'memberName' used in NET451; remove when no longer supported.")]
public static unsafe void DumpBuffer(object thisOrContextObject, IntPtr bufferPtr, int count, [CallerMemberName] string memberName = null)
{
Debug.Assert(bufferPtr != IntPtr.Zero);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static string BuildSasSignature(string keyName, string key, string target

public static string BuildExpiresOn(TimeSpan timeToLive)
{
DateTime epochTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
var epochTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
DateTime expiresOn = DateTime.UtcNow.Add(timeToLive);
TimeSpan secondsFromBaseTime = expiresOn.Subtract(epochTime);
long seconds = Convert.ToInt64(secondsFromBaseTime.TotalSeconds, CultureInfo.InvariantCulture);
Expand Down
4 changes: 2 additions & 2 deletions common/src/service/HttpClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -882,10 +882,10 @@ internal static HttpMessageHandler CreateDefaultHttpMessageHandler(IWebProxy web
#pragma warning disable CA2000 // Dispose objects before losing scope (object is returned by this method, so the caller is responsible for disposing it)
#if NETCOREAPP && !NETCOREAPP2_0 && !NETCOREAPP1_0 && !NETCOREAPP1_1
// SocketsHttpHandler is only available in netcoreapp2.1 and onwards
SocketsHttpHandler httpMessageHandler = new SocketsHttpHandler();
var httpMessageHandler = new SocketsHttpHandler();
httpMessageHandler.SslOptions.EnabledSslProtocols = TlsVersions.Instance.Preferred;
#else
HttpClientHandler httpMessageHandler = new HttpClientHandler();
var httpMessageHandler = new HttpClientHandler();
#if !NET451
httpMessageHandler.SslProtocols = TlsVersions.Instance.Preferred;
httpMessageHandler.CheckCertificateRevocationList = TlsVersions.Instance.CertificateRevocationCheck;
Expand Down
5 changes: 4 additions & 1 deletion common/src/service/IAuthorizationHeaderProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

namespace Microsoft.Azure.Devices
{
interface IAuthorizationHeaderProvider
/// <summary>
/// Gets the authorization header for authenticated requests, regardless of choice of authentication.
/// </summary>
internal interface IAuthorizationHeaderProvider
{
string GetAuthorizationHeader();
}
Expand Down
4 changes: 2 additions & 2 deletions common/src/service/StringValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static bool IsBase64String(string value)
return false;
}

var lengthNoPadding = value.Length;
int lengthNoPadding = value.Length;
value = value.TrimEnd(Base64Padding);
var lengthPadding = value.Length;
int lengthPadding = value.Length;

if ((lengthNoPadding - lengthPadding) > 2)
{
Expand Down
17 changes: 17 additions & 0 deletions e2e/test/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage(
"Style",
"IDE1006:Naming Styles",
Justification = "Missing Async suffix on test method names. Test method names may be misleading when they have the Async suffix. Additionally, not changing test names help to maintain ADO history.",
Scope = "module")]
[assembly: SuppressMessage(
"CodeQuality",
"IDE0079:Remove unnecessary suppression",
Justification = "Each frameworks consider certain suppressions required by other frameworks unnecessary.",
Scope = "module")]
12 changes: 6 additions & 6 deletions e2e/test/config/TestConfiguration.IoTHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,39 @@ public static string GetIotHubSharedAccessSignature(TimeSpan timeToLive)
public static X509Certificate2 GetCertificateWithPrivateKey()
{
const string hubPfxCert = "IOTHUB_X509_PFX_CERTIFICATE";
var cert = GetBase64EncodedCertificate(hubPfxCert, defaultValue: string.Empty);
X509Certificate2 cert = GetBase64EncodedCertificate(hubPfxCert, defaultValue: string.Empty);
Assert.IsTrue(cert.NotAfter > DateTime.UtcNow, $"The X509 cert from {hubPfxCert} has expired.");
return cert;
}

public static X509Certificate2 GetChainDeviceCertificateWithPrivateKey()
{
const string hubPfxCert = "HUB_CHAIN_DEVICE_PFX_CERTIFICATE";
var cert = GetBase64EncodedCertificate(hubPfxCert, defaultValue: string.Empty);
X509Certificate2 cert = GetBase64EncodedCertificate(hubPfxCert, defaultValue: string.Empty);
Assert.IsTrue(cert.NotAfter > DateTime.UtcNow, $"The X509 cert from {hubPfxCert} has expired.");
return cert;
}

public static X509Certificate2 GetRootCACertificate()
{
const string hubCert = "HUB_CHAIN_ROOT_CA_CERTIFICATE";
var cert = GetBase64EncodedCertificate(hubCert);
X509Certificate2 cert = GetBase64EncodedCertificate(hubCert);
Assert.IsTrue(cert.NotAfter > DateTime.UtcNow, $"The X509 cert from {hubCert} has expired.");
return cert;
}

public static X509Certificate2 GetIntermediate1Certificate()
{
const string hubCert = "HUB_CHAIN_INTERMEDIATE1_CERTIFICATE";
var cert = GetBase64EncodedCertificate(hubCert);
X509Certificate2 cert = GetBase64EncodedCertificate(hubCert);
Assert.IsTrue(cert.NotAfter > DateTime.UtcNow, $"The X509 cert from {hubCert} has expired.");
return cert;
}

public static X509Certificate2 GetIntermediate2Certificate()
{
const string hubCert = "HUB_CHAIN_INTERMEDIATE2_CERTIFICATE";
var cert = GetBase64EncodedCertificate(hubCert);
X509Certificate2 cert = GetBase64EncodedCertificate(hubCert);
Assert.IsTrue(cert.NotAfter > DateTime.UtcNow, $"The X509 cert from {hubCert} has expired.");
return cert;
}
Expand All @@ -111,7 +111,7 @@ public static X509Certificate2 GetIntermediate2Certificate()

private static string GenerateSasToken(string resourceUri, string sharedAccessKey, TimeSpan timeToLive, string policyName = default)
{
DateTime epochTime = new DateTime(1970, 1, 1);
var epochTime = new DateTime(1970, 1, 1);
DateTime expiresOn = DateTime.UtcNow.Add(timeToLive);
TimeSpan secondsFromEpochTime = expiresOn.Subtract(epochTime);
long seconds = Convert.ToInt64(secondsFromEpochTime.TotalSeconds, CultureInfo.InvariantCulture);
Expand Down
29 changes: 0 additions & 29 deletions e2e/test/helpers/ImportExportDevicesHelpers.cs

This file was deleted.

30 changes: 30 additions & 0 deletions e2e/test/helpers/ImportExportHelpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.IO;
using System.Text;
using Newtonsoft.Json;

namespace Microsoft.Azure.Devices.E2ETests.Helpers
{
internal static class ImportExportHelpers
{
/// <summary>
/// Makes a stream compatible for writing to a storage blob of serialized, newline-delimited rows of the specified objects.
/// </summary>
/// <param name="items">The objects to serialize.</param>
public static Stream BuildImportStream<T>(IReadOnlyList<T> items)
{
var itemsFileSb = new StringBuilder();

foreach (T item in items)
{
itemsFileSb.AppendLine(JsonConvert.SerializeObject(item));
}

byte[] itemsFileInBytes = Encoding.Default.GetBytes(itemsFileSb.ToString());
return new MemoryStream(itemsFileInBytes);
}
}
}
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(TestConfiguration.Storage.ConnectionString);
var storageAccount = CloudStorageAccount.Parse(TestConfiguration.Storage.ConnectionString);
CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer = cloudBlobClient.GetContainerReference(ContainerName);
await CloudBlobContainer.CreateIfNotExistsAsync().ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion 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(TestConfiguration.IoTHub.ConnectionString);
using var rm = RegistryManager.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString);
s_logger.Trace($"{nameof(GetTestDeviceAsync)}: Creating device {deviceName} with type {type}.");

Client.IAuthenticationMethod auth = null;
Expand Down
10 changes: 3 additions & 7 deletions e2e/test/helpers/TestDeviceCallbackHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,11 @@ public async Task WaitForReceiveMessageCallbackAsync(CancellationToken ct)

public async Task SetClientPropertyUpdateCallbackHandlerAsync<T>(string expectedPropName, string componentName = default)
{
string userContext = "myContext";

await _deviceClient
.SubscribeToWritablePropertyUpdateRequestsAsync(
(patch, context) =>
patch =>
{
_logger.Trace($"{nameof(SetClientPropertyUpdateCallbackHandlerAsync)}: DeviceClient {_testDevice.Id} callback property: WritableProperty: {patch}, {context}");
_logger.Trace($"{nameof(SetClientPropertyUpdateCallbackHandlerAsync)}: DeviceClient {_testDevice.Id} callback property: WritableProperty: {patch}.");

try
{
Expand All @@ -193,7 +191,6 @@ await _deviceClient

isPropertyPresent.Should().BeTrue();
propertyFromCollection.Should().BeEquivalentTo((T)ExpectedClientPropertyValue);
context.Should().Be(userContext);
}
catch (Exception ex)
{
Expand All @@ -206,8 +203,7 @@ await _deviceClient
}

return Task.FromResult(true);
},
userContext)
})
.ConfigureAwait(false);
}

Expand Down
Loading