Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public string Location
public async Task<ResourceConfig<RG>> CreateConfigAsync()
=> new ResourceConfig<RG>(
new ResourceStrategy<RG>(
null,
null,
async (c, p) => new RG(),
null,
null,
Expand All @@ -51,7 +51,7 @@ public async Task<ResourceConfig<RG>> CreateConfigAsync()

class AsyncCmdlet : IAsyncCmdlet
{
public CancellationToken CancellationToken { get; }
public CancellationToken CancellationToken { get; }
= new CancellationToken();

public IEnumerable<KeyValuePair<string, object>> Parameters
Expand Down Expand Up @@ -89,6 +89,11 @@ public void WriteVerbose(string message)
{
Assert.Equal("Str = \"str\"", message);
}

public void WriteWarning(string message)
{
throw new NotImplementedException();
}
}

[Fact]
Expand All @@ -102,4 +107,4 @@ public async Task TestVerboseStream()
await client.RunAsync("subscriptionId", parameters, asyncCmdlet);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ public AsyncCmdlet(ICmdlet cmdlet)
public void WriteVerbose(string message)
=> Scheduler.BeginInvoke(() => Cmdlet.WriteVerbose(message));

public void WriteWarning(string message)
=> Scheduler.BeginInvoke(() => Cmdlet.WriteWarning(message));

public Task<bool> ShouldProcessAsync(string target, string action)
=> Scheduler.Invoke(() => Cmdlet.ShouldProcess(target, action));

Expand All @@ -199,8 +202,6 @@ public void WriteObject(object value)

public void ReportTaskProgress(ITaskProgress taskProgress)
=> Scheduler.BeginInvoke(() => TaskProgressList.Add(taskProgress));


}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Azure.Commands.Common.Strategies</RootNamespace>
<AssemblyName>Microsoft.Azure.Commands.Common.Strategies.3</AssemblyName>
<AssemblyName>Microsoft.Azure.Commands.Common.Strategies.4</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Microsoft.Azure.Commands.Common.Strategies</AssemblyName>
<AssemblyName>Microsoft.Azure.Commands.Common.Strategies.4</AssemblyName>
<RootNamespace>Microsoft.Azure.Commands.Common.Strategies</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ public interface IAsyncCmdlet
IEnumerable<KeyValuePair<string, object>> Parameters { get; }

/// <summary>
/// Log additional information.
/// Thread-safe `WriteVerbose` function.
/// </summary>
/// <param name="message"></param>
/// <param name="message">The additional information to log</param>
void WriteVerbose(string message);

/// <summary>
Expand All @@ -40,11 +41,17 @@ public interface IAsyncCmdlet
Task<bool> ShouldProcessAsync(string target, string action);

/// <summary>
/// Thread-safe `WriteVerbose` function.
/// Thread-safe `WriteObject` function.
/// </summary>
/// <param name="value"></param>
void WriteObject(object value);

/// <summary>
/// Thread-safe `WriteWarning` function.
/// </summary>
/// <param name="message"></param>
void WriteWarning(string message);

/// <summary>
/// Report task progress. The function is used to report current task and cmdlet progress.
/// </summary>
Expand All @@ -61,4 +68,4 @@ public interface IAsyncCmdlet
/// </summary>
CancellationToken CancellationToken { get; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public interface ICmdlet
/// <param name="value"></param>
void WriteObject(object value);

/// <summary>
/// See also PowerShell `WriteWarning`.
/// </summary>
/// <param name="message"></param>
void WriteWarning(string message);

/// <summary>
/// See also PowerShell `WriteProgress`.
/// </summary>
Expand All @@ -64,4 +70,4 @@ void WriteProgress(
/// </summary>
IEnumerable<KeyValuePair<string, object>> Parameters { get; }
}
}
}
2 changes: 1 addition & 1 deletion src/ResourceManager/Compute/AzureRM.Compute.Netcore.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RequiredModules = @(@{ModuleName = 'AzureRM.Profile.Netcore'; ModuleVersion = '0

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = '.\AutoMapper.dll',
'.\Microsoft.Azure.Commands.Common.Strategies.dll',
'.\Microsoft.Azure.Commands.Common.Strategies.4.dll',
'.\Microsoft.Azure.Management.Compute.dll',
'.\Microsoft.Azure.Management.KeyVault.dll'

Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/Compute/AzureRM.Compute.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RequiredAssemblies = '.\AutoMapper.dll', '.\Microsoft.Azure.Management.Compute.d
'.\Microsoft.WindowsAzure.Commands.Sync.dll',
'.\Microsoft.WindowsAzure.Commands.Tools.Vhd.dll',
'.\Microsoft.WindowsAzure.Storage.dll', '.\System.Spatial.dll',
'.\Microsoft.Azure.Commands.Common.Strategies.3.dll'
'.\Microsoft.Azure.Commands.Common.Strategies.4.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public void WriteProgress(
CurrentOperation = currentOperation,
PercentComplete = percentComplete,
});

public void WriteWarning(string message)
=> _Cmdlet.WriteWarning(message);
}
}
}
2 changes: 1 addition & 1 deletion src/ResourceManager/Websites/AzureRM.Websites.Netcore.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ PowerShellVersion = '5.1'
RequiredModules = @(@{ModuleName = 'AzureRM.Profile.Netcore'; ModuleVersion = '0.11.0'; })

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = '.\Microsoft.Azure.Management.Websites.dll', '.\Microsoft.Azure.Commands.Common.Strategies.dll'
RequiredAssemblies = '.\Microsoft.Azure.Management.Websites.dll', '.\Microsoft.Azure.Commands.Common.Strategies.4.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/Websites/AzureRM.Websites.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.1.0'; }

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = '.\Microsoft.Azure.Management.Websites.dll',
'.\Microsoft.Azure.Commands.Common.Strategies.3.dll'
'.\Microsoft.Azure.Commands.Common.Strategies.4.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
Expand Down
1 change: 1 addition & 0 deletions src/ResourceManager/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Current Release
* `New-AzureRMWebApp` is updated to use common algorithms from the Strategy library.

## Version 5.0.1
* Set minimum dependency of module to PowerShell 5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebAppSimple.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestRemoveWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public void TestCreateNewAppOnAse()
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppOnAse");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewWebAppSimple()
{
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppSimple");
}

[Fact(Skip = "Needs investigation. Fails running playback")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetWebApp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,4 +768,23 @@ function Test-WebAppPublishingProfile
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $planName -Force
Remove-AzureRmResourceGroup -Name $rgname -Force
}
}

<#
.SYNOPSIS
Tests creating a web app with a simple parameterset.
#>
function Test-CreateNewWebAppSimple
{
$appName = Get-WebsiteName
try
{
$webapp = New-AzureRmWebApp -Name $appName

Assert-AreEqual $appName $webapp.Name
}
finally
{
Remove-AzureRmResourceGroup $appName
}
}
Loading