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 9278a119357c CAMEL-26637: camel-azure-cosmosdb - createContainer does
not normalize the partition key path (#29243)
9278a119357c is described below
commit 9278a119357cc0fd78b6af0a2c82d9466f22dd4d
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Nov 5 16:48:47 2026 +0100
CAMEL-26637: camel-azure-cosmosdb - createContainer does not normalize the
partition key path (#29243)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../azure/cosmosdb/operations/CosmosDbDatabaseOperations.java | 4 ++--
.../azure/cosmosdb/operations/CosmosDbDatabaseOperationsTest.java | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git
a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperations.java
b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperations.java
index d347b496a6cf..fd4afea01c5d 100644
---
a/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperations.java
+++
b/components/camel-azure/camel-azure-cosmosdb/src/main/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperations.java
@@ -68,8 +68,8 @@ public class CosmosDbDatabaseOperations {
return applyToDatabase(database ->
database.createContainerIfNotExists(cosmosProp,
throughputProperties));
} else {
- return applyToDatabase(database ->
database.createContainerIfNotExists(containerId, containerPartitionKeyPath,
- throughputProperties));
+ return applyToDatabase(database ->
database.createContainerIfNotExists(containerId,
+ enhancedContainerPartitionKeyPath, throughputProperties));
}
}
diff --git
a/components/camel-azure/camel-azure-cosmosdb/src/test/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperationsTest.java
b/components/camel-azure/camel-azure-cosmosdb/src/test/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperationsTest.java
index 46bcc099e506..908c0ab670cb 100644
---
a/components/camel-azure/camel-azure-cosmosdb/src/test/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperationsTest.java
+++
b/components/camel-azure/camel-azure-cosmosdb/src/test/java/org/apache/camel/component/azure/cosmosdb/operations/CosmosDbDatabaseOperationsTest.java
@@ -27,7 +27,11 @@ import reactor.core.publisher.Mono;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
class CosmosDbDatabaseOperationsTest {
@@ -66,6 +70,8 @@ class CosmosDbDatabaseOperationsTest {
assertEquals("/path",
returnedContainerResponseFirstCase.getProperties().getPartitionKeyDefinition().getPaths().get(0));
assertEquals("/path",
returnedContainerResponseSecondCase.getProperties().getPartitionKeyDefinition().getPaths().get(0));
+ // the container is created with the path that starts with /, given
with or without it
+ verify(database,
times(2)).createContainerIfNotExists(eq("test-container"), eq("/path"),
isNull());
}
@Test