Skip to content
Snippets Groups Projects
Commit 5cb4704a authored by Harshika Dhoot's avatar Harshika Dhoot
Browse files

updating variable names to more meaningful ones like in m16

parent 2db33b7e
No related branches found
No related tags found
1 merge request!588updating variable names to more meaningful ones like in m16
...@@ -39,8 +39,8 @@ public class AzureBootstrapConfig { ...@@ -39,8 +39,8 @@ public class AzureBootstrapConfig {
@Value("${azure.servicebus.reindex.topic-name}") @Value("${azure.servicebus.reindex.topic-name}")
private String serviceBusReindexTopicName; private String serviceBusReindexTopicName;
@Value("${publish.indexing.progress}") @Value("${publish.to.azure.servicebus.topic.enabled}")
private boolean publishIndexingProgress; private boolean shouldPublishToServiceBusTopic;
@Value("${ELASTIC_CACHE_EXPIRATION}") @Value("${ELASTIC_CACHE_EXPIRATION}")
private Integer elasticCacheExpiration; private Integer elasticCacheExpiration;
...@@ -67,10 +67,8 @@ public class AzureBootstrapConfig { ...@@ -67,10 +67,8 @@ public class AzureBootstrapConfig {
} }
@Bean @Bean
@Named("PUBLISH_TO_INDEXING_PROGRESS_TOPIC") @Named("PUBLISH_TO_SERVICE_BUS_INDEXERSTATUS_TOPIC_ENABLED")
public Boolean publishIndexingProgress() { public boolean shouldPublishToServiceBusTopic() { return shouldPublishToServiceBusTopic;}
return publishIndexingProgress;
}
@Bean @Bean
@Named("ELASTIC_CACHE_EXPIRATION") @Named("ELASTIC_CACHE_EXPIRATION")
......
...@@ -57,8 +57,8 @@ public class PublisherImpl implements IPublisher { ...@@ -57,8 +57,8 @@ public class PublisherImpl implements IPublisher {
private String serviceBusTopic; private String serviceBusTopic;
@Inject @Inject
@Named("PUBLISH_TO_INDEXING_PROGRESS_TOPIC") @Named("PUBLISH_TO_SERVICE_BUS_INDEXERSTATUS_TOPIC_ENABLED")
private boolean publishToIndexingProgressTopic; private boolean shouldPublishToServiceBusTopic;
@Override @Override
public void publishStatusChangedTagsToTopic(DpsHeaders headers, JobStatus indexerBatchStatus) throws Exception { public void publishStatusChangedTagsToTopic(DpsHeaders headers, JobStatus indexerBatchStatus) throws Exception {
...@@ -76,7 +76,7 @@ public class PublisherImpl implements IPublisher { ...@@ -76,7 +76,7 @@ public class PublisherImpl implements IPublisher {
message.setContentType("application/json"); message.setContentType("application/json");
try { try {
if(publishToIndexingProgressTopic) { if(shouldPublishToServiceBusTopic) {
logger.debug("Indexer publishes message " + headers.getCorrelationId()); logger.debug("Indexer publishes message " + headers.getCorrelationId());
topicClientFactory.getClient(headers.getPartitionId(), serviceBusTopic).send(message); topicClientFactory.getClient(headers.getPartitionId(), serviceBusTopic).send(message);
} }
......
...@@ -69,7 +69,7 @@ azure.cosmosdb.database=${cosmosdb_database} ...@@ -69,7 +69,7 @@ azure.cosmosdb.database=${cosmosdb_database}
#AzureServiceBusconfiguration #AzureServiceBusconfiguration
azure.servicebus.topic-name=${servicebus_topic_name} azure.servicebus.topic-name=${servicebus_topic_name}
azure.servicebus.reindex.topic-name=${reindex_topic_name} azure.servicebus.reindex.topic-name=${reindex_topic_name}
publish.indexing.progress=false publish.to.azure.servicebus.topic.enabled=false
#Indexer-Queue-header #Indexer-Queue-header
indexer.queue.key=abcd indexer.queue.key=abcd
......
...@@ -23,8 +23,8 @@ public class PublisherImplTest { ...@@ -23,8 +23,8 @@ public class PublisherImplTest {
private static String serviceBusTopicField = "serviceBusTopic"; private static String serviceBusTopicField = "serviceBusTopic";
private static String serviceBusTopicValue = "recordChangeTopic"; private static String serviceBusTopicValue = "recordChangeTopic";
private static String publishToIndexingProgressTopicField = "publishToIndexingProgressTopic"; private static String shouldPublishToServiceBusTopicField = "shouldPublishToServiceBusTopic";
private static Boolean publishToIndexingProgressTopicValue = true; private static Boolean shouldPublishToServiceBusTopicValue = true;
private static String partitionId = "opendes"; private static String partitionId = "opendes";
@Mock @Mock
...@@ -45,7 +45,7 @@ public class PublisherImplTest { ...@@ -45,7 +45,7 @@ public class PublisherImplTest {
@Test @Test
public void should_invoke_getPartitionIdOfdpsHeaders_when_publishStatusChangedTagsToTopic_isCalled() throws Exception { public void should_invoke_getPartitionIdOfdpsHeaders_when_publishStatusChangedTagsToTopic_isCalled() throws Exception {
ReflectionTestUtils.setField(sut,serviceBusTopicField,serviceBusTopicValue); ReflectionTestUtils.setField(sut,serviceBusTopicField,serviceBusTopicValue);
ReflectionTestUtils.setField(sut,publishToIndexingProgressTopicField,publishToIndexingProgressTopicValue); ReflectionTestUtils.setField(sut,shouldPublishToServiceBusTopicField,shouldPublishToServiceBusTopicValue);
when(dpsHeaders.getPartitionId()).thenReturn(partitionId); when(dpsHeaders.getPartitionId()).thenReturn(partitionId);
sut.publishStatusChangedTagsToTopic(dpsHeaders, jobStatus); sut.publishStatusChangedTagsToTopic(dpsHeaders, jobStatus);
...@@ -56,7 +56,7 @@ public class PublisherImplTest { ...@@ -56,7 +56,7 @@ public class PublisherImplTest {
@Test @Test
public void should_invoke_getAccountIdOfDpsHeaders_when_publishStatusChangedTagsToTopic_isCalledWithGetPartitionIdReturningEmptyString() throws Exception { public void should_invoke_getAccountIdOfDpsHeaders_when_publishStatusChangedTagsToTopic_isCalledWithGetPartitionIdReturningEmptyString() throws Exception {
ReflectionTestUtils.setField(sut,serviceBusTopicField,serviceBusTopicValue); ReflectionTestUtils.setField(sut,serviceBusTopicField,serviceBusTopicValue);
ReflectionTestUtils.setField(sut,publishToIndexingProgressTopicField,publishToIndexingProgressTopicValue); ReflectionTestUtils.setField(sut,shouldPublishToServiceBusTopicField,shouldPublishToServiceBusTopicValue);
when(dpsHeaders.getPartitionId()).thenReturn(""); when(dpsHeaders.getPartitionId()).thenReturn("");
sut.publishStatusChangedTagsToTopic(dpsHeaders, jobStatus); sut.publishStatusChangedTagsToTopic(dpsHeaders, jobStatus);
...@@ -67,7 +67,7 @@ public class PublisherImplTest { ...@@ -67,7 +67,7 @@ public class PublisherImplTest {
@Test @Test
public void should_invoke_getClientOftopicClientFactory_when_publishStatusChangedTagsToTopic_isCalled() throws Exception { public void should_invoke_getClientOftopicClientFactory_when_publishStatusChangedTagsToTopic_isCalled() throws Exception {
ReflectionTestUtils.setField(sut,serviceBusTopicField,serviceBusTopicValue); ReflectionTestUtils.setField(sut,serviceBusTopicField,serviceBusTopicValue);
ReflectionTestUtils.setField(sut,publishToIndexingProgressTopicField,publishToIndexingProgressTopicValue); ReflectionTestUtils.setField(sut,shouldPublishToServiceBusTopicField,shouldPublishToServiceBusTopicValue);
when(dpsHeaders.getPartitionId()).thenReturn(partitionId); when(dpsHeaders.getPartitionId()).thenReturn(partitionId);
sut.publishStatusChangedTagsToTopic(dpsHeaders, jobStatus); sut.publishStatusChangedTagsToTopic(dpsHeaders, jobStatus);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment