Commit 59b4de23 authored by Ronak Sakhuja's avatar Ronak Sakhuja
Browse files

Merge branch 'master' of...

Merge branch 'master' of https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure into users/rosakhuj/cosmosRetry
parents 726851f2 10b07b14
......@@ -20,7 +20,7 @@
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-azure</artifactId>
<packaging>jar</packaging>
<version>0.9.0-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
<name>core-lib-azure</name>
<properties>
......@@ -37,7 +37,7 @@
<azure.appinsights.log4j.version>2.6.3</azure.appinsights.log4j.version>
<azure.spring.boot.version>3.4.0</azure.spring.boot.version>
<lombok.version>1.18.16</lombok.version>
<osdu.oscorecommon.version>0.9.0-rc13</osdu.oscorecommon.version>
<osdu.oscorecommon.version>0.9.0</osdu.oscorecommon.version>
<azure-mgmt-eventgrid.version>1.0.0-beta-3</azure-mgmt-eventgrid.version>
<azure-security-keyvault-keys.version>4.2.3</azure-security-keyvault-keys.version>
<documentdb-bulkexecutor.version>2.12.0</documentdb-bulkexecutor.version>
......
......@@ -71,7 +71,7 @@ public class PartitionServiceEventGridClient {
Validators.checkNotNullAndNotEmpty(partitionId, "partitionId");
Validators.checkNotNullAndNotEmpty(topicName, "topicName");
Map<String, EventGridTopicPartitionInfoAzure> eventGridTopicPartitionInfoAzure = getAllEventGridTopicsInPartition(partitionId);
Map<String, EventGridTopicPartitionInfoAzure> eventGridTopicPartitionInfoAzure = getAllRelevantEventGridTopicsInPartition(partitionId, topicName);
if (!eventGridTopicPartitionInfoAzure.containsKey(topicName)) {
throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Invalid EventGrid Partition configuration for the partition " + partitionId, "Please refer to wiki here <>");
......@@ -80,20 +80,21 @@ public class PartitionServiceEventGridClient {
}
/**
* Get partition info.
* Get relevant event grid topics.
*
* @param partitionId Partition Id
* @return Partition info
* @param topicName Topic Name
* @return Event Grid Topics
* @throws AppException Exception thrown by {@link IPartitionFactory}
* @throws PartitionException Exception thrown by {@link IPartitionFactory}
*/
Map<String, EventGridTopicPartitionInfoAzure> getAllEventGridTopicsInPartition(final String partitionId) throws AppException, PartitionException {
Map<String, EventGridTopicPartitionInfoAzure> getAllRelevantEventGridTopicsInPartition(final String partitionId, final String topicName) throws AppException, PartitionException {
PartitionInfo partitionInfo = getPartitionInfo(partitionId);
Map<String, Property> propertyMap = partitionInfo.getProperties();
Map<String, EventGridTopicPartitionInfoAzure> topics = new HashMap<>();
for (Map.Entry<String, Property> property : propertyMap.entrySet()) {
if (isEventGridProperty(property)) {
if (isEventGridProperty(property) && property.getKey().contains(topicName)) {
StringTokenizer stringTokenizer = new StringTokenizer(property.getKey(), "-");
if (stringTokenizer.countTokens() == 2) {
addEventGridTopicName(topics, property, stringTokenizer);
......
# Copyright © Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is place holder for all the common configuration across services. The properties
# which are common across all services can be placed here.
#
# In order to use the properties in this file (i.e., common.properties) in any service, configure
# the environment variable SPRING_CONFIG_NAME = common,application in that service. Doing this will
# configure the service to use properties from this file along with application.properties of that service.
#Enable tomcat metrics
server.tomcat.mbeanregistry.enabled=true
#Tomcat threads configuration
server.tomcat.min-spare-threads=100
\ No newline at end of file
......@@ -66,7 +66,6 @@ public class PartitionServiceEventGridClientTest {
final String eventGridTopicName2 = "testEventGridTopicName2";
final String eventGridTopicAccessKey2 = "testEventGridTopicAccessKey2";
final String topicId1 = "recordstopic";
final String topicId2 = "testtopic";
Map<String, Property> properties = new HashMap<>();
properties.put("id", Property.builder().value(PARTITION_ID).build());
......@@ -85,18 +84,15 @@ public class PartitionServiceEventGridClientTest {
// Act
Map<String, EventGridTopicPartitionInfoAzure> eventGridTopicPartitionInfoAzureMap =
partitionServiceClientSpy.getAllEventGridTopicsInPartition("tenant1");
partitionServiceClientSpy.getAllRelevantEventGridTopicsInPartition("tenant1", "recordstopic");
// Assert
assertEquals(eventGridTopicPartitionInfoAzureMap.size(), 2);
assertEquals(eventGridTopicPartitionInfoAzureMap.size(), 1);
assertTrue(eventGridTopicPartitionInfoAzureMap.containsKey(topicId1));
assertTrue(eventGridTopicPartitionInfoAzureMap.containsKey(topicId2));
// Validate that the EventGridTopicPartitionInfo is mapped correctly.
assertEquals(eventGridTopicPartitionInfoAzureMap.get(topicId1).getTopicName(), eventGridTopicName1);
assertEquals(eventGridTopicPartitionInfoAzureMap.get(topicId1).getTopicAccessKey(), eventGridTopicAccessKey1);
assertEquals(eventGridTopicPartitionInfoAzureMap.get(topicId2).getTopicName(), eventGridTopicName2);
assertEquals(eventGridTopicPartitionInfoAzureMap.get(topicId2).getTopicAccessKey(), eventGridTopicAccessKey2);
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment