diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 18b6b07f21f42..1c10ec6f67b8a 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -492,7 +492,7 @@ the main ServiceBusClientBuilder. --> - + diff --git a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/java/com/azure/spring/cloud/actuate/autoconfigure/eventhubs/EventHubHealthConfiguration.java b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/java/com/azure/spring/cloud/actuate/autoconfigure/eventhubs/EventHubsHealthConfiguration.java similarity index 81% rename from sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/java/com/azure/spring/cloud/actuate/autoconfigure/eventhubs/EventHubHealthConfiguration.java rename to sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/java/com/azure/spring/cloud/actuate/autoconfigure/eventhubs/EventHubsHealthConfiguration.java index 5a024bd2fd35b..5f04b2517156a 100644 --- a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/java/com/azure/spring/cloud/actuate/autoconfigure/eventhubs/EventHubHealthConfiguration.java +++ b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/java/com/azure/spring/cloud/actuate/autoconfigure/eventhubs/EventHubsHealthConfiguration.java @@ -6,8 +6,8 @@ import com.azure.messaging.eventhubs.EventHubClientBuilder; import com.azure.messaging.eventhubs.EventHubConsumerAsyncClient; import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; -import com.azure.spring.cloud.actuate.eventhubs.EventHubHealthIndicator; -import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubAutoConfiguration; +import com.azure.spring.cloud.actuate.eventhubs.EventHubsHealthIndicator; +import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsAutoConfiguration; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator; @@ -22,17 +22,17 @@ */ @Configuration @ConditionalOnClass({ EventHubClientBuilder.class, HealthIndicator.class }) -@AutoConfigureAfter(AzureEventHubAutoConfiguration.class) -public class EventHubHealthConfiguration { +@AutoConfigureAfter(AzureEventHubsAutoConfiguration.class) +public class EventHubsHealthConfiguration { @Bean @ConditionalOnBean(EventHubClientBuilder.class) @ConditionalOnEnabledHealthIndicator("azure-eventhub") - public EventHubHealthIndicator eventHubHealthIndicator( + public EventHubsHealthIndicator eventHubsHealthIndicator( ObjectProvider producerAsyncClients, ObjectProvider consumerAsyncClients) { - return new EventHubHealthIndicator(producerAsyncClients.getIfAvailable(), + return new EventHubsHealthIndicator(producerAsyncClients.getIfAvailable(), consumerAsyncClients.getIfAvailable()); } diff --git a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/resources/META-INF/spring.factories b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/resources/META-INF/spring.factories index cae4193157890..c84995fcc9377 100644 --- a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/resources/META-INF/spring.factories +++ b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/src/main/resources/META-INF/spring.factories @@ -1,6 +1,6 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.azure.spring.cloud.actuate.autoconfigure.cosmos.CosmosHealthConfiguration,\ -com.azure.spring.cloud.actuate.autoconfigure.eventhubs.EventHubHealthConfiguration,\ +com.azure.spring.cloud.actuate.autoconfigure.eventhubs.EventHubsHealthConfiguration,\ com.azure.spring.cloud.actuate.autoconfigure.keyvault.KeyVaultHealthConfiguration,\ com.azure.spring.cloud.actuate.autoconfigure.storage.StorageBlobHealthConfiguration,\ com.azure.spring.cloud.actuate.autoconfigure.storage.StorageFileHealthConfiguration,\ diff --git a/sdk/spring/spring-cloud-azure-actuator/src/main/java/com/azure/spring/cloud/actuate/eventhubs/EventHubHealthIndicator.java b/sdk/spring/spring-cloud-azure-actuator/src/main/java/com/azure/spring/cloud/actuate/eventhubs/EventHubsHealthIndicator.java similarity index 87% rename from sdk/spring/spring-cloud-azure-actuator/src/main/java/com/azure/spring/cloud/actuate/eventhubs/EventHubHealthIndicator.java rename to sdk/spring/spring-cloud-azure-actuator/src/main/java/com/azure/spring/cloud/actuate/eventhubs/EventHubsHealthIndicator.java index 0d1a335eb129c..f13e8f693fdc1 100644 --- a/sdk/spring/spring-cloud-azure-actuator/src/main/java/com/azure/spring/cloud/actuate/eventhubs/EventHubHealthIndicator.java +++ b/sdk/spring/spring-cloud-azure-actuator/src/main/java/com/azure/spring/cloud/actuate/eventhubs/EventHubsHealthIndicator.java @@ -11,9 +11,9 @@ import java.time.Duration; /** - * Health indicator for Event Hubs. + * Health indicator for Azure Event Hubs. */ -public class EventHubHealthIndicator implements HealthIndicator { +public class EventHubsHealthIndicator implements HealthIndicator { private static final int DEFAULT_TIMEOUT = 30; @@ -22,8 +22,8 @@ public class EventHubHealthIndicator implements HealthIndicator { private int timeout = DEFAULT_TIMEOUT; - public EventHubHealthIndicator(EventHubProducerAsyncClient producerAsyncClient, - EventHubConsumerAsyncClient consumerAsyncClient) { + public EventHubsHealthIndicator(EventHubProducerAsyncClient producerAsyncClient, + EventHubConsumerAsyncClient consumerAsyncClient) { this.producerAsyncClient = producerAsyncClient; this.consumerAsyncClient = consumerAsyncClient; } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfiguration.java index 7e42ad661dbe6..9b4d91010e7bb 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfiguration.java @@ -5,7 +5,7 @@ import com.azure.messaging.eventhubs.EventHubClientBuilder; import com.azure.messaging.eventhubs.checkpointstore.blob.BlobCheckpointStore; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.service.storage.blob.BlobServiceClientBuilderFactory; import com.azure.storage.blob.BlobContainerAsyncClient; import org.slf4j.Logger; @@ -39,12 +39,12 @@ public class AzureBlobCheckpointStoreConfiguration { public BlobCheckpointStore blobCheckpointStore( @Qualifier(EVENT_HUB_PROCESSOR_CHECKPOINT_STORE_STORAGE_CLIENT_BUILDER_FACTORY_BEAN_NAME) BlobServiceClientBuilderFactory factory, - AzureEventHubProperties eventHubProperties, + AzureEventHubsProperties eventHubsProperties, ObjectProvider initializers) { final BlobContainerAsyncClient blobContainerAsyncClient = factory .build() .buildAsyncClient() - .getBlobContainerAsyncClient(eventHubProperties.getProcessor().getCheckpointStore().getContainerName()); + .getBlobContainerAsyncClient(eventHubsProperties.getProcessor().getCheckpointStore().getContainerName()); initializers.ifAvailable(initializer -> initializer.init(blobContainerAsyncClient)); @@ -65,17 +65,18 @@ public BlobCheckpointStoreContainerInitializer blobCheckpointStoreContainerIniti @Bean(EVENT_HUB_PROCESSOR_CHECKPOINT_STORE_STORAGE_CLIENT_BUILDER_FACTORY_BEAN_NAME) @ConditionalOnMissingBean(name = EVENT_HUB_PROCESSOR_CHECKPOINT_STORE_STORAGE_CLIENT_BUILDER_FACTORY_BEAN_NAME) - public BlobServiceClientBuilderFactory eventHubProcessorBlobServiceClientBuilderFactory(AzureEventHubProperties eventHubProperties) { - return new BlobServiceClientBuilderFactory(getCheckpointStoreProperties(eventHubProperties)); + public BlobServiceClientBuilderFactory eventHubProcessorBlobServiceClientBuilderFactory( + AzureEventHubsProperties eventHubsProperties) { + return new BlobServiceClientBuilderFactory(getCheckpointStoreProperties(eventHubsProperties)); } - private AzureEventHubProperties.Processor.BlobCheckpointStore getCheckpointStoreProperties( - AzureEventHubProperties ehProperties) { + private AzureEventHubsProperties.Processor.BlobCheckpointStore getCheckpointStoreProperties( + AzureEventHubsProperties ehProperties) { - AzureEventHubProperties.Processor.BlobCheckpointStore result = new AzureEventHubProperties.Processor + AzureEventHubsProperties.Processor.BlobCheckpointStore result = new AzureEventHubsProperties.Processor .BlobCheckpointStore(); - AzureEventHubProperties.Processor.BlobCheckpointStore csProperties = ehProperties.getProcessor() - .getCheckpointStore(); + AzureEventHubsProperties.Processor.BlobCheckpointStore csProperties = ehProperties.getProcessor() + .getCheckpointStore(); mergeAzureCommonProperties(ehProperties, csProperties, result); BeanUtils.copyProperties(csProperties, result); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsAutoConfiguration.java similarity index 71% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubAutoConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsAutoConfiguration.java index fe8930935661b..1575598b38995 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsAutoConfiguration.java @@ -6,7 +6,7 @@ import com.azure.messaging.eventhubs.EventHubClientBuilder; import com.azure.spring.cloud.autoconfigure.AzureServiceConfigurationBase; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnAnyProperty; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -22,22 +22,22 @@ @ConditionalOnProperty(value = "spring.cloud.azure.eventhubs.enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = { "connection-string", "namespace" }) @Import({ - AzureEventHubClientBuilderConfiguration.class, - AzureEventHubConsumerClientConfiguration.class, - AzureEventHubProducerClientConfiguration.class, + AzureEventHubsClientBuilderConfiguration.class, + AzureEventHubsConsumerClientConfiguration.class, + AzureEventHubsProducerClientConfiguration.class, AzureBlobCheckpointStoreConfiguration.class, - AzureEventProcessorClientConfiguration.class + AzureEventHubsProcessorClientConfiguration.class }) -public class AzureEventHubAutoConfiguration extends AzureServiceConfigurationBase { +public class AzureEventHubsAutoConfiguration extends AzureServiceConfigurationBase { - public AzureEventHubAutoConfiguration(AzureGlobalProperties azureGlobalProperties) { + public AzureEventHubsAutoConfiguration(AzureGlobalProperties azureGlobalProperties) { super(azureGlobalProperties); } @Bean - @ConfigurationProperties(AzureEventHubProperties.PREFIX) - public AzureEventHubProperties azureEventHubProperties() { - return loadProperties(this.azureGlobalProperties, new AzureEventHubProperties()); + @ConfigurationProperties(AzureEventHubsProperties.PREFIX) + public AzureEventHubsProperties azureEventHubsProperties() { + return loadProperties(this.azureGlobalProperties, new AzureEventHubsProperties()); } } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubClientBuilderConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsClientBuilderConfiguration.java similarity index 86% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubClientBuilderConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsClientBuilderConfiguration.java index 67e7823f3ca10..519d2692e1fba 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubClientBuilderConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsClientBuilderConfiguration.java @@ -5,7 +5,7 @@ import com.azure.messaging.eventhubs.EventHubClientBuilder; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnAnyProperty; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.core.AzureSpringIdentifier; import com.azure.spring.core.connectionstring.ConnectionStringProvider; import com.azure.spring.core.connectionstring.StaticConnectionStringProvider; @@ -24,7 +24,7 @@ @Configuration(proxyBeanMethods = false) @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = { "connection-string", "namespace" }) @ConditionalOnProperty(prefix = "spring.cloud.azure.eventhubs", name = "event-hub-name") -class AzureEventHubClientBuilderConfiguration { +class AzureEventHubsClientBuilderConfiguration { @Bean @ConditionalOnMissingBean @@ -34,8 +34,8 @@ public EventHubClientBuilder eventHubClientBuilder(EventHubClientBuilderFactory @Bean @ConditionalOnMissingBean - public EventHubClientBuilderFactory eventHubClientBuilderFactory(AzureEventHubProperties properties, - ObjectProvider> connectionStringProviders) { + public EventHubClientBuilderFactory eventHubClientBuilderFactory(AzureEventHubsProperties properties, + ObjectProvider> connectionStringProviders) { final EventHubClientBuilderFactory builderFactory = new EventHubClientBuilderFactory(properties); builderFactory.setConnectionStringProvider(connectionStringProviders.getIfAvailable()); @@ -45,10 +45,10 @@ public EventHubClientBuilderFactory eventHubClientBuilderFactory(AzureEventHubPr @Bean @ConditionalOnProperty("spring.cloud.azure.eventhubs.connection-string") - public StaticConnectionStringProvider eventHubStaticConnectionStringProvider( - AzureEventHubProperties eventHubProperties) { - return new StaticConnectionStringProvider<>(AzureServiceType.EVENT_HUB, - eventHubProperties.getConnectionString()); + public StaticConnectionStringProvider eventHubsStaticConnectionStringProvider( + AzureEventHubsProperties eventHubsProperties) { + return new StaticConnectionStringProvider<>(AzureServiceType.EVENT_HUBS, + eventHubsProperties.getConnectionString()); } } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubConsumerClientConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsConsumerClientConfiguration.java similarity index 88% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubConsumerClientConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsConsumerClientConfiguration.java index d6a03d358e944..0b3404d6b27bc 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubConsumerClientConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsConsumerClientConfiguration.java @@ -8,7 +8,7 @@ import com.azure.messaging.eventhubs.EventHubConsumerClient; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnAnyProperty; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnMissingProperty; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.core.AzureSpringIdentifier; import com.azure.spring.core.connectionstring.StaticConnectionStringProvider; import com.azure.spring.core.service.AzureServiceType; @@ -32,12 +32,12 @@ */ @Configuration(proxyBeanMethods = false) @Import({ - AzureEventHubConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class, - AzureEventHubConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class + AzureEventHubsConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class, + AzureEventHubsConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class }) @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = { "event-hub-name", "consumer.event-hub-name" }) @ConditionalOnProperty(prefix = "spring.cloud.azure.eventhubs.consumer", name = "consumer-group") -class AzureEventHubConsumerClientConfiguration { +class AzureEventHubsConsumerClientConfiguration { @ConditionalOnMissingProperty(prefix = "spring.cloud.azure.eventhubs.consumer", name = { "connection-string", "namespace" }) @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = { "connection-string", "namespace" }) @@ -46,7 +46,7 @@ class AzureEventHubConsumerClientConfiguration { static class SharedConsumerConnectionConfiguration { private final EventHubClientBuilder builder; - SharedConsumerConnectionConfiguration(AzureEventHubProperties properties, EventHubClientBuilder builder) { + SharedConsumerConnectionConfiguration(AzureEventHubsProperties properties, EventHubClientBuilder builder) { this.builder = builder; PropertyMapper mapper = new PropertyMapper(); @@ -71,10 +71,10 @@ public EventHubConsumerClient eventHubConsumerClient(EventHubClientBuilder build @Configuration(proxyBeanMethods = false) static class DedicatedConsumerConnectionConfiguration { - private final AzureEventHubProperties.Consumer consumerProperties; + private final AzureEventHubsProperties.Consumer consumerProperties; - DedicatedConsumerConnectionConfiguration(AzureEventHubProperties eventHubProperties) { - this.consumerProperties = eventHubProperties.buildConsumerProperties(); + DedicatedConsumerConnectionConfiguration(AzureEventHubsProperties eventHubsProperties) { + this.consumerProperties = eventHubsProperties.buildConsumerProperties(); } @Bean(EVENT_HUB_CONSUMER_CLIENT_BUILDER_FACTORY_BEAN_NAME) @@ -83,7 +83,7 @@ public EventHubClientBuilderFactory eventHubClientBuilderFactoryForConsumer() { final EventHubClientBuilderFactory builderFactory = new EventHubClientBuilderFactory(this.consumerProperties); - builderFactory.setConnectionStringProvider(new StaticConnectionStringProvider<>(AzureServiceType.EVENT_HUB, + builderFactory.setConnectionStringProvider(new StaticConnectionStringProvider<>(AzureServiceType.EVENT_HUBS, this.consumerProperties.getConnectionString())); builderFactory.setSpringIdentifier(AzureSpringIdentifier.AZURE_SPRING_EVENT_HUB); return builderFactory; diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubMessagingAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsMessagingAutoConfiguration.java similarity index 69% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubMessagingAutoConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsMessagingAutoConfiguration.java index c3e59d3f5b6bb..4a94149488003 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubMessagingAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsMessagingAutoConfiguration.java @@ -5,14 +5,14 @@ import com.azure.messaging.eventhubs.CheckpointStore; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnAnyProperty; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.core.properties.AzurePropertiesUtils; -import com.azure.spring.eventhubs.core.EventHubProcessorContainer; +import com.azure.spring.eventhubs.core.EventHubsProcessorContainer; import com.azure.spring.eventhubs.core.EventHubsTemplate; -import com.azure.spring.eventhubs.core.processor.DefaultEventHubNamespaceProcessorFactory; -import com.azure.spring.eventhubs.core.processor.EventHubProcessorFactory; -import com.azure.spring.eventhubs.core.producer.DefaultEventHubNamespaceProducerFactory; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; +import com.azure.spring.eventhubs.core.processor.DefaultEventHubsNamespaceProcessorFactory; +import com.azure.spring.eventhubs.core.processor.EventHubsProcessorFactory; +import com.azure.spring.eventhubs.core.producer.DefaultEventHubsNamespaceProducerFactory; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; import com.azure.spring.eventhubs.core.properties.NamespaceProperties; import com.azure.spring.eventhubs.core.properties.ProcessorProperties; import com.azure.spring.eventhubs.core.properties.ProducerProperties; @@ -33,23 +33,23 @@ /** * An auto-configuration for Event Hub, which provides {@link EventHubsTemplate} and {@link - * EventHubProcessorContainer}. + * EventHubsProcessorContainer}. */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(EventHubsTemplate.class) -@AutoConfigureAfter(AzureEventHubAutoConfiguration.class) +@AutoConfigureAfter(AzureEventHubsAutoConfiguration.class) @ConditionalOnProperty(value = "spring.cloud.azure.eventhubs.enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = { "connection-string", "namespace" }) -@ConditionalOnBean(AzureEventHubProperties.class) +@ConditionalOnBean(AzureEventHubsProperties.class) @Import({ - AzureEventHubMessagingAutoConfiguration.EventHubsTemplateConfiguration.class, - AzureEventHubMessagingAutoConfiguration.ProcessorContainerConfiguration.class + AzureEventHubsMessagingAutoConfiguration.EventHubsTemplateConfiguration.class, + AzureEventHubsMessagingAutoConfiguration.ProcessorContainerConfiguration.class }) -public class AzureEventHubMessagingAutoConfiguration { +public class AzureEventHubsMessagingAutoConfiguration { @Bean @ConditionalOnMissingBean - public NamespaceProperties eventHubNamespaceProperties(AzureEventHubProperties properties) { + public NamespaceProperties eventHubNamespaceProperties(AzureEventHubsProperties properties) { NamespaceProperties namespaceProperties = new NamespaceProperties(); AzurePropertiesUtils.copyAzureCommonProperties(properties, namespaceProperties); BeanUtils.copyProperties(properties, namespaceProperties); @@ -58,7 +58,7 @@ public NamespaceProperties eventHubNamespaceProperties(AzureEventHubProperties p } /** - * Configure the {@link EventHubProcessorContainer} + * Configure the {@link EventHubsProcessorContainer} */ @Configuration(proxyBeanMethods = false) @ConditionalOnBean(CheckpointStore.class) @@ -67,16 +67,17 @@ public static class ProcessorContainerConfiguration { @Bean @ConditionalOnMissingBean - public EventHubProcessorFactory defaultEventProcessorFactory( + public EventHubsProcessorFactory defaultEventHubsNamespaceProcessorFactory( NamespaceProperties properties, CheckpointStore checkpointStore, ObjectProvider, ProcessorProperties>> suppliers) { - return new DefaultEventHubNamespaceProcessorFactory(checkpointStore, properties, suppliers.getIfAvailable()); + return new DefaultEventHubsNamespaceProcessorFactory(checkpointStore, properties, + suppliers.getIfAvailable()); } @Bean @ConditionalOnMissingBean - public EventHubProcessorContainer eventProcessorContainer(EventHubProcessorFactory processorFactory) { - return new EventHubProcessorContainer(processorFactory); + public EventHubsProcessorContainer eventHubsProcessorContainer(EventHubsProcessorFactory processorFactory) { + return new EventHubsProcessorContainer(processorFactory); } } @@ -89,15 +90,15 @@ public static class EventHubsTemplateConfiguration { @Bean @ConditionalOnMissingBean - public EventHubProducerFactory defaultEventHubProducerFactory( + public EventHubsProducerFactory defaultEventHubsNamespaceProducerFactory( NamespaceProperties properties, ObjectProvider> suppliers) { - return new DefaultEventHubNamespaceProducerFactory(properties, suppliers.getIfAvailable()); + return new DefaultEventHubsNamespaceProducerFactory(properties, suppliers.getIfAvailable()); } @Bean @ConditionalOnMissingBean - public EventHubsTemplate eventHubsTemplate(EventHubProducerFactory producerFactory) { + public EventHubsTemplate eventHubsTemplate(EventHubsProducerFactory producerFactory) { return new EventHubsTemplate(producerFactory); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventProcessorClientConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorClientConfiguration.java similarity index 69% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventProcessorClientConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorClientConfiguration.java index c5fa62e3073a8..25be6369861d2 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventProcessorClientConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorClientConfiguration.java @@ -7,7 +7,7 @@ import com.azure.messaging.eventhubs.EventProcessorClient; import com.azure.messaging.eventhubs.EventProcessorClientBuilder; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnAnyProperty; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.cloud.resourcemanager.connectionstring.AbstractArmConnectionStringProvider; import com.azure.spring.core.connectionstring.StaticConnectionStringProvider; import com.azure.spring.core.service.AzureServiceType; @@ -24,20 +24,22 @@ import org.springframework.context.annotation.Configuration; import org.springframework.util.StringUtils; +import static com.azure.spring.core.service.AzureServiceType.EVENT_HUBS; + /** * Configures a {@link EventProcessorClient}. */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(EventProcessorClientBuilder.class) @ConditionalOnBean({ EventProcessingListener.class, CheckpointStore.class }) -@Conditional(AzureEventProcessorClientConfiguration.ProcessorAvailableCondition.class) -class AzureEventProcessorClientConfiguration { +@Conditional(AzureEventHubsProcessorClientConfiguration.ProcessorAvailableCondition.class) +class AzureEventHubsProcessorClientConfiguration { - private final AzureEventHubProperties.Processor processorProperties; + private final AzureEventHubsProperties.Processor processorProperties; - AzureEventProcessorClientConfiguration(AzureEventHubProperties eventHubProperties) { - this.processorProperties = eventHubProperties.buildProcessorProperties(); + AzureEventHubsProcessorClientConfiguration(AzureEventHubsProperties eventHubsProperties) { + this.processorProperties = eventHubsProperties.buildProcessorProperties(); } @Bean @@ -48,16 +50,15 @@ public EventProcessorClient eventProcessorClient(EventProcessorClientBuilder bui @Bean @ConditionalOnMissingBean - public EventProcessorClientBuilderFactory factory(CheckpointStore checkpointStore, - EventProcessingListener listener, - ObjectProvider> connectionStringProviders) { - final EventProcessorClientBuilderFactory factory = new EventProcessorClientBuilderFactory(this.processorProperties, - checkpointStore, - listener); + public EventProcessorClientBuilderFactory eventProcessorClientBuilderFactory( + CheckpointStore checkpointStore, EventProcessingListener listener, + ObjectProvider> connectionStringProviders) { + final EventProcessorClientBuilderFactory factory = + new EventProcessorClientBuilderFactory(this.processorProperties, checkpointStore, listener); if (StringUtils.hasText(this.processorProperties.getConnectionString())) { - factory.setConnectionStringProvider(new StaticConnectionStringProvider<>(AzureServiceType.EVENT_HUB, - this.processorProperties.getConnectionString())); + factory.setConnectionStringProvider( + new StaticConnectionStringProvider<>(EVENT_HUBS, this.processorProperties.getConnectionString())); } else { factory.setConnectionStringProvider(connectionStringProviders.getIfAvailable()); } @@ -66,7 +67,7 @@ public EventProcessorClientBuilderFactory factory(CheckpointStore checkpointStor @Bean @ConditionalOnMissingBean - public EventProcessorClientBuilder evenProcessorClientBuilder(EventProcessorClientBuilderFactory factory) { + public EventProcessorClientBuilder eventProcessorClientBuilder(EventProcessorClientBuilderFactory factory) { return factory.build(); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProducerClientConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProducerClientConfiguration.java similarity index 92% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProducerClientConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProducerClientConfiguration.java index 8906adfd74118..0415d0303c8cf 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProducerClientConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProducerClientConfiguration.java @@ -8,7 +8,7 @@ import com.azure.messaging.eventhubs.EventHubProducerClient; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnAnyProperty; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnMissingProperty; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.core.AzureSpringIdentifier; import com.azure.spring.core.connectionstring.StaticConnectionStringProvider; import com.azure.spring.core.service.AzureServiceType; @@ -29,7 +29,7 @@ */ @Configuration(proxyBeanMethods = false) @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = { "event-hub-name", "producer.event-hub-name" }) -class AzureEventHubProducerClientConfiguration { +class AzureEventHubsProducerClientConfiguration { @ConditionalOnMissingProperty(prefix = "spring.cloud.azure.eventhubs.producer", name = { "connection-string", "namespace" }) @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = { "connection-string", "namespace" }) @@ -53,10 +53,10 @@ public EventHubProducerClient eventHubProducerClient(EventHubClientBuilder build @Configuration(proxyBeanMethods = false) static class DedicatedProducerConnectionConfiguration { - private final AzureEventHubProperties.Producer producerProperties; + private final AzureEventHubsProperties.Producer producerProperties; - DedicatedProducerConnectionConfiguration(AzureEventHubProperties eventHubProperties) { - this.producerProperties = eventHubProperties.buildProducerProperties(); + DedicatedProducerConnectionConfiguration(AzureEventHubsProperties eventHubsProperties) { + this.producerProperties = eventHubsProperties.buildProducerProperties(); } @Bean(EVENT_HUB_PRODUCER_CLIENT_BUILDER_FACTORY_BEAN_NAME) @@ -65,7 +65,7 @@ public EventHubClientBuilderFactory eventHubClientBuilderFactoryForProducer() { final EventHubClientBuilderFactory builderFactory = new EventHubClientBuilderFactory(this.producerProperties); - builderFactory.setConnectionStringProvider(new StaticConnectionStringProvider<>(AzureServiceType.EVENT_HUB, + builderFactory.setConnectionStringProvider(new StaticConnectionStringProvider<>(AzureServiceType.EVENT_HUBS, this.producerProperties.getConnectionString())); builderFactory.setSpringIdentifier(AzureSpringIdentifier.AZURE_SPRING_EVENT_HUB); return builderFactory; diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/kafka/AzureEventHubKafkaAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/kafka/AzureEventHubsKafkaAutoConfiguration.java similarity index 93% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/kafka/AzureEventHubKafkaAutoConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/kafka/AzureEventHubsKafkaAutoConfiguration.java index 8f7c39a366245..9101848ad5227 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/kafka/AzureEventHubKafkaAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/kafka/AzureEventHubsKafkaAutoConfiguration.java @@ -3,7 +3,7 @@ package com.azure.spring.cloud.autoconfigure.eventhubs.kafka; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.core.connectionstring.ConnectionStringProvider; import com.azure.spring.core.service.AzureServiceType; import org.springframework.beans.factory.ObjectProvider; @@ -23,7 +23,7 @@ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(KafkaTemplate.class) //@EnableConfigurationProperties(AzureEventHubProperties.class) -public class AzureEventHubKafkaAutoConfiguration { +public class AzureEventHubsKafkaAutoConfiguration { private static final String SECURITY_PROTOCOL = "security.protocol"; private static final String SASL_SSL = "SASL_SSL"; private static final String SASL_JAAS_CONFIG = "sasl.jaas.config"; @@ -38,8 +38,8 @@ public class AzureEventHubKafkaAutoConfiguration { @Bean // TODO (xiada): refactor this logic public KafkaProperties kafkaProperties( - AzureEventHubProperties eventHubProperties, - ObjectProvider> connectionStringProviders) { + AzureEventHubsProperties eventHubsProperties, + ObjectProvider> connectionStringProviders) { KafkaProperties kafkaProperties = new KafkaProperties(); /* String endpoint = namespace.serviceBusEndpoint(); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubCommonProperties.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubsCommonProperties.java similarity index 87% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubCommonProperties.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubsCommonProperties.java index 2b0aa0519f4ad..2516f0bdda4a4 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubCommonProperties.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubsCommonProperties.java @@ -4,12 +4,12 @@ package com.azure.spring.cloud.autoconfigure.eventhubs.properties; import com.azure.spring.cloud.autoconfigure.properties.AbstractAzureAmqpCP; -import com.azure.spring.core.connectionstring.implementation.EventHubConnectionString; +import com.azure.spring.core.connectionstring.implementation.EventHubsConnectionString; /** - * Azure Event Hub related properties. + * Azure Event Hubs related properties. */ -public abstract class AzureEventHubCommonProperties extends AbstractAzureAmqpCP { +public abstract class AzureEventHubsCommonProperties extends AbstractAzureAmqpCP { protected String domainName = "servicebus.windows.net"; protected String namespace; @@ -21,14 +21,14 @@ protected String extractFqdnFromConnectionString() { if (this.connectionString == null) { return null; } - return new EventHubConnectionString(this.connectionString).getFullyQualifiedNamespace(); + return new EventHubsConnectionString(this.connectionString).getFullyQualifiedNamespace(); } protected String extractEventHubNameFromConnectionString() { if (this.connectionString == null) { return null; } - return new EventHubConnectionString(this.connectionString).getEntityPath(); + return new EventHubsConnectionString(this.connectionString).getEntityPath(); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubProperties.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubsProperties.java similarity index 91% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubProperties.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubsProperties.java index 8e4b658871f0f..016f7acb546f1 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubProperties.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/properties/AzureEventHubsProperties.java @@ -5,10 +5,10 @@ import com.azure.spring.cloud.autoconfigure.storage.blob.properties.AzureStorageBlobProperties; import com.azure.spring.core.properties.AzurePropertiesUtils; -import com.azure.spring.service.eventhubs.properties.EventHubConsumerDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubNamespaceDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubProcessorDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubProducerDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsConsumerDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsNamespaceDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsProcessorDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsProducerDescriptor; import org.springframework.beans.BeanUtils; import org.springframework.boot.context.properties.PropertyMapper; @@ -17,9 +17,9 @@ import java.util.Map; /** - * Azure Event Hub related properties. + * Azure Event Hubs related properties. */ -public class AzureEventHubProperties extends AzureEventHubCommonProperties implements EventHubNamespaceDescriptor { +public class AzureEventHubsProperties extends AzureEventHubsCommonProperties implements EventHubsNamespaceDescriptor { public static final String PREFIX = "spring.cloud.azure.eventhubs"; @@ -129,14 +129,14 @@ public Processor getProcessor() { /** * Properties of an Event Hub producer. */ - public static class Producer extends AzureEventHubCommonProperties implements EventHubProducerDescriptor { + public static class Producer extends AzureEventHubsCommonProperties implements EventHubsProducerDescriptor { } /** * Properties of an Event Hub consumer. */ - public static class Consumer extends AzureEventHubCommonProperties implements EventHubConsumerDescriptor { + public static class Consumer extends AzureEventHubsCommonProperties implements EventHubsConsumerDescriptor { /** * Name of the consumer group this consumer is associated with. @@ -170,7 +170,7 @@ public void setPrefetchCount(Integer prefetchCount) { /** * Properties of an Event Hub processor. */ - public static class Processor extends Consumer implements EventHubProcessorDescriptor { + public static class Processor extends Consumer implements EventHubsProcessorDescriptor { private Boolean trackLastEnqueuedEventProperties; private Map initialPartitionEventPosition = new HashMap<>(); @@ -218,14 +218,14 @@ public BlobCheckpointStore getCheckpointStore() { /** * Event processor load balancing properties. */ - public static class LoadBalancing extends EventHubProcessorDescriptor.LoadBalancing { + public static class LoadBalancing extends EventHubsProcessorDescriptor.LoadBalancing { } /** * Event processor batch properties. */ - public static class Batch extends EventHubProcessorDescriptor.Batch { + public static class Batch extends EventHubsProcessorDescriptor.Batch { } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/messaging/AzureMessagingListenerAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/messaging/AzureMessagingListenerAutoConfiguration.java index 50eae39a7ab7a..d7b80b48e93d3 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/messaging/AzureMessagingListenerAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/messaging/AzureMessagingListenerAutoConfiguration.java @@ -3,7 +3,7 @@ package com.azure.spring.cloud.autoconfigure.messaging; -import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubMessagingAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsMessagingAutoConfiguration; import com.azure.spring.cloud.autoconfigure.servicebus.AzureServiceBusTopicOperationAutoConfiguration; import com.azure.spring.messaging.annotation.EnableAzureMessaging; import com.azure.spring.messaging.config.AzureListenerAnnotationBeanPostProcessor; @@ -24,7 +24,7 @@ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(EnableAzureMessaging.class) @AutoConfigureAfter({ - AzureEventHubMessagingAutoConfiguration.class, + AzureEventHubsMessagingAutoConfiguration.class, AzureServiceBusTopicOperationAutoConfiguration.class }) @ConditionalOnBean(SubscribeByGroupOperation.class) diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubResourceManagerAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubsResourceManagerAutoConfiguration.java similarity index 52% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubResourceManagerAutoConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubsResourceManagerAutoConfiguration.java index aad0f5d2a37a4..7acf09cc8835c 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubResourceManagerAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubsResourceManagerAutoConfiguration.java @@ -6,10 +6,10 @@ import com.azure.messaging.eventhubs.EventHubClientBuilder; import com.azure.resourcemanager.AzureResourceManager; import com.azure.spring.cloud.autoconfigure.condition.ConditionalOnMissingProperty; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; -import com.azure.spring.cloud.resourcemanager.connectionstring.EventHubArmConnectionStringProvider; -import com.azure.spring.eventhubs.provisioning.EventHubProvisioner; -import com.azure.spring.eventhubs.provisioning.arm.DefaultEventHubProvisioner; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; +import com.azure.spring.cloud.resourcemanager.connectionstring.EventHubsArmConnectionStringProvider; +import com.azure.spring.eventhubs.provisioning.EventHubsProvisioner; +import com.azure.spring.eventhubs.provisioning.arm.DefaultEventHubsProvisioner; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -21,36 +21,36 @@ /** * */ -@ConditionalOnProperty(prefix = AzureEventHubProperties.PREFIX, value = "enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnProperty(prefix = AzureEventHubsProperties.PREFIX, value = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnClass(EventHubClientBuilder.class) @ConditionalOnBean(AzureResourceManager.class) @AutoConfigureAfter(AzureResourceManagerAutoConfiguration.class) -public class AzureEventHubResourceManagerAutoConfiguration extends AzureServiceResourceManagerConfigurationBase { +public class AzureEventHubsResourceManagerAutoConfiguration extends AzureServiceResourceManagerConfigurationBase { - private final AzureEventHubProperties eventHubProperties; + private final AzureEventHubsProperties eventHubsProperties; - public AzureEventHubResourceManagerAutoConfiguration(AzureResourceManager azureResourceManager, - AzureEventHubProperties eventHubProperties) { + public AzureEventHubsResourceManagerAutoConfiguration(AzureResourceManager azureResourceManager, + AzureEventHubsProperties eventHubsProperties) { super(azureResourceManager); - this.eventHubProperties = eventHubProperties; + this.eventHubsProperties = eventHubsProperties; } @Bean @ConditionalOnMissingBean - @ConditionalOnProperty(prefix = AzureEventHubProperties.PREFIX, value = "namespace") - @ConditionalOnMissingProperty(prefix = AzureEventHubProperties.PREFIX, value = "connection-string") + @ConditionalOnProperty(prefix = AzureEventHubsProperties.PREFIX, value = "namespace") + @ConditionalOnMissingProperty(prefix = AzureEventHubsProperties.PREFIX, value = "connection-string") @Order - public EventHubArmConnectionStringProvider eventHubArmConnectionStringProvider() { + public EventHubsArmConnectionStringProvider eventHubsArmConnectionStringProvider() { - return new EventHubArmConnectionStringProvider(this.azureResourceManager, - this.eventHubProperties.getResource(), - this.eventHubProperties.getNamespace()); + return new EventHubsArmConnectionStringProvider(this.azureResourceManager, + this.eventHubsProperties.getResource(), + this.eventHubsProperties.getNamespace()); } @Bean @ConditionalOnMissingBean - public EventHubProvisioner eventHubProvisioner() { - return new DefaultEventHubProvisioner(this.azureResourceManager, this.eventHubProperties.getResource()); + public EventHubsProvisioner eventHubsProvisioner() { + return new DefaultEventHubsProvisioner(this.azureResourceManager, this.eventHubsProperties.getResource()); } } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/resources/META-INF/spring.factories b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/resources/META-INF/spring.factories index 987ae1957ee64..bcf36e881e432 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/resources/META-INF/spring.factories +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/resources/META-INF/spring.factories @@ -17,9 +17,9 @@ com.azure.spring.cloud.autoconfigure.cosmos.AzureCosmosAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.data.cosmos.CosmosDataAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.data.cosmos.CosmosRepositoriesAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.data.cosmos.CosmosReactiveRepositoriesAutoConfiguration,\ -com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubAutoConfiguration,\ -com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubMessagingAutoConfiguration,\ -com.azure.spring.cloud.autoconfigure.eventhubs.kafka.AzureEventHubKafkaAutoConfiguration,\ +com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsAutoConfiguration,\ +com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsMessagingAutoConfiguration,\ +com.azure.spring.cloud.autoconfigure.eventhubs.kafka.AzureEventHubsKafkaAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.keyvault.secrets.AzureKeyVaultSecretAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.keyvault.certificates.AzureKeyVaultCertificateAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.servicebus.AzureServiceBusAutoConfiguration,\ @@ -32,7 +32,7 @@ com.azure.spring.cloud.autoconfigure.storage.fileshare.AzureStorageFileShareReso com.azure.spring.cloud.autoconfigure.storage.queue.AzureStorageQueueAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.storage.AzureStorageQueueOperationAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.resourcemanager.AzureResourceManagerAutoConfiguration,\ -com.azure.spring.cloud.autoconfigure.resourcemanager.AzureEventHubResourceManagerAutoConfiguration,\ +com.azure.spring.cloud.autoconfigure.resourcemanager.AzureEventHubsResourceManagerAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.resourcemanager.AzureServiceBusResourceManagerAutoConfiguration,\ com.azure.spring.cloud.autoconfigure.resourcemanager.AzureStorageQueueResourceManagerAutoConfiguration diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/AzureServiceConfigurationBaseTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/AzureServiceConfigurationBaseTest.java index fdb867f54023f..fae261af2c54c 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/AzureServiceConfigurationBaseTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/AzureServiceConfigurationBaseTest.java @@ -9,8 +9,8 @@ import com.azure.security.keyvault.secrets.SecretClientBuilder; import com.azure.spring.cloud.autoconfigure.cosmos.AzureCosmosAutoConfiguration; import com.azure.spring.cloud.autoconfigure.cosmos.properties.AzureCosmosProperties; -import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubAutoConfiguration; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.cloud.autoconfigure.keyvault.secrets.AzureKeyVaultSecretAutoConfiguration; import com.azure.spring.cloud.autoconfigure.keyvault.secrets.properties.AzureKeyVaultSecretProperties; import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties; @@ -39,7 +39,7 @@ class AzureServiceConfigurationBaseTest { .withConfiguration(AutoConfigurations.of( AzureCosmosAutoConfiguration.class, AzureKeyVaultSecretAutoConfiguration.class, - AzureEventHubAutoConfiguration.class)); + AzureEventHubsAutoConfiguration.class)); @Test void configureGlobalShouldApplyToAzureCosmosProperties() { @@ -152,8 +152,8 @@ void configureGlobalShouldApplyToAmqpAzureEventHubsProperties() { "spring.cloud.azure.eventhubs.namespace=test" ) .run(context -> { - assertThat(context).hasSingleBean(AzureEventHubProperties.class); - final AzureEventHubProperties properties = context.getBean(AzureEventHubProperties.class); + assertThat(context).hasSingleBean(AzureEventHubsProperties.class); + final AzureEventHubsProperties properties = context.getBean(AzureEventHubsProperties.class); assertThat(properties).extracting("credential.clientId").isEqualTo("global-client-id"); assertThat(properties).extracting("credential.clientSecret").isEqualTo("global-client-secret"); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalConfigurationEnvironmentPostProcessorTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalConfigurationEnvironmentPostProcessorTest.java index 47fbec7331b55..9c834169f2a17 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalConfigurationEnvironmentPostProcessorTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalConfigurationEnvironmentPostProcessorTest.java @@ -4,7 +4,7 @@ package com.azure.spring.cloud.autoconfigure.context; import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.cloud.autoconfigure.keyvault.secrets.properties.AzureKeyVaultSecretProperties; import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties; import com.azure.spring.core.aware.AzureProfileAware; @@ -149,10 +149,10 @@ void azureSdkEnvShouldBindCorrect() { PropertiesPropertySource propertiesPropertySource = new PropertiesPropertySource("test-properties", properties); ConfigurableEnvironment environment = getEnvironment(propertiesPropertySource); - AzureEventHubProperties eventHubProperties = Binder.get(environment).bind(AzureEventHubProperties.PREFIX, AzureEventHubProperties.class).get(); + AzureEventHubsProperties eventHubsProperties = Binder.get(environment).bind(AzureEventHubsProperties.PREFIX, AzureEventHubsProperties.class).get(); AzureKeyVaultSecretProperties keyVaultSecretProperties = Binder.get(environment).bind(AzureKeyVaultSecretProperties.PREFIX, AzureKeyVaultSecretProperties.class).get(); - assertEquals("test-connection-str", eventHubProperties.getConnectionString()); + assertEquals("test-connection-str", eventHubsProperties.getConnectionString()); assertEquals("test-endpoint", keyVaultSecretProperties.getEndpoint()); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfigurationTest.java index e826d42b5635c..67c69522e50dd 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureBlobCheckpointStoreConfigurationTest.java @@ -5,7 +5,7 @@ import com.azure.messaging.eventhubs.checkpointstore.blob.BlobCheckpointStore; import com.azure.spring.cloud.autoconfigure.context.AzureContextUtils; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties; import com.azure.spring.cloud.autoconfigure.storage.blob.AzureStorageBlobAutoConfiguration; import com.azure.spring.service.storage.blob.BlobServiceClientBuilderFactory; @@ -45,15 +45,15 @@ void configureWithoutRequiredProperties() { @Test void configureWithStorageInfo() { - AzureEventHubProperties azureEventHubProperties = new AzureEventHubProperties(); - azureEventHubProperties.getProcessor().getCheckpointStore().setAccountName("sa"); - azureEventHubProperties.getProcessor().getCheckpointStore().setContainerName("abc"); + AzureEventHubsProperties azureEventHubsProperties = new AzureEventHubsProperties(); + azureEventHubsProperties.getProcessor().getCheckpointStore().setAccountName("sa"); + azureEventHubsProperties.getProcessor().getCheckpointStore().setContainerName("abc"); this.contextRunner .withPropertyValues( "spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=abc", "spring.cloud.azure.eventhubs.processor.checkpoint-store.account-name=sa" ) - .withBean(AzureEventHubProperties.class, () -> azureEventHubProperties) + .withBean(AzureEventHubsProperties.class, () -> azureEventHubsProperties) .withBean(BlobCheckpointStore.class, () -> mock(BlobCheckpointStore.class)) .run(context -> { assertThat(context).hasSingleBean(AzureBlobCheckpointStoreConfiguration.class); @@ -64,9 +64,9 @@ void configureWithStorageInfo() { @Test void shouldWorkWithStorageClientConfiguration() { - AzureEventHubProperties azureEventHubProperties = new AzureEventHubProperties(); - azureEventHubProperties.getProcessor().getCheckpointStore().setAccountName("sa"); - azureEventHubProperties.getProcessor().getCheckpointStore().setContainerName("abc"); + AzureEventHubsProperties azureEventHubsProperties = new AzureEventHubsProperties(); + azureEventHubsProperties.getProcessor().getCheckpointStore().setAccountName("sa"); + azureEventHubsProperties.getProcessor().getCheckpointStore().setContainerName("abc"); this.contextRunner .withUserConfiguration(AzureStorageBlobAutoConfiguration.class) @@ -76,7 +76,7 @@ void shouldWorkWithStorageClientConfiguration() { "spring.cloud.azure.storage.blob.account-name=sa", "spring.cloud.azure.storage.blob.container-name=abc" ) - .withBean(AzureEventHubProperties.class, () -> azureEventHubProperties) + .withBean(AzureEventHubsProperties.class, () -> azureEventHubsProperties) .withBean(AzureGlobalProperties.class, AzureGlobalProperties::new) .withBean(BlobCheckpointStore.class, () -> mock(BlobCheckpointStore.class)) .run(context -> { diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubAutoConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsAutoConfigurationTest.java similarity index 85% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubAutoConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsAutoConfigurationTest.java index 95302f3a2ce4d..598df69eb8c08 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubAutoConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsAutoConfigurationTest.java @@ -4,7 +4,7 @@ package com.azure.spring.cloud.autoconfigure.eventhubs; import com.azure.messaging.eventhubs.EventHubClientBuilder; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -15,30 +15,30 @@ import static org.assertj.core.api.Assertions.assertThat; -class AzureEventHubAutoConfigurationTest { +class AzureEventHubsAutoConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubAutoConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsAutoConfiguration.class)); @Test void configureWithoutEventHubClientBuilder() { this.contextRunner .withClassLoader(new FilteredClassLoader(EventHubClientBuilder.class)) - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubAutoConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsAutoConfiguration.class)); } @Test void configureWithEventHubDisabled() { this.contextRunner .withPropertyValues("spring.cloud.azure.eventhubs.enabled=false") - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubAutoConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsAutoConfiguration.class)); } @Test void configureWithoutConnectionStringAndNamespace() { this.contextRunner .withPropertyValues("spring.cloud.azure.eventhubs.enabled=true") - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubAutoConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsAutoConfiguration.class)); } @Test @@ -46,7 +46,7 @@ void configureWithNamespace() { this.contextRunner .withPropertyValues("spring.cloud.azure.eventhubs.namespace=test-eventhub-namespace") .withBean(AzureGlobalProperties.class, AzureGlobalProperties::new) - .run(context -> assertThat(context).hasSingleBean(AzureEventHubProperties.class)); + .run(context -> assertThat(context).hasSingleBean(AzureEventHubsProperties.class)); } @Test @@ -54,11 +54,11 @@ void configureWithConnectionString() { this.contextRunner .withPropertyValues("spring.cloud.azure.eventhubs.connection-string=test-connection-string") .withBean(AzureGlobalProperties.class, AzureGlobalProperties::new) - .run(context -> assertThat(context).hasSingleBean(AzureEventHubProperties.class)); + .run(context -> assertThat(context).hasSingleBean(AzureEventHubsProperties.class)); } @Test - void configureAzureEventHubProperties() { + void configureAzureEventHubsProperties() { AzureGlobalProperties azureProperties = new AzureGlobalProperties(); azureProperties.getCredential().setClientId("azure-client-id"); azureProperties.getCredential().setClientSecret("azure-client-secret"); @@ -72,8 +72,8 @@ void configureAzureEventHubProperties() { "spring.cloud.azure.eventhubs.connection-string=test-connection-string" ) .run(context -> { - assertThat(context).hasSingleBean(AzureEventHubProperties.class); - final AzureEventHubProperties properties = context.getBean(AzureEventHubProperties.class); + assertThat(context).hasSingleBean(AzureEventHubsProperties.class); + final AzureEventHubsProperties properties = context.getBean(AzureEventHubsProperties.class); assertThat(properties).extracting("credential.clientId").isEqualTo("eventhubs-client-id"); assertThat(properties).extracting("credential.clientSecret").isEqualTo("azure-client-secret"); assertThat(properties).extracting("retry.backoff.delay").isEqualTo(Duration.ofMinutes(2)); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubClientBuilderConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsClientBuilderConfigurationTest.java similarity index 81% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubClientBuilderConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsClientBuilderConfigurationTest.java index 1e9d64d18b6a7..e7d0dcbd361df 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubClientBuilderConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsClientBuilderConfigurationTest.java @@ -15,14 +15,14 @@ import static com.azure.spring.cloud.autoconfigure.eventhubs.EventHubsTestUtils.CONNECTION_STRING; import static org.assertj.core.api.Assertions.assertThat; -class AzureEventHubClientBuilderConfigurationTest { +class AzureEventHubsClientBuilderConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubClientBuilderConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsClientBuilderConfiguration.class)); @Test void noConnectionInfoProvidedShouldNotConfigure() { - contextRunner.run(context -> assertThat(context).doesNotHaveBean(AzureEventHubClientBuilderConfiguration.class)); + contextRunner.run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsClientBuilderConfiguration.class)); } @Test @@ -33,14 +33,14 @@ void connectionStringProvidedShouldConfigure() { "spring.cloud.azure.eventhubs.connection-string=" + String.format(CONNECTION_STRING, "test-namespace"), "spring.cloud.azure.eventhubs.event-hub-name=test-event-hub" ) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .run(context -> { - assertThat(context).hasSingleBean(AzureEventHubClientBuilderConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsClientBuilderConfiguration.class); assertThat(context).hasSingleBean(EventHubClientBuilderFactory.class); assertThat(context).hasSingleBean(EventHubClientBuilder.class); assertThat(context).hasSingleBean(StaticConnectionStringProvider.class); StaticConnectionStringProvider connectionStringProvider = context.getBean(StaticConnectionStringProvider.class); - Assertions.assertEquals(AzureServiceType.EVENT_HUB, connectionStringProvider.getServiceType()); + Assertions.assertEquals(AzureServiceType.EVENT_HUBS, connectionStringProvider.getServiceType()); }); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubConsumerClientConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsConsumerClientConfigurationTest.java similarity index 79% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubConsumerClientConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsConsumerClientConfigurationTest.java index 1c8260cd4ee65..44bae232505bb 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubConsumerClientConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsConsumerClientConfigurationTest.java @@ -15,14 +15,14 @@ import static com.azure.spring.cloud.autoconfigure.eventhubs.EventHubsTestUtils.CONNECTION_STRING; import static org.assertj.core.api.Assertions.assertThat; -class AzureEventHubConsumerClientConfigurationTest { +class AzureEventHubsConsumerClientConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubConsumerClientConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsConsumerClientConfiguration.class)); @Test void noEventHubNameProvidedShouldNotConfigure() { - contextRunner.run(context -> assertThat(context).doesNotHaveBean(AzureEventHubConsumerClientConfiguration.class)); + contextRunner.run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsConsumerClientConfiguration.class)); } @Test @@ -33,9 +33,9 @@ void eventHubNameAndConsumerGroupProvidedShouldConfigure() { "spring.cloud.azure.eventhubs.consumer.consumer-group=test-consumer-group" ) .run(context -> { - assertThat(context).hasSingleBean(AzureEventHubConsumerClientConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsConsumerClientConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); }); contextRunner @@ -44,9 +44,9 @@ void eventHubNameAndConsumerGroupProvidedShouldConfigure() { "spring.cloud.azure.eventhubs.consumer.consumer-group=test-consumer-group" ) .run(context -> { - assertThat(context).hasSingleBean(AzureEventHubConsumerClientConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsConsumerClientConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); }); } @@ -66,12 +66,12 @@ void withGlobalEventHubConnectionSetShouldConfigureShared() { "spring.cloud.azure.eventhubs.event-hub-name=" + eventHubName, "spring.cloud.azure.eventhubs.consumer.consumer-group=" + consumerGroupName ) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .withBean(EventHubClientBuilder.class, () -> clientBuilder) .run( context -> { - assertThat(context).doesNotHaveBean(AzureEventHubConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); - assertThat(context).hasSingleBean(AzureEventHubConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); assertThat(context).hasSingleBean(EventHubConsumerAsyncClient.class); assertThat(context).hasSingleBean(EventHubConsumerClient.class); } @@ -87,12 +87,12 @@ void withDedicatedEvenHubConnectionSetShouldConfigureDedicated() { "spring.cloud.azure.eventhubs.consumer.consumer-group=test-consumer-group", "spring.cloud.azure.eventhubs.namespace=test-namespace" ) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .withBean(EventHubClientBuilder.class, EventHubClientBuilder::new) .run( context -> { - assertThat(context).doesNotHaveBean(AzureEventHubConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); - assertThat(context).hasSingleBean(AzureEventHubConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsConsumerClientConfiguration.SharedConsumerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsConsumerClientConfiguration.DedicatedConsumerConnectionConfiguration.class); assertThat(context).hasSingleBean(EventHubClientBuilderFactory.class); assertThat(context).hasSingleBean(EventHubConsumerAsyncClient.class); assertThat(context).hasSingleBean(EventHubConsumerClient.class); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubKafkaAutoConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsKafkaAutoConfigurationTest.java similarity index 94% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubKafkaAutoConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsKafkaAutoConfigurationTest.java index c049e6b87a0ee..8f93c8a9ace81 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubKafkaAutoConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsKafkaAutoConfigurationTest.java @@ -3,17 +3,17 @@ package com.azure.spring.cloud.autoconfigure.eventhubs; -import com.azure.spring.cloud.autoconfigure.eventhubs.kafka.AzureEventHubKafkaAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.kafka.AzureEventHubsKafkaAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; -class AzureEventHubKafkaAutoConfigurationTest { +class AzureEventHubsKafkaAutoConfigurationTest { private static final String EVENT_HUB_PROPERTY_PREFIX = "spring.cloud.azure.eventhubs."; private static final String AZURE_PROPERTY_PREFIX = "spring.cloud.azure."; private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubKafkaAutoConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsKafkaAutoConfiguration.class)); // TODO(xiada): add tests /* diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventProcessorClientConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorClientConfigurationTest.java similarity index 84% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventProcessorClientConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorClientConfigurationTest.java index 64e67e52e5cc5..1f60e1e3871e2 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventProcessorClientConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorClientConfigurationTest.java @@ -16,23 +16,23 @@ import static org.assertj.core.api.Assertions.assertThat; -class AzureEventProcessorClientConfigurationTest { +class AzureEventHubsProcessorClientConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventProcessorClientConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsProcessorClientConfiguration.class)); @Test void noEventHubNameProvidedShouldNotConfigure() { contextRunner .withPropertyValues("spring.cloud.azure.eventhubs.consumer-group=test-cg") - .run(context -> assertThat(context).doesNotHaveBean(AzureEventProcessorClientConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsProcessorClientConfiguration.class)); } @Test void noConsumerGroupProvidedShouldNotConfigure() { contextRunner .withPropertyValues("spring.cloud.azure.eventhubs.event-hub-name=test-eventhub") - .run(context -> assertThat(context).doesNotHaveBean(AzureEventProcessorClientConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsProcessorClientConfiguration.class)); } @Test @@ -40,14 +40,14 @@ void eventHubNameAndConsumerGroupProvidedShouldConfigure() { contextRunner .withBean(EventProcessingListener.class, TestEventProcessorListener::new) .withBean(CheckpointStore.class, TestCheckpointStore::new) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .withPropertyValues( "spring.cloud.azure.eventhubs.namespace=test-namespace", "spring.cloud.azure.eventhubs.event-hub-name=test-eventhub", "spring.cloud.azure.eventhubs.processor.consumer-group=test-consumer-group" ) .run(context -> { - assertThat(context).hasSingleBean(AzureEventProcessorClientConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsProcessorClientConfiguration.class); assertThat(context).hasSingleBean(EventProcessorClientBuilderFactory.class); assertThat(context).hasSingleBean(EventProcessorClientBuilder.class); assertThat(context).hasSingleBean(EventProcessorClient.class); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProcessorContainerConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorContainerConfigurationTest.java similarity index 62% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProcessorContainerConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorContainerConfigurationTest.java index e4d7b442e8b3b..f46063ada6ca2 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProcessorContainerConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProcessorContainerConfigurationTest.java @@ -4,8 +4,8 @@ package com.azure.spring.cloud.autoconfigure.eventhubs; import com.azure.messaging.eventhubs.CheckpointStore; -import com.azure.spring.eventhubs.core.EventHubProcessorContainer; -import com.azure.spring.eventhubs.core.processor.EventHubProcessorFactory; +import com.azure.spring.eventhubs.core.EventHubsProcessorContainer; +import com.azure.spring.eventhubs.core.processor.EventHubsProcessorFactory; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; @@ -14,10 +14,10 @@ import static com.azure.spring.cloud.autoconfigure.eventhubs.EventHubsTestUtils.CONNECTION_STRING; import static org.assertj.core.api.Assertions.assertThat; -class AzureEventHubProcessorContainerConfigurationTest { +class AzureEventHubsProcessorContainerConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubMessagingAutoConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsMessagingAutoConfiguration.class)); @Test void disableEventHubsShouldNotConfigure() { @@ -26,25 +26,25 @@ void disableEventHubsShouldNotConfigure() { "spring.cloud.azure.eventhubs.enabled=false", "spring.cloud.azure.eventhubs.namespace=test-namespace" ) - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); } @Test - void withoutEventHubProcessorContainerShouldNotConfigure() { + void withoutEventHubsProcessorContainerShouldNotConfigure() { this.contextRunner - .withClassLoader(new FilteredClassLoader(EventHubProcessorContainer.class)) + .withClassLoader(new FilteredClassLoader(EventHubsProcessorContainer.class)) .withPropertyValues( "spring.cloud.azure.eventhubs.namespace=test-namespace" ) - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); } @Test void withoutEventHubConnectionShouldNotConfigure() { this.contextRunner - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .withBean(CheckpointStore.class, TestCheckpointStore::new) - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); } @Test @@ -53,8 +53,8 @@ void withoutCheckpointStoreShouldConfigure() { .withPropertyValues( "spring.cloud.azure.eventhubs.connection-string=" + String.format(CONNECTION_STRING, "test-namespace") ) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsMessagingAutoConfiguration.ProcessorContainerConfiguration.class)); } @Test @@ -63,12 +63,12 @@ void connectionInfoAndCheckpointStoreProvidedShouldConfigure() { .withPropertyValues( "spring.cloud.azure.eventhubs.connection-string=" + String.format(CONNECTION_STRING, "test-namespace") ) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .withBean(CheckpointStore.class, TestCheckpointStore::new) .run(context -> { - assertThat(context).hasSingleBean(EventHubProcessorContainer.class); - assertThat(context).hasSingleBean(EventHubProcessorFactory.class); - assertThat(context).hasSingleBean(AzureEventHubMessagingAutoConfiguration.ProcessorContainerConfiguration.class); + assertThat(context).hasSingleBean(EventHubsProcessorContainer.class); + assertThat(context).hasSingleBean(EventHubsProcessorFactory.class); + assertThat(context).hasSingleBean(AzureEventHubsMessagingAutoConfiguration.ProcessorContainerConfiguration.class); }); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProducerClientConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProducerClientConfigurationTest.java similarity index 79% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProducerClientConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProducerClientConfigurationTest.java index df2c3bf1ed032..bbfc1670a7115 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubProducerClientConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsProducerClientConfigurationTest.java @@ -15,14 +15,14 @@ import static com.azure.spring.cloud.autoconfigure.eventhubs.EventHubsTestUtils.CONNECTION_STRING; import static org.assertj.core.api.Assertions.assertThat; -class AzureEventHubProducerClientConfigurationTest { +class AzureEventHubsProducerClientConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubProducerClientConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsProducerClientConfiguration.class)); @Test void noEventHubNameProvidedShouldNotConfigure() { - contextRunner.run(context -> assertThat(context).doesNotHaveBean(AzureEventHubProducerClientConfiguration.class)); + contextRunner.run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsProducerClientConfiguration.class)); } @Test @@ -32,9 +32,9 @@ void eventHubNameProvidedShouldConfigure() { "spring.cloud.azure.eventhubs.event-hub-name=test-eventhub" ) .run(context -> { - assertThat(context).hasSingleBean(AzureEventHubProducerClientConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubProducerClientConfiguration.SharedProducerConnectionConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsProducerClientConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsProducerClientConfiguration.SharedProducerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); }); contextRunner @@ -42,9 +42,9 @@ void eventHubNameProvidedShouldConfigure() { "spring.cloud.azure.eventhubs.producer.event-hub-name=test-eventhub" ) .run(context -> { - assertThat(context).hasSingleBean(AzureEventHubProducerClientConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubProducerClientConfiguration.SharedProducerConnectionConfiguration.class); - assertThat(context).doesNotHaveBean(AzureEventHubProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsProducerClientConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsProducerClientConfiguration.SharedProducerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); }); } @@ -66,8 +66,8 @@ void withGlobalEventHubConnectionSetShouldConfigureShared() { .withBean(EventHubClientBuilder.class, () -> clientBuilder) .run( context -> { - assertThat(context).doesNotHaveBean(AzureEventHubProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); - assertThat(context).hasSingleBean(AzureEventHubProducerClientConfiguration.SharedProducerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsProducerClientConfiguration.SharedProducerConnectionConfiguration.class); assertThat(context).hasSingleBean(EventHubProducerClient.class); assertThat(context).hasSingleBean(EventHubProducerAsyncClient.class); } @@ -82,12 +82,12 @@ void withDedicatedEvenHubConnectionSetShouldConfigureDedicated() { "spring.cloud.azure.eventhubs.producer.event-hub-name=test-event-hub", "spring.cloud.azure.eventhubs.namespace=test-namespace" ) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .withBean(EventHubClientBuilder.class, EventHubClientBuilder::new) .run( context -> { - assertThat(context).doesNotHaveBean(AzureEventHubProducerClientConfiguration.SharedProducerConnectionConfiguration.class); - assertThat(context).hasSingleBean(AzureEventHubProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); + assertThat(context).doesNotHaveBean(AzureEventHubsProducerClientConfiguration.SharedProducerConnectionConfiguration.class); + assertThat(context).hasSingleBean(AzureEventHubsProducerClientConfiguration.DedicatedProducerConnectionConfiguration.class); assertThat(context).hasSingleBean(EventHubClientBuilderFactory.class); assertThat(context).hasSingleBean(EventHubProducerClient.class); assertThat(context).hasSingleBean(EventHubProducerAsyncClient.class); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubPropertiesTestConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsPropertiesTestConfiguration.java similarity index 65% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubPropertiesTestConfiguration.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsPropertiesTestConfiguration.java index 2818bef789164..2ff9c19d5af8b 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubPropertiesTestConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsPropertiesTestConfiguration.java @@ -3,17 +3,17 @@ package com.azure.spring.cloud.autoconfigure.eventhubs; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @EnableConfigurationProperties -class AzureEventHubPropertiesTestConfiguration { +class AzureEventHubsPropertiesTestConfiguration { @Bean - @ConfigurationProperties(AzureEventHubProperties.PREFIX) - public AzureEventHubProperties azureEventHubProperties() { - return new AzureEventHubProperties(); + @ConfigurationProperties(AzureEventHubsProperties.PREFIX) + public AzureEventHubsProperties azureEventHubsProperties() { + return new AzureEventHubsProperties(); } } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsTemplateConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsTemplateConfigurationTest.java index 52c9d60c5a056..2d0966a176007 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsTemplateConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsTemplateConfigurationTest.java @@ -4,7 +4,7 @@ package com.azure.spring.cloud.autoconfigure.eventhubs; import com.azure.spring.eventhubs.core.EventHubsTemplate; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; @@ -16,7 +16,7 @@ class AzureEventHubsTemplateConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubMessagingAutoConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsMessagingAutoConfiguration.class)); @Test void disableEventHubsShouldNotConfigure() { @@ -25,7 +25,7 @@ void disableEventHubsShouldNotConfigure() { "spring.cloud.azure.eventhubs.enabled=false", "spring.cloud.azure.eventhubs.namespace=test-namespace" ) - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubMessagingAutoConfiguration.EventHubsTemplateConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsMessagingAutoConfiguration.EventHubsTemplateConfiguration.class)); } @Test @@ -35,13 +35,13 @@ void withoutEventHubsTemplateShouldNotConfigure() { .withPropertyValues( "spring.cloud.azure.eventhubs.namespace=test-namespace" ) - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubMessagingAutoConfiguration.EventHubsTemplateConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsMessagingAutoConfiguration.EventHubsTemplateConfiguration.class)); } @Test void withoutEventHubConnectionShouldNotConfigure() { this.contextRunner - .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubMessagingAutoConfiguration.EventHubsTemplateConfiguration.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubsMessagingAutoConfiguration.EventHubsTemplateConfiguration.class)); } @Test @@ -50,11 +50,11 @@ void connectionInfoProvidedShouldConfigure() { .withPropertyValues( "spring.cloud.azure.eventhubs.connection-string=" + String.format(CONNECTION_STRING, "test-namespace") ) - .withUserConfiguration(AzureEventHubPropertiesTestConfiguration.class) + .withUserConfiguration(AzureEventHubsPropertiesTestConfiguration.class) .run(context -> { assertThat(context).hasSingleBean(EventHubsTemplate.class); - assertThat(context).hasSingleBean(EventHubProducerFactory.class); - assertThat(context).hasSingleBean(AzureEventHubMessagingAutoConfiguration.EventHubsTemplateConfiguration.class); + assertThat(context).hasSingleBean(EventHubsProducerFactory.class); + assertThat(context).hasSingleBean(AzureEventHubsMessagingAutoConfiguration.EventHubsTemplateConfiguration.class); }); } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubResourceManagerAutoConfigurationTest.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubsResourceManagerAutoConfigurationTest.java similarity index 68% rename from sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubResourceManagerAutoConfigurationTest.java rename to sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubsResourceManagerAutoConfigurationTest.java index 9c16fc3825ed6..835e35c6301bb 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubResourceManagerAutoConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureEventHubsResourceManagerAutoConfigurationTest.java @@ -5,10 +5,10 @@ import com.azure.messaging.eventhubs.EventHubClientBuilder; import com.azure.resourcemanager.AzureResourceManager; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; import com.azure.spring.cloud.autoconfigure.properties.AzureGlobalProperties; -import com.azure.spring.cloud.resourcemanager.connectionstring.EventHubArmConnectionStringProvider; -import com.azure.spring.eventhubs.provisioning.EventHubProvisioner; +import com.azure.spring.cloud.resourcemanager.connectionstring.EventHubsArmConnectionStringProvider; +import com.azure.spring.eventhubs.provisioning.EventHubsProvisioner; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; @@ -17,10 +17,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -class AzureEventHubResourceManagerAutoConfigurationTest { +class AzureEventHubsResourceManagerAutoConfigurationTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(AzureEventHubResourceManagerAutoConfiguration.class)); + .withConfiguration(AutoConfigurations.of(AzureEventHubsResourceManagerAutoConfiguration.class)); private final String connectionString = "connection-string=Endpoint=sb://eventhub-test-1" + ".servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;" @@ -31,8 +31,8 @@ void testEventHubResourceManagerDisabled() { this.contextRunner .withPropertyValues("spring.cloud.azure.eventhubs.enabled=false") .run(context -> { - assertThat(context).doesNotHaveBean(EventHubArmConnectionStringProvider.class); - assertThat(context).doesNotHaveBean(EventHubProvisioner.class); + assertThat(context).doesNotHaveBean(EventHubsArmConnectionStringProvider.class); + assertThat(context).doesNotHaveBean(EventHubsProvisioner.class); }); } @@ -41,25 +41,25 @@ void testEventHubResourceManagerWithoutEventHubClientBuilderClass() { this.contextRunner .withClassLoader(new FilteredClassLoader(EventHubClientBuilder.class)) .run(context -> { - assertThat(context).doesNotHaveBean(EventHubArmConnectionStringProvider.class); - assertThat(context).doesNotHaveBean(EventHubProvisioner.class); + assertThat(context).doesNotHaveBean(EventHubsArmConnectionStringProvider.class); + assertThat(context).doesNotHaveBean(EventHubsProvisioner.class); }); } @Test void testEventHubArmConnectionStringProviderBeanDisabled() { this.contextRunner - .withPropertyValues(AzureEventHubProperties.PREFIX + "." + connectionString) - .run(context -> assertThat(context).doesNotHaveBean(EventHubArmConnectionStringProvider.class)); + .withPropertyValues(AzureEventHubsProperties.PREFIX + "." + connectionString) + .run(context -> assertThat(context).doesNotHaveBean(EventHubsArmConnectionStringProvider.class)); } @Test - void testAzureEventHubResourceManagerAutoConfigurationBeans() { + void testAzureEventHubsResourceManagerAutoConfigurationBeans() { this.contextRunner .withUserConfiguration(AzureResourceManagerAutoConfiguration.class) .withBean(AzureGlobalProperties.class, AzureGlobalProperties::new) .withBean(AzureResourceManager.class, () -> mock(AzureResourceManager.class)) - .withBean(AzureEventHubProperties.class, AzureEventHubProperties::new) - .run(context -> assertThat(context).hasSingleBean(EventHubProvisioner.class)); + .withBean(AzureEventHubsProperties.class, AzureEventHubsProperties::new) + .run(context -> assertThat(context).hasSingleBean(EventHubsProvisioner.class)); } } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusPropertiesTestConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusPropertiesTestConfiguration.java index 5fce1583a77da..65660dab818d9 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusPropertiesTestConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusPropertiesTestConfiguration.java @@ -13,7 +13,7 @@ class AzureServiceBusPropertiesTestConfiguration { @Bean @ConfigurationProperties(AzureServiceBusProperties.PREFIX) - public AzureServiceBusProperties azureEventHubProperties() { + public AzureServiceBusProperties azureServiceBusProperties() { return new AzureServiceBusProperties(); } } diff --git a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/connectionstring/implementation/EventHubConnectionString.java b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/connectionstring/implementation/EventHubsConnectionString.java similarity index 94% rename from sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/connectionstring/implementation/EventHubConnectionString.java rename to sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/connectionstring/implementation/EventHubsConnectionString.java index 89c1e3f974f4b..1f5b43ce89d68 100644 --- a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/connectionstring/implementation/EventHubConnectionString.java +++ b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/connectionstring/implementation/EventHubsConnectionString.java @@ -11,7 +11,7 @@ import static com.azure.spring.core.connectionstring.ConnectionStringSegments.SHARED_ACCESS_KEY_NAME; -public class EventHubConnectionString { +public class EventHubsConnectionString { private final URI endpointUri; private final String endpoint; @@ -19,7 +19,7 @@ public class EventHubConnectionString { private final String sharedAccessKeyName; private final String sharedAccessKey; - public EventHubConnectionString(String str) { + public EventHubsConnectionString(String str) { ConnectionString connectionString = new ConnectionString(str, ConnectionStringType.EVENT_HUB); this.endpointUri = connectionString.getEndpointUri(); diff --git a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/service/AzureServiceType.java b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/service/AzureServiceType.java index 9256593f694ed..de465a364cc7c 100644 --- a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/service/AzureServiceType.java +++ b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/core/service/AzureServiceType.java @@ -9,7 +9,7 @@ public final class AzureServiceType { public static final ServiceBus SERVICE_BUS = new ServiceBus(); - public static final EventHub EVENT_HUB = new EventHub(); + public static final EventHubs EVENT_HUBS = new EventHubs(); public static final StorageBlob STORAGE_BLOB = new StorageBlob(); public static final StorageQueue STORAGE_QUEUE = new StorageQueue(); public static final AppConfiguration APP_CONFIGURATION = new AppConfiguration(); @@ -24,7 +24,7 @@ public static class ServiceBus { /** * The Event Hub service. */ - public static class EventHub { + public static class EventHubs { } diff --git a/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/connectionstring/EventHubArmConnectionStringProvider.java b/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/connectionstring/EventHubsArmConnectionStringProvider.java similarity index 76% rename from sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/connectionstring/EventHubArmConnectionStringProvider.java rename to sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/connectionstring/EventHubsArmConnectionStringProvider.java index 2c63bf9ef48b3..86ca117c415e0 100644 --- a/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/connectionstring/EventHubArmConnectionStringProvider.java +++ b/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/connectionstring/EventHubsArmConnectionStringProvider.java @@ -6,21 +6,21 @@ import com.azure.resourcemanager.AzureResourceManager; import com.azure.resourcemanager.eventhubs.models.AuthorizationRule; import com.azure.resourcemanager.eventhubs.models.EventHubAuthorizationKey; -import com.azure.spring.core.properties.resource.AzureResourceMetadata; import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubNamespaceCrud; +import com.azure.spring.core.properties.resource.AzureResourceMetadata; import com.azure.spring.core.service.AzureServiceType; /** * A connection string provider reads Event Hub connection string from Azure Resource Manager. */ -public class EventHubArmConnectionStringProvider extends AbstractArmConnectionStringProvider { +public class EventHubsArmConnectionStringProvider extends AbstractArmConnectionStringProvider { private final String namespace; private final EventHubNamespaceCrud eventHubNamespaceCrud; - public EventHubArmConnectionStringProvider(AzureResourceManager resourceManager, - AzureResourceMetadata resourceMetadata, - String namespace) { + public EventHubsArmConnectionStringProvider(AzureResourceManager resourceManager, + AzureResourceMetadata resourceMetadata, + String namespace) { super(resourceManager, resourceMetadata); this.namespace = namespace; this.eventHubNamespaceCrud = new EventHubNamespaceCrud(resourceManager, resourceMetadata); @@ -41,7 +41,7 @@ public String getConnectionString() { } @Override - public AzureServiceType.EventHub getServiceType() { - return AzureServiceType.EVENT_HUB; + public AzureServiceType.EventHubs getServiceType() { + return AzureServiceType.EVENT_HUBS; } } diff --git a/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubConsumerGroupCrud.java b/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubsConsumerGroupCrud.java similarity index 85% rename from sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubConsumerGroupCrud.java rename to sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubsConsumerGroupCrud.java index b53afc580dc8f..7a60555349dcd 100644 --- a/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubConsumerGroupCrud.java +++ b/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubsConsumerGroupCrud.java @@ -12,13 +12,13 @@ /** - * Resource manager for Event Hubs consumer group. + * Resource manager for Azure Event Hubs consumer group. */ -public class EventHubConsumerGroupCrud +public class EventHubsConsumerGroupCrud extends AbstractResourceCrud> { - public EventHubConsumerGroupCrud(AzureResourceManager azureResourceManager, - AzureResourceMetadata resourceMetadata) { + public EventHubsConsumerGroupCrud(AzureResourceManager azureResourceManager, + AzureResourceMetadata resourceMetadata) { super(azureResourceManager, resourceMetadata); } @@ -55,7 +55,7 @@ public EventHubConsumerGroup internalCreate(Tuple3 consu .eventHubs() .consumerGroups() .define(consumerGroupCoordinate.getT2()) - .withExistingEventHub(new EventHubCrud(this.resourceManager, this.resourceMetadata) + .withExistingEventHub(new EventHubsCrud(this.resourceManager, this.resourceMetadata) .getOrCreate(Tuples.of(consumerGroupCoordinate.getT1(), consumerGroupCoordinate.getT2()))) .create(); diff --git a/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubCrud.java b/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubsCrud.java similarity index 88% rename from sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubCrud.java rename to sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubsCrud.java index 4b84a415b2db3..9393b4626bff3 100644 --- a/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubCrud.java +++ b/sdk/spring/spring-cloud-azure-resourcemanager/src/main/java/com/azure/spring/cloud/resourcemanager/implementation/crud/EventHubsCrud.java @@ -10,11 +10,11 @@ import reactor.util.function.Tuple2; /** - * Resource manager for Event Hubs. + * Resource manager for Azure Event Hubs. */ -public class EventHubCrud extends AbstractResourceCrud> { +public class EventHubsCrud extends AbstractResourceCrud> { - public EventHubCrud(AzureResourceManager azureResourceManager, AzureResourceMetadata azureResourceMetadata) { + public EventHubsCrud(AzureResourceManager azureResourceManager, AzureResourceMetadata azureResourceMetadata) { super(azureResourceManager, azureResourceMetadata); } diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventHubClientBuilderFactory.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventHubClientBuilderFactory.java index a66a610a2e2a8..64237a61687cb 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventHubClientBuilderFactory.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventHubClientBuilderFactory.java @@ -17,9 +17,9 @@ import com.azure.spring.core.factory.AbstractAzureAmqpClientBuilderFactory; import com.azure.spring.core.properties.AzureProperties; import com.azure.spring.service.core.PropertyMapper; -import com.azure.spring.service.eventhubs.properties.EventHubCommonDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubConsumerDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubNamespaceDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsCommonDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsConsumerDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsNamespaceDescriptor; import java.util.Arrays; import java.util.List; @@ -31,10 +31,10 @@ */ public class EventHubClientBuilderFactory extends AbstractAzureAmqpClientBuilderFactory { - private final EventHubCommonDescriptor eventHubProperties; + private final EventHubsCommonDescriptor eventHubsProperties; - public EventHubClientBuilderFactory(EventHubCommonDescriptor eventHubProperties) { - this.eventHubProperties = eventHubProperties; + public EventHubClientBuilderFactory(EventHubsCommonDescriptor eventHubsProperties) { + this.eventHubsProperties = eventHubsProperties; } @Override @@ -64,15 +64,15 @@ protected BiConsumer consumeConfiguration( @Override protected BiConsumer consumeDefaultTokenCredential() { - return (builder, tokenCredential) -> builder.credential(eventHubProperties.getFQDN(), - eventHubProperties.getEventHubName(), + return (builder, tokenCredential) -> builder.credential(eventHubsProperties.getFQDN(), + eventHubsProperties.getEventHubName(), tokenCredential); } @Override protected BiConsumer consumeConnectionString() { // TODO (xiada) defines whether the connection-string contains event-hub-name - return (builder, connectionString) -> builder.connectionString(connectionString, this.eventHubProperties.getEventHubName()); + return (builder, connectionString) -> builder.connectionString(connectionString, this.eventHubsProperties.getEventHubName()); } @Override @@ -82,7 +82,7 @@ protected EventHubClientBuilder createBuilderInstance() { @Override protected AzureProperties getAzureProperties() { - return this.eventHubProperties; + return this.eventHubsProperties; } @@ -92,16 +92,16 @@ protected AzureProperties getAzureProperties() { protected void configureService(EventHubClientBuilder builder) { PropertyMapper mapper = new PropertyMapper(); - mapper.from(eventHubProperties.getCustomEndpointAddress()).to(builder::customEndpointAddress); + mapper.from(eventHubsProperties.getCustomEndpointAddress()).to(builder::customEndpointAddress); - if (this.eventHubProperties instanceof EventHubNamespaceDescriptor) { - mapper.from(((EventHubNamespaceDescriptor) this.eventHubProperties).getSharedConnection()) + if (this.eventHubsProperties instanceof EventHubsNamespaceDescriptor) { + mapper.from(((EventHubsNamespaceDescriptor) this.eventHubsProperties).getSharedConnection()) .whenTrue() .to(t -> builder.shareConnection()); } - if (this.eventHubProperties instanceof EventHubConsumerDescriptor) { - EventHubConsumerDescriptor consumerProperties = (EventHubConsumerDescriptor) this.eventHubProperties; + if (this.eventHubsProperties instanceof EventHubsConsumerDescriptor) { + EventHubsConsumerDescriptor consumerProperties = (EventHubsConsumerDescriptor) this.eventHubsProperties; mapper.from(consumerProperties.getConsumerGroup()).to(builder::consumerGroup); mapper.from(consumerProperties.getPrefetchCount()).to(builder::prefetchCount); } @@ -116,14 +116,14 @@ protected void configureService(EventHubClientBuilder builder) { @Override protected List> getAuthenticationDescriptors(EventHubClientBuilder builder) { return Arrays.asList( - new NamedKeyAuthenticationDescriptor(provider -> builder.credential(eventHubProperties.getFQDN(), - eventHubProperties.getEventHubName(), + new NamedKeyAuthenticationDescriptor(provider -> builder.credential(eventHubsProperties.getFQDN(), + eventHubsProperties.getEventHubName(), provider.getCredential())), - new SasAuthenticationDescriptor(provider -> builder.credential(eventHubProperties.getFQDN(), - eventHubProperties.getEventHubName(), + new SasAuthenticationDescriptor(provider -> builder.credential(eventHubsProperties.getFQDN(), + eventHubsProperties.getEventHubName(), provider.getCredential())), - new TokenAuthenticationDescriptor(provider -> builder.credential(eventHubProperties.getFQDN(), - eventHubProperties.getEventHubName(), + new TokenAuthenticationDescriptor(provider -> builder.credential(eventHubsProperties.getFQDN(), + eventHubsProperties.getEventHubName(), provider.getCredential())) ); } diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventProcessorClientBuilderFactory.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventProcessorClientBuilderFactory.java index 7cd8cdc709e9e..5365059d46cf3 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventProcessorClientBuilderFactory.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/factory/EventProcessorClientBuilderFactory.java @@ -23,7 +23,7 @@ import com.azure.spring.service.eventhubs.processor.BatchEventProcessingListener; import com.azure.spring.service.eventhubs.processor.EventProcessingListener; import com.azure.spring.service.eventhubs.processor.RecordEventProcessingListener; -import com.azure.spring.service.eventhubs.properties.EventHubProcessorDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsProcessorDescriptor; import org.springframework.util.CollectionUtils; import java.util.Arrays; @@ -38,11 +38,11 @@ */ public class EventProcessorClientBuilderFactory extends AbstractAzureAmqpClientBuilderFactory { - private final EventHubProcessorDescriptor processorProperties; + private final EventHubsProcessorDescriptor processorProperties; private final CheckpointStore checkpointStore; private final EventProcessingListener processorListener; - public EventProcessorClientBuilderFactory(EventHubProcessorDescriptor processorProperties, + public EventProcessorClientBuilderFactory(EventHubsProcessorDescriptor processorProperties, CheckpointStore checkpointStore, EventProcessingListener listener) { this.processorProperties = processorProperties; @@ -149,7 +149,7 @@ private void configureCheckpointStore(EventProcessorClientBuilder builder) { } private void configureProcessorListener(EventProcessorClientBuilder builder) { - final EventHubProcessorDescriptor.Batch batch = this.processorProperties.getBatch(); + final EventHubsProcessorDescriptor.Batch batch = this.processorProperties.getBatch(); if (isBatchMode()) { if (processorListener instanceof BatchEventProcessingListener) { @@ -173,7 +173,7 @@ private void configureProcessorListener(EventProcessorClientBuilder builder) { } private boolean isBatchMode() { - final EventHubProcessorDescriptor.Batch batch = this.processorProperties.getBatch(); + final EventHubsProcessorDescriptor.Batch batch = this.processorProperties.getBatch(); return batch.getMaxWaitTime() != null || batch.getMaxSize() != null; } diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubCommonDescriptor.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsCommonDescriptor.java similarity index 76% rename from sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubCommonDescriptor.java rename to sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsCommonDescriptor.java index 2ed3c607fc779..a31c38542fb16 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubCommonDescriptor.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsCommonDescriptor.java @@ -7,9 +7,9 @@ import com.azure.spring.core.aware.authentication.ConnectionStringAware; /** - * Azure Event Hub common related properties. + * Azure Event Hubs common related properties. */ -public interface EventHubCommonDescriptor extends AzureProperties, ConnectionStringAware { +public interface EventHubsCommonDescriptor extends AzureProperties, ConnectionStringAware { String getFQDN(); diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubConsumerDescriptor.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsConsumerDescriptor.java similarity index 63% rename from sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubConsumerDescriptor.java rename to sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsConsumerDescriptor.java index 8863eadeaaef0..9776678b97a56 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubConsumerDescriptor.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsConsumerDescriptor.java @@ -4,9 +4,9 @@ package com.azure.spring.service.eventhubs.properties; /** - * Azure Event Hub Consumer related properties. + * Azure Event Hubs Consumer related properties. */ -public interface EventHubConsumerDescriptor extends EventHubCommonDescriptor { +public interface EventHubsConsumerDescriptor extends EventHubsCommonDescriptor { String getConsumerGroup(); diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubNamespaceDescriptor.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsNamespaceDescriptor.java similarity index 62% rename from sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubNamespaceDescriptor.java rename to sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsNamespaceDescriptor.java index 925a62062930f..8b9fef3d58c1c 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubNamespaceDescriptor.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsNamespaceDescriptor.java @@ -4,9 +4,9 @@ package com.azure.spring.service.eventhubs.properties; /** - * Azure Event Hub related properties. + * Azure Event Hubs related properties. */ -public interface EventHubNamespaceDescriptor extends EventHubCommonDescriptor { +public interface EventHubsNamespaceDescriptor extends EventHubsCommonDescriptor { Boolean getSharedConnection(); diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubProcessorDescriptor.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsProcessorDescriptor.java similarity index 94% rename from sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubProcessorDescriptor.java rename to sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsProcessorDescriptor.java index 8ab29a5654e5a..3d438cd8c87cf 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubProcessorDescriptor.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsProcessorDescriptor.java @@ -10,9 +10,9 @@ import java.util.Map; /** - * Azure Event Hub Processor related properties. + * Azure Event Hubs Processor related properties. */ -public interface EventHubProcessorDescriptor extends EventHubConsumerDescriptor { +public interface EventHubsProcessorDescriptor extends EventHubsConsumerDescriptor { Boolean getTrackLastEnqueuedEventProperties(); diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubProducerDescriptor.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsProducerDescriptor.java similarity index 55% rename from sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubProducerDescriptor.java rename to sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsProducerDescriptor.java index b5320694109a4..3a4ec91564ba4 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubProducerDescriptor.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/service/eventhubs/properties/EventHubsProducerDescriptor.java @@ -4,8 +4,8 @@ package com.azure.spring.service.eventhubs.properties; /** - * Azure Event Hub Producer related properties. + * Azure Event Hubs Producer related properties. */ -public interface EventHubProducerDescriptor extends EventHubCommonDescriptor { +public interface EventHubsProducerDescriptor extends EventHubsCommonDescriptor { } diff --git a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/EventHubClientBuilderFactoryTest.java b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/EventHubsClientBuilderFactoryTest.java similarity index 71% rename from sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/EventHubClientBuilderFactoryTest.java rename to sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/EventHubsClientBuilderFactoryTest.java index 7e3bf0e44f076..c86cb1f23905e 100644 --- a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/EventHubClientBuilderFactoryTest.java +++ b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/EventHubsClientBuilderFactoryTest.java @@ -17,20 +17,19 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -public class EventHubClientBuilderFactoryTest extends AzureServiceClientBuilderFactoryTestBase { +public class EventHubsClientBuilderFactoryTest extends AzureServiceClientBuilderFactoryTestBase { @Override - protected TestAzureEventHubProperties createMinimalServiceProperties() { - TestAzureEventHubProperties testAzureEventHubProperties = new TestAzureEventHubProperties(); - return testAzureEventHubProperties; + protected TestAzureEventHubsProperties createMinimalServiceProperties() { + return new TestAzureEventHubsProperties(); } @Test void testRetryOptionsConfigured() { ArrayList list = new ArrayList<>(); - TestAzureEventHubProperties properties = createMinimalServiceProperties(); + TestAzureEventHubsProperties properties = createMinimalServiceProperties(); final EventHubClientBuilderFactoryExt builderFactory = new EventHubClientBuilderFactoryExt(properties); final EventHubClientBuilder builder = builderFactory.build(); final EventHubConsumerClient client = builder.buildConsumerClient(); @@ -39,7 +38,7 @@ void testRetryOptionsConfigured() { static class EventHubClientBuilderFactoryExt extends EventHubClientBuilderFactory { - EventHubClientBuilderFactoryExt(TestAzureEventHubProperties properties) { + EventHubClientBuilderFactoryExt(TestAzureEventHubsProperties properties) { super(properties); } diff --git a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubCommonProperties.java b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsCommonProperties.java similarity index 88% rename from sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubCommonProperties.java rename to sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsCommonProperties.java index 8c908ebd37923..4a6c23a470b32 100644 --- a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubCommonProperties.java +++ b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsCommonProperties.java @@ -3,13 +3,13 @@ package com.azure.spring.service.eventhubs; -import com.azure.spring.core.connectionstring.implementation.EventHubConnectionString; +import com.azure.spring.core.connectionstring.implementation.EventHubsConnectionString; import com.azure.spring.service.core.properties.AbstractAmqpProperties; /** - * Azure Event Hub related properties. + * Azure Event Hubs related properties. */ -public abstract class TestAzureEventHubCommonProperties extends AbstractAmqpProperties { +public abstract class TestAzureEventHubsCommonProperties extends AbstractAmqpProperties { protected String domainName = "servicebus.windows.net"; protected String namespace; @@ -22,14 +22,14 @@ protected String extractFqdnFromConnectionString() { if (this.connectionString == null) { return null; } - return new EventHubConnectionString(this.connectionString).getFullyQualifiedNamespace(); + return new EventHubsConnectionString(this.connectionString).getFullyQualifiedNamespace(); } protected String extractEventHubNameFromConnectionString() { if (this.connectionString == null) { return null; } - return new EventHubConnectionString(this.connectionString).getEntityPath(); + return new EventHubsConnectionString(this.connectionString).getEntityPath(); } diff --git a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubConsumerProperties.java b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsConsumerProperties.java similarity index 72% rename from sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubConsumerProperties.java rename to sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsConsumerProperties.java index 89a012307e335..9ca0b35825f68 100644 --- a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubConsumerProperties.java +++ b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsConsumerProperties.java @@ -4,9 +4,9 @@ package com.azure.spring.service.eventhubs; /** - * Azure Event Hub related properties. + * Azure Event Hubs related properties. */ -public abstract class TestAzureEventHubConsumerProperties extends TestAzureEventHubCommonProperties { +public abstract class TestAzureEventHubsConsumerProperties extends TestAzureEventHubsCommonProperties { protected String consumerGroup; diff --git a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubProperties.java b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsProperties.java similarity index 77% rename from sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubProperties.java rename to sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsProperties.java index ac08f7d7036af..f3dfc339fddd8 100644 --- a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubProperties.java +++ b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/service/eventhubs/TestAzureEventHubsProperties.java @@ -3,10 +3,10 @@ package com.azure.spring.service.eventhubs; -import com.azure.spring.service.eventhubs.properties.EventHubConsumerDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubNamespaceDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubProcessorDescriptor; -import com.azure.spring.service.eventhubs.properties.EventHubProducerDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsConsumerDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsNamespaceDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsProcessorDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsProducerDescriptor; import com.azure.spring.service.storage.blob.TestAzureStorageBlobProperties; import java.time.Duration; @@ -14,9 +14,9 @@ import java.util.Map; /** - * Azure Event Hub related properties. + * Azure Event Hubs related properties. */ -public class TestAzureEventHubProperties extends TestAzureEventHubCommonProperties implements EventHubNamespaceDescriptor { +public class TestAzureEventHubsProperties extends TestAzureEventHubsCommonProperties implements EventHubsNamespaceDescriptor { private Boolean isSharedConnection; private final Producer producer = new Producer(); @@ -46,21 +46,21 @@ public Processor getProcessor() { /** * Properties of an Event Hub producer. */ - public static class Producer extends TestAzureEventHubCommonProperties implements EventHubProducerDescriptor { + public static class Producer extends TestAzureEventHubsCommonProperties implements EventHubsProducerDescriptor { } /** * Properties of an Event Hub consumer. */ - public static class Consumer extends TestAzureEventHubConsumerProperties implements EventHubConsumerDescriptor { + public static class Consumer extends TestAzureEventHubsConsumerProperties implements EventHubsConsumerDescriptor { } /** * Properties of an Event Hub processor. */ - public static class Processor extends TestAzureEventHubConsumerProperties implements EventHubProcessorDescriptor { + public static class Processor extends TestAzureEventHubsConsumerProperties implements EventHubsProcessorDescriptor { private Boolean trackLastEnqueuedEventProperties; private Map initialPartitionEventPosition = new HashMap<>(); diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubBindingProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubBindingProperties.java deleted file mode 100644 index d4c89d268ab95..0000000000000 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubBindingProperties.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.cloud.stream.binder.eventhubs.properties; - -import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider; - -/** - * @author Warren Zhu - */ -public class EventHubBindingProperties implements BinderSpecificPropertiesProvider { - - private EventHubConsumerProperties consumer = new EventHubConsumerProperties(); - private EventHubProducerProperties producer = new EventHubProducerProperties(); - - public EventHubConsumerProperties getConsumer() { - return consumer; - } - - public void setConsumer(EventHubConsumerProperties consumer) { - this.consumer = consumer; - } - - public EventHubProducerProperties getProducer() { - return producer; - } - - public void setProducer(EventHubProducerProperties producer) { - this.producer = producer; - } -} diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubConsumerProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubConsumerProperties.java deleted file mode 100644 index 2949682081bd0..0000000000000 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubConsumerProperties.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.cloud.stream.binder.eventhubs.properties; - -import com.azure.spring.eventhubs.core.properties.ProcessorProperties; -import com.azure.spring.messaging.checkpoint.CheckpointConfig; - -/** - * - */ -public class EventHubConsumerProperties extends ProcessorProperties { -// /** -// * Whether the consumer receives messages from the beginning or end of event hub. -// * If {@link StartPosition#EARLIEST}, from beginning. If {@link StartPosition#LATEST}, from end. -// *

-// * Default: {@link StartPosition#LATEST} -// */ -// private EventProcessingProperties.StartPosition startPosition = EventProcessingProperties.StartPosition.LATEST; - private final CheckpointConfig checkpoint = new CheckpointConfig(); - -// public EventProcessingProperties.StartPosition getStartPosition() { -// return startPosition; -// } -// -// public void setStartPosition(EventProcessingProperties.StartPosition startPosition) { -// this.startPosition = startPosition; -// } -// - public CheckpointConfig getCheckpoint() { - return checkpoint; - } - -} diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsBindingProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsBindingProperties.java new file mode 100644 index 0000000000000..71a1874947c41 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsBindingProperties.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.cloud.stream.binder.eventhubs.properties; + +import org.springframework.cloud.stream.binder.BinderSpecificPropertiesProvider; + +/** + * + */ +public class EventHubsBindingProperties implements BinderSpecificPropertiesProvider { + + private EventHubsConsumerProperties consumer = new EventHubsConsumerProperties(); + private EventHubsProducerProperties producer = new EventHubsProducerProperties(); + + public EventHubsConsumerProperties getConsumer() { + return consumer; + } + + public void setConsumer(EventHubsConsumerProperties consumer) { + this.consumer = consumer; + } + + public EventHubsProducerProperties getProducer() { + return producer; + } + + public void setProducer(EventHubsProducerProperties producer) { + this.producer = producer; + } +} diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsConsumerProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsConsumerProperties.java new file mode 100644 index 0000000000000..6ef8073ca3674 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsConsumerProperties.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.cloud.stream.binder.eventhubs.properties; + +import com.azure.spring.eventhubs.core.properties.ProcessorProperties; +import com.azure.spring.messaging.checkpoint.CheckpointConfig; + +/** + * + */ +public class EventHubsConsumerProperties extends ProcessorProperties { + + // TODO (xiada): should we support this for the entire binding, but we should figure out how to iterate partitions + // first + // /** + // * Whether the consumer receives messages from the beginning or end of event hub. + // * If {@link StartPosition#EARLIEST}, from beginning. If {@link StartPosition#LATEST}, from end. + // *

+ // * Default: {@link StartPosition#LATEST} + // */ + // private EventProcessingProperties.StartPosition startPosition = EventProcessingProperties.StartPosition.LATEST; + + private final CheckpointConfig checkpoint = new CheckpointConfig(); + + public CheckpointConfig getCheckpoint() { + return checkpoint; + } + +} diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubExtendedBindingProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsExtendedBindingProperties.java similarity index 57% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubExtendedBindingProperties.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsExtendedBindingProperties.java index c4d015dd06d7d..9371c55f5813c 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubExtendedBindingProperties.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsExtendedBindingProperties.java @@ -12,11 +12,12 @@ /** * */ -@ConfigurationProperties("spring.cloud.stream.eventhub") -public class EventHubExtendedBindingProperties - extends AbstractExtendedBindingProperties { +@ConfigurationProperties(EventHubsExtendedBindingProperties.PREFIX) +public class EventHubsExtendedBindingProperties + extends AbstractExtendedBindingProperties { - private static final String DEFAULTS_PREFIX = "spring.cloud.stream.eventhub.default"; + public static final String PREFIX = "spring.cloud.stream.eventhubs"; + private static final String DEFAULTS_PREFIX = PREFIX + ".default"; @Override public String getDefaultsPrefix() { @@ -25,10 +26,10 @@ public String getDefaultsPrefix() { @Override public Class getExtendedPropertiesEntryClass() { - return EventHubBindingProperties.class; + return EventHubsBindingProperties.class; } - public Map getBindings() { + public Map getBindings() { return doGetBindings(); } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubProducerProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsProducerProperties.java similarity index 92% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubProducerProperties.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsProducerProperties.java index b7b34622ec5c7..9a6f763bc338c 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubProducerProperties.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/properties/EventHubsProducerProperties.java @@ -6,9 +6,9 @@ import com.azure.spring.eventhubs.core.properties.ProducerProperties; /** - * @author Warren Zhu + * */ -public class EventHubProducerProperties extends ProducerProperties { +public class EventHubsProducerProperties extends ProducerProperties { /** * Whether the producer should act in a synchronous manner with respect to sending messages into destination. * If true, the producer will wait for a response from Event Hub after a send operation before sending next message. diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubChannelResourceManagerProvisioner.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubChannelResourceManagerProvisioner.java deleted file mode 100644 index 2dbd47064ccf7..0000000000000 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubChannelResourceManagerProvisioner.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.cloud.stream.binder.eventhubs.provisioning; - -import org.springframework.lang.NonNull; -import org.springframework.util.Assert; - -/** - * @author Warren Zhu - */ -public class EventHubChannelResourceManagerProvisioner extends EventHubChannelProvisioner { - - private final String namespace; - private final EventHubProvisioner eventHubProvisioner; - - public EventHubChannelResourceManagerProvisioner(@NonNull String namespace, - @NonNull EventHubProvisioner eventHubProvisioner) { - Assert.hasText(namespace, "The namespace can't be null or empty"); - this.namespace = namespace; - this.eventHubProvisioner = eventHubProvisioner; - } - - @Override - protected void validateOrCreateForConsumer(String name, String group) { - eventHubProvisioner.provisionConsumerGroup(this.namespace, name, group); - } - - @Override - protected void validateOrCreateForProducer(String name) { - eventHubProvisioner.provisionEventHub(this.namespace, name); - } -} diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubProvisioner.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubProvisioner.java deleted file mode 100644 index 77868e22e09f5..0000000000000 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubProvisioner.java +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.cloud.stream.binder.eventhubs.provisioning; - -/** - * An interface to provision Event Hubs resources. - */ -public interface EventHubProvisioner { - - void provisionNamespace(String namespace); - - void provisionEventHub(String namespace, String eventHub); - - void provisionConsumerGroup(String namespace, String eventHub, String consumerGroup); - -} diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubChannelProvisioner.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsChannelProvisioner.java similarity index 70% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubChannelProvisioner.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsChannelProvisioner.java index 1888f210ed148..1bc2a315759c4 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubChannelProvisioner.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsChannelProvisioner.java @@ -3,8 +3,8 @@ package com.azure.spring.cloud.stream.binder.eventhubs.provisioning; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubProducerProperties; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubConsumerProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsProducerProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsConsumerProperties; import org.springframework.cloud.stream.binder.ExtendedConsumerProperties; import org.springframework.cloud.stream.binder.ExtendedProducerProperties; import org.springframework.cloud.stream.provisioning.ConsumerDestination; @@ -13,24 +13,24 @@ import org.springframework.cloud.stream.provisioning.ProvisioningProvider; /** - * @author Warren Zhu + * */ -public class EventHubChannelProvisioner implements - ProvisioningProvider, - ExtendedProducerProperties> { +public class EventHubsChannelProvisioner implements + ProvisioningProvider, + ExtendedProducerProperties> { @Override public ProducerDestination provisionProducerDestination(String name, - ExtendedProducerProperties properties) throws ProvisioningException { + ExtendedProducerProperties properties) throws ProvisioningException { validateOrCreateForProducer(name); - return new EventHubProducerDestination(name); + return new EventHubsProducerDestination(name); } @Override public ConsumerDestination provisionConsumerDestination(String name, String group, - ExtendedConsumerProperties properties) throws ProvisioningException { + ExtendedConsumerProperties properties) throws ProvisioningException { validateOrCreateForConsumer(name, group); - return new EventHubConsumerDestination(name); + return new EventHubsConsumerDestination(name); } protected void validateOrCreateForConsumer(String name, String group) { diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsChannelResourceManagerProvisioner.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsChannelResourceManagerProvisioner.java new file mode 100644 index 0000000000000..cbd30fee65fe3 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsChannelResourceManagerProvisioner.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.cloud.stream.binder.eventhubs.provisioning; + +import com.azure.spring.eventhubs.provisioning.EventHubsProvisioner; +import org.springframework.lang.NonNull; +import org.springframework.util.Assert; + +/** + * + */ +public class EventHubsChannelResourceManagerProvisioner extends EventHubsChannelProvisioner { + + private final String namespace; + private final EventHubsProvisioner eventHubsProvisioner; + + public EventHubsChannelResourceManagerProvisioner(@NonNull String namespace, + @NonNull EventHubsProvisioner eventHubsProvisioner) { + Assert.hasText(namespace, "The namespace can't be null or empty"); + this.namespace = namespace; + this.eventHubsProvisioner = eventHubsProvisioner; + } + + @Override + protected void validateOrCreateForConsumer(String name, String group) { + eventHubsProvisioner.provisionConsumerGroup(this.namespace, name, group); + } + + @Override + protected void validateOrCreateForProducer(String name) { + eventHubsProvisioner.provisionEventHub(this.namespace, name); + } +} diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubConsumerDestination.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsConsumerDestination.java similarity index 77% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubConsumerDestination.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsConsumerDestination.java index 5cb7d4c7d936d..5dd95413eea9a 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubConsumerDestination.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsConsumerDestination.java @@ -6,13 +6,13 @@ import org.springframework.cloud.stream.provisioning.ConsumerDestination; /** - * @author Warren Zhu + * */ -public class EventHubConsumerDestination implements ConsumerDestination { +public class EventHubsConsumerDestination implements ConsumerDestination { private final String name; - public EventHubConsumerDestination(String name) { + public EventHubsConsumerDestination(String name) { this.name = name; } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubProducerDestination.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsProducerDestination.java similarity index 71% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubProducerDestination.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsProducerDestination.java index d2b169b1f2842..2d8b6df493185 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubProducerDestination.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/provisioning/EventHubsProducerDestination.java @@ -6,13 +6,13 @@ import org.springframework.cloud.stream.provisioning.ProducerDestination; /** - * @author Warren Zhu + * */ -public class EventHubProducerDestination implements ProducerDestination { +public class EventHubsProducerDestination implements ProducerDestination { private final String name; - public EventHubProducerDestination(String name) { + public EventHubsProducerDestination(String name) { this.name = name; } @@ -28,6 +28,6 @@ public String getNameForPartition(int partition) { @Override public String toString() { - return "EventHubProducerDestination{" + "name='" + name + '\'' + '}'; + return "EventHubsProducerDestination{" + "name='" + name + '\'' + '}'; } } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md index e75c68fd91060..f3bea1c5dcf99 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/CHANGELOG.md @@ -6,6 +6,8 @@ ### Breaking Changes - Change artifact id from `azure-spring-cloud-stream-binder-eventhubs` to `spring-cloud-azure-stream-binder-eventhubs`. +- Change the binder type from `eventhub` to `eventhubs`. +- Change the Spring Cloud Stream Binding extended properties prefix from `spring.cloud.stream.eventhub` to `spring.cloud.stream.eventhubs`. ### Bugs Fixed diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/README.md b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/README.md index f4f2c6bfb57bd..935d67f1dfc6f 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/README.md +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/README.md @@ -1,7 +1,7 @@ # Azure Event Hubs Spring Cloud Stream Binder client library for Java -The project provides **Spring Cloud Stream Binder for Azure Event Hub** which allows you to build message-driven -microservice using **Spring Cloud Stream** based on [Azure Event Hub][azure_event_hub] service. +The project provides **Spring Cloud Stream Binder for Azure Event Hubs** which allows you to build message-driven +microservice using **Spring Cloud Stream** based on [Azure Event Hubs][azure_event_hub] service. [Source code][src] | [Package (Maven)][package] | [API reference documentation][refdocs] | [Product documentation][docs] | [Samples][sample] @@ -24,7 +24,7 @@ microservice using **Spring Cloud Stream** based on [Azure Event Hub][azure_even ### EventHub Binder Overview -The Spring Cloud Stream Binder for Azure Event Hub provides the binding implementation for the Spring Cloud Stream. +The Spring Cloud Stream Binder for Azure Event Hubs provides the binding implementation for the Spring Cloud Stream. This implementation uses Spring Integration Event Hub Channel Adapters at its foundation. From design's perspective, Event Hub is similar as Kafka. Also, Event Hub could be accessed via Kafka API. If your project has tight dependency on Kafka API, you can try [Event Hub with Kafka API Sample][kafka_sample] @@ -33,7 +33,7 @@ on Kafka API, you can try [Event Hub with Kafka API Sample][kafka_sample] Event Hub provides similar support of consumer group as Apache Kafka, but with slight different logic. While Kafka stores all committed offsets in the broker, you have to store offsets of event hub messages being processed manually. Event Hub SDK provide the function to store such offsets inside Azure Storage Account. So -that's why you have to fill `spring.cloud.stream.eventhub.checkpoint-storage-account`. +that's why you have to fill `spring.cloud.stream.eventhubs.checkpoint-storage-account`. #### Partitioning Support @@ -105,7 +105,7 @@ For more information about setting partition for the producer properties, please #### Event Hub Producer Properties #### -It supports the following configurations with the format of `spring.cloud.stream.eventhub.bindings..producer`. +It supports the following configurations with the format of `spring.cloud.stream.eventhubs.bindings..producer`. **_sync_** @@ -122,7 +122,7 @@ Default: `10000` #### Event Hub Consumer Properties #### -It supports the following configurations with the format of `spring.cloud.stream.eventhub.bindings..consumer`. +It supports the following configurations with the format of `spring.cloud.stream.eventhubs.bindings..consumer`. **_start-position_** diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubHealthIndicator.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsHealthIndicator.java similarity index 83% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubHealthIndicator.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsHealthIndicator.java index 442a4bbf88e2a..0725b1ecbedf0 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubHealthIndicator.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsHealthIndicator.java @@ -4,7 +4,7 @@ package com.azure.spring.cloud.stream.binder.eventhubs; import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; @@ -14,19 +14,19 @@ /** * Health indicator for Event Hubs. */ -public class EventHubHealthIndicator implements HealthIndicator { +public class EventHubsHealthIndicator implements HealthIndicator { private static final int DEFAULT_TIMEOUT = 30; - private final EventHubMessageChannelBinder binder; + private final EventHubsMessageChannelBinder binder; - private final EventHubProducerFactory producerFactory; + private final EventHubsProducerFactory producerFactory; private EventHubProducerAsyncClient producerAsyncClient; private int timeout = DEFAULT_TIMEOUT; - public EventHubHealthIndicator(EventHubMessageChannelBinder binder, EventHubProducerFactory producerFactory) { + public EventHubsHealthIndicator(EventHubsMessageChannelBinder binder, EventHubsProducerFactory producerFactory) { this.binder = binder; this.producerFactory = producerFactory; } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubMessageChannelBinder.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsMessageChannelBinder.java similarity index 77% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubMessageChannelBinder.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsMessageChannelBinder.java index 7d79043adcc4e..0e0ea446ae1ef 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubMessageChannelBinder.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsMessageChannelBinder.java @@ -4,18 +4,18 @@ package com.azure.spring.cloud.stream.binder.eventhubs; import com.azure.messaging.eventhubs.CheckpointStore; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubConsumerProperties; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubExtendedBindingProperties; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubProducerProperties; -import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubChannelProvisioner; -import com.azure.spring.eventhubs.core.EventHubProcessorContainer; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsConsumerProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsExtendedBindingProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsProducerProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubsChannelProvisioner; +import com.azure.spring.eventhubs.core.EventHubsProcessorContainer; import com.azure.spring.eventhubs.core.EventHubsTemplate; -import com.azure.spring.eventhubs.core.processor.DefaultEventHubNamespaceProcessorFactory; -import com.azure.spring.eventhubs.core.producer.DefaultEventHubNamespaceProducerFactory; +import com.azure.spring.eventhubs.core.processor.DefaultEventHubsNamespaceProcessorFactory; +import com.azure.spring.eventhubs.core.producer.DefaultEventHubsNamespaceProducerFactory; import com.azure.spring.eventhubs.core.properties.NamespaceProperties; import com.azure.spring.eventhubs.core.properties.ProcessorProperties; import com.azure.spring.eventhubs.core.properties.ProducerProperties; -import com.azure.spring.integration.eventhubs.inbound.EventHubInboundChannelAdapter; +import com.azure.spring.integration.eventhubs.inbound.EventHubsInboundChannelAdapter; import com.azure.spring.integration.handler.DefaultMessageHandler; import com.azure.spring.messaging.PropertiesSupplier; import org.slf4j.Logger; @@ -47,36 +47,36 @@ /** * */ -public class EventHubMessageChannelBinder extends +public class EventHubsMessageChannelBinder extends // @formatter:off - AbstractMessageChannelBinder, ExtendedProducerProperties, EventHubChannelProvisioner> + AbstractMessageChannelBinder, ExtendedProducerProperties, EventHubsChannelProvisioner> // @formatter:on implements - ExtendedPropertiesBinder { + ExtendedPropertiesBinder { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubMessageChannelBinder.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsMessageChannelBinder.class); private static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser(); private NamespaceProperties namespaceProperties; private EventHubsTemplate eventHubsTemplate; private CheckpointStore checkpointStore; - private EventHubProcessorContainer processorContainer; - private EventHubExtendedBindingProperties bindingProperties = new EventHubExtendedBindingProperties(); - private final Map> + private EventHubsProcessorContainer processorContainer; + private EventHubsExtendedBindingProperties bindingProperties = new EventHubsExtendedBindingProperties(); + private final Map> extendedProducerPropertiesMap = new ConcurrentHashMap<>(); - private final Map, ExtendedConsumerProperties> + private final Map, ExtendedConsumerProperties> extendedConsumerPropertiesMap = new ConcurrentHashMap<>(); private final Map eventHubsInUse = new ConcurrentHashMap<>(); - public EventHubMessageChannelBinder(String[] headersToEmbed, EventHubChannelProvisioner provisioningProvider) { + public EventHubsMessageChannelBinder(String[] headersToEmbed, EventHubsChannelProvisioner provisioningProvider) { super(headersToEmbed, provisioningProvider); } @Override protected MessageHandler createProducerMessageHandler( ProducerDestination destination, - ExtendedProducerProperties producerProperties, + ExtendedProducerProperties producerProperties, MessageChannel errorChannel) { extendedProducerPropertiesMap.put(destination.getName(), producerProperties); Assert.notNull(getEventHubTemplate(), "eventHubsTemplate can't be null when create a producer"); @@ -101,7 +101,7 @@ protected MessageHandler createProducerMessageHandler( @Override protected MessageProducer createConsumerEndpoint(ConsumerDestination destination, String group, - ExtendedConsumerProperties properties) { + ExtendedConsumerProperties properties) { extendedConsumerPropertiesMap.put(Tuples.of(destination.getName(), group), properties); Assert.notNull(getProcessorContainer(), "eventProcessorsContainer can't be null when create a consumer"); @@ -112,7 +112,7 @@ protected MessageProducer createConsumerEndpoint(ConsumerDestination destination group = "anonymous." + UUID.randomUUID(); } - EventHubInboundChannelAdapter inboundAdapter = new EventHubInboundChannelAdapter(this.processorContainer, + EventHubsInboundChannelAdapter inboundAdapter = new EventHubsInboundChannelAdapter(this.processorContainer, destination.getName(), group, properties.getExtension().getCheckpoint()); inboundAdapter.setBeanFactory(getBeanFactory()); @@ -124,12 +124,12 @@ protected MessageProducer createConsumerEndpoint(ConsumerDestination destination } @Override - public EventHubConsumerProperties getExtendedConsumerProperties(String destination) { + public EventHubsConsumerProperties getExtendedConsumerProperties(String destination) { return this.bindingProperties.getExtendedConsumerProperties(destination); } @Override - public EventHubProducerProperties getExtendedProducerProperties(String destination) { + public EventHubsProducerProperties getExtendedProducerProperties(String destination) { return this.bindingProperties.getExtendedProducerProperties(destination); } @@ -143,7 +143,7 @@ public Class getExtendedPropertiesEn return this.bindingProperties.getExtendedPropertiesEntryClass(); } - public void setBindingProperties(EventHubExtendedBindingProperties bindingProperties) { + public void setBindingProperties(EventHubsExtendedBindingProperties bindingProperties) { this.bindingProperties = bindingProperties; } @@ -167,8 +167,8 @@ public String getConsumerGroup() { private PropertiesSupplier getProducerPropertiesSupplier() { return key -> { if (this.extendedProducerPropertiesMap.containsKey(key)) { - EventHubProducerProperties producerProperties = this.extendedProducerPropertiesMap.get(key) - .getExtension(); + EventHubsProducerProperties producerProperties = this.extendedProducerPropertiesMap.get(key) + .getExtension(); producerProperties.setEventHubName(key); return producerProperties; } else { @@ -181,8 +181,8 @@ private PropertiesSupplier getProducerPropertiesSupp private PropertiesSupplier, ProcessorProperties> getProcessorPropertiesSupplier() { return key -> { if (this.extendedConsumerPropertiesMap.containsKey(key)) { - EventHubConsumerProperties consumerProperties = this.extendedConsumerPropertiesMap.get(key) - .getExtension(); + EventHubsConsumerProperties consumerProperties = this.extendedConsumerPropertiesMap.get(key) + .getExtension(); consumerProperties.setEventHubName(key.getT1()); consumerProperties.setConsumerGroup(key.getT2()); return consumerProperties; @@ -195,14 +195,14 @@ private PropertiesSupplier, ProcessorProperties> getProce private EventHubsTemplate getEventHubTemplate() { if (this.eventHubsTemplate == null) { - this.eventHubsTemplate = new EventHubsTemplate(new DefaultEventHubNamespaceProducerFactory(this.namespaceProperties, getProducerPropertiesSupplier())); + this.eventHubsTemplate = new EventHubsTemplate(new DefaultEventHubsNamespaceProducerFactory(this.namespaceProperties, getProducerPropertiesSupplier())); } return this.eventHubsTemplate; } - private EventHubProcessorContainer getProcessorContainer() { + private EventHubsProcessorContainer getProcessorContainer() { if (this.processorContainer == null) { - this.processorContainer = new EventHubProcessorContainer(new DefaultEventHubNamespaceProcessorFactory(this.checkpointStore, this.namespaceProperties, getProcessorPropertiesSupplier())); + this.processorContainer = new EventHubsProcessorContainer(new DefaultEventHubsNamespaceProcessorFactory(this.checkpointStore, this.namespaceProperties, getProcessorPropertiesSupplier())); } return this.processorContainer; } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubBinderConfiguration.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubsBinderConfiguration.java similarity index 51% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubBinderConfiguration.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubsBinderConfiguration.java index 7bf64cefac7d7..5dcb3d498a1c6 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubBinderConfiguration.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubsBinderConfiguration.java @@ -5,17 +5,17 @@ import com.azure.messaging.eventhubs.CheckpointStore; import com.azure.spring.cloud.autoconfigure.context.AzureGlobalPropertiesAutoConfiguration; -import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubAutoConfiguration; -import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubMessagingAutoConfiguration; -import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubProperties; -import com.azure.spring.cloud.autoconfigure.resourcemanager.AzureEventHubResourceManagerAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsMessagingAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.properties.AzureEventHubsProperties; +import com.azure.spring.cloud.autoconfigure.resourcemanager.AzureEventHubsResourceManagerAutoConfiguration; import com.azure.spring.cloud.autoconfigure.resourcemanager.AzureResourceManagerAutoConfiguration; -import com.azure.spring.cloud.stream.binder.eventhubs.EventHubMessageChannelBinder; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubExtendedBindingProperties; -import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubChannelProvisioner; -import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubChannelResourceManagerProvisioner; -import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubProvisioner; +import com.azure.spring.cloud.stream.binder.eventhubs.EventHubsMessageChannelBinder; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsExtendedBindingProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubsChannelProvisioner; +import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubsChannelResourceManagerProvisioner; import com.azure.spring.eventhubs.core.properties.NamespaceProperties; +import com.azure.spring.eventhubs.provisioning.EventHubsProvisioner; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -33,38 +33,38 @@ @Import({ AzureGlobalPropertiesAutoConfiguration.class, AzureResourceManagerAutoConfiguration.class, - AzureEventHubResourceManagerAutoConfiguration.class, - AzureEventHubAutoConfiguration.class, - AzureEventHubMessagingAutoConfiguration.class, - EventHubBinderHealthIndicatorConfiguration.class + AzureEventHubsResourceManagerAutoConfiguration.class, + AzureEventHubsAutoConfiguration.class, + AzureEventHubsMessagingAutoConfiguration.class, + EventHubsBinderHealthIndicatorConfiguration.class }) -@EnableConfigurationProperties(EventHubExtendedBindingProperties.class) -public class EventHubBinderConfiguration { +@EnableConfigurationProperties(EventHubsExtendedBindingProperties.class) +public class EventHubsBinderConfiguration { @Bean @ConditionalOnMissingBean - @ConditionalOnBean({ EventHubProvisioner.class, AzureEventHubProperties.class }) - public EventHubChannelProvisioner eventHubChannelArmProvisioner(AzureEventHubProperties eventHubProperties, - EventHubProvisioner eventHubProvisioner) { + @ConditionalOnBean({ EventHubsProvisioner.class, AzureEventHubsProperties.class }) + public EventHubsChannelProvisioner eventHubChannelArmProvisioner( + AzureEventHubsProperties eventHubsProperties, EventHubsProvisioner eventHubsProvisioner) { - return new EventHubChannelResourceManagerProvisioner(eventHubProperties.getNamespace(), - eventHubProvisioner); + return new EventHubsChannelResourceManagerProvisioner(eventHubsProperties.getNamespace(), + eventHubsProvisioner); } @Bean - @ConditionalOnMissingBean({ EventHubProvisioner.class, EventHubChannelProvisioner.class }) - public EventHubChannelProvisioner eventHubChannelProvisioner() { - return new EventHubChannelProvisioner(); + @ConditionalOnMissingBean({ EventHubsProvisioner.class, EventHubsChannelProvisioner.class }) + public EventHubsChannelProvisioner eventHubChannelProvisioner() { + return new EventHubsChannelProvisioner(); } @Bean @ConditionalOnMissingBean - public EventHubMessageChannelBinder eventHubBinder(EventHubChannelProvisioner eventHubChannelProvisioner, - EventHubExtendedBindingProperties bindingProperties, - ObjectProvider namespaceProperties, - CheckpointStore checkpointStore) { - EventHubMessageChannelBinder binder = new EventHubMessageChannelBinder(null, eventHubChannelProvisioner); + public EventHubsMessageChannelBinder eventHubBinder(EventHubsChannelProvisioner channelProvisioner, + EventHubsExtendedBindingProperties bindingProperties, + ObjectProvider namespaceProperties, + CheckpointStore checkpointStore) { + EventHubsMessageChannelBinder binder = new EventHubsMessageChannelBinder(null, channelProvisioner); binder.setBindingProperties(bindingProperties); binder.setNamespaceProperties(namespaceProperties.getIfAvailable()); binder.setCheckpointStore(checkpointStore); diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubBinderHealthIndicatorConfiguration.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubsBinderHealthIndicatorConfiguration.java similarity index 53% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubBinderHealthIndicatorConfiguration.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubsBinderHealthIndicatorConfiguration.java index bd40c8e0ce0ac..2adde860271c0 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubBinderHealthIndicatorConfiguration.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/config/EventHubsBinderHealthIndicatorConfiguration.java @@ -3,9 +3,9 @@ package com.azure.spring.cloud.stream.binder.eventhubs.config; -import com.azure.spring.cloud.stream.binder.eventhubs.EventHubHealthIndicator; -import com.azure.spring.cloud.stream.binder.eventhubs.EventHubMessageChannelBinder; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; +import com.azure.spring.cloud.stream.binder.eventhubs.EventHubsHealthIndicator; +import com.azure.spring.cloud.stream.binder.eventhubs.EventHubsMessageChannelBinder; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -15,12 +15,12 @@ @Configuration @ConditionalOnClass(HealthIndicator.class) @ConditionalOnEnabledHealthIndicator("binders") -class EventHubBinderHealthIndicatorConfiguration { +class EventHubsBinderHealthIndicatorConfiguration { @Bean - EventHubHealthIndicator eventHubHealthIndicator(EventHubMessageChannelBinder binder, - EventHubProducerFactory producerFactory) { - return new EventHubHealthIndicator(binder, producerFactory); + EventHubsHealthIndicator eventHubHealthIndicator(EventHubsMessageChannelBinder binder, + EventHubsProducerFactory producerFactory) { + return new EventHubsHealthIndicator(binder, producerFactory); } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/resources/META-INF/spring.binders b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/resources/META-INF/spring.binders index 347cd5b5def74..81716db596ea1 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/resources/META-INF/spring.binders +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/main/resources/META-INF/spring.binders @@ -1 +1 @@ -eventhub=com.azure.spring.cloud.stream.binder.eventhubs.config.EventHubBinderConfiguration +eventhubs=com.azure.spring.cloud.stream.binder.eventhubs.config.EventHubsBinderConfiguration diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubTestBinder.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubTestBinder.java index 3401f0424239f..f98b505e8fd60 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubTestBinder.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubTestBinder.java @@ -3,9 +3,9 @@ package com.azure.spring.cloud.stream.binder.eventhubs; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubConsumerProperties; -import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubProducerProperties; -import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubChannelProvisioner; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsConsumerProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.properties.EventHubsProducerProperties; +import com.azure.spring.cloud.stream.binder.eventhubs.provisioning.EventHubsChannelProvisioner; import org.springframework.cloud.stream.binder.AbstractTestBinder; import org.springframework.cloud.stream.binder.BinderHeaders; import org.springframework.cloud.stream.binder.ExtendedConsumerProperties; @@ -17,12 +17,12 @@ */ public class EventHubTestBinder extends - AbstractTestBinder, - ExtendedProducerProperties> { + AbstractTestBinder, + ExtendedProducerProperties> { EventHubTestBinder() { - EventHubMessageChannelBinder binder = new EventHubMessageChannelBinder(BinderHeaders.STANDARD_HEADERS, - new EventHubChannelProvisioner()); + EventHubsMessageChannelBinder binder = new EventHubsMessageChannelBinder(BinderHeaders.STANDARD_HEADERS, + new EventHubsChannelProvisioner()); binder.setApplicationContext(new GenericApplicationContext()); this.setBinder(binder); diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderBatchModeIT.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderBatchModeIT.java similarity index 84% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderBatchModeIT.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderBatchModeIT.java index efd8e4dd004b9..e66b3c240c7c2 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderBatchModeIT.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderBatchModeIT.java @@ -24,17 +24,17 @@ import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(classes = EventHubBinderBatchModeIT.TestConfig.class) +@SpringBootTest(classes = EventHubsBinderBatchModeIT.TestConfig.class) @TestPropertySource(properties = { - "spring.cloud.stream.eventhub.bindings.consume-in-0.consumer.checkpoint.mode=BATCH", + "spring.cloud.stream.eventhubs.bindings.consume-in-0.consumer.checkpoint.mode=BATCH", "spring.cloud.stream.bindings.consume-in-0.destination=test-eventhub-batch", "spring.cloud.stream.bindings.supply-out-0.destination=test-eventhub-batch", "spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=test-eventhub-batch" }) -public class EventHubBinderBatchModeIT { +public class EventHubsBinderBatchModeIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderBatchModeIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsBinderBatchModeIT.class); private static final String MESSAGE = UUID.randomUUID().toString(); @@ -62,7 +62,7 @@ public Supplier>> supply(Sinks.Many> many) public Consumer> consume() { return message -> { LOGGER.info("EventHubBinderBatchModeIT: New message received: '{}'", message.getPayload()); - if (message.getPayload().equals(EventHubBinderBatchModeIT.MESSAGE)) { + if (message.getPayload().equals(EventHubsBinderBatchModeIT.MESSAGE)) { LATCH.countDown(); } }; @@ -72,10 +72,10 @@ public Consumer> consume() { @Test public void testSendAndReceiveMessage() throws InterruptedException { LOGGER.info("EventHubBinderBatchModeIT begin."); - EventHubBinderBatchModeIT.LATCH.await(15, TimeUnit.SECONDS); + EventHubsBinderBatchModeIT.LATCH.await(15, TimeUnit.SECONDS); LOGGER.info("Send a message:" + MESSAGE + "."); many.emitNext(new GenericMessage<>(MESSAGE), Sinks.EmitFailureHandler.FAIL_FAST); - assertThat(EventHubBinderBatchModeIT.LATCH.await(600, TimeUnit.SECONDS)).isTrue(); + assertThat(EventHubsBinderBatchModeIT.LATCH.await(600, TimeUnit.SECONDS)).isTrue(); LOGGER.info("EventHubBinderBatchModeIT end."); } } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderConfigurationTest.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderConfigurationTest.java similarity index 83% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderConfigurationTest.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderConfigurationTest.java index 44f0204fe91da..59cc2d425206b 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderConfigurationTest.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderConfigurationTest.java @@ -3,15 +3,15 @@ package com.azure.spring.cloud.stream.binder.eventhubs; -import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubAutoConfiguration; -import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubMessagingAutoConfiguration; -import com.azure.spring.cloud.autoconfigure.resourcemanager.AzureEventHubResourceManagerAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.eventhubs.AzureEventHubsMessagingAutoConfiguration; +import com.azure.spring.cloud.autoconfigure.resourcemanager.AzureEventHubsResourceManagerAutoConfiguration; import com.azure.spring.cloud.autoconfigure.resourcemanager.AzureResourceManagerAutoConfiguration; -import com.azure.spring.cloud.stream.binder.eventhubs.config.EventHubBinderConfiguration; +import com.azure.spring.cloud.stream.binder.eventhubs.config.EventHubsBinderConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; -public class EventHubBinderConfigurationTest { +public class EventHubsBinderConfigurationTest { private static final String EVENT_HUB_PROPERTY_PREFIX = "spring.cloud.azure.eventhub."; private static final String AZURE_PROPERTY_PREFIX = "spring.cloud.azure."; @@ -24,10 +24,10 @@ public class EventHubBinderConfigurationTest { .withPropertyValues(AZURE_PROPERTY_PREFIX + "stream.function.definition=supply") .withPropertyValues(AZURE_PROPERTY_PREFIX + "stream.bindings.supply-out-0.destination=eventhub1") .withConfiguration(AutoConfigurations.of(AzureResourceManagerAutoConfiguration.class, - AzureEventHubResourceManagerAutoConfiguration.class, - AzureEventHubAutoConfiguration.class, - AzureEventHubMessagingAutoConfiguration.class, - EventHubBinderConfiguration.class)); + AzureEventHubsResourceManagerAutoConfiguration.class, + AzureEventHubsAutoConfiguration.class, + AzureEventHubsMessagingAutoConfiguration.class, + EventHubsBinderConfiguration.class)); /* // TODO (xiada): tests @Test diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderConsumeErrorIT.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderConsumeErrorIT.java similarity index 93% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderConsumeErrorIT.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderConsumeErrorIT.java index b21b44d9e5df7..2b215b2b1faa0 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderConsumeErrorIT.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderConsumeErrorIT.java @@ -25,16 +25,16 @@ import java.util.function.Consumer; import java.util.function.Supplier; -@SpringBootTest(classes = EventHubBinderConsumeErrorIT.TestConfig.class) +@SpringBootTest(classes = EventHubsBinderConsumeErrorIT.TestConfig.class) @TestPropertySource(properties = { - "spring.cloud.stream.eventhub.default.consumer.checkpoint.mode=MANUAL", + "spring.cloud.stream.eventhubs.default.consumer.checkpoint.mode=MANUAL", "spring.cloud.stream.bindings.consume-in-0.destination=test-eventhub-message", "spring.cloud.stream.bindings.supply-out-0.destination=test-eventhub-message", "spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=test-eventhub-message" }) -public class EventHubBinderConsumeErrorIT { +public class EventHubsBinderConsumeErrorIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderConsumeErrorIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsBinderConsumeErrorIT.class); private static final String MESSAGE = "Azure Spring Cloud EventHub Test"; @Autowired diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderHealthIT.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderHealthIT.java similarity index 97% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderHealthIT.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderHealthIT.java index baa89306605b9..fa1262d327f71 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderHealthIT.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderHealthIT.java @@ -21,9 +21,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class EventHubBinderHealthIT { +public class EventHubsBinderHealthIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderHealthIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsBinderHealthIT.class); private final RestTemplate restTemplate = new RestTemplate(); diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderHealthIndicatorTest.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderHealthIndicatorTest.java similarity index 73% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderHealthIndicatorTest.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderHealthIndicatorTest.java index ae716e7db2d5d..e8f8e8e9a51fe 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderHealthIndicatorTest.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderHealthIndicatorTest.java @@ -5,7 +5,7 @@ import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; import com.azure.messaging.eventhubs.EventHubProperties; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; @@ -23,24 +23,24 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class EventHubBinderHealthIndicatorTest { +public class EventHubsBinderHealthIndicatorTest { @Mock - private EventHubMessageChannelBinder binder; + private EventHubsMessageChannelBinder binder; @Mock - private EventHubProducerFactory producerFactory; + private EventHubsProducerFactory producerFactory; @Mock private EventHubProducerAsyncClient producerAsyncClient; - private EventHubHealthIndicator healthIndicator; + private EventHubsHealthIndicator healthIndicator; @BeforeEach public void init() { MockitoAnnotations.openMocks(this); when(producerFactory.createProducer(anyString())).thenReturn(producerAsyncClient); - healthIndicator = new EventHubHealthIndicator(binder, producerFactory); + healthIndicator = new EventHubsHealthIndicator(binder, producerFactory); } @Test @@ -52,8 +52,8 @@ public void testNoEventHubsInUse() { @Test public void testEventHubIsUp() { - Map eventHubsInUse = new HashMap<>(); - eventHubsInUse.put("eventhub-1", new EventHubMessageChannelBinder.EventHubInformation(null)); + Map eventHubsInUse = new HashMap<>(); + eventHubsInUse.put("eventhub-1", new EventHubsMessageChannelBinder.EventHubInformation(null)); EventHubProperties eventHubProperties = mock(EventHubProperties.class); @@ -66,8 +66,8 @@ public void testEventHubIsUp() { @Test public void testEventHubIsDown() { - Map eventHubsInUse = new HashMap<>(); - eventHubsInUse.put("eventhub-1", new EventHubMessageChannelBinder.EventHubInformation(null)); + Map eventHubsInUse = new HashMap<>(); + eventHubsInUse.put("eventhub-1", new EventHubsMessageChannelBinder.EventHubInformation(null)); when(binder.getEventHubsInUse()).thenReturn(eventHubsInUse); when(producerAsyncClient.getEventHubProperties()).thenThrow(new IllegalStateException()); @@ -81,8 +81,8 @@ public void testEventHubIsDown() { public void testGetEventHubInfoTimeout() { healthIndicator.setTimeout(1); - Map eventHubsInUse = new HashMap<>(); - eventHubsInUse.put("eventhub-1", new EventHubMessageChannelBinder.EventHubInformation(null)); + Map eventHubsInUse = new HashMap<>(); + eventHubsInUse.put("eventhub-1", new EventHubsMessageChannelBinder.EventHubInformation(null)); EventHubProperties eventHubProperties = mock(EventHubProperties.class); diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderManualModeIT.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderManualModeIT.java similarity index 86% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderManualModeIT.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderManualModeIT.java index 1ef73822e0edd..b757b6b23aa9d 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderManualModeIT.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderManualModeIT.java @@ -27,17 +27,17 @@ import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(classes = EventHubBinderManualModeIT.TestConfig.class) +@SpringBootTest(classes = EventHubsBinderManualModeIT.TestConfig.class) @TestPropertySource(properties = { - "spring.cloud.stream.eventhub.default.consumer.checkpoint.mode=MANUAL", + "spring.cloud.stream.eventhubs.default.consumer.checkpoint.mode=MANUAL", "spring.cloud.stream.bindings.consume-in-0.destination=test-eventhub-manual", "spring.cloud.stream.bindings.supply-out-0.destination=test-eventhub-manual", "spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=test-eventhub-manual" }) -public class EventHubBinderManualModeIT { +public class EventHubsBinderManualModeIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderManualModeIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsBinderManualModeIT.class); private static final String MESSAGE = UUID.randomUUID().toString(); private static final CountDownLatch LATCH = new CountDownLatch(1); @@ -63,7 +63,7 @@ public Supplier>> supply(Sinks.Many> many) public Consumer> consume() { return message -> { LOGGER.info("EventHubBinderManualModeIT: New message received: '{}'", message.getPayload()); - if (message.getPayload().equals(EventHubBinderManualModeIT.MESSAGE)) { + if (message.getPayload().equals(EventHubsBinderManualModeIT.MESSAGE)) { Checkpointer checkpointer = (Checkpointer) message.getHeaders().get(AzureHeaders.CHECKPOINTER); checkpointer.success().handle((r, ex) -> { Assertions.assertNull(ex); @@ -77,10 +77,10 @@ public Consumer> consume() { @Test public void testSendAndReceiveMessage() throws InterruptedException { LOGGER.info("EventHubBinderManualModeIT begin."); - EventHubBinderManualModeIT.LATCH.await(15, TimeUnit.SECONDS); + EventHubsBinderManualModeIT.LATCH.await(15, TimeUnit.SECONDS); LOGGER.info("Send a message:" + MESSAGE + "."); many.emitNext(new GenericMessage<>(MESSAGE), Sinks.EmitFailureHandler.FAIL_FAST); - assertThat(EventHubBinderManualModeIT.LATCH.await(30, TimeUnit.SECONDS)).isTrue(); + assertThat(EventHubsBinderManualModeIT.LATCH.await(30, TimeUnit.SECONDS)).isTrue(); LOGGER.info("EventHubBinderManualModeIT end."); } } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderRecordModeIT.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderRecordModeIT.java similarity index 84% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderRecordModeIT.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderRecordModeIT.java index 391476c85ad14..08535e150f347 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderRecordModeIT.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderRecordModeIT.java @@ -24,17 +24,17 @@ import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(classes = EventHubBinderRecordModeIT.TestConfig.class) +@SpringBootTest(classes = EventHubsBinderRecordModeIT.TestConfig.class) @TestPropertySource(properties = { - "spring.cloud.stream.eventhub.bindings.consume-in-0.consumer.checkpoint.mode=RECORD", + "spring.cloud.stream.eventhubs.bindings.consume-in-0.consumer.checkpoint.mode=RECORD", "spring.cloud.stream.bindings.consume-in-0.destination=test-eventhub-record", "spring.cloud.stream.bindings.supply-out-0.destination=test-eventhub-record", "spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=test-eventhub-record" }) -public class EventHubBinderRecordModeIT { +public class EventHubsBinderRecordModeIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderRecordModeIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsBinderRecordModeIT.class); private static final String MESSAGE = UUID.randomUUID().toString(); private static final CountDownLatch LATCH = new CountDownLatch(1); @@ -60,7 +60,7 @@ public Supplier>> supply(Sinks.Many> many) public Consumer> consume() { return message -> { LOGGER.info("EventHubBinderRecordModeIT: New message received: '{}'", message.getPayload()); - if (message.getPayload().equals(EventHubBinderRecordModeIT.MESSAGE)) { + if (message.getPayload().equals(EventHubsBinderRecordModeIT.MESSAGE)) { LATCH.countDown(); } }; @@ -70,10 +70,10 @@ public Consumer> consume() { @Test public void testSendAndReceiveMessage() throws InterruptedException { LOGGER.info("EventHubBinderRecordModeIT begin."); - EventHubBinderRecordModeIT.LATCH.await(15, TimeUnit.SECONDS); + EventHubsBinderRecordModeIT.LATCH.await(15, TimeUnit.SECONDS); LOGGER.info("Send a message:" + MESSAGE + "."); many.emitNext(new GenericMessage<>(MESSAGE), Sinks.EmitFailureHandler.FAIL_FAST); - assertThat(EventHubBinderRecordModeIT.LATCH.await(30, TimeUnit.SECONDS)).isTrue(); + assertThat(EventHubsBinderRecordModeIT.LATCH.await(30, TimeUnit.SECONDS)).isTrue(); LOGGER.info("EventHubBinderRecordModeIT end."); } } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderSyncModeIT.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderSyncModeIT.java similarity index 84% rename from sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderSyncModeIT.java rename to sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderSyncModeIT.java index a3374c49d9b31..a4a84e74396cb 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubBinderSyncModeIT.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsBinderSyncModeIT.java @@ -26,17 +26,17 @@ import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(classes = EventHubBinderSyncModeIT.TestConfig.class) +@SpringBootTest(classes = EventHubsBinderSyncModeIT.TestConfig.class) @TestPropertySource(properties = { - "spring.cloud.stream.eventhub.bindings.supply-out-0.producer.sync=true", + "spring.cloud.stream.eventhubs.bindings.supply-out-0.producer.sync=true", "spring.cloud.stream.bindings.consume-in-0.destination=test-eventhub-sync", "spring.cloud.stream.bindings.supply-out-0.destination=test-eventhub-sync", "spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=test-eventhub-sync" }) -public class EventHubBinderSyncModeIT { +public class EventHubsBinderSyncModeIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderSyncModeIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsBinderSyncModeIT.class); private static final String MESSAGE = UUID.randomUUID().toString(); @Autowired @@ -66,7 +66,7 @@ public Supplier>> supply(Sinks.Many> many) public Consumer> consume() { return message -> { LOGGER.info("EventHubBinderRecordModeIT: New message received: '{}'", message.getPayload()); - if (message.getPayload().equals(EventHubBinderSyncModeIT.MESSAGE) && message.getHeaders().containsKey("x-opt-enqueued-time")) { + if (message.getPayload().equals(EventHubsBinderSyncModeIT.MESSAGE) && message.getHeaders().containsKey("x-opt-enqueued-time")) { LATCH.countDown(); } }; @@ -76,10 +76,10 @@ public Consumer> consume() { @Test public void testSendAndReceiveMessage() throws InterruptedException { LOGGER.info("EventHubBinderSyncModeIT begin."); - EventHubBinderSyncModeIT.LATCH.await(15, TimeUnit.SECONDS); + EventHubsBinderSyncModeIT.LATCH.await(15, TimeUnit.SECONDS); LOGGER.info("Send a message:" + MESSAGE + "."); many.emitNext(new GenericMessage<>(MESSAGE), Sinks.EmitFailureHandler.FAIL_FAST); - assertThat(EventHubBinderSyncModeIT.LATCH.await(30, TimeUnit.SECONDS)).isTrue(); + assertThat(EventHubsBinderSyncModeIT.LATCH.await(30, TimeUnit.SECONDS)).isTrue(); LOGGER.info("EventHubBinderSyncModeIT end."); } } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsTestTemplate.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsTestTemplate.java index 4ca74fcb41f04..0dda077b51861 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsTestTemplate.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/EventHubsTestTemplate.java @@ -6,8 +6,8 @@ import com.azure.messaging.eventhubs.EventData; import com.azure.messaging.eventhubs.models.EventContext; import com.azure.spring.eventhubs.core.EventHubsTemplate; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; -import com.azure.spring.eventhubs.support.converter.EventHubMessageConverter; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; +import com.azure.spring.eventhubs.support.converter.EventHubsMessageConverter; import com.azure.spring.messaging.PartitionSupplier; import com.azure.spring.service.eventhubs.processor.RecordEventProcessingListener; import org.springframework.lang.NonNull; @@ -22,10 +22,10 @@ */ public class EventHubsTestTemplate extends EventHubsTemplate { - private final EventHubMessageConverter messageConverter = new EventHubMessageConverter(); + private final EventHubsMessageConverter messageConverter = new EventHubsMessageConverter(); private final RecordEventProcessingListener listener; - public EventHubsTestTemplate(EventHubProducerFactory producerFactory, + public EventHubsTestTemplate(EventHubsProducerFactory producerFactory, RecordEventProcessingListener listener) { super(producerFactory); this.listener = listener; diff --git a/sdk/spring/spring-integration-azure-eventhubs/src/main/java/com/azure/spring/integration/eventhubs/inbound/EventHubInboundChannelAdapter.java b/sdk/spring/spring-integration-azure-eventhubs/src/main/java/com/azure/spring/integration/eventhubs/inbound/EventHubsInboundChannelAdapter.java similarity index 81% rename from sdk/spring/spring-integration-azure-eventhubs/src/main/java/com/azure/spring/integration/eventhubs/inbound/EventHubInboundChannelAdapter.java rename to sdk/spring/spring-integration-azure-eventhubs/src/main/java/com/azure/spring/integration/eventhubs/inbound/EventHubsInboundChannelAdapter.java index 514296dcc460a..961cb8c5a83a9 100644 --- a/sdk/spring/spring-integration-azure-eventhubs/src/main/java/com/azure/spring/integration/eventhubs/inbound/EventHubInboundChannelAdapter.java +++ b/sdk/spring/spring-integration-azure-eventhubs/src/main/java/com/azure/spring/integration/eventhubs/inbound/EventHubsInboundChannelAdapter.java @@ -7,8 +7,8 @@ import com.azure.messaging.eventhubs.models.EventContext; import com.azure.messaging.eventhubs.models.PartitionContext; import com.azure.spring.eventhubs.checkpoint.CheckpointManager; -import com.azure.spring.eventhubs.core.EventHubProcessorContainer; -import com.azure.spring.eventhubs.support.converter.EventHubMessageConverter; +import com.azure.spring.eventhubs.core.EventHubsProcessorContainer; +import com.azure.spring.eventhubs.support.converter.EventHubsMessageConverter; import com.azure.spring.messaging.AzureHeaders; import com.azure.spring.messaging.ListenerMode; import com.azure.spring.messaging.checkpoint.AzureCheckpointer; @@ -31,12 +31,12 @@ import java.util.Map; /** - * Inbound channel adapter for Event Hubs. + * Inbound channel adapter for Azure Event Hubs. */ -public class EventHubInboundChannelAdapter extends MessageProducerSupport { +public class EventHubsInboundChannelAdapter extends MessageProducerSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubInboundChannelAdapter.class); - private final EventHubProcessorContainer processorContainer; + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsInboundChannelAdapter.class); + private final EventHubsProcessorContainer processorContainer; private final String eventHubName; private final String consumerGroup; private final ListenerMode listenerMode; @@ -45,16 +45,16 @@ public class EventHubInboundChannelAdapter extends MessageProducerSupport { private EventProcessingListener listener; private CheckpointManager checkpointManager; - public EventHubInboundChannelAdapter(EventHubProcessorContainer processorContainer, - String eventHubName, String consumerGroup, - CheckpointConfig checkpointConfig) { + public EventHubsInboundChannelAdapter(EventHubsProcessorContainer processorContainer, + String eventHubName, String consumerGroup, + CheckpointConfig checkpointConfig) { this(processorContainer, eventHubName, consumerGroup, ListenerMode.RECORD, checkpointConfig); } - public EventHubInboundChannelAdapter(EventHubProcessorContainer eventProcessorsContainer, - String eventHubName, String consumerGroup, - ListenerMode listenerMode, - CheckpointConfig checkpointConfig) { + public EventHubsInboundChannelAdapter(EventHubsProcessorContainer eventProcessorsContainer, + String eventHubName, String consumerGroup, + ListenerMode listenerMode, + CheckpointConfig checkpointConfig) { Assert.notNull(eventHubName, "eventhubName must be provided"); Assert.notNull(consumerGroup, "consumerGroup must be provided"); @@ -85,7 +85,7 @@ protected void doStop() { this.processorContainer.stop(); } - public void setMessageConverter(EventHubMessageConverter messageConverter) { + public void setMessageConverter(EventHubsMessageConverter messageConverter) { this.recordEventProcessor.setMessageConverter(messageConverter); } @@ -95,7 +95,7 @@ public void setPayloadType(Class payloadType) { private class IntegrationRecordEventProcessingListener implements RecordEventProcessingListener { - private EventHubMessageConverter messageConverter = new EventHubMessageConverter(); + private EventHubsMessageConverter messageConverter = new EventHubsMessageConverter(); private Class payloadType = byte[].class; @@ -145,7 +145,7 @@ public InitializationContextConsumer getInitializationContextConsumer() { initializationContext.getPartitionContext().getPartitionId()); } - public void setMessageConverter(EventHubMessageConverter converter) { + public void setMessageConverter(EventHubsMessageConverter converter) { this.messageConverter = converter; } diff --git a/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/inbound/EventHubInboundAdapterTest.java b/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/inbound/EventHubsInboundAdapterTest.java similarity index 78% rename from sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/inbound/EventHubInboundAdapterTest.java rename to sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/inbound/EventHubsInboundAdapterTest.java index c8c2f8e8c14f8..40aac0e1610ca 100644 --- a/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/inbound/EventHubInboundAdapterTest.java +++ b/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/inbound/EventHubsInboundAdapterTest.java @@ -3,7 +3,7 @@ package com.azure.spring.integration.eventhubs.inbound; -import com.azure.spring.eventhubs.core.EventHubProcessorContainer; +import com.azure.spring.eventhubs.core.EventHubsProcessorContainer; import com.azure.spring.messaging.checkpoint.CheckpointConfig; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -21,9 +21,9 @@ import static org.mockito.Mockito.mock; -class EventHubInboundAdapterTest { +class EventHubsInboundAdapterTest { - private TestEventHubInboundChannelAdapter adapter; + private TestEventHubsInboundChannelAdapter adapter; private final String consumerGroup = "group"; private final String eventHub = "dest"; @@ -35,13 +35,13 @@ class EventHubInboundAdapterTest { @BeforeEach void setUp() { - EventHubProcessorContainer processorsContainer = mock(EventHubProcessorContainer.class); + EventHubsProcessorContainer processorsContainer = mock(EventHubsProcessorContainer.class); // EventProcessorClient processorClient = mock(EventProcessorClient.class); // when(processorsContainer.subscribe(eventHub, consumerGroup, processorProperties)).thenReturn // (processorClient); // - this.adapter = new TestEventHubInboundChannelAdapter(processorsContainer, this.eventHub, this.consumerGroup, + this.adapter = new TestEventHubsInboundChannelAdapter(processorsContainer, this.eventHub, this.consumerGroup, new CheckpointConfig()); } @@ -71,12 +71,12 @@ void sendAndReceive() throws InterruptedException { } } - static class TestEventHubInboundChannelAdapter extends EventHubInboundChannelAdapter { + static class TestEventHubsInboundChannelAdapter extends EventHubsInboundChannelAdapter { - TestEventHubInboundChannelAdapter(EventHubProcessorContainer eventProcessorsContainer, - String eventHubName, String consumerGroup, - CheckpointConfig checkpointConfig) { + TestEventHubsInboundChannelAdapter(EventHubsProcessorContainer eventProcessorsContainer, + String eventHubName, String consumerGroup, + CheckpointConfig checkpointConfig) { super(eventProcessorsContainer, eventHubName, consumerGroup, checkpointConfig); } diff --git a/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/outbound/EventHubMessageHandlerTest.java b/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/outbound/EventHubsMessageHandlerTest.java similarity index 98% rename from sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/outbound/EventHubMessageHandlerTest.java rename to sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/outbound/EventHubsMessageHandlerTest.java index 064378a8e8c10..867750e8a695d 100644 --- a/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/outbound/EventHubMessageHandlerTest.java +++ b/sdk/spring/spring-integration-azure-eventhubs/src/test/java/com/azure/spring/integration/eventhubs/outbound/EventHubsMessageHandlerTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class EventHubMessageHandlerTest extends MessageHandlerTest { +public class EventHubsMessageHandlerTest extends MessageHandlerTest { private static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser(); private static final String TO_PARTITION_SUPPLIER_METHOD_NAME = "toPartitionSupplier"; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubRuntimeException.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubRuntimeException.java deleted file mode 100644 index 1f909a702f483..0000000000000 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubRuntimeException.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.eventhubs.core; - -import org.springframework.core.NestedRuntimeException; - -/** - * The Azure Event Hub specific {@link NestedRuntimeException}. - * - * @author Warren Zhu - */ -public class EventHubRuntimeException extends NestedRuntimeException { - - public EventHubRuntimeException(String msg) { - super(msg); - } - - public EventHubRuntimeException(String msg, Throwable cause) { - super(msg, cause); - } -} diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubProcessorContainer.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsProcessorContainer.java similarity index 84% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubProcessorContainer.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsProcessorContainer.java index 32e12cda01f58..15203d63e08fb 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubProcessorContainer.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsProcessorContainer.java @@ -4,7 +4,7 @@ package com.azure.spring.eventhubs.core; import com.azure.messaging.eventhubs.EventProcessorClient; -import com.azure.spring.eventhubs.core.processor.EventHubProcessorFactory; +import com.azure.spring.eventhubs.core.processor.EventHubsProcessorFactory; import com.azure.spring.service.eventhubs.processor.EventProcessingListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,15 +19,15 @@ /** * */ -public class EventHubProcessorContainer implements Lifecycle, DisposableBean { +public class EventHubsProcessorContainer implements Lifecycle, DisposableBean { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubProcessorContainer.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsProcessorContainer.class); - private final EventHubProcessorFactory processorFactory; + private final EventHubsProcessorFactory processorFactory; private final List clients = new ArrayList<>(); private final AtomicBoolean isRunning = new AtomicBoolean(false); - public EventHubProcessorContainer(EventHubProcessorFactory processorFactory) { + public EventHubsProcessorContainer(EventHubsProcessorFactory processorFactory) { this.processorFactory = processorFactory; } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsRuntimeException.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsRuntimeException.java new file mode 100644 index 0000000000000..e1196fceac7d9 --- /dev/null +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsRuntimeException.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.eventhubs.core; + +import org.springframework.core.NestedRuntimeException; + +/** + * The Azure Event Hubs specific {@link NestedRuntimeException}. + * + */ +public class EventHubsRuntimeException extends NestedRuntimeException { + + public EventHubsRuntimeException(String msg) { + super(msg); + } + + public EventHubsRuntimeException(String msg, Throwable cause) { + super(msg, cause); + } +} diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsTemplate.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsTemplate.java index ec860994b9bfa..80694b49a048c 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsTemplate.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/EventHubsTemplate.java @@ -7,8 +7,8 @@ import com.azure.messaging.eventhubs.EventData; import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; import com.azure.messaging.eventhubs.models.CreateBatchOptions; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; -import com.azure.spring.eventhubs.support.converter.EventHubMessageConverter; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; +import com.azure.spring.eventhubs.support.converter.EventHubsMessageConverter; import com.azure.spring.messaging.PartitionSupplier; import com.azure.spring.messaging.core.BatchSendOperation; import com.azure.spring.messaging.core.SendOperation; @@ -29,10 +29,10 @@ public class EventHubsTemplate implements SendOperation, BatchSendOperation { private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsTemplate.class); - private final EventHubProducerFactory producerFactory; - private EventHubMessageConverter messageConverter = new EventHubMessageConverter(); + private final EventHubsProducerFactory producerFactory; + private EventHubsMessageConverter messageConverter = new EventHubsMessageConverter(); - public EventHubsTemplate(EventHubProducerFactory producerFactory) { + public EventHubsTemplate(EventHubsProducerFactory producerFactory) { this.producerFactory = producerFactory; } @@ -72,7 +72,7 @@ private CreateBatchOptions buildCreateBatchOptions(PartitionSupplier partitionSu .setPartitionKey(partitionSupplier != null ? partitionSupplier.getPartitionKey() : null); } - public void setMessageConverter(EventHubMessageConverter messageConverter) { + public void setMessageConverter(EventHubsMessageConverter messageConverter) { this.messageConverter = messageConverter; } } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubNamespaceProcessorFactory.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubsNamespaceProcessorFactory.java similarity index 81% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubNamespaceProcessorFactory.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubsNamespaceProcessorFactory.java index de64e469a421f..7e514c4e88bc6 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubNamespaceProcessorFactory.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubsNamespaceProcessorFactory.java @@ -30,9 +30,9 @@ * configuration entry is provided at both processor and namespace level, the processor level configuration will take * advantage. */ -public class DefaultEventHubNamespaceProcessorFactory implements EventHubProcessorFactory, DisposableBean { +public class DefaultEventHubsNamespaceProcessorFactory implements EventHubsProcessorFactory, DisposableBean { - private static final Logger LOGGER = LoggerFactory.getLogger(DefaultEventHubNamespaceProcessorFactory.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultEventHubsNamespaceProcessorFactory.class); private final List listeners = new ArrayList<>(); private final NamespaceProperties namespaceProperties; @@ -41,23 +41,23 @@ public class DefaultEventHubNamespaceProcessorFactory implements EventHubProcess private final Map, EventProcessorClient> processorClientMap = new ConcurrentHashMap<>(); private final ProcessorPropertiesParentMerger propertiesMerger = new ProcessorPropertiesParentMerger(); - public DefaultEventHubNamespaceProcessorFactory(CheckpointStore checkpointStore) { + public DefaultEventHubsNamespaceProcessorFactory(CheckpointStore checkpointStore) { this(checkpointStore, null, null); } - public DefaultEventHubNamespaceProcessorFactory(CheckpointStore checkpointStore, - NamespaceProperties namespaceProperties) { + public DefaultEventHubsNamespaceProcessorFactory(CheckpointStore checkpointStore, + NamespaceProperties namespaceProperties) { this(checkpointStore, namespaceProperties, key -> null); } - public DefaultEventHubNamespaceProcessorFactory(CheckpointStore checkpointStore, - PropertiesSupplier, - ProcessorProperties> supplier) { + public DefaultEventHubsNamespaceProcessorFactory(CheckpointStore checkpointStore, + PropertiesSupplier, + ProcessorProperties> supplier) { this(checkpointStore, null, supplier); } - public DefaultEventHubNamespaceProcessorFactory(CheckpointStore checkpointStore, - NamespaceProperties namespaceProperties, - PropertiesSupplier, + public DefaultEventHubsNamespaceProcessorFactory(CheckpointStore checkpointStore, + NamespaceProperties namespaceProperties, + PropertiesSupplier, ProcessorProperties> supplier) { Assert.notNull(checkpointStore, "CheckpointStore must be provided."); this.checkpointStore = checkpointStore; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/EventHubProcessorFactory.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/EventHubsProcessorFactory.java similarity index 95% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/EventHubProcessorFactory.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/EventHubsProcessorFactory.java index aeb9b04768a20..5329dfd958055 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/EventHubProcessorFactory.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/processor/EventHubsProcessorFactory.java @@ -9,7 +9,7 @@ /** * The strategy to produce {@link EventProcessorClient} instance. */ -public interface EventHubProcessorFactory { +public interface EventHubsProcessorFactory { EventProcessorClient createProcessor(String eventHub, String consumerGroup, EventProcessingListener listener); diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubNamespaceProducerFactory.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubsNamespaceProducerFactory.java similarity index 87% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubNamespaceProducerFactory.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubsNamespaceProducerFactory.java index fa1c5736162e3..9b5dadd139401 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubNamespaceProducerFactory.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubsNamespaceProducerFactory.java @@ -22,7 +22,7 @@ * if a configuration entry is provided at both producer and namespace level, the producer level configuration will * take advantage. */ -public final class DefaultEventHubNamespaceProducerFactory implements EventHubProducerFactory, DisposableBean { +public final class DefaultEventHubsNamespaceProducerFactory implements EventHubsProducerFactory, DisposableBean { private final List listeners = new ArrayList<>(); private final NamespaceProperties namespaceProperties; @@ -30,12 +30,12 @@ public final class DefaultEventHubNamespaceProducerFactory implements EventHubPr private final Map clients = new ConcurrentHashMap<>(); private final ProducerPropertiesParentMerger parentMerger = new ProducerPropertiesParentMerger(); - public DefaultEventHubNamespaceProducerFactory(NamespaceProperties namespaceProperties) { + public DefaultEventHubsNamespaceProducerFactory(NamespaceProperties namespaceProperties) { this(namespaceProperties, key -> null); } - public DefaultEventHubNamespaceProducerFactory(NamespaceProperties namespaceProperties, - PropertiesSupplier supplier) { + public DefaultEventHubsNamespaceProducerFactory(NamespaceProperties namespaceProperties, + PropertiesSupplier supplier) { this.namespaceProperties = namespaceProperties; this.propertiesSupplier = supplier; } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/EventHubProducerFactory.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/EventHubsProducerFactory.java similarity index 94% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/EventHubProducerFactory.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/EventHubsProducerFactory.java index e17a8c2ee205d..e8bd8d5a911f6 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/EventHubProducerFactory.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/producer/EventHubsProducerFactory.java @@ -8,7 +8,7 @@ /** * The strategy to produce {@link EventHubProducerAsyncClient} instance. */ -public interface EventHubProducerFactory { +public interface EventHubsProducerFactory { EventHubProducerAsyncClient createProducer(String eventHub); diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/CommonProperties.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/CommonProperties.java index 3484eb0f23729..34c882f9dedf7 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/CommonProperties.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/CommonProperties.java @@ -4,14 +4,14 @@ package com.azure.spring.eventhubs.core.properties; import com.azure.spring.core.aware.authentication.ConnectionStringAware; -import com.azure.spring.core.connectionstring.implementation.EventHubConnectionString; +import com.azure.spring.core.connectionstring.implementation.EventHubsConnectionString; import com.azure.spring.core.properties.AbstractAzureAmqpSdkProperties; -import com.azure.spring.service.eventhubs.properties.EventHubCommonDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsCommonDescriptor; /** * Common properties shared by event hub namespace, a producer, and a consumer. */ -abstract class CommonProperties extends AbstractAzureAmqpSdkProperties implements EventHubCommonDescriptor, ConnectionStringAware { +abstract class CommonProperties extends AbstractAzureAmqpSdkProperties implements EventHubsCommonDescriptor, ConnectionStringAware { private String domainName = "servicebus.windows.net"; @@ -24,14 +24,14 @@ private String extractFqdnFromConnectionString() { if (this.connectionString == null) { return null; } - return new EventHubConnectionString(this.connectionString).getFullyQualifiedNamespace(); + return new EventHubsConnectionString(this.connectionString).getFullyQualifiedNamespace(); } private String extractEventHubNameFromConnectionString() { if (this.connectionString == null) { return null; } - return new EventHubConnectionString(this.connectionString).getEntityPath(); + return new EventHubsConnectionString(this.connectionString).getEntityPath(); } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ConsumerProperties.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ConsumerProperties.java index 7531a24d2fdfc..ec6a56b3565df 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ConsumerProperties.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ConsumerProperties.java @@ -3,12 +3,12 @@ package com.azure.spring.eventhubs.core.properties; -import com.azure.spring.service.eventhubs.properties.EventHubConsumerDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsConsumerDescriptor; /** * An event hub consumer related properties. */ -public class ConsumerProperties extends CommonProperties implements EventHubConsumerDescriptor { +public class ConsumerProperties extends CommonProperties implements EventHubsConsumerDescriptor { protected String consumerGroup; protected Integer prefetchCount; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/NamespaceProperties.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/NamespaceProperties.java index eb20a95e30dbf..d600fc2fb4dcb 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/NamespaceProperties.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/NamespaceProperties.java @@ -3,12 +3,12 @@ package com.azure.spring.eventhubs.core.properties; -import com.azure.spring.service.eventhubs.properties.EventHubNamespaceDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsNamespaceDescriptor; /** * An event hub namespace related properties. */ -public class NamespaceProperties extends CommonProperties implements EventHubNamespaceDescriptor { +public class NamespaceProperties extends CommonProperties implements EventHubsNamespaceDescriptor { private Boolean sharedConnection; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProcessorProperties.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProcessorProperties.java index 4ef55e8016a2b..7eb864e46adf0 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProcessorProperties.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProcessorProperties.java @@ -3,7 +3,7 @@ package com.azure.spring.eventhubs.core.properties; -import com.azure.spring.service.eventhubs.properties.EventHubProcessorDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsProcessorDescriptor; import java.time.Duration; import java.util.HashMap; @@ -12,9 +12,9 @@ /** * An event hub processor related properties. */ -public class ProcessorProperties extends ConsumerProperties implements EventHubProcessorDescriptor { +public class ProcessorProperties extends ConsumerProperties implements EventHubsProcessorDescriptor { - private final Map initialPartitionEventPosition = new HashMap<>(); + private final Map initialPartitionEventPosition = new HashMap<>(); private final LoadBalancing loadBalancing = new LoadBalancing(); private final Batch batch = new Batch(); private Boolean trackLastEnqueuedEventProperties; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProducerProperties.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProducerProperties.java index bca398357f85a..725b798191e1d 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProducerProperties.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/core/properties/ProducerProperties.java @@ -3,11 +3,11 @@ package com.azure.spring.eventhubs.core.properties; -import com.azure.spring.service.eventhubs.properties.EventHubProducerDescriptor; +import com.azure.spring.service.eventhubs.properties.EventHubsProducerDescriptor; /** * An event hub producer related properties. */ -public class ProducerProperties extends CommonProperties implements EventHubProducerDescriptor { +public class ProducerProperties extends CommonProperties implements EventHubsProducerDescriptor { } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/EventHubProvisioner.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/EventHubsProvisioner.java similarity index 91% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/EventHubProvisioner.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/EventHubsProvisioner.java index d4b5446ef3023..62728fbf53971 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/EventHubProvisioner.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/EventHubsProvisioner.java @@ -6,7 +6,7 @@ /** * An interface to provision Event Hubs resources. */ -public interface EventHubProvisioner { +public interface EventHubsProvisioner { void provisionNamespace(String namespace); diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/arm/DefaultEventHubProvisioner.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/arm/DefaultEventHubsProvisioner.java similarity index 58% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/arm/DefaultEventHubProvisioner.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/arm/DefaultEventHubsProvisioner.java index 1b3fd91e4695f..b8ac0b89b27eb 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/arm/DefaultEventHubProvisioner.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/provisioning/arm/DefaultEventHubsProvisioner.java @@ -4,27 +4,27 @@ package com.azure.spring.eventhubs.provisioning.arm; import com.azure.resourcemanager.AzureResourceManager; -import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubConsumerGroupCrud; -import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubCrud; +import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubsConsumerGroupCrud; +import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubsCrud; import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubNamespaceCrud; import com.azure.spring.core.properties.resource.AzureResourceMetadata; -import com.azure.spring.eventhubs.provisioning.EventHubProvisioner; +import com.azure.spring.eventhubs.provisioning.EventHubsProvisioner; import reactor.util.function.Tuples; /** - * Default implementation to provision an Event Hub. + * Default implementation to provision resources in Azure Event Hubs. */ -public class DefaultEventHubProvisioner implements EventHubProvisioner { +public class DefaultEventHubsProvisioner implements EventHubsProvisioner { private final EventHubNamespaceCrud namespaceCrud; - private final EventHubCrud eventHubCrud; - private final EventHubConsumerGroupCrud consumerGroupCrud; + private final EventHubsCrud eventHubsCrud; + private final EventHubsConsumerGroupCrud consumerGroupCrud; - public DefaultEventHubProvisioner(AzureResourceManager azureResourceManager, - AzureResourceMetadata azureResourceMetadata) { + public DefaultEventHubsProvisioner(AzureResourceManager azureResourceManager, + AzureResourceMetadata azureResourceMetadata) { this.namespaceCrud = new EventHubNamespaceCrud(azureResourceManager, azureResourceMetadata); - this.eventHubCrud = new EventHubCrud(azureResourceManager, azureResourceMetadata); - this.consumerGroupCrud = new EventHubConsumerGroupCrud(azureResourceManager, azureResourceMetadata); + this.eventHubsCrud = new EventHubsCrud(azureResourceManager, azureResourceMetadata); + this.consumerGroupCrud = new EventHubsConsumerGroupCrud(azureResourceManager, azureResourceMetadata); } @Override @@ -34,7 +34,7 @@ public void provisionNamespace(String namespace) { @Override public void provisionEventHub(String namespace, String eventHub) { - this.eventHubCrud.getOrCreate(Tuples.of(namespace, eventHub)); + this.eventHubsCrud.getOrCreate(Tuples.of(namespace, eventHub)); } @Override diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/EventHubHeaders.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/EventHubsHeaders.java similarity index 80% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/EventHubHeaders.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/EventHubsHeaders.java index 15679a6ef35d0..d0484780236fb 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/EventHubHeaders.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/EventHubsHeaders.java @@ -5,9 +5,9 @@ import com.azure.spring.messaging.AzureHeaders; /** - * Azure Event Hub internal headers for Spring Messaging messages. + * Azure Event Hubs internal headers for Spring Messaging messages. */ -public class EventHubHeaders extends AzureHeaders { +public class EventHubsHeaders extends AzureHeaders { private static final String PREFIX = AzureHeaders.PREFIX + "eventhub_"; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/converter/EventHubMessageConverter.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/converter/EventHubsMessageConverter.java similarity index 76% rename from sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/converter/EventHubMessageConverter.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/converter/EventHubsMessageConverter.java index ba1af3ede6248..0f7e960343290 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/converter/EventHubMessageConverter.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/eventhubs/support/converter/EventHubsMessageConverter.java @@ -4,7 +4,7 @@ package com.azure.spring.eventhubs.support.converter; import com.azure.messaging.eventhubs.EventData; -import com.azure.spring.eventhubs.support.EventHubHeaders; +import com.azure.spring.eventhubs.support.EventHubsHeaders; import com.azure.spring.messaging.converter.AbstractAzureMessageConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,17 +22,16 @@ /** * A converter to turn a {@link Message} to {@link EventData} and vice versa. * - * @author Warren Zhu */ -public class EventHubMessageConverter extends AbstractAzureMessageConverter { +public class EventHubsMessageConverter extends AbstractAzureMessageConverter { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubMessageConverter.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsMessageConverter.class); private static final Set SYSTEM_HEADERS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( - EventHubHeaders.PARTITION_KEY, - EventHubHeaders.ENQUEUED_TIME, - EventHubHeaders.OFFSET, - EventHubHeaders.SEQUENCE_NUMBER))); + EventHubsHeaders.PARTITION_KEY, + EventHubsHeaders.ENQUEUED_TIME, + EventHubsHeaders.OFFSET, + EventHubsHeaders.SEQUENCE_NUMBER))); @Override protected byte[] getPayload(EventData azureMessage) { @@ -67,7 +66,6 @@ protected Map buildCustomHeaders(EventData azureMessage) { Map headers = super.buildCustomHeaders(azureMessage); headers.putAll(getSystemProperties(azureMessage)); - headers.putAll(azureMessage.getProperties()); return headers; } @@ -75,10 +73,10 @@ protected Map buildCustomHeaders(EventData azureMessage) { private Map getSystemProperties(EventData azureMessage) { Map result = new HashMap<>(); result.putAll(azureMessage.getSystemProperties()); - result.put(EventHubHeaders.ENQUEUED_TIME, azureMessage.getEnqueuedTime()); - result.put(EventHubHeaders.OFFSET, azureMessage.getOffset()); - result.put(EventHubHeaders.SEQUENCE_NUMBER, azureMessage.getSequenceNumber()); - result.put(EventHubHeaders.PARTITION_KEY, azureMessage.getPartitionKey()); + result.put(EventHubsHeaders.ENQUEUED_TIME, azureMessage.getEnqueuedTime()); + result.put(EventHubsHeaders.OFFSET, azureMessage.getOffset()); + result.put(EventHubsHeaders.SEQUENCE_NUMBER, azureMessage.getSequenceNumber()); + result.put(EventHubsHeaders.PARTITION_KEY, azureMessage.getPartitionKey()); return result; } } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubProcessorsContainerTest.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubsProcessorsContainerTest.java similarity index 91% rename from sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubProcessorsContainerTest.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubsProcessorsContainerTest.java index 252432be8bcfe..e765077f5a258 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubProcessorsContainerTest.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubsProcessorsContainerTest.java @@ -4,7 +4,7 @@ package com.azure.spring.eventhubs.core; import com.azure.messaging.eventhubs.EventProcessorClient; -import com.azure.spring.eventhubs.core.processor.EventHubProcessorFactory; +import com.azure.spring.eventhubs.core.processor.EventHubsProcessorFactory; import com.azure.spring.service.eventhubs.processor.EventProcessingListener; import com.azure.spring.service.eventhubs.processor.RecordEventProcessingListener; import org.junit.jupiter.api.AfterEach; @@ -23,10 +23,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -class EventHubProcessorsContainerTest { +class EventHubsProcessorsContainerTest { @Mock - private EventHubProcessorFactory mockProcessorFactory; + private EventHubsProcessorFactory mockProcessorFactory; @Mock private EventProcessorClient oneEventProcessorClient; @@ -34,7 +34,7 @@ class EventHubProcessorsContainerTest { @Mock private EventProcessorClient anotherEventProcessorClient; - private EventHubProcessorContainer processorContainer; + private EventHubsProcessorContainer processorContainer; private final RecordEventProcessingListener listener = eventContext -> { }; private AutoCloseable closeable; @@ -51,7 +51,7 @@ void setUp() { when(this.mockProcessorFactory.createProcessor(eq(destination), eq(anotherConsumerGroup), isA(EventProcessingListener.class))) .thenReturn(this.anotherEventProcessorClient); - this.processorContainer = new EventHubProcessorContainer(mockProcessorFactory); + this.processorContainer = new EventHubsProcessorContainer(mockProcessorFactory); doNothing().when(this.oneEventProcessorClient).stop(); doNothing().when(this.oneEventProcessorClient).start(); } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubTemplateSendTest.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubsTemplateSendTest.java similarity index 86% rename from sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubTemplateSendTest.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubsTemplateSendTest.java index eae58324bc476..7d6f38e5d0f40 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubTemplateSendTest.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/EventHubsTemplateSendTest.java @@ -7,7 +7,7 @@ import com.azure.messaging.eventhubs.EventDataBatch; import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; import com.azure.messaging.eventhubs.models.CreateBatchOptions; -import com.azure.spring.eventhubs.core.producer.EventHubProducerFactory; +import com.azure.spring.eventhubs.core.producer.EventHubsProducerFactory; import com.azure.spring.messaging.core.SendOperationTest; import org.junit.jupiter.api.BeforeEach; import reactor.core.publisher.Mono; @@ -20,15 +20,15 @@ import static org.mockito.Mockito.when; -public class EventHubTemplateSendTest extends SendOperationTest { +public class EventHubsTemplateSendTest extends SendOperationTest { - private EventHubProducerFactory producerFactory; + private EventHubsProducerFactory producerFactory; private EventHubProducerAsyncClient mockProducerClient; @BeforeEach public void setUp() { this.mockProducerClient = mock(EventHubProducerAsyncClient.class); - this.producerFactory = mock(EventHubProducerFactory.class); + this.producerFactory = mock(EventHubsProducerFactory.class); EventDataBatch eventDataBatch = mock(EventDataBatch.class); when(this.producerFactory.createProducer(eq(this.destination))).thenReturn(this.mockProducerClient); @@ -48,7 +48,7 @@ protected void verifySendCalled(int times) { @Override protected void whenSendWithException() { when(this.producerFactory.createProducer(this.destination)) - .thenThrow(EventHubRuntimeException.class); + .thenThrow(EventHubsRuntimeException.class); } @Override diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubNamespaceProcessorFactoryTest.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubsNamespaceProcessorFactoryTest.java similarity index 88% rename from sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubNamespaceProcessorFactoryTest.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubsNamespaceProcessorFactoryTest.java index deaecae73cca1..6a932d39930bf 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubNamespaceProcessorFactoryTest.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/processor/DefaultEventHubsNamespaceProcessorFactoryTest.java @@ -14,9 +14,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.powermock.api.mockito.PowerMockito.mock; -class DefaultEventHubNamespaceProcessorFactoryTest { +class DefaultEventHubsNamespaceProcessorFactoryTest { - private EventHubProcessorFactory processorFactory; + private EventHubsProcessorFactory processorFactory; private final String eventHubName = "eventHub"; private final String consumerGroup = "group"; private final String anotherConsumerGroup = "group2"; @@ -27,10 +27,10 @@ class DefaultEventHubNamespaceProcessorFactoryTest { void setUp() { NamespaceProperties namespaceProperties = new NamespaceProperties(); namespaceProperties.setNamespace("test-namespace"); - this.processorFactory = new DefaultEventHubNamespaceProcessorFactory(mock(CheckpointStore.class), + this.processorFactory = new DefaultEventHubsNamespaceProcessorFactory(mock(CheckpointStore.class), namespaceProperties); processorAddedTimes = 0; - this.processorFactory.addListener(new EventHubProcessorFactory.Listener() { + this.processorFactory.addListener(new EventHubsProcessorFactory.Listener() { @Override public void processorAdded(String eventHub, String consumerGroup) { processorAddedTimes++; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubNamespaceProducerFactoryTest.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubsNamespaceProducerFactoryTest.java similarity index 86% rename from sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubNamespaceProducerFactoryTest.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubsNamespaceProducerFactoryTest.java index b0357fbe7a2ad..44105b6abe82f 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubNamespaceProducerFactoryTest.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/core/producer/DefaultEventHubsNamespaceProducerFactoryTest.java @@ -11,9 +11,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -class DefaultEventHubNamespaceProducerFactoryTest { +class DefaultEventHubsNamespaceProducerFactoryTest { - private EventHubProducerFactory producerFactory; + private EventHubsProducerFactory producerFactory; private final String eventHubName = "eventHub"; private int producerAddedTimes = 0; @@ -21,9 +21,9 @@ class DefaultEventHubNamespaceProducerFactoryTest { void setUp() { NamespaceProperties namespaceProperties = new NamespaceProperties(); namespaceProperties.setNamespace("test-namespace"); - this.producerFactory = new DefaultEventHubNamespaceProducerFactory(namespaceProperties); + this.producerFactory = new DefaultEventHubsNamespaceProducerFactory(namespaceProperties); producerAddedTimes = 0; - this.producerFactory.addListener(new EventHubProducerFactory.Listener() { + this.producerFactory.addListener(new EventHubsProducerFactory.Listener() { @Override public void producerAdded(String name) { producerAddedTimes++; diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/support/converter/EventHubMessageConverterTest.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/support/converter/EventHubsMessageConverterTest.java similarity index 77% rename from sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/support/converter/EventHubMessageConverterTest.java rename to sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/support/converter/EventHubsMessageConverterTest.java index 2a27d057a30f8..5acfb62a1d334 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/support/converter/EventHubMessageConverterTest.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/eventhubs/support/converter/EventHubsMessageConverterTest.java @@ -4,7 +4,7 @@ package com.azure.spring.eventhubs.support.converter; import com.azure.messaging.eventhubs.EventData; -import com.azure.spring.eventhubs.support.EventHubHeaders; +import com.azure.spring.eventhubs.support.EventHubsHeaders; import com.azure.spring.messaging.converter.AzureMessageConverter; import com.azure.spring.messaging.converter.UnaryAzureMessageConverterTest; import org.junit.jupiter.api.Test; @@ -24,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.messaging.support.NativeMessageHeaderAccessor.NATIVE_HEADERS; -public class EventHubMessageConverterTest extends UnaryAzureMessageConverterTest { +public class EventHubsMessageConverterTest extends UnaryAzureMessageConverterTest { private static final String EVENT_DATA = "event-hub-test-string"; @@ -35,7 +35,7 @@ public class EventHubMessageConverterTest extends UnaryAzureMessageConverterTest @Override public AzureMessageConverter getConverter() { - return new EventHubMessageConverter(); + return new EventHubsMessageConverter(); } @Override @@ -65,7 +65,7 @@ public void testConvertCustomHeadersToEventData() { EventData eventData = new EventData(EVENT_DATA); - EventHubMessageConverter converter = new EventHubMessageConverter(); + EventHubsMessageConverter converter = new EventHubsMessageConverter(); converter.setCustomHeaders(headers, eventData); assertEquals(eventData.getProperties().get("fake-header"), "fake-value"); @@ -77,7 +77,7 @@ public void testCustomHeadersFromEventData() { EventData eventData = new EventData(EVENT_DATA); eventData.getProperties().put("fake-header", "fake-value"); - EventHubMessageConverter converter = new EventHubMessageConverter(); + EventHubsMessageConverter converter = new EventHubsMessageConverter(); Map headerHeadersMap = converter.buildCustomHeaders(eventData); assertEquals(headerHeadersMap.get("fake-header"), "fake-value"); assertEquals(eventData.getBodyAsString(), EVENT_DATA); @@ -89,7 +89,7 @@ public void testNativeHeadersFromEventData() { String nativeHeadersString = "{\"spanId\":[\"spanId-1\", \"spanId-2\"],\"spanTraceId\":[\"spanTraceId-1\", \"spanTraceId-2\"]}"; eventData.getProperties().put(NATIVE_HEADERS, nativeHeadersString); - EventHubMessageConverter converter = new EventHubMessageConverter(); + EventHubsMessageConverter converter = new EventHubsMessageConverter(); Map headerHeadersMap = converter.buildCustomHeaders(eventData); assertEquals(headerHeadersMap.get(NATIVE_HEADERS).getClass(), String.class); } @@ -97,33 +97,33 @@ public void testNativeHeadersFromEventData() { @Test public void testSystemPropertiesScreenedOut() { Map headerMap = new HashMap<>(); - headerMap.put(EventHubHeaders.PARTITION_KEY, PARTITION_KEY); - headerMap.put(EventHubHeaders.ENQUEUED_TIME, ENQUEUED_TIME); - headerMap.put(EventHubHeaders.OFFSET, OFFSET); - headerMap.put(EventHubHeaders.SEQUENCE_NUMBER, SEQUENCE_NUMBER); + headerMap.put(EventHubsHeaders.PARTITION_KEY, PARTITION_KEY); + headerMap.put(EventHubsHeaders.ENQUEUED_TIME, ENQUEUED_TIME); + headerMap.put(EventHubsHeaders.OFFSET, OFFSET); + headerMap.put(EventHubsHeaders.SEQUENCE_NUMBER, SEQUENCE_NUMBER); MessageHeaders headers = new MessageHeaders(headerMap); EventData eventData = new EventData(EVENT_DATA); - EventHubMessageConverter converter = new EventHubMessageConverter(); + EventHubsMessageConverter converter = new EventHubsMessageConverter(); converter.setCustomHeaders(headers, eventData); - assertFalse(eventData.getProperties().containsKey(EventHubHeaders.PARTITION_KEY)); - assertFalse(eventData.getProperties().containsKey(EventHubHeaders.ENQUEUED_TIME)); - assertFalse(eventData.getProperties().containsKey(EventHubHeaders.OFFSET)); - assertFalse(eventData.getProperties().containsKey(EventHubHeaders.SEQUENCE_NUMBER)); + assertFalse(eventData.getProperties().containsKey(EventHubsHeaders.PARTITION_KEY)); + assertFalse(eventData.getProperties().containsKey(EventHubsHeaders.ENQUEUED_TIME)); + assertFalse(eventData.getProperties().containsKey(EventHubsHeaders.OFFSET)); + assertFalse(eventData.getProperties().containsKey(EventHubsHeaders.SEQUENCE_NUMBER)); } @Test public void testSystemPropertiesConvertedFromEventData() { EventData eventData = new EventData(EVENT_DATA); - EventHubMessageConverter converter = new EventHubMessageConverter(); + EventHubsMessageConverter converter = new EventHubsMessageConverter(); Map headerHeadersMap = converter.buildCustomHeaders(eventData); - assertTrue(headerHeadersMap.containsKey(EventHubHeaders.ENQUEUED_TIME)); - assertTrue(headerHeadersMap.containsKey(EventHubHeaders.OFFSET)); - assertTrue(headerHeadersMap.containsKey(EventHubHeaders.SEQUENCE_NUMBER)); - assertTrue(headerHeadersMap.containsKey(EventHubHeaders.PARTITION_KEY)); + assertTrue(headerHeadersMap.containsKey(EventHubsHeaders.ENQUEUED_TIME)); + assertTrue(headerHeadersMap.containsKey(EventHubsHeaders.OFFSET)); + assertTrue(headerHeadersMap.containsKey(EventHubsHeaders.SEQUENCE_NUMBER)); + assertTrue(headerHeadersMap.containsKey(EventHubsHeaders.PARTITION_KEY)); } } diff --git a/sdk/spring/spring-reference.yml b/sdk/spring/spring-reference.yml index 1db4fb2f032d6..993f787b7fb83 100644 --- a/sdk/spring/spring-reference.yml +++ b/sdk/spring/spring-reference.yml @@ -494,7 +494,7 @@ groupId: com.azure.spring versionGA: 4.0.0 versionPreview: 2.0.0-beta.1 - description: Microsoft's Spring Cloud Stream Binder provides Spring Cloud Stream Binder for Azure Event Hub which allows you to build message-driven microservice using Spring Cloud Stream based on Azure Event Hub service. + description: Microsoft's Spring Cloud Stream Binder provides Spring Cloud Stream Binder for Azure Event Hubs which allows you to build message-driven microservice using Spring Cloud Stream based on Azure Event Hubs service. type: spring links: repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-stream-binder-eventhubs @@ -517,7 +517,7 @@ - artifactId: spring-cloud-azure-starter-stream-eventhubs groupId: com.azure.spring versionPreview: 4.0.0-beta.1 - description: Microsoft's Spring Cloud Stream Binder Starter provides Spring Cloud Stream Binder for Azure Event Hub which allows you to build message-driven microservice using Spring Cloud Stream based on Azure Event Hub service. + description: Microsoft's Spring Cloud Stream Binder Starter provides Spring Cloud Stream Binder for Azure Event Hubs which allows you to build message-driven microservice using Spring Cloud Stream based on Azure Event Hubs service. type: spring links: repopath: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-stream-eventhubs