From 8c837b8ec4c7f1326146ab593cea7f655ac70fe4 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 08:20:26 -0800 Subject: [PATCH 01/21] Fix naming. NameSpace -> Namespace. --- sdk/eventhubs/test-resources.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 3a1a25ce2541..8bb328498179 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -55,13 +55,13 @@ "premiumAccountName": "[concat('prem', parameters('baseName'))]", "dataLakeAccountName": "[concat('dtlk', parameters('baseName'))]", "location": "[resourceGroup().location]", - "eventHubNameSpaceName": "[parameters('baseName')]" + "eventHubNamespaceName": "[parameters('baseName')]" }, "resources": [ { "type": "Microsoft.EventHub/namespaces", "apiVersion": "[variables('eventHubsApiVersion')]", - "name": "[variables('eventHubNameSpaceName')]", + "name": "[variables('eventHubNamespaceName')]", "location": "[variables('location')]", "sku": { "name": "Standard", @@ -165,7 +165,7 @@ "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNameSpaceName'))]" + "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]" ], "properties": { "messageRetentionInDays": 7, @@ -201,7 +201,7 @@ "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", "type": "Microsoft.EventHub/namespaces/AuthorizationRules", "dependsOn": [ - "[concat('Microsoft.EventHub/namespaces/', variables('eventHubNameSpaceName'))]" + "[concat('Microsoft.EventHub/namespaces/', variables('eventHubNamespaceName'))]" ], "properties": { "rights": [ @@ -364,7 +364,7 @@ }, "AZURE_EVENTHUBS_FULLY_QUALIFIED_DOMAIN_NAME": { "type": "string", - "value": "[concat(variables('eventHubNameSpaceName'), '.', parameters('eventHubNamespaceHostNameSuffix'))]" + "value": "[concat(variables('eventHubNamespaceName'), '.', parameters('eventHubNamespaceHostNameSuffix'))]" }, "BLOB_STORAGE_ACCOUNT_NAME": { "type": "string", From d40fb2e5a835c7652c5b3d7a8789a92b25e71865 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 08:21:13 -0800 Subject: [PATCH 02/21] Fix formatting for json files. --- sdk/eventhubs/test-resources.json | 716 +++++++++++++++--------------- 1 file changed, 358 insertions(+), 358 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 8bb328498179..0655299280d2 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -44,387 +44,387 @@ } }, "variables": { - "storageApiVersion": "2019-04-01", - "eventHubsApiVersion": "2017-04-01", - "authorizationApiVersion": "2018-09-01-preview", - "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", - "contributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c')]", - "AuthorizationRulesName": "[concat('authr', parameters('baseName'))]", - "primaryAccountName": "[concat('prim', parameters('baseName'))]", - "secondaryAccountName": "[concat('sec', parameters('baseName'))]", - "premiumAccountName": "[concat('prem', parameters('baseName'))]", - "dataLakeAccountName": "[concat('dtlk', parameters('baseName'))]", - "location": "[resourceGroup().location]", - "eventHubNamespaceName": "[parameters('baseName')]" + "storageApiVersion": "2019-04-01", + "eventHubsApiVersion": "2017-04-01", + "authorizationApiVersion": "2018-09-01-preview", + "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", + "contributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c')]", + "AuthorizationRulesName": "[concat('authr', parameters('baseName'))]", + "primaryAccountName": "[concat('prim', parameters('baseName'))]", + "secondaryAccountName": "[concat('sec', parameters('baseName'))]", + "premiumAccountName": "[concat('prem', parameters('baseName'))]", + "dataLakeAccountName": "[concat('dtlk', parameters('baseName'))]", + "location": "[resourceGroup().location]", + "eventHubNamespaceName": "[parameters('baseName')]" }, "resources": [ - { - "type": "Microsoft.EventHub/namespaces", - "apiVersion": "[variables('eventHubsApiVersion')]", - "name": "[variables('eventHubNamespaceName')]", - "location": "[variables('location')]", - "sku": { - "name": "Standard", - "tier": "Standard", - "capacity": 5 - }, - "properties": { - "zoneRedundant": false, - "isAutoInflateEnabled": false, - "maximumThroughputUnits": 0, - "cors": { - "corsRules": [ - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "*" - ], - "allowedMethods": [ - "DELETE", - "GET", - "HEAD", - "MERGE", - "POST", - "OPTIONS", - "PUT" - ], - "maxAgeInSeconds": 86400, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - } - ] - } - } - }, - { - "apiVersion": "[variables('eventHubsApiVersion')]", - "type": "Microsoft.EventHub/namespaces/eventhubs", - "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", - "location": "[variables('location')]", - "dependsOn": [ - "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]" - ], - "properties": { - "messageRetentionInDays": 7, - "partitionCount": 2 - } + { + "type": "Microsoft.EventHub/namespaces", + "apiVersion": "[variables('eventHubsApiVersion')]", + "name": "[variables('eventHubNamespaceName')]", + "location": "[variables('location')]", + "sku": { + "name": "Standard", + "tier": "Standard", + "capacity": 5 }, - { - "type": "Microsoft.Authorization/roleAssignments", - "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('dataContributorRoleId', variables('primaryAccountName')))]", - "dependsOn": [ - "[variables('primaryAccountName')]" - ], - "properties": { - "roleDefinitionId": "[variables('blobDataContributorRoleId')]", - "principalId": "[parameters('testApplicationOid')]" - } - }, - { - "type": "Microsoft.Authorization/roleAssignments", - "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('contributorRoleId', variables('primaryAccountName')))]", - "dependsOn": [ - "[variables('primaryAccountName')]" - ], - "properties": { - "roleDefinitionId": "[variables('contributorRoleId')]", - "principalId": "[parameters('testApplicationOid')]" - } - }, - { - "apiVersion": "2017-04-01", - "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", - "type": "Microsoft.EventHub/namespaces/AuthorizationRules", - "dependsOn": [ - "[concat('Microsoft.EventHub/namespaces/', variables('eventHubNamespaceName'))]" - ], - "properties": { - "rights": [ - "Send", - "Listen", - "Manage" + "properties": { + "zoneRedundant": false, + "isAutoInflateEnabled": false, + "maximumThroughputUnits": 0, + "cors": { + "corsRules": [ + { + "allowedOrigins": [ + "example.com" + ], + "allowedMethods": [ + "GET" + ], + "maxAgeInSeconds": 8888, + "exposedHeaders": [ + "*" + ], + "allowedHeaders": [ + "*" + ] + }, + { + "allowedOrigins": [ + "*" + ], + "allowedMethods": [ + "DELETE", + "GET", + "HEAD", + "MERGE", + "POST", + "OPTIONS", + "PUT" + ], + "maxAgeInSeconds": 86400, + "exposedHeaders": [ + "*" + ], + "allowedHeaders": [ + "*" + ] + }, + { + "allowedOrigins": [ + "example.com" + ], + "allowedMethods": [ + "GET" + ], + "maxAgeInSeconds": 8888, + "exposedHeaders": [ + "*" + ], + "allowedHeaders": [ + "*" + ] + }, + { + "allowedOrigins": [ + "example.com" + ], + "allowedMethods": [ + "GET" + ], + "maxAgeInSeconds": 8888, + "exposedHeaders": [ + "*" + ], + "allowedHeaders": [ + "*" + ] + }, + { + "allowedOrigins": [ + "example.com" + ], + "allowedMethods": [ + "GET" + ], + "maxAgeInSeconds": 8888, + "exposedHeaders": [ + "*" + ], + "allowedHeaders": [ + "*" + ] + } ] } + } + }, + { + "apiVersion": "[variables('eventHubsApiVersion')]", + "type": "Microsoft.EventHub/namespaces/eventhubs", + "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]" + ], + "properties": { + "messageRetentionInDays": 7, + "partitionCount": 2 + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "[variables('authorizationApiVersion')]", + "name": "[guid(concat('dataContributorRoleId', variables('primaryAccountName')))]", + "dependsOn": [ + "[variables('primaryAccountName')]" + ], + "properties": { + "roleDefinitionId": "[variables('blobDataContributorRoleId')]", + "principalId": "[parameters('testApplicationOid')]" + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "[variables('authorizationApiVersion')]", + "name": "[guid(concat('contributorRoleId', variables('primaryAccountName')))]", + "dependsOn": [ + "[variables('primaryAccountName')]" + ], + "properties": { + "roleDefinitionId": "[variables('contributorRoleId')]", + "principalId": "[parameters('testApplicationOid')]" + } + }, + { + "apiVersion": "2017-04-01", + "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", + "type": "Microsoft.EventHub/namespaces/AuthorizationRules", + "dependsOn": [ + "[concat('Microsoft.EventHub/namespaces/', variables('eventHubNamespaceName'))]" + ], + "properties": { + "rights": [ + "Send", + "Listen", + "Manage" + ] + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[variables('primaryAccountName')]", + "location": "[variables('location')]", + "sku": { + "name": "Standard_RAGRS", + "tier": "Standard" }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('primaryAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Standard_RAGRS", - "tier": "Standard" + "kind": "StorageV2", + "properties": { + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" }, - "kind": "StorageV2", - "properties": { - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [], - "ipRules": [], - "defaultAction": "Allow" - }, - "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "enabled": true }, - "keySource": "Microsoft.Storage" + "blob": { + "enabled": true + } }, - "accessTier": "Hot" - } + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[variables('secondaryAccountName')]", + "location": "[variables('location')]", + "sku": { + "name": "Standard_RAGRS", + "tier": "Standard" }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('secondaryAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Standard_RAGRS", - "tier": "Standard" + "kind": "StorageV2", + "properties": { + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" }, - "kind": "StorageV2", - "properties": { - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [], - "ipRules": [], - "defaultAction": "Allow" - }, - "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "enabled": true }, - "keySource": "Microsoft.Storage" + "blob": { + "enabled": true + } }, - "accessTier": "Hot" - } + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[variables('premiumAccountName')]", + "location": "[variables('location')]", + "sku": { + "name": "Premium_LRS", + "tier": "Premium" }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('premiumAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Premium_LRS", - "tier": "Premium" + "kind": "StorageV2", + "properties": { + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" }, - "kind": "StorageV2", - "properties": { - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [], - "ipRules": [], - "defaultAction": "Allow" - }, - "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "enabled": true }, - "keySource": "Microsoft.Storage" + "blob": { + "enabled": true + } }, - "accessTier": "Hot" - } + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[variables('dataLakeAccountName')]", + "location": "[variables('location')]", + "sku": { + "name": "Standard_RAGRS", + "tier": "Standard" }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('dataLakeAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Standard_RAGRS", - "tier": "Standard" + "kind": "StorageV2", + "properties": { + "isHnsEnabled": true, + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" }, - "kind": "StorageV2", - "properties": { - "isHnsEnabled": true, - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [], - "ipRules": [], - "defaultAction": "Allow" - }, - "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } + "supportsHttpsTrafficOnly": true, + "encryption": { + "services": { + "file": { + "enabled": true }, - "keySource": "Microsoft.Storage" + "blob": { + "enabled": true + } }, - "accessTier": "Hot" - } + "keySource": "Microsoft.Storage" + }, + "accessTier": "Hot" } + } ], "outputs": { - "AZURE_TENANT_ID": { - "type": "string", - "value": "[parameters('tenantId')]" - }, - "AZURE_CLIENT_ID": { - "type": "string", - "value": "[parameters('testApplicationId')]" - }, - "AZURE_CLIENT_SECRET": { - "type": "string", - "value": "[parameters('testApplicationSecret')]" - }, - "AZURE_EVENTHUBS_CONNECTION_STRING": { - "type": "string", - "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('baseName'), 'RootManageSharedAccessKey'), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName') )]" - }, - "AZURE_EVENTHUBS_EVENT_HUB_NAME": { - "type": "string", - "value": "[parameters('eventHubName')]" - }, - "AZURE_EVENTHUBS_FULLY_QUALIFIED_DOMAIN_NAME": { - "type": "string", - "value": "[concat(variables('eventHubNamespaceName'), '.', parameters('eventHubNamespaceHostNameSuffix'))]" - }, - "BLOB_STORAGE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('secondaryAccountName')]" - }, - "BLOB_STORAGE_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('secondaryAccountName')), variables('storageApiVersion')).keys[0].value]" - }, - "PREMIUM_STORAGE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('premiumAccountName')]" - }, - "PREMIUM_STORAGE_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('premiumAccountName')), variables('storageApiVersion')).keys[0].value]" - }, - "AZURE_STORAGE_BLOB_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "AZURE_STORAGE_FILE_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "AZURE_STORAGE_FILE_ENDPOINT": { - "type": "string", - "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).primaryEndpoints.file]" - }, - "AZURE_STORAGE_QUEUE_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "AZURE_STORAGE_QUEUE_ENDPOINT": { - "type": "string", - "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).primaryEndpoints.queue]" - }, - "PRIMARY_STORAGE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('primaryAccountName')]" - }, - "PRIMARY_STORAGE_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value]" - }, - "STORAGE_DATA_LAKE_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('dataLakeAccountName')), variables('storageApiVersion')).keys[0].value]" - }, - "STORAGE_DATA_LAKE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('dataLakeAccountName')]" - }, - "SECONDARY_STORAGE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('secondaryAccountName')]" - }, - "SECONDARY_STORAGE_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('secondaryAccountName')), variables('storageApiVersion')).keys[0].value]" - } + "AZURE_TENANT_ID": { + "type": "string", + "value": "[parameters('tenantId')]" + }, + "AZURE_CLIENT_ID": { + "type": "string", + "value": "[parameters('testApplicationId')]" + }, + "AZURE_CLIENT_SECRET": { + "type": "string", + "value": "[parameters('testApplicationSecret')]" + }, + "AZURE_EVENTHUBS_CONNECTION_STRING": { + "type": "string", + "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('baseName'), 'RootManageSharedAccessKey'), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName') )]" + }, + "AZURE_EVENTHUBS_EVENT_HUB_NAME": { + "type": "string", + "value": "[parameters('eventHubName')]" + }, + "AZURE_EVENTHUBS_FULLY_QUALIFIED_DOMAIN_NAME": { + "type": "string", + "value": "[concat(variables('eventHubNamespaceName'), '.', parameters('eventHubNamespaceHostNameSuffix'))]" + }, + "BLOB_STORAGE_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('secondaryAccountName')]" + }, + "BLOB_STORAGE_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('secondaryAccountName')), variables('storageApiVersion')).keys[0].value]" + }, + "PREMIUM_STORAGE_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('premiumAccountName')]" + }, + "PREMIUM_STORAGE_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('premiumAccountName')), variables('storageApiVersion')).keys[0].value]" + }, + "AZURE_STORAGE_BLOB_CONNECTION_STRING": { + "type": "string", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" + }, + "AZURE_STORAGE_FILE_CONNECTION_STRING": { + "type": "string", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" + }, + "AZURE_STORAGE_FILE_ENDPOINT": { + "type": "string", + "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).primaryEndpoints.file]" + }, + "AZURE_STORAGE_QUEUE_CONNECTION_STRING": { + "type": "string", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" + }, + "AZURE_STORAGE_QUEUE_ENDPOINT": { + "type": "string", + "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).primaryEndpoints.queue]" + }, + "PRIMARY_STORAGE_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('primaryAccountName')]" + }, + "PRIMARY_STORAGE_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value]" + }, + "STORAGE_DATA_LAKE_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('dataLakeAccountName')), variables('storageApiVersion')).keys[0].value]" + }, + "STORAGE_DATA_LAKE_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('dataLakeAccountName')]" + }, + "SECONDARY_STORAGE_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('secondaryAccountName')]" + }, + "SECONDARY_STORAGE_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('secondaryAccountName')), variables('storageApiVersion')).keys[0].value]" } } +} From 0957424418af4ddc798ccc2208fe720a8774bddd Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 08:27:09 -0800 Subject: [PATCH 03/21] Adding DataOwner roleId. --- sdk/eventhubs/test-resources.json | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 0655299280d2..39e6b5311ee2 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -55,13 +55,14 @@ "premiumAccountName": "[concat('prem', parameters('baseName'))]", "dataLakeAccountName": "[concat('dtlk', parameters('baseName'))]", "location": "[resourceGroup().location]", - "eventHubNamespaceName": "[parameters('baseName')]" + "eventHubsNamespaceName": "[parameters('baseName')]", + "eventHubsDataOwnerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/f526a384-b230-433a-b45c-95f59c4a2dec')]" }, "resources": [ { "type": "Microsoft.EventHub/namespaces", "apiVersion": "[variables('eventHubsApiVersion')]", - "name": "[variables('eventHubNamespaceName')]", + "name": "[variables('eventHubsNamespaceName')]", "location": "[variables('location')]", "sku": { "name": "Standard", @@ -165,7 +166,7 @@ "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]" + "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" ], "properties": { "messageRetentionInDays": 7, @@ -184,6 +185,18 @@ "principalId": "[parameters('testApplicationOid')]" } }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "[variables('authorizationApiVersion')]", + "name": "[guid(concat('dataContributorRoleId', variables('primaryAccountName')))]", + "dependsOn": [ + "[variables('primaryAccountName')]" + ], + "properties": { + "roleDefinitionId": "[variables('blobDataContributorRoleId')]", + "principalId": "[parameters('testApplicationOid')]" + } + }, { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "[variables('authorizationApiVersion')]", @@ -201,7 +214,7 @@ "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", "type": "Microsoft.EventHub/namespaces/AuthorizationRules", "dependsOn": [ - "[concat('Microsoft.EventHub/namespaces/', variables('eventHubNamespaceName'))]" + "[concat('Microsoft.EventHub/namespaces/', variables('eventHubsNamespaceName'))]" ], "properties": { "rights": [ @@ -364,7 +377,7 @@ }, "AZURE_EVENTHUBS_FULLY_QUALIFIED_DOMAIN_NAME": { "type": "string", - "value": "[concat(variables('eventHubNamespaceName'), '.', parameters('eventHubNamespaceHostNameSuffix'))]" + "value": "[concat(variables('eventHubsNamespaceName'), '.', parameters('eventHubNamespaceHostNameSuffix'))]" }, "BLOB_STORAGE_ACCOUNT_NAME": { "type": "string", From 5f7fc88aa8fc969d54b8c4241ecb638348b94209 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 08:34:40 -0800 Subject: [PATCH 04/21] Adding authorization for Event Hubs to be accessed by test client Id. --- sdk/eventhubs/test-resources.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 39e6b5311ee2..8ac306139d25 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -176,12 +176,12 @@ { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('dataContributorRoleId', variables('primaryAccountName')))]", + "name": "[guid(concat('eventHubsDataOwnerRoleId', variables('eventHubsNamespaceName')))]", "dependsOn": [ - "[variables('primaryAccountName')]" + "[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('eventHubName'))]" ], "properties": { - "roleDefinitionId": "[variables('blobDataContributorRoleId')]", + "roleDefinitionId": "[variables('eventHubsDataOwnerRoleId')]", "principalId": "[parameters('testApplicationOid')]" } }, From d3f747d9719faf8ae4f2488a28a0acc5f9fb341a Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 08:45:42 -0800 Subject: [PATCH 05/21] Adding scope to role assignments. --- sdk/eventhubs/test-resources.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 8ac306139d25..cf031d3e4027 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -169,7 +169,7 @@ "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" ], "properties": { - "messageRetentionInDays": 7, + "messageRetentionInDays": 1, "partitionCount": 2 } }, @@ -182,7 +182,8 @@ ], "properties": { "roleDefinitionId": "[variables('eventHubsDataOwnerRoleId')]", - "principalId": "[parameters('testApplicationOid')]" + "principalId": "[parameters('testApplicationOid')]", + "scope": "[resourceGroup().id]" } }, { @@ -194,7 +195,8 @@ ], "properties": { "roleDefinitionId": "[variables('blobDataContributorRoleId')]", - "principalId": "[parameters('testApplicationOid')]" + "principalId": "[parameters('testApplicationOid')]", + "scope": "[resourceGroup().id]" } }, { @@ -206,7 +208,8 @@ ], "properties": { "roleDefinitionId": "[variables('contributorRoleId')]", - "principalId": "[parameters('testApplicationOid')]" + "principalId": "[parameters('testApplicationOid')]", + "scope": "[resourceGroup().id]" } }, { From 85056d2291ff174a4256cb7252bf7bc42938a320 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 10:24:21 -0800 Subject: [PATCH 06/21] Fixing authorization rules. --- sdk/eventhubs/test-resources.json | 141 ++++++------------------------ 1 file changed, 29 insertions(+), 112 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index cf031d3e4027..f3d00ddcb0ca 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -3,7 +3,7 @@ "contentVersion": "1.0.0.0", "parameters": { "baseName": { - "type": "String" + "type": "string" }, "storageEndpointSuffix": { "type": "string", @@ -11,29 +11,29 @@ }, "eventHubName": { "type": "string", - "defaultValue": "javaeventhub" + "defaultValue": "java-eventhub" }, "eventHubNamespaceHostNameSuffix": { "type": "string", "defaultValue": "servicebus.windows.net" }, - "testApplicationOid": { + "tenantId": { "type": "string", + "defaultValue": "72f988bf-86f1-41af-91ab-2d7cd011db47", "metadata": { - "description": "The principal to assign the role to. This is application object id." + "description": "The tenant id to which the application and resources belong." } }, - "tenantId": { + "testApplicationId": { "type": "string", - "defaultValue": "72f988bf-86f1-41af-91ab-2d7cd011db47", "metadata": { - "description": "The tenant ID to which the application and resources belong." + "description": "The client id of the service principal used to run tests." } }, - "testApplicationId": { + "testApplicationOid": { "type": "string", "metadata": { - "description": "The application client ID used to run tests." + "description": "This is the object id of the service principal used to run tests." } }, "testApplicationSecret": { @@ -49,7 +49,7 @@ "authorizationApiVersion": "2018-09-01-preview", "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", "contributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c')]", - "AuthorizationRulesName": "[concat('authr', parameters('baseName'))]", + "authorizationRulesName": "[concat('authr', parameters('baseName'))]", "primaryAccountName": "[concat('prim', parameters('baseName'))]", "secondaryAccountName": "[concat('sec', parameters('baseName'))]", "premiumAccountName": "[concat('prem', parameters('baseName'))]", @@ -72,92 +72,8 @@ "properties": { "zoneRedundant": false, "isAutoInflateEnabled": false, - "maximumThroughputUnits": 0, - "cors": { - "corsRules": [ - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "*" - ], - "allowedMethods": [ - "DELETE", - "GET", - "HEAD", - "MERGE", - "POST", - "OPTIONS", - "PUT" - ], - "maxAgeInSeconds": 86400, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - }, - { - "allowedOrigins": [ - "example.com" - ], - "allowedMethods": [ - "GET" - ], - "maxAgeInSeconds": 8888, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - } - ] - } + "maximumThroughputUnits": 2, + "kafkaEnabled": true } }, { @@ -170,7 +86,8 @@ ], "properties": { "messageRetentionInDays": 1, - "partitionCount": 2 + "partitionCount": 2, + "status": "Active" } }, { @@ -186,6 +103,21 @@ "scope": "[resourceGroup().id]" } }, + { + "apiVersion": "[variables('authorizationApiVersion')]", + "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", + "type": "Microsoft.EventHub/namespaces/AuthorizationRules", + "dependsOn": [ + "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" + ], + "properties": { + "rights": [ + "Send", + "Listen", + "Manage" + ] + } + }, { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "[variables('authorizationApiVersion')]", @@ -212,21 +144,6 @@ "scope": "[resourceGroup().id]" } }, - { - "apiVersion": "2017-04-01", - "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", - "type": "Microsoft.EventHub/namespaces/AuthorizationRules", - "dependsOn": [ - "[concat('Microsoft.EventHub/namespaces/', variables('eventHubsNamespaceName'))]" - ], - "properties": { - "rights": [ - "Send", - "Listen", - "Manage" - ] - } - }, { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "[variables('storageApiVersion')]", From 2bc521caf5fc817da34258844efc77a76f55f384 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 12:06:02 -0800 Subject: [PATCH 07/21] Fixing authorization rules. --- sdk/eventhubs/test-resources.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index f3d00ddcb0ca..7385e2551c95 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -11,7 +11,7 @@ }, "eventHubName": { "type": "string", - "defaultValue": "java-eventhub" + "defaultValue": "javaeventhub" }, "eventHubNamespaceHostNameSuffix": { "type": "string", @@ -72,17 +72,17 @@ "properties": { "zoneRedundant": false, "isAutoInflateEnabled": false, - "maximumThroughputUnits": 2, + "maximumThroughputUnits": 0, "kafkaEnabled": true } }, { "apiVersion": "[variables('eventHubsApiVersion')]", "type": "Microsoft.EventHub/namespaces/eventhubs", - "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", + "name": "[concat(variables('eventHubsNamespaceName'), '/', parameters('eventHubName'))]", "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" + "[variables('eventHubsNamespaceName')]" ], "properties": { "messageRetentionInDays": 1, @@ -95,7 +95,7 @@ "apiVersion": "[variables('authorizationApiVersion')]", "name": "[guid(concat('eventHubsDataOwnerRoleId', variables('eventHubsNamespaceName')))]", "dependsOn": [ - "[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('eventHubName'))]" + "[variables('eventHubsNamespaceName')]" ], "properties": { "roleDefinitionId": "[variables('eventHubsDataOwnerRoleId')]", @@ -104,11 +104,11 @@ } }, { + "type": "Microsoft.EventHub/namespaces/AuthorizationRules", "apiVersion": "[variables('authorizationApiVersion')]", "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", - "type": "Microsoft.EventHub/namespaces/AuthorizationRules", "dependsOn": [ - "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" + "[variables('eventHubsNamespaceName')]" ], "properties": { "rights": [ From 11023599a88f1d23699dd7ee181b48a7a9a3bfd3 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 28 Jan 2020 12:12:01 -0800 Subject: [PATCH 08/21] Remove scope. --- sdk/eventhubs/test-resources.json | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 7385e2551c95..01865cdf7252 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -99,8 +99,7 @@ ], "properties": { "roleDefinitionId": "[variables('eventHubsDataOwnerRoleId')]", - "principalId": "[parameters('testApplicationOid')]", - "scope": "[resourceGroup().id]" + "principalId": "[parameters('testApplicationOid')]" } }, { @@ -127,8 +126,7 @@ ], "properties": { "roleDefinitionId": "[variables('blobDataContributorRoleId')]", - "principalId": "[parameters('testApplicationOid')]", - "scope": "[resourceGroup().id]" + "principalId": "[parameters('testApplicationOid')]" } }, { @@ -140,8 +138,7 @@ ], "properties": { "roleDefinitionId": "[variables('contributorRoleId')]", - "principalId": "[parameters('testApplicationOid')]", - "scope": "[resourceGroup().id]" + "principalId": "[parameters('testApplicationOid')]" } }, { From dcea38c833ac5a8493c26294cd27834e9a76e248 Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 30 Jan 2020 06:51:54 -0800 Subject: [PATCH 09/21] Removing extra resource creation. --- sdk/eventhubs/test-resources.json | 120 ++++++------------------------ 1 file changed, 21 insertions(+), 99 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 01865cdf7252..825eecee499e 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -3,7 +3,10 @@ "contentVersion": "1.0.0.0", "parameters": { "baseName": { - "type": "string" + "type": "string", + "metadata": { + "description": "Base name to append to Azure resources." + } }, "storageEndpointSuffix": { "type": "string", @@ -44,19 +47,18 @@ } }, "variables": { - "storageApiVersion": "2019-04-01", - "eventHubsApiVersion": "2017-04-01", "authorizationApiVersion": "2018-09-01-preview", + "authorizationRulesName": "[concat('authr', parameters('baseName'))]", "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", "contributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c')]", - "authorizationRulesName": "[concat('authr', parameters('baseName'))]", + "eventHubsApiVersion": "2017-04-01", + "eventHubsDataOwnerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/f526a384-b230-433a-b45c-95f59c4a2dec')]", + "eventHubsNamespaceName": "[concat('eventhub', parameters('baseName'))]", + "location": "[resourceGroup().location]", + "premiumAccountName": "[concat('prem', parameters('baseName'))]", "primaryAccountName": "[concat('prim', parameters('baseName'))]", "secondaryAccountName": "[concat('sec', parameters('baseName'))]", - "premiumAccountName": "[concat('prem', parameters('baseName'))]", - "dataLakeAccountName": "[concat('dtlk', parameters('baseName'))]", - "location": "[resourceGroup().location]", - "eventHubsNamespaceName": "[parameters('baseName')]", - "eventHubsDataOwnerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/f526a384-b230-433a-b45c-95f59c4a2dec')]" + "storageApiVersion": "2019-04-01" }, "resources": [ { @@ -77,12 +79,12 @@ } }, { - "apiVersion": "[variables('eventHubsApiVersion')]", "type": "Microsoft.EventHub/namespaces/eventhubs", + "apiVersion": "[variables('eventHubsApiVersion')]", "name": "[concat(variables('eventHubsNamespaceName'), '/', parameters('eventHubName'))]", "location": "[variables('location')]", "dependsOn": [ - "[variables('eventHubsNamespaceName')]" + "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" ], "properties": { "messageRetentionInDays": 1, @@ -90,24 +92,13 @@ "status": "Active" } }, - { - "type": "Microsoft.Authorization/roleAssignments", - "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('eventHubsDataOwnerRoleId', variables('eventHubsNamespaceName')))]", - "dependsOn": [ - "[variables('eventHubsNamespaceName')]" - ], - "properties": { - "roleDefinitionId": "[variables('eventHubsDataOwnerRoleId')]", - "principalId": "[parameters('testApplicationOid')]" - } - }, { "type": "Microsoft.EventHub/namespaces/AuthorizationRules", - "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[concat(parameters('baseName'), '/', parameters('eventHubName'))]", + "apiVersion": "[variables('eventHubsApiVersion')]", + "name": "[concat(variables('eventHubsNamespaceName'), '/RootManageSharedAccessKey')]", + "location": "[variables('location')]", "dependsOn": [ - "[variables('eventHubsNamespaceName')]" + "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" ], "properties": { "rights": [ @@ -120,24 +111,12 @@ { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('dataContributorRoleId', variables('primaryAccountName')))]", - "dependsOn": [ - "[variables('primaryAccountName')]" - ], - "properties": { - "roleDefinitionId": "[variables('blobDataContributorRoleId')]", - "principalId": "[parameters('testApplicationOid')]" - } - }, - { - "type": "Microsoft.Authorization/roleAssignments", - "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('contributorRoleId', variables('primaryAccountName')))]", + "name": "[guid(concat('eventHubsDataOwnerRoleId', variables('eventHubsNamespaceName')))]", "dependsOn": [ - "[variables('primaryAccountName')]" + "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" ], "properties": { - "roleDefinitionId": "[variables('contributorRoleId')]", + "roleDefinitionId": "[variables('eventHubsDataOwnerRoleId')]", "principalId": "[parameters('testApplicationOid')]" } }, @@ -236,39 +215,6 @@ }, "accessTier": "Hot" } - }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('dataLakeAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Standard_RAGRS", - "tier": "Standard" - }, - "kind": "StorageV2", - "properties": { - "isHnsEnabled": true, - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [], - "ipRules": [], - "defaultAction": "Allow" - }, - "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } - }, - "keySource": "Microsoft.Storage" - }, - "accessTier": "Hot" - } } ], "outputs": { @@ -286,7 +232,7 @@ }, "AZURE_EVENTHUBS_CONNECTION_STRING": { "type": "string", - "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('baseName'), 'RootManageSharedAccessKey'), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName') )]" + "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('baseName'), 'RootManageSharedAccessKey'), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName'))]" }, "AZURE_EVENTHUBS_EVENT_HUB_NAME": { "type": "string", @@ -316,22 +262,6 @@ "type": "string", "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" }, - "AZURE_STORAGE_FILE_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "AZURE_STORAGE_FILE_ENDPOINT": { - "type": "string", - "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).primaryEndpoints.file]" - }, - "AZURE_STORAGE_QUEUE_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "AZURE_STORAGE_QUEUE_ENDPOINT": { - "type": "string", - "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).primaryEndpoints.queue]" - }, "PRIMARY_STORAGE_ACCOUNT_NAME": { "type": "string", "value": "[variables('primaryAccountName')]" @@ -340,14 +270,6 @@ "type": "string", "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value]" }, - "STORAGE_DATA_LAKE_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('dataLakeAccountName')), variables('storageApiVersion')).keys[0].value]" - }, - "STORAGE_DATA_LAKE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('dataLakeAccountName')]" - }, "SECONDARY_STORAGE_ACCOUNT_NAME": { "type": "string", "value": "[variables('secondaryAccountName')]" From 5a383b64dcc4168a07a0b801c31e3ed76b4ebfdd Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 30 Jan 2020 07:16:18 -0800 Subject: [PATCH 10/21] Update output to stop using basename --- sdk/eventhubs/test-resources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 825eecee499e..fd10c6e6529d 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -232,7 +232,7 @@ }, "AZURE_EVENTHUBS_CONNECTION_STRING": { "type": "string", - "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('baseName'), 'RootManageSharedAccessKey'), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName'))]" + "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubsNamespaceName'), 'RootManageSharedAccessKey'), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName'))]" }, "AZURE_EVENTHUBS_EVENT_HUB_NAME": { "type": "string", From 1b8252a004fa45337ca892a2531c4e161676a2ef Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 30 Jan 2020 07:46:21 -0800 Subject: [PATCH 11/21] Remove unused connection string. --- sdk/eventhubs/test-resources.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index fd10c6e6529d..69c31a82c65e 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -258,10 +258,6 @@ "type": "string", "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('premiumAccountName')), variables('storageApiVersion')).keys[0].value]" }, - "AZURE_STORAGE_BLOB_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('primaryAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, "PRIMARY_STORAGE_ACCOUNT_NAME": { "type": "string", "value": "[variables('primaryAccountName')]" From 2b0230e3cc96657678a3ca10d81cc83a703ba893 Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 30 Jan 2020 08:07:22 -0800 Subject: [PATCH 12/21] Use name of created authorization rule. --- sdk/eventhubs/test-resources.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index 69c31a82c65e..b562b3627353 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -53,6 +53,7 @@ "contributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c')]", "eventHubsApiVersion": "2017-04-01", "eventHubsDataOwnerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/f526a384-b230-433a-b45c-95f59c4a2dec')]", + "eventHubsNamespaceKeyName": "RootManageSharedAccessKey", "eventHubsNamespaceName": "[concat('eventhub', parameters('baseName'))]", "location": "[resourceGroup().location]", "premiumAccountName": "[concat('prem', parameters('baseName'))]", @@ -95,7 +96,7 @@ { "type": "Microsoft.EventHub/namespaces/AuthorizationRules", "apiVersion": "[variables('eventHubsApiVersion')]", - "name": "[concat(variables('eventHubsNamespaceName'), '/RootManageSharedAccessKey')]", + "name": "[concat(variables('eventHubsNamespaceName'), '/', variables('eventHubsNamespaceKeyName'))]", "location": "[variables('location')]", "dependsOn": [ "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]" @@ -232,7 +233,7 @@ }, "AZURE_EVENTHUBS_CONNECTION_STRING": { "type": "string", - "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubsNamespaceName'), 'RootManageSharedAccessKey'), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName'))]" + "value": "[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubsNamespaceName'), variables('eventHubsNamespaceKeyName')), variables('eventHubsApiVersion')).primaryConnectionString, ';EntityPath=', parameters('eventHubName'))]" }, "AZURE_EVENTHUBS_EVENT_HUB_NAME": { "type": "string", From ba6e2bf520cff8cd6224320ec96ec67da39acca8 Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 3 Feb 2020 16:09:13 -0800 Subject: [PATCH 13/21] Remove duplicated test. --- .../ReactorConnectionIntegrationTest.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java index f31c084fdff0..32cfadee9d02 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java @@ -87,20 +87,4 @@ public void getCbsNode() { .assertNext(node -> Assertions.assertTrue(node instanceof ClaimsBasedSecurityChannel)) .verifyComplete(); } - - @Test - public void getCbsNodeAuthorize() { - // Arrange - final AzureTokenManagerProvider provider = new AzureTokenManagerProvider( - CbsAuthorizationType.SHARED_ACCESS_SIGNATURE, - getConnectionStringProperties().getEndpoint().getHost(), - ClientConstants.AZURE_ACTIVE_DIRECTORY_SCOPE); - - final String tokenAudience = provider.getScopesFromResource(getConnectionStringProperties().getEntityPath()); - - // Act & Assert - StepVerifier.create(connection.getClaimsBasedSecurityNode().flatMap(node -> node.authorize(tokenAudience, tokenAudience))) - .assertNext(expiration -> OffsetDateTime.now(ZoneOffset.UTC).isBefore(expiration)) - .verifyComplete(); - } } From 8659f878768f532506161d7c178536b02338f71b Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 3 Feb 2020 16:18:12 -0800 Subject: [PATCH 14/21] Use three partitions because of timing issues. --- ...EventHubClientMetadataIntegrationTest.java | 2 +- ...HubConsumerAsyncClientIntegrationTest.java | 21 +++++++++++++++---- ...EventHubConsumerClientIntegrationTest.java | 2 +- sdk/eventhubs/test-resources.json | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java index 0dd3db73b4bc..dd5fa9c3e555 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java @@ -19,7 +19,7 @@ * Tests the metadata operations such as fetching partition properties and event hub properties. */ public class EventHubClientMetadataIntegrationTest extends IntegrationTestBase { - private final String[] expectedPartitionIds = new String[]{"0", "1"}; + private final String[] expectedPartitionIds = new String[]{"0", "1", "2"}; private EventHubAsyncClient client; private String eventHubName; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java index fefd49d7de73..1bbf64d07a7c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java @@ -10,8 +10,10 @@ import com.azure.messaging.eventhubs.models.PartitionEvent; import com.azure.messaging.eventhubs.models.ReceiveOptions; import com.azure.messaging.eventhubs.models.SendOptions; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import reactor.core.Disposable; import reactor.core.Disposables; @@ -46,7 +48,7 @@ public class EventHubConsumerAsyncClientIntegrationTest extends IntegrationTestBase { private static final String PARTITION_ID_HEADER = "SENT_PARTITION_ID"; - private final String[] expectedPartitionIds = new String[]{"0", "1"}; + private final String[] expectedPartitionIds = new String[]{"0", "1", "2"}; private static final String MESSAGE_TRACKING_ID = UUID.randomUUID().toString(); @@ -56,6 +58,16 @@ public EventHubConsumerAsyncClientIntegrationTest() { super(new ClientLogger(EventHubConsumerAsyncClientIntegrationTest.class)); } + @BeforeAll + static void beforeAll() { + StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); + } + + @AfterAll + static void afterAll() { + StepVerifier.resetDefaultTimeout(); + } + @Override protected void beforeTest() { client = createBuilder() @@ -243,7 +255,8 @@ private static void verifyLastRetrieved(AtomicReference TestUtils.isMatchingEvent(event, MESSAGE_TRACKING_ID)) .subscribe( event -> logger.info("C1:\tReceived event sequence: {}", event.getData().getSequenceNumber()), @@ -277,7 +290,7 @@ public void sameOwnerLevelClosesFirstConsumer() throws InterruptedException { logger.info("STARTED CONSUMING FROM PARTITION 1 with C3"); final EventHubConsumerAsyncClient consumer2 = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, 1); - subscriptions.add(consumer2.receiveFromPartition(secondPartitionId, position, options) + subscriptions.add(consumer2.receiveFromPartition(lastPartition, position, options) .filter(event -> TestUtils.isMatchingEvent(event, MESSAGE_TRACKING_ID)) .subscribe( event -> logger.info("C3:\tReceived event sequence: {}", event.getData().getSequenceNumber()), diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java index f0aa90c85b00..92000554dee7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java @@ -30,7 +30,7 @@ public class EventHubConsumerClientIntegrationTest extends IntegrationTestBase { private static final int NUMBER_OF_EVENTS = 10; private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean(); - private final String[] expectedPartitionIds = new String[]{"0", "1"}; + private final String[] expectedPartitionIds = new String[]{"0", "1", "2"}; private static volatile IntegrationTestEventData testData = null; diff --git a/sdk/eventhubs/test-resources.json b/sdk/eventhubs/test-resources.json index b562b3627353..d4608ba51060 100644 --- a/sdk/eventhubs/test-resources.json +++ b/sdk/eventhubs/test-resources.json @@ -89,7 +89,7 @@ ], "properties": { "messageRetentionInDays": 1, - "partitionCount": 2, + "partitionCount": 3, "status": "Active" } }, From bd7ecd1864a931fa0e8349e7321b12f93493a500 Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 3 Feb 2020 16:43:34 -0800 Subject: [PATCH 15/21] Fix analyze issues. --- .../implementation/ReactorConnectionIntegrationTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java index 32cfadee9d02..6b0804af848a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java @@ -6,7 +6,6 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.AzureTokenManagerProvider; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ClaimsBasedSecurityChannel; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.ConnectionStringProperties; @@ -26,8 +25,6 @@ import reactor.core.scheduler.Schedulers; import reactor.test.StepVerifier; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; import java.util.Map; import static com.azure.core.amqp.implementation.CbsAuthorizationType.SHARED_ACCESS_SIGNATURE; From 0000cae71e5595bbdc8652478f4733ff4119032e Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 3 Feb 2020 17:44:30 -0800 Subject: [PATCH 16/21] Fix broken tests. --- .../EventHubAsyncClientIntegrationTest.java | 4 +- ...EventHubClientMetadataIntegrationTest.java | 1 + ...HubConsumerAsyncClientIntegrationTest.java | 4 +- ...EventHubConsumerClientIntegrationTest.java | 4 +- ...HubProducerAsyncClientIntegrationTest.java | 2 +- .../ReactorConnectionIntegrationTest.java | 87 ------------------- 6 files changed, 8 insertions(+), 94 deletions(-) delete mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java index e7c54bc8865f..35ec17a48f7c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java @@ -169,7 +169,7 @@ void getPropertiesWithCredentials() { StepVerifier.create(client.getProperties()) .assertNext(properties -> { Assertions.assertEquals(getEventHubName(), properties.getName()); - Assertions.assertEquals(2, properties.getPartitionIds().stream().count()); + Assertions.assertEquals(3, properties.getPartitionIds().stream().count()); }) .expectComplete() .verify(TIMEOUT); @@ -189,7 +189,7 @@ void getMultipleProperties() { StepVerifier.create(theClient.getProperties()) .assertNext(properties -> { Assertions.assertEquals(getEventHubName(), properties.getName()); - Assertions.assertEquals(2, properties.getPartitionIds().stream().count()); + Assertions.assertEquals(3, properties.getPartitionIds().stream().count()); }) .verifyComplete(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java index dd5fa9c3e555..e086efb4dac5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java @@ -92,6 +92,7 @@ public void getPartitionPropertiesMultipleCalls() { // Assert StepVerifier.create(partitionProperties) + .assertNext(properties -> Assertions.assertEquals(eventHubName, properties.getEventHubName())) .assertNext(properties -> Assertions.assertEquals(eventHubName, properties.getEventHubName())) .assertNext(properties -> Assertions.assertEquals(eventHubName, properties.getEventHubName())) .verifyComplete(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java index 1bbf64d07a7c..7018fcb51231 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java @@ -323,7 +323,7 @@ public void getEventHubProperties() { .assertNext(properties -> { Assertions.assertNotNull(properties); Assertions.assertEquals(consumer.getEventHubName(), properties.getName()); - Assertions.assertEquals(2, properties.getPartitionIds().stream().count()); + Assertions.assertEquals(3, properties.getPartitionIds().stream().count()); }).verifyComplete(); } finally { dispose(consumer); @@ -469,7 +469,7 @@ public void receivesMultiplePartitions() { Assertions.assertTrue(expectedPartitions.isEmpty(), "Expected messages to be received from all partitions. " + "There are: " + expectedPartitions.size()); } - + getEventHubProperties /** * Verifies we can receive from the same partition concurrently. */ diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java index 92000554dee7..2267a8e570a6 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java @@ -242,7 +242,7 @@ public void getEventHubProperties() { final EventHubProperties properties = consumer.getEventHubProperties(); Assertions.assertNotNull(properties); Assertions.assertEquals(consumer.getEventHubName(), properties.getName()); - Assertions.assertEquals(2, properties.getPartitionIds().stream().count()); + Assertions.assertEquals(3, properties.getPartitionIds().stream().count()); } finally { dispose(consumer); } @@ -262,7 +262,7 @@ public void getPartitionIds() { final IterableStream partitionIds = consumer.getPartitionIds(); final List collect = partitionIds.stream().collect(Collectors.toList()); - Assertions.assertEquals(2, collect.size()); + Assertions.assertEquals(3, collect.size()); } finally { dispose(consumer); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java index ab3114c1924a..345436baf492 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java @@ -183,7 +183,7 @@ void sendWithCredentials() { StepVerifier.create(client.getEventHubProperties()) .assertNext(properties -> { Assertions.assertEquals(getEventHubName(), properties.getName()); - Assertions.assertEquals(2, properties.getPartitionIds().stream().count()); + Assertions.assertEquals(3, properties.getPartitionIds().stream().count()); }) .expectComplete() .verify(TIMEOUT); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java deleted file mode 100644 index 6b0804af848a..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs.implementation; - -import com.azure.core.amqp.AmqpTransportType; -import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.AzureTokenManagerProvider; -import com.azure.core.amqp.implementation.ClaimsBasedSecurityChannel; -import com.azure.core.amqp.implementation.ConnectionOptions; -import com.azure.core.amqp.implementation.ConnectionStringProperties; -import com.azure.core.amqp.implementation.MessageSerializer; -import com.azure.core.amqp.implementation.ReactorConnection; -import com.azure.core.amqp.implementation.ReactorHandlerProvider; -import com.azure.core.amqp.implementation.ReactorProvider; -import com.azure.core.credential.TokenCredential; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.IntegrationTestBase; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import reactor.core.scheduler.Schedulers; -import reactor.test.StepVerifier; - -import java.util.Map; - -import static com.azure.core.amqp.implementation.CbsAuthorizationType.SHARED_ACCESS_SIGNATURE; - -public class ReactorConnectionIntegrationTest extends IntegrationTestBase { - - private ReactorConnection connection; - - @Mock - private MessageSerializer serializer; - private static String product; - private static String clientVersion; - - public ReactorConnectionIntegrationTest() { - super(new ClientLogger(ReactorConnectionIntegrationTest.class)); - } - - @BeforeAll - public static void init() { - Map properties = CoreUtils.getProperties("azure-messaging-eventhubs.properties"); - product = properties.get("name"); - clientVersion = properties.get("version"); - } - - @Override - protected void beforeTest() { - MockitoAnnotations.initMocks(this); - - ConnectionStringProperties connectionString = getConnectionStringProperties(); - - TokenCredential tokenCredential = new EventHubSharedKeyCredential(connectionString.getSharedAccessKeyName(), - connectionString.getSharedAccessKey()); - - final ConnectionOptions options = new ConnectionOptions(connectionString.getEndpoint().getHost(), - connectionString.getEntityPath(), tokenCredential, SHARED_ACCESS_SIGNATURE, AmqpTransportType.AMQP, - RETRY_OPTIONS, ProxyOptions.SYSTEM_DEFAULTS, Schedulers.single()); - - AzureTokenManagerProvider tokenManagerProvider = new AzureTokenManagerProvider(options.getAuthorizationType(), - options.getFullyQualifiedNamespace(), ClientConstants.AZURE_ACTIVE_DIRECTORY_SCOPE); - ReactorProvider reactorProvider = new ReactorProvider(); - ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(reactorProvider); - connection = new ReactorConnection("test-connection-id", options, reactorProvider, - handlerProvider, tokenManagerProvider, serializer, product, clientVersion); - } - - @Override - protected void afterTest() { - if (connection != null) { - connection.dispose(); - } - } - - @Test - public void getCbsNode() { - // Act & Assert - StepVerifier.create(connection.getClaimsBasedSecurityNode()) - .assertNext(node -> Assertions.assertTrue(node instanceof ClaimsBasedSecurityChannel)) - .verifyComplete(); - } -} From 9598d184a56bb225da9142df474583827a6825a1 Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 3 Feb 2020 17:49:28 -0800 Subject: [PATCH 17/21] Fix BackCompatTest --- .../azure/messaging/eventhubs/BackCompatTest.java | 12 +++++++++--- .../EventHubConsumerAsyncClientIntegrationTest.java | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java index dbb62f6a9db9..a07d5d0084ae 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java @@ -72,7 +72,12 @@ protected void afterTest() { @Test public void backCompatWithJavaSDKOlderThan0110() { // Arrange + final Duration timeout = Duration.ofSeconds(30); final String messageTrackingValue = UUID.randomUUID().toString(); + final PartitionProperties properties = consumer.getPartitionProperties(PARTITION_ID).block(timeout); + + Assertions.assertNotNull(properties); + final EventPosition position = EventPosition.fromSequenceNumber(properties.getLastEnqueuedSequenceNumber(), true); // until version 0.10.0 - we used to have Properties as HashMap // This specific combination is intended to test the back compat - with the new Properties type as HashMap @@ -96,12 +101,13 @@ public void backCompatWithJavaSDKOlderThan0110() { final EventData eventData = serializer.deserialize(message, EventData.class); // Act & Assert - StepVerifier.create(consumer.receiveFromPartition(PARTITION_ID, EventPosition.latest()) + producer.send(eventData, sendOptions).block(TIMEOUT); + + StepVerifier.create(consumer.receiveFromPartition(PARTITION_ID, position) .filter(received -> isMatchingEvent(received, messageTrackingValue)).take(1)) - .then(() -> producer.send(eventData, sendOptions).block(TIMEOUT)) .assertNext(event -> validateAmqpProperties(applicationProperties, event.getData())) .expectComplete() - .verify(Duration.ofSeconds(45)); + .verify(timeout); } private void validateAmqpProperties(Map expected, EventData event) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java index 7018fcb51231..b3eb55d081f9 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java @@ -469,7 +469,7 @@ public void receivesMultiplePartitions() { Assertions.assertTrue(expectedPartitions.isEmpty(), "Expected messages to be received from all partitions. " + "There are: " + expectedPartitions.size()); } - getEventHubProperties + /** * Verifies we can receive from the same partition concurrently. */ From eef4681a3cbe2b62154693582a0473f38334f49f Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 4 Feb 2020 14:44:58 -0800 Subject: [PATCH 18/21] Update logging. --- ...HubConsumerAsyncClientIntegrationTest.java | 20 +++++++++++-------- sdk/eventhubs/tests.yml | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java index b3eb55d081f9..39c46e798aa9 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java @@ -150,21 +150,25 @@ public void parallelCreationOfReceivers() { @Test public void lastEnqueuedInformationIsNotUpdated() { // Arrange - final String secondPartitionId = "1"; - final EventPosition position = EventPosition.fromEnqueuedTime(Instant.now()); + final String firstPartition = "0"; + final PartitionProperties properties = client.getPartitionProperties(firstPartition).block(); + Assertions.assertNotNull(properties); + + final EventPosition position = EventPosition.fromSequenceNumber(properties.getLastEnqueuedSequenceNumber()); final EventHubConsumerAsyncClient consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, 1); final ReceiveOptions options = new ReceiveOptions().setTrackLastEnqueuedEventProperties(false); final AtomicBoolean isActive = new AtomicBoolean(true); final int expectedNumber = 5; final EventHubProducerAsyncClient producer = client.createProducer(); - final Disposable producerEvents = getEvents(isActive).flatMap(event -> producer.send(event)).subscribe( - sent -> logger.info("Event sent."), - error -> logger.error("Error sending event", error)); + final SendOptions sendOptions = new SendOptions().setPartitionId(firstPartition); + final Disposable producerEvents = getEvents(isActive) + .flatMap(event -> producer.send(event, sendOptions)) + .subscribe(sent -> logger.info("Event sent."), error -> logger.error("Error sending event", error)); // Act & Assert try { - StepVerifier.create(consumer.receiveFromPartition(secondPartitionId, position, options) + StepVerifier.create(consumer.receiveFromPartition(firstPartition, position, options) .take(expectedNumber)) .assertNext(event -> { Assertions.assertNull(event.getLastEnqueuedEventProperties(), "'lastEnqueuedEventProperties' " @@ -476,8 +480,8 @@ public void receivesMultiplePartitions() { @Test public void multipleReceiversSamePartition() throws InterruptedException { // Arrange - final EventHubConsumerAsyncClient consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, 50); - final EventHubConsumerAsyncClient consumer2 = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, 50); + final EventHubConsumerAsyncClient consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, 1); + final EventHubConsumerAsyncClient consumer2 = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, 1); final String partitionId = "1"; final PartitionProperties properties = consumer.getPartitionProperties(partitionId).block(TIMEOUT); Assertions.assertNotNull(properties, "Should have been able to get partition properties."); diff --git a/sdk/eventhubs/tests.yml b/sdk/eventhubs/tests.yml index eefd68daa071..67f91bfd8807 100644 --- a/sdk/eventhubs/tests.yml +++ b/sdk/eventhubs/tests.yml @@ -7,4 +7,4 @@ jobs: TimeoutInMinutes: 120 EnvVars: AZURE_TEST_MODE: RECORD - AZURE_LOG_LEVEL: 4 + AZURE_LOG_LEVEL: 2 From 6479da16a165830066901edb6e3c282d9e30ab73 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 4 Feb 2020 16:41:55 -0800 Subject: [PATCH 19/21] Dispose of invalid clients. --- ...EventHubClientMetadataIntegrationTest.java | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java index e086efb4dac5..92941e51898c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java @@ -112,16 +112,20 @@ public void getPartitionPropertiesInvalidToken() { .buildAsyncClient(); // Act & Assert - StepVerifier.create(invalidClient.getProperties()) - .expectErrorSatisfies(error -> { - Assertions.assertTrue(error instanceof AmqpException); - - AmqpException exception = (AmqpException) error; - Assertions.assertEquals(AmqpErrorCondition.UNAUTHORIZED_ACCESS, exception.getErrorCondition()); - Assertions.assertFalse(exception.isTransient()); - Assertions.assertFalse(CoreUtils.isNullOrEmpty(exception.getMessage())); - }) - .verify(); + try { + StepVerifier.create(invalidClient.getProperties()) + .expectErrorSatisfies(error -> { + Assertions.assertTrue(error instanceof AmqpException); + + AmqpException exception = (AmqpException) error; + Assertions.assertEquals(AmqpErrorCondition.UNAUTHORIZED_ACCESS, exception.getErrorCondition()); + Assertions.assertFalse(exception.isTransient()); + Assertions.assertFalse(CoreUtils.isNullOrEmpty(exception.getMessage())); + }) + .verify(); + } finally { + invalidClient.close(); + } } /** @@ -138,15 +142,19 @@ public void getPartitionPropertiesNonExistentHub() { .buildAsyncClient(); // Act & Assert - StepVerifier.create(invalidClient.getPartitionIds()) - .expectErrorSatisfies(error -> { - Assertions.assertTrue(error instanceof AmqpException); - - AmqpException exception = (AmqpException) error; - Assertions.assertEquals(AmqpErrorCondition.NOT_FOUND, exception.getErrorCondition()); - Assertions.assertFalse(exception.isTransient()); - Assertions.assertFalse(CoreUtils.isNullOrEmpty(exception.getMessage())); - }) - .verify(); + try { + StepVerifier.create(invalidClient.getPartitionIds()) + .expectErrorSatisfies(error -> { + Assertions.assertTrue(error instanceof AmqpException); + + AmqpException exception = (AmqpException) error; + Assertions.assertEquals(AmqpErrorCondition.NOT_FOUND, exception.getErrorCondition()); + Assertions.assertFalse(exception.isTransient()); + Assertions.assertFalse(CoreUtils.isNullOrEmpty(exception.getMessage())); + }) + .verify(); + } finally { + invalidClient.close(); + } } } From f5e409f9099b2f2e8609cf49a86cbb7a96018f80 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 4 Feb 2020 17:56:37 -0800 Subject: [PATCH 20/21] Adding assertion for it. --- .../eventhubs/EventHubConsumerClientIntegrationTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java index 2267a8e570a6..36085afda46e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientIntegrationTest.java @@ -63,6 +63,8 @@ protected void beforeTest() { testData = setupEventTestData(producer, NUMBER_OF_EVENTS, options); } + Assertions.assertNotNull(testData, "'testData' should have been populated."); + startingPosition = EventPosition.fromEnqueuedTime(testData.getEnqueuedTime()); consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, DEFAULT_PREFETCH_COUNT); } From c4bb7969486f9589c98c34214420f6db000ac2b4 Mon Sep 17 00:00:00 2001 From: Connie Date: Wed, 5 Feb 2020 12:12:30 -0800 Subject: [PATCH 21/21] Update ProxySendTest --- .../azure/messaging/eventhubs/ProxySendTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java index 7de2d3698e96..369bd96276fb 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java @@ -10,6 +10,7 @@ import com.azure.messaging.eventhubs.models.EventPosition; import com.azure.messaging.eventhubs.models.SendOptions; import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; @@ -20,7 +21,7 @@ import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; -import java.time.Instant; +import java.time.Duration; import java.util.Collections; import java.util.List; import java.util.UUID; @@ -40,6 +41,8 @@ public ProxySendTest() { @BeforeAll public static void initialize() throws Exception { + StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); + proxyServer = new SimpleProxy(PROXY_PORT); proxyServer.start(t -> { }); @@ -60,6 +63,8 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { @AfterAll public static void cleanupClient() throws Exception { + StepVerifier.resetDefaultTimeout(); + if (proxyServer != null) { proxyServer.stop(); } @@ -89,7 +94,11 @@ public void sendEvents() { final SendOptions options = new SendOptions().setPartitionId(PARTITION_ID); final EventHubProducerAsyncClient producer = builder.buildAsyncProducerClient(); final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, messageId); - final Instant sendTime = Instant.now(); + final PartitionProperties information = producer.getPartitionProperties(PARTITION_ID).block(); + + Assertions.assertNotNull(information, "Should receive partition information."); + + final EventPosition position = EventPosition.fromSequenceNumber(information.getLastEnqueuedSequenceNumber()); final EventHubConsumerAsyncClient consumer = builder .consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME) .buildAsyncConsumerClient(); @@ -101,7 +110,7 @@ public void sendEvents() { .verify(TIMEOUT); // Assert - StepVerifier.create(consumer.receiveFromPartition(PARTITION_ID, EventPosition.fromEnqueuedTime(sendTime)) + StepVerifier.create(consumer.receiveFromPartition(PARTITION_ID, position) .filter(x -> TestUtils.isMatchingEvent(x, messageId)).take(NUMBER_OF_EVENTS)) .expectNextCount(NUMBER_OF_EVENTS) .expectComplete()