Skip to content

Commit 6269e1b

Browse files
committed
Tools folder restore and Test fix after dependency nuget changes
1 parent 7065b47 commit 6269e1b

File tree

95 files changed

+15841
-9296
lines changed

Some content is hidden

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

95 files changed

+15841
-9296
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
function Get-AzureRmResourceGroup
2+
{
3+
[CmdletBinding()]
4+
param(
5+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
6+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] $Location,
7+
[string] [Parameter(ValueFromPipelineByPropertyName=$true)] $Id,
8+
[switch] $Force)
9+
BEGIN {
10+
$context = Get-Context
11+
$client = Get-ResourcesClient $context
12+
}
13+
PROCESS {
14+
if($Name -eq $null) {
15+
$getTask = $client.ResourceGroups.ListAsync($null, [System.Threading.CancellationToken]::None)
16+
$rg = $getTask.Result
17+
$resourceGroup = List-ResourceGroup
18+
Write-Output $resourceGroup
19+
} else {
20+
$getTask = $client.ResourceGroups.GetAsync($Name, [System.Threading.CancellationToken]::None)
21+
$rg = $getTask.Result
22+
if($rg -eq $null) {
23+
$resourceGroup = $null
24+
} else {
25+
$resourceGroup = Get-ResourceGroup $Name $Location $rg.ResourceGroup.Id
26+
}
27+
Write-Output $resourceGroup
28+
}
29+
}
30+
END {}
31+
}
32+
33+
function Get-AzureRmResourceProvider
34+
{
35+
[CmdletBinding()]
36+
param(
37+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ProviderNamespace)
38+
BEGIN {
39+
$context = Get-Context
40+
$client = Get-ResourcesClient $context
41+
}
42+
PROCESS {
43+
$getTask = $client.Providers.GetAsync($ProviderNamespace, [System.Threading.CancellationToken]::None)
44+
Write-Output $getTask.Result.Provider
45+
}
46+
END {}
47+
}
48+
49+
function New-AzureRmResourceGroup
50+
{
51+
[CmdletBinding()]
52+
param(
53+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
54+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] $Location,
55+
[string] [Parameter(ValueFromPipelineByPropertyName=$true)] $Tags,
56+
[switch] $Force)
57+
BEGIN {
58+
$context = Get-Context
59+
$client = Get-ResourcesClient $context
60+
}
61+
PROCESS {
62+
$createParams = New-Object -Type Microsoft.Azure.Management.Resources.Models.ResourceGroup
63+
$createParams.Location = $Location
64+
$createTask = $client.ResourceGroups.CreateOrUpdateAsync($Name, $createParams, [System.Threading.CancellationToken]::None)
65+
$rg = $createTask.Result
66+
$resourceGroup = Get-ResourceGroup $Name $Location
67+
Write-Output $resourceGroup
68+
}
69+
END {}
70+
}
71+
72+
function New-AzureRmResourceGroupDeployment
73+
{
74+
[CmdletBinding()]
75+
param(
76+
[string] [alias("DeploymentName")] $Name,
77+
[string] $ResourceGroupName,
78+
[string] $TemplateFile,
79+
[string] $serverName,
80+
[string] $databaseName,
81+
[string] $storageName,
82+
[string] $version,
83+
[string] $EnvLocation,
84+
[string] $administratorLogin,
85+
[string] $TemplateParameterFile,
86+
[switch] $Force)
87+
BEGIN {
88+
$context = Get-Context
89+
$client = Get-ResourcesClient $context
90+
}
91+
PROCESS {
92+
$createParams = New-Object -Type Microsoft.Azure.Management.Resources.Models.Deployment
93+
$createTask = $client.Deployments.CreateOrUpdateAsync($Name, $Name, $createParams, [System.Threading.CancellationToken]::None)
94+
$rg = $createTask.Result
95+
}
96+
END {}
97+
}
98+
99+
function Remove-AzureRmResourceGroup
100+
{
101+
[CmdletBinding()]
102+
param(
103+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
104+
[switch] $Force)
105+
BEGIN {
106+
$context = Get-Context
107+
$client = Get-ResourcesClient $context
108+
}
109+
PROCESS {
110+
$deleteTask = $client.ResourceGroups.DeleteAsync($Name, [System.Threading.CancellationToken]::None)
111+
$rg = $deleteTask.Result
112+
}
113+
END {}
114+
}
115+
116+
function Get-Context
117+
{
118+
return [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile.DefaultContext
119+
}
120+
121+
function Get-ResourcesClient
122+
{
123+
param([Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext] $context)
124+
$factory = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance.ClientFactory
125+
[System.Type[]]$types = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContext], [string]
126+
$method = [Microsoft.Azure.Commands.Common.Authentication.IHyakClientFactory].GetMethod("CreateClient", $types)
127+
$closedMethod = $method.MakeGenericMethod([Microsoft.Azure.Management.Resources.ResourceManagementClient])
128+
$arguments = $context, [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureEnvironment+Endpoint]::ResourceManager
129+
$client = $closedMethod.Invoke($factory, $arguments)
130+
return $client
131+
}
132+
133+
function Get-ResourceGroup {
134+
param([string] $name, [string] $location, [string] $id)
135+
$rg = New-Object PSObject -Property @{"ResourceGroupName" = $name; "Location" = $location; "ResourceId" = $id}
136+
return $rg
137+
}
138+
139+
function List-ResourceGroup {
140+
$rg = New-Object PSObject -Property @{"ResourceGroupName" = $name; "Location" = $location; }
141+
return $rg
142+
}

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery.Test/Commands.RecoveryServices.SiteRecovery.Test.csproj

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@
3434
<WarningLevel>4</WarningLevel>
3535
</PropertyGroup>
3636
<ItemGroup>
37-
<Reference Include="Hyak.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
38-
<HintPath>..\..\..\packages\Hyak.Common.1.0.3\lib\net45\Hyak.Common.dll</HintPath>
39-
<Private>True</Private>
40-
</Reference>
37+
<Reference Include="Hyak.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
4138
<Reference Include="Microsoft.Azure.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4239
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.2\lib\net45\Microsoft.Azure.Common.dll</HintPath>
4340
<Private>True</Private>
@@ -58,7 +55,7 @@
5855
<Private>True</Private>
5956
</Reference>
6057
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
61-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
58+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.9.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
6259
</Reference>
6360
<Reference Include="Microsoft.Azure.Management.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6461
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.4.1.0-preview\lib\net45\Microsoft.Azure.Management.Storage.dll</HintPath>
@@ -77,6 +74,7 @@
7774
<Compile Include="ScenarioTests\A2A\AsrA2ATestsBase.cs" />
7875
</ItemGroup>
7976
<ItemGroup>
77+
<None Include="AzureRm.Resources.ps1" />
8078
<None Include="packages.config">
8179
<SubType>Designer</SubType>
8280
</None>
@@ -206,14 +204,6 @@
206204
<Project>{604260DC-B392-4CF4-81EC-34B14591E2D2}</Project>
207205
<Name>Commands.RecoveryServices</Name>
208206
</ProjectReference>
209-
<ProjectReference Include="..\..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj">
210-
<Project>{8058d403-06e3-4bed-8924-d166ce303961}</Project>
211-
<Name>Commands.Resources.Rest</Name>
212-
</ProjectReference>
213-
<ProjectReference Include="..\..\Resources\Commands.Resources\Commands.Resources.csproj">
214-
<Project>{e1f5201d-6067-430e-b303-4e367652991b}</Project>
215-
<Name>Commands.Resources</Name>
216-
</ProjectReference>
217207
<ProjectReference Include="..\Commands.RecoveryServices.SiteRecovery\Commands.RecoveryServices.SiteRecovery.csproj">
218208
<Project>{7c879645-31ee-4a78-ad81-5512300fa105}</Project>
219209
<Name>Commands.RecoveryServices.SiteRecovery</Name>

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/A2ATestsHelper.ps1

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,16 @@ function getVaultRg{
2727

2828

2929
function getVaultRgLocation{
30-
$locationMap = Get-AzureRmLocation| select location,displayName
31-
$provider = Get-AzureRmResourceProvider -ProviderNamespace "Microsoft.RecoveryServices"
32-
33-
$resourceTypes = $provider[0].ResourceTypes | Where-Object { $_.ResourceTypeName -eq "vaults"}
34-
$resourceLocation = $resourceTypes.Locations[0]
35-
return $resourceLocation
30+
return "eastus"
3631
}
3732

3833
function getVaultLocation{
39-
$locationMap = Get-AzureRmLocation| select location,displayName
40-
$provider = Get-AzureRmResourceProvider -ProviderNamespace "Microsoft.RecoveryServices"
41-
42-
$resourceTypes = $provider[0].ResourceTypes | Where-Object { $_.ResourceTypeName -eq "vaults"}
43-
$resourceLocation = $resourceTypes.Locations[0]
44-
foreach($location in $locationMap){
45-
if($location.DisplayName -eq $resourceLocation){
46-
return $location.Location
47-
}
48-
}
34+
return "eastus"
4935
}
5036

5137
function getPrimaryLocation
5238
{
53-
$locationMap = Get-AzureRmLocation| select location,displayName
54-
$provider = Get-AzureRmResourceProvider -ProviderNamespace "Microsoft.RecoveryServices"
55-
56-
$resourceTypes = $provider[0].ResourceTypes | Where-Object { $_.ResourceTypeName -eq "vaults"}
57-
$resourceLocation = $resourceTypes.Locations[1]
58-
foreach($location in $locationMap){
59-
if($location.DisplayName -eq $resourceLocation){
60-
return $location.Location
61-
}
62-
}
39+
return "westus"
6340
}
6441

6542
function getRecoveryLocation{
@@ -84,8 +61,6 @@ function getAzureVm{
8461
$password=$VMLocalAdminSecurePassword|ConvertTo-SecureString -AsPlainText -Force
8562
$Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $password);
8663
New-AzureRmVM -Name MyVm -Credential $Credential -location getPrimaryLocation
87-
88-
8964
}
9065

9166
function getPrimaryPolicy{
@@ -155,7 +130,7 @@ function WaitForJobCompletion
155130
{
156131
param(
157132
[string] $JobId,
158-
[int] $JobQueryWaitTimeInSeconds = 60,
133+
[int] $JobQueryWaitTimeInSeconds = 20,
159134
[string] $Message = "NA"
160135
)
161136
$isJobLeftForProcessing = $true;

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery.Test/ScenarioTests/A2A/AsrA2ATests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function Test-NewA2AManagedDiskReplicationConfiguration
6363
Test GetAsrFabric new parametersets
6464
#>
6565
function Test-NewAsrFabric {
66-
$seed = 10;
66+
$seed = 35;
6767
$primaryPolicyName = getPrimaryPolicy
6868
$vaultRgLocation = getVaultRgLocation
6969
$vaultName = getVaultName
@@ -93,7 +93,7 @@ function Test-NewAsrFabric {
9393

9494
function Test-NewContainer{
9595

96-
$seed = 11;
96+
$seed = 33;
9797
$primaryPolicyName = getPrimaryPolicy
9898
$recoveryPolicyName = getRecoveryPolicy
9999

0 commit comments

Comments
 (0)