You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2023/12/13 12:49:21 UTC

(camel) 03/04: CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Eventhubs - Test

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-18590-eventhubs
in repository https://gitbox.apache.org/repos/asf/camel.git

commit be040a0c33aafa8da8843aada6d8f29ddd76e015
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Dec 13 13:36:41 2023 +0100

    CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Eventhubs - Test
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../azure/eventhubs/EventHubsComponentTest.java       | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/components/camel-azure/camel-azure-eventhubs/src/test/java/org/apache/camel/component/azure/eventhubs/EventHubsComponentTest.java b/components/camel-azure/camel-azure-eventhubs/src/test/java/org/apache/camel/component/azure/eventhubs/EventHubsComponentTest.java
index dffb896ddf5..0b294de006c 100644
--- a/components/camel-azure/camel-azure-eventhubs/src/test/java/org/apache/camel/component/azure/eventhubs/EventHubsComponentTest.java
+++ b/components/camel-azure/camel-azure-eventhubs/src/test/java/org/apache/camel/component/azure/eventhubs/EventHubsComponentTest.java
@@ -139,6 +139,25 @@ class EventHubsComponentTest extends CamelTestSupport {
         assertEquals(1000, endpoint.getConfiguration().getCheckpointBatchTimeout());
     }
 
+    @Test
+    public void testCreateEndpointWithConfigAzureIdentity() {
+        final String uri = "azure-eventhubs:namespace/hubName?sharedAccessName=DummyAccessKeyName"
+                           + "&sharedAccessKey=DummyKey"
+                           + "&consumerGroupName=testConsumer&prefetchCount=100"
+                           + "&checkpointBatchSize=100&checkpointBatchTimeout=1000"
+                           + "&credentialType=AZURE_IDENTITY";
+
+        final EventHubsEndpoint endpoint = context.getEndpoint(uri, EventHubsEndpoint.class);
+
+        assertEquals("namespace", endpoint.getConfiguration().getNamespace());
+        assertEquals("hubName", endpoint.getConfiguration().getEventHubName());
+        assertEquals("testConsumer", endpoint.getConfiguration().getConsumerGroupName());
+        assertEquals(CredentialType.AZURE_IDENTITY, endpoint.getConfiguration().getCredentialType());
+        assertEquals(100, endpoint.getConfiguration().getPrefetchCount());
+        assertEquals(100, endpoint.getConfiguration().getCheckpointBatchSize());
+        assertEquals(1000, endpoint.getConfiguration().getCheckpointBatchTimeout());
+    }
+
     private String getErrorMessage(final String uri) {
         ResolveEndpointFailedException exception
                 = assertThrows(ResolveEndpointFailedException.class, () -> context.getEndpoint(uri));