-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hub-svc): add support and tests for configurations export (#2250)
- Loading branch information
David R. Williamson
authored
Dec 15, 2021
1 parent
5245797
commit d22f9f3
Showing
12 changed files
with
511 additions
and
252 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
308 changes: 206 additions & 102 deletions
308
e2e/test/iothub/service/RegistryManagerExportDevicesTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.