Skip to content

ServiceBus: Added 'properties' to CorrelationFilter to support Custom filters #5861

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 3 commits into from
Apr 4, 2018
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
1 change: 1 addition & 0 deletions src/ResourceManager/ServiceBus/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Additional information about change #1
-->
## Current Release
* Added 'properties' in CorrelationFilter of Rules to support customproperties
* updated New-AzureRmServiceBusGeoDRConfiguration help and fixed Rules cmdlet output
* Fixed auto-forward properties in New-AzureRmServiceBusQueue and New-AzureRmServiceBusSubscription cmdlet
* Updated to the latest version of the Azure ClientRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@
<Reference Include="Microsoft.Azure.Management.Authorization">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.2\lib\portable-net45+wp8+wpa81+win\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ServiceBus.1.1.0\lib\net452\Microsoft.Azure.Management.ServiceBus.dll</HintPath>
<Reference Include="Microsoft.Azure.Management.ServiceBus">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ServiceBus.1.2.0\lib\net452\Microsoft.Azure.Management.ServiceBus.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Test.HttpRecorder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function ServiceBusRuleTests
$nameTopic = getAssetName "Topic-"
$subName = getAssetName "Subscription-"
$ruleName = getAssetName "Rule-"
$ruleName1 = getAssetName "Rule-"

Write-Debug "Create resource group"
Write-Debug "ResourceGroup name : $resourceGroupName"
Expand Down Expand Up @@ -79,24 +80,46 @@ function ServiceBusRuleTests

$setRule = Set-AzureRmServiceBusRule -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $resultGetTopic.Name -Subscription $subName -Name $ruleName -InputObject $getRule
Assert-AreEqual $setRule.SqlFilter.SqlExpression "myproperty='testing'" "Rule's SqlExpression updated earlier is not found."

# Create Rule
$createRule1 = New-AzureRmServiceBusRule -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $resultGetTopic.Name -Subscription $subName -Name $ruleName1 -SqlExpression "myproperty='test'"
Assert-AreEqual $createRule1.Name $ruleName1 "Rule created earlier is not found."

# Get Rule
$getRule1 = Get-AzureRmServiceBusRule -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $resultGetTopic.Name -Subscription $subName -Name $ruleName1
Assert-AreEqual $getRule1.Name $ruleName1 "Get-rule, Rule created earlier is not found."

# Update Rule
$getRule1.FilterType = "CorrelationFilter"
$getRule1.CorrelationFilter.Properties.add("topichint","topichintexpresion")
$getRule1.CorrelationFilter.Properties.add("topichint1","topichintexpresion1")
$getRule1.CorrelationFilter.Properties.add("topichint2","topichintexpresion2")

$setRule1 = Set-AzureRmServiceBusRule -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $resultGetTopic.Name -Subscription $subName -Name $ruleName1 -InputObject $getRule1
Assert-AreEqual $setRule1.FilterType "CorrelationFilter" "Rule's FilterType is not CorrelationFilter"
Assert-True {$setRule1.CorrelationFilter.Properties.Count -gt 1} "CorrelationFilter - properties count is less than 1, where as it should be greate than 1"
Assert-AreEqual $setRule1.CorrelationFilter.Properties.Count 3 "CorrelationFilter - properties count in not 3"

#remove Rule
Remove-AzureRmServiceBusRule -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $resultGetTopic.Name -Subscription $subName -Name $ruleName -Force

#remove Rule
Remove-AzureRmServiceBusRule -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $resultGetTopic.Name -Subscription $subName -Name $ruleName1 -Force

# Get rule List to verfiy the deleted rule
$ruleList_delete = Get-AzureRmServiceBusRule -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $resultGetTopic.Name -Subscription $subName
Assert-AreEqual $ruleList_delete.Count 0 "Rule List: Rule count not equal to Zero delete"
Assert-AreEqual $ruleList_delete.Count 0 "Rule List: Rule count not equal to Zero delete"

# Delete the created/Updated Subscription
$ResultDeleteTopic = Remove-AzureRmServiceBusSubscription -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Topic $ResulListTopic[0].Name -Name $resultGetSub.Name
Assert-True {$ResultDeleteTopic} "Topic not deleted"

# Cleanup
# Delete all Created Topic
Write-Debug " Delete the Topic"
for ($i = 0; $i -lt $ResulListTopic.Count; $i++)
{
$delete1 = Remove-AzureRmServiceBusTopic -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Name $ResulListTopic[$i].Name
$delete1 = Remove-AzureRmServiceBusTopic -ResourceGroupName $resourceGroupName -Namespace $namespaceName -Name $ResulListTopic[$i].Name
}

Write-Debug "Delete NameSpace"
Expand Down
Loading