This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch CAMEL-18590-datalake-fix in repository https://gitbox.apache.org/repos/asf/camel.git
commit 944656f1731085e4e54f79ff6aa06dc9f0e09e0a Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Mon Dec 18 11:42:43 2023 +0100 CAMEL-18590 - Camel-Azure components: Define a unique configuration for authentication - Azure Datalake - Tests Signed-off-by: Andrea Cosentino <anco...@gmail.com> --- .../datalake/component/DataLakeComponentTest.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/component/DataLakeComponentTest.java b/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/component/DataLakeComponentTest.java index 41d236893e3..d9f6fdc39f7 100644 --- a/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/component/DataLakeComponentTest.java +++ b/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/component/DataLakeComponentTest.java @@ -19,6 +19,7 @@ package org.apache.camel.component.azure.storage.datalake.component; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.file.datalake.DataLakeServiceClientBuilder; import org.apache.camel.Producer; +import org.apache.camel.component.azure.storage.datalake.CredentialType; import org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration; import org.apache.camel.component.azure.storage.datalake.DataLakeEndpoint; import org.apache.camel.component.azure.storage.datalake.DataLakeOperationsDefinition; @@ -65,6 +66,36 @@ class DataLakeComponentTest extends CamelTestSupport { assertEquals("test.txt", endpoint.getConfiguration().getFileName()); } + @Test + public void testWithAzureIdentity() { + + final DataLakeEndpoint endpoint = (DataLakeEndpoint) context + .getEndpoint( + "azure-storage-datalake:cameltesting/abc?operation=upload&fileName=test.txt&credentialType=AZURE_IDENTITY"); + + assertEquals("cameltesting", endpoint.getConfiguration().getAccountName()); + assertEquals("abc", endpoint.getConfiguration().getFileSystemName()); + assertNull(endpoint.getConfiguration().getServiceClient()); + assertEquals(DataLakeOperationsDefinition.upload, endpoint.getConfiguration().getOperation()); + assertEquals("test.txt", endpoint.getConfiguration().getFileName()); + assertEquals(endpoint.getConfiguration().getCredentialType(), CredentialType.AZURE_IDENTITY); + } + + @Test + public void testWithAzureSAS() { + + final DataLakeEndpoint endpoint = (DataLakeEndpoint) context + .getEndpoint( + "azure-storage-datalake:cameltesting/abc?operation=upload&fileName=test.txt&credentialType=AZURE_SAS"); + + assertEquals("cameltesting", endpoint.getConfiguration().getAccountName()); + assertEquals("abc", endpoint.getConfiguration().getFileSystemName()); + assertNull(endpoint.getConfiguration().getServiceClient()); + assertEquals(DataLakeOperationsDefinition.upload, endpoint.getConfiguration().getOperation()); + assertEquals("test.txt", endpoint.getConfiguration().getFileName()); + assertEquals(endpoint.getConfiguration().getCredentialType(), CredentialType.AZURE_SAS); + } + @Test public void testProducerWithoutFileName() throws Exception { context.getRegistry().bind("credentials", storageSharedKeyCredentials());