Skip to content

Commit

Permalink
Merge pull request Azure#1789 from pankajsn/dev
Browse files Browse the repository at this point in the history
Azure Logic App PowerShell Cmdlets
  • Loading branch information
Hovsep committed Feb 9, 2016
2 parents 278111a + 3d0f3c5 commit a37b4e9
Show file tree
Hide file tree
Showing 5 changed files with 665 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
<None Include="Resources\TestSimpleWorkflowTriggerDefinition.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\TestSimpleWorkflowTriggerDefinitionWithDelayAction.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\Common.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -190,6 +193,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.LogicApp.Test.ScenarioTests.WorkflowRunTests\TestRunLogicApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.LogicApp.Test.ScenarioTests.WorkflowRunTests\TestStopAzureRmLogicAppRun.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.LogicApp.Test.ScenarioTests.WorkflowTests\TestCreateAndGetLogicAppUsingDefinitionWithActions.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "http://schema.management.azure.com/providers/Microsoft.Logic/schemas/2014-12-01-preview/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"runworkflowmanually": {
"defaultValue": false,
"type": "bool"
}
},
"triggers": {
"httpTrigger": {
"type": "Http",
"inputs": {
"method": "GET",
"uri": "http://www.bing.com"
},
"recurrence": {
"frequency": "Hour",
"interval": 1
},
"conditions": [
{
"expression": "@bool('true')"
}
]
}
},
"actions": {
"http": {
"until": {
"limit": {
"timeout": "PT1H"
},
"conditions": [
{
"expression": "@bool('false')"
}
]
},
"type": "Http",
"inputs": {
"method": "GET",
"uri": "http://www.bing.com",
},
"conditions": [
{
"expression": "@bool('true')"
}
]
}
},
"outputs": {
"output1": {
"type": "string",
"value": "true"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,15 @@ public void TestGetAzureLogicAppRunAction()
{
WorkflowController.NewInstance.RunPowerShellTest("Test-GetAzureLogicAppRunAction");
}

/// <summary>
/// Test Stop-AzureRmLogicAppRun command to cancel logic app run
/// </summary>
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStopAzureRmLogicAppRun()
{
WorkflowController.NewInstance.RunPowerShellTest("Test-StopAzureRmLogicAppRun");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,34 @@ function Test-GetAzureLogicAppRunAction

$action = Get-AzureRmLogicAppRunAction -ResourceGroupName $resourceGroupName -Name $workflowName -RunName $runHistory[0].Name -ActionName "http"
Assert-NotNull $action
}

<#
.SYNOPSIS
Test Start and Stop AzureLogicApp command for logic app workflow.
#>
function Test-StopAzureRmLogicAppRun
{
$resourceGroup = TestSetup-CreateResourceGroup
$resourceGroupName = $resourceGroup.ResourceGroupName
$planName = "StandardServicePlan"
$Plan = TestSetup-CreateAppServicePlan $resourceGroup.ResourceGroupName $planName

$workflowName = getAssetname
$definitionFilePath = "Resources\TestSimpleWorkflowTriggerDefinitionWithDelayAction.json"

$workflow = New-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -DefinitionFilePath $definitionFilePath -AppServicePlan $planName

[int]$counter = 0
do {
Sleep -seconds 2
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)

Start-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"

$runHistory = Get-AzureRmLogicAppRunHistory -ResourceGroupName $resourceGroupName -Name $workflowName

Stop-AzureRmLogicAppRun -ResourceGroupName $resourceGroupName -Name $workflowName -RunName $runHistory[0].Name

}
Loading

0 comments on commit a37b4e9

Please sign in to comment.