Skip to content

. #11

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

Merged
merged 30 commits into from
May 26, 2015
Merged

. #11

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2e515f1
Add support for the SetParameters.xml file to override package config…
naeemkhedarun Apr 2, 2015
1fa34e8
WebhookCmdlets
shipram May 6, 2015
fcb5951
WebhookCmdlets
shipram May 6, 2015
41f276b
webhookcmdlets3
shipram May 6, 2015
b5713fb
List All get paged data
safeermohammed May 14, 2015
02bb2d1
review comments
safeermohammed May 15, 2015
d46e6e2
fixing schedule test
safeermohammed May 21, 2015
053621e
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
safeermohammed May 21, 2015
6ffec05
Cmdlets for webhooks and Tests
shipram May 21, 2015
c035421
Merge branch 'dev' of https://github.com/AzureAutomationTeam/azure-po…
shipram May 21, 2015
2e11ddd
saving work
shipram May 21, 2015
0243237
removing unwanted file
shipram May 21, 2015
0537585
Implemented paging in Get cmdlets
shipram May 21, 2015
7dd9cb4
fixed param order
shipram May 21, 2015
f1fb934
deleted unwanted file
shipram May 21, 2015
c999ef2
addressed code review comments
shipram May 22, 2015
ddb6da5
Merge remote-tracking branch 'upstream/dev' into dev
naeemkhedarun May 22, 2015
f8048be
Merge pull request #5 from shipram/dev
safeermohammed May 22, 2015
eb4ff91
Updated to new SDK 1.0.3
safeermohammed May 22, 2015
7f1eba5
Check correct value for setparameters is passed to the web client.
naeemkhedarun May 23, 2015
da9ca43
Merge remote-tracking branch 'upstream/dev' into dev
naeemkhedarun May 23, 2015
964c830
Get all accounts at subscription level
safeermohammed May 23, 2015
2cd333c
Deprecating old event types
yoavrubin May 26, 2015
1795372
defaulting Streamtype to any
safeermohammed May 26, 2015
fe5ce94
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
safeermohammed May 26, 2015
6fdede4
adding wxi
yoavrubin May 26, 2015
cd5331b
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yoavrubin May 26, 2015
a541017
Merge pull request #427 from yoavrubin/dev
May 26, 2015
2be1493
Merge pull request #316 from naeemkhedarun/dev
May 26, 2015
e073bb8
Merge pull request #422 from AzureAutomationTeam/dev
May 26, 2015
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
336 changes: 0 additions & 336 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UnitTests\GetAzureAutomationWebhookTest.cs" />
<Compile Include="UnitTests\NewAzureAutomationAccountTest.cs" />
<Compile Include="UnitTests\GetAzureAutomationAccountTest.cs" />
<Compile Include="UnitTests\NewAzureAutomationWebhookTest.cs" />
<Compile Include="UnitTests\RemoveAzureAutomationAccountTest.cs" />
<Compile Include="UnitTests\RemoveAzureAutomationWebhookTest.cs" />
<Compile Include="UnitTests\SetAzureAutomationWebhookTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common\Commands.Common.Test\Commands.Common.Test.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ public void GetAzureAutomationAllAccountsSuccessfull()
{
// Setup
string resourceGroupName = "resourceGroup";
string nextLink = string.Empty;

this.mockAutomationClient.Setup(f => f.ListAutomationAccounts(resourceGroupName)).Returns((string a) => new List<AutomationAccount>());
this.mockAutomationClient.Setup(f => f.ListAutomationAccounts(resourceGroupName, ref nextLink)).Returns((string a, string b) => new List<AutomationAccount>());

// Test
this.cmdlet.ExecuteCmdlet();

// Assert
this.mockAutomationClient.Verify(f => f.ListAutomationAccounts(null), Times.Once());
this.mockAutomationClient.Verify(f => f.ListAutomationAccounts(resourceGroupName, ref nextLink), Times.Once());
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Automation.Cmdlet;
using Microsoft.Azure.Commands.Automation.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Moq;

namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
{
[TestClass]
public class GetAzureAutomationWebhookTest : TestBase
{
private Mock<IAutomationClient> mockAutomationClient;

private MockCommandRuntime mockCommandRuntime;

private GetAzureAutomationWebhook cmdlet;

[TestInitialize]
public void SetupTest()
{
this.mockAutomationClient = new Mock<IAutomationClient>();
this.mockCommandRuntime = new MockCommandRuntime();
this.cmdlet = new GetAzureAutomationWebhook
{
AutomationClient = this.mockAutomationClient.Object,
CommandRuntime = this.mockCommandRuntime
};
}

[TestMethod]
public void GetAzureAutomationWebhookByNameSuccessful()
{
// Setup
string resourceGroupName = "resourceGroup";
string accountName = "account";
string webhookName = "webhookName";
this.cmdlet.SetParameterSet("ByName");

this.mockAutomationClient.Setup(f => f.GetWebhook(resourceGroupName, accountName, webhookName));

// Test
this.cmdlet.ResourceGroupName = resourceGroupName;
this.cmdlet.AutomationAccountName = accountName;
this.cmdlet.Name = webhookName;
this.cmdlet.ExecuteCmdlet();

// Assert
this.mockAutomationClient.Verify(f => f.GetWebhook(resourceGroupName, accountName, webhookName), Times.Once());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Automation.Cmdlet;
using Microsoft.Azure.Commands.Automation.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Moq;
using System;

namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
{
[TestClass]
public class NewAzureAutomationWebhookTest : TestBase
{
private Mock<IAutomationClient> mockAutomationClient;

private MockCommandRuntime mockCommandRuntime;

private NewAzureAutomationWebhook cmdlet;

[TestInitialize]
public void SetupTest()
{
this.mockAutomationClient = new Mock<IAutomationClient>();
this.mockCommandRuntime = new MockCommandRuntime();
this.cmdlet = new NewAzureAutomationWebhook
{
AutomationClient = this.mockAutomationClient.Object,
CommandRuntime = this.mockCommandRuntime
};
}

[TestMethod]
public void NewAzureAutomationWebhookByNameSuccessful()
{
// Setup
string resourceGroupName = "resourceGroup";
string accountName = "account";
string name = "webhookName";
string runbookName = "runbookName";
DateTimeOffset expiryTime = DateTimeOffset.Now.AddDays(1);

this.mockAutomationClient.Setup(
f => f.CreateWebhook(resourceGroupName, accountName, name, runbookName, true, expiryTime, null));

// Test
this.cmdlet.ResourceGroupName = resourceGroupName;
this.cmdlet.AutomationAccountName = accountName;
this.cmdlet.Name = name;
this.cmdlet.RunbookName = runbookName;
this.cmdlet.ExpiryTime = expiryTime;
this.cmdlet.IsEnabled = true;
this.cmdlet.Parameters = null;
this.cmdlet.ExecuteCmdlet();

// Assert
this.mockAutomationClient.Verify(
f => f.CreateWebhook(resourceGroupName, accountName, name, runbookName, true, expiryTime, null),
Times.Once());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Automation.Cmdlet;
using Microsoft.Azure.Commands.Automation.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Moq;

namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
{
[TestClass]
public class RemoveAzureAutomationWebhookTest : TestBase
{
private Mock<IAutomationClient> mockAutomationClient;

private MockCommandRuntime mockCommandRuntime;

private RemoveAzureAutomationWebhook cmdlet;

[TestInitialize]
public void SetupTest()
{
this.mockAutomationClient = new Mock<IAutomationClient>();
this.mockCommandRuntime = new MockCommandRuntime();
this.cmdlet = new RemoveAzureAutomationWebhook
{
AutomationClient = this.mockAutomationClient.Object,
CommandRuntime = this.mockCommandRuntime
};
}

[TestMethod]
public void RemoveAzureAutomationWebhookByNameSuccessful()
{
// Setup
string resourceGroupName = "resourceGroup";
string accountName = "account";
string webhookName = "webhookName";
this.cmdlet.SetParameterSet("ByName");

this.mockAutomationClient.Setup(f => f.DeleteWebhook(resourceGroupName, accountName, webhookName));

// Test
this.cmdlet.ResourceGroupName = resourceGroupName;
this.cmdlet.AutomationAccountName = accountName;
this.cmdlet.Name = webhookName;
this.cmdlet.ExecuteCmdlet();

// Assert
this.mockAutomationClient.Verify(f => f.DeleteWebhook(resourceGroupName, accountName, webhookName), Times.Once());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Automation.Cmdlet;
using Microsoft.Azure.Commands.Automation.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Moq;

namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
{
[TestClass]
public class SetAzureAutomationWebhookTest : TestBase
{
private Mock<IAutomationClient> mockAutomationClient;

private MockCommandRuntime mockCommandRuntime;

private SetAzureAutomationWebhook cmdlet;

[TestInitialize]
public void SetupTest()
{
this.mockAutomationClient = new Mock<IAutomationClient>();
this.mockCommandRuntime = new MockCommandRuntime();
this.cmdlet = new SetAzureAutomationWebhook
{
AutomationClient = this.mockAutomationClient.Object,
CommandRuntime = this.mockCommandRuntime
};
}

[TestMethod]
public void SetAzureAutomationWebhookToDisabledSuccessful()
{
// Setup
string resourceGroupName = "resourceGroup";
string accountName = "account";
string name = "webhookName";

this.mockAutomationClient.Setup(
f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false));

// Test
this.cmdlet.ResourceGroupName = resourceGroupName;
this.cmdlet.AutomationAccountName = accountName;
this.cmdlet.Name = name;
this.cmdlet.IsEnabled = false;
this.cmdlet.Parameters = null;
this.cmdlet.ExecuteCmdlet();

// Assert
this.mockAutomationClient.Verify(
f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false),
Times.Once());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ public IAutomationClient AutomationClient
/// <summary>
/// Gets or sets the automation account name.
/// </summary>
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
[ValidateNotNullOrEmpty]
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAutomationAccountName, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
public string ResourceGroupName { get; set; }

/// <summary>
/// Gets or sets the automation account name.
/// </summary>
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAutomationAccountName, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The automation account name.")]
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAutomationAccountName, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The automation account name.")]
[Alias("AutomationAccountName")]
[ValidateNotNullOrEmpty]
public string Name { get; set; }
Expand All @@ -77,13 +77,19 @@ public override void ExecuteCmdlet()
{
this.AutomationClient.GetAutomationAccount(this.ResourceGroupName, this.Name)
};
this.WriteObject(ret, true);
}
else
{
ret = this.AutomationClient.ListAutomationAccounts(this.ResourceGroupName);
}
string nextLink = string.Empty;

this.WriteObject(ret, true);
do
{
ret = this.AutomationClient.ListAutomationAccounts(this.ResourceGroupName, ref nextLink);
this.WriteObject(ret, true);

} while (!string.IsNullOrEmpty(nextLink));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ protected override void AutomationExecuteCmdlet()
{
this.AutomationClient.GetModule(this.ResourceGroupName, this.AutomationAccountName, this.Name)
};
this.GenerateCmdletOutput(ret);
}
else
{
ret = this.AutomationClient.ListModules(this.ResourceGroupName, this.AutomationAccountName);
}
string nextLink = string.Empty;

do
{
ret = this.AutomationClient.ListModules(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
this.GenerateCmdletOutput(ret);

this.GenerateCmdletOutput(ret);
} while (!string.IsNullOrEmpty(nextLink));
}
}
}
}
Loading