Skip to content

Commit 8b518b9

Browse files
author
jaguzman
committed
Fixed issues with the azure emulator task, as well as simplifying the logic for running testing servers
1 parent 59cfa80 commit 8b518b9

File tree

50 files changed

+269
-526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+269
-526
lines changed

benchmarks/DotNetToolkit.Repository.Performance/DotNetToolkit.Repository.Performance.csproj

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,40 +45,4 @@
4545
<Reference Include="System.Configuration" />
4646
</ItemGroup>
4747

48-
<ItemGroup>
49-
<None Update="Tasks\tools\azure-storage-emulator\AzureStorageEmulator.exe">
50-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51-
</None>
52-
<None Update="Tasks\tools\azure-storage-emulator\AzureStorageEmulator.exe.config">
53-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
54-
</None>
55-
<None Update="Tasks\tools\azure-storage-emulator\Microsoft.Azure.DevelopmentStorage.Services.dll">
56-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
57-
</None>
58-
<None Update="Tasks\tools\azure-storage-emulator\Microsoft.Azure.DevelopmentStorage.Store.dll">
59-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
60-
</None>
61-
<None Update="Tasks\tools\azure-storage-emulator\Microsoft.Azure.Storage.Emulator.Controller.dll">
62-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
63-
</None>
64-
<None Update="Tasks\tools\azure-storage-emulator\Microsoft.Data.Edm.dll">
65-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
66-
</None>
67-
<None Update="Tasks\tools\azure-storage-emulator\Microsoft.Data.OData.dll">
68-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
69-
</None>
70-
<None Update="Tasks\tools\azure-storage-emulator\Microsoft.Data.Services.Client.dll">
71-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
72-
</None>
73-
<None Update="Tasks\tools\azure-storage-emulator\Microsoft.Data.Services.dll">
74-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
75-
</None>
76-
<None Update="Tasks\tools\azure-storage-emulator\StartStorageEmulator.cmd">
77-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
78-
</None>
79-
<None Update="Tasks\tools\azure-storage-emulator\System.Spatial.dll">
80-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
81-
</None>
82-
</ItemGroup>
83-
8448
</Project>

benchmarks/DotNetToolkit.Repository.Performance/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ static void Main(string[] args)
1313
Console.WriteLine("// * Database Setup: End *");
1414

1515
Console.WriteLine("// * AzureStorageEmulator: Start *");
16-
Tasks.AzureEmulatorTasks.Run();
16+
Running.AzureStorageEmulatorManager.Start();
1717

1818
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new Config());
1919

20-
Tasks.AzureEmulatorTasks.Cleanup();
20+
Running.AzureStorageEmulatorManager.Stop();
2121
Console.WriteLine("// * AzureStorageEmulator: End *");
2222
}
2323

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
namespace DotNetToolkit.Repository.Performance.Running
2+
{
3+
using System.Diagnostics;
4+
using System.Linq;
5+
6+
public static class AzureStorageEmulatorManager
7+
{
8+
private const string _azureStorageEmulatorPath = @"C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe";
9+
private const string _win7ProcessName = "WAStorageEmulator";
10+
private const string _win8ProcessName = "WASTOR~1";
11+
private const string _win10ProcessName = "AzureStorageEmulator";
12+
13+
static Process GetProcess()
14+
{
15+
return Process.GetProcessesByName(_win10ProcessName).FirstOrDefault()
16+
?? Process.GetProcessesByName(_win8ProcessName).FirstOrDefault()
17+
?? Process.GetProcessesByName(_win7ProcessName).FirstOrDefault();
18+
}
19+
20+
static readonly ProcessStartInfo _startStorageEmulator = new ProcessStartInfo
21+
{
22+
FileName = _azureStorageEmulatorPath,
23+
Arguments = "start",
24+
UseShellExecute = false,
25+
WindowStyle = ProcessWindowStyle.Hidden
26+
};
27+
28+
static readonly ProcessStartInfo _stopStorageEmulator = new ProcessStartInfo
29+
{
30+
FileName = _azureStorageEmulatorPath,
31+
Arguments = "stop",
32+
WindowStyle = ProcessWindowStyle.Hidden
33+
};
34+
35+
static bool IsProcessStarted()
36+
{
37+
return GetProcess() != null;
38+
}
39+
40+
public static void Start()
41+
{
42+
if (IsProcessStarted())
43+
{
44+
return;
45+
}
46+
using (var process = Process.Start(_startStorageEmulator))
47+
{
48+
process.WaitForExit();
49+
}
50+
}
51+
52+
public static void Stop()
53+
{
54+
using (var process = Process.Start(_stopStorageEmulator))
55+
{
56+
process.WaitForExit();
57+
}
58+
}
59+
}
60+
}

benchmarks/DotNetToolkit.Repository.Performance/Tasks/AzureEmulatorTasks.cs

Lines changed: 0 additions & 38 deletions
This file was deleted.

benchmarks/DotNetToolkit.Repository.Performance/Tasks/Task.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

benchmarks/DotNetToolkit.Repository.Performance/Tasks/tools/azure-storage-emulator/AzureStorageEmulator.exe.config

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)