This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new f4757ea763c CAMEL-20239: Camel-Azure-Files: The component doesn't set
account parameter on the URI
f4757ea763c is described below
commit f4757ea763c574336958a922ced47640baf52d21
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Feb 7 12:19:19 2024 +0100
CAMEL-20239: Camel-Azure-Files: The component doesn't set account parameter
on the URI
---
.../apache/camel/component/file/azure/FilesConfiguration.java | 9 +++++++++
.../camel/component/file/azure/FilesConfigurationTest.java | 8 +++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git
a/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesConfiguration.java
b/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesConfiguration.java
index 8190dfee8ea..cb630fa820a 100644
---
a/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesConfiguration.java
+++
b/components/camel-azure/camel-azure-files/src/main/java/org/apache/camel/component/file/azure/FilesConfiguration.java
@@ -56,6 +56,15 @@ public class FilesConfiguration extends
RemoteFileConfiguration {
setSendNoop(false);
setBinary(true);
setPassiveMode(true);
+ if (account == null) {
+ // URI host maps to the account option
+ String host = uri.getHost();
+ if (host != null) {
+ // reset host as it requires to know the account name also
+ setAccount(host);
+ setHost(host);
+ }
+ }
}
@Override
diff --git
a/components/camel-azure/camel-azure-files/src/test/java/org/apache/camel/component/file/azure/FilesConfigurationTest.java
b/components/camel-azure/camel-azure-files/src/test/java/org/apache/camel/component/file/azure/FilesConfigurationTest.java
index 4a5796abfa6..49a14c64579 100644
---
a/components/camel-azure/camel-azure-files/src/test/java/org/apache/camel/component/file/azure/FilesConfigurationTest.java
+++
b/components/camel-azure/camel-azure-files/src/test/java/org/apache/camel/component/file/azure/FilesConfigurationTest.java
@@ -17,7 +17,6 @@
package org.apache.camel.component.file.azure;
import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -26,18 +25,18 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
public class FilesConfigurationTest extends CamelTestSupport {
@Test
- @Disabled("It's not clear how account should be extracted")
void accountForAccountHostURIShouldBeExtracted() {
var remoteConf = context
.getEndpoint("azure-files://account.file.core.windows.net/share",
FilesEndpoint.class)
.getConfiguration();
- assertEquals("account", remoteConf.getAccount());
+ assertEquals("share", remoteConf.getShare());
+ assertEquals("account.file.core.windows.net", remoteConf.getAccount());
}
@Test
- @Disabled("It's not clear how account should be extracted")
void accountForAccountOnlyURIShouldBeExtracted() {
var remoteConf = context.getEndpoint("azure-files://account/share",
FilesEndpoint.class).getConfiguration();
+ assertEquals("share", remoteConf.getShare());
assertEquals("account", remoteConf.getAccount());
}
@@ -50,7 +49,6 @@ public class FilesConfigurationTest extends CamelTestSupport {
}
@Test
- @Disabled("It's not clear how account should be extracted")
void hostForAccountURIShouldDefaultToFileCoreWindowsNetSuffix() {
var remoteConf = context.getEndpoint("azure-files://account/share",
FilesEndpoint.class).getConfiguration();
assertEquals("account.file.core.windows.net", remoteConf.getHost());