You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2026/03/20 10:11:26 UTC
(camel) 02/07: CAMEL-23214: Remove unrelated changes from port migration PR
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch CAMEL-23214-port-misc
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a28a6dbd176785668661b7cfdf3c32dec3946faf
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Mar 20 05:33:13 2026 +0100
CAMEL-23214: Remove unrelated changes from port migration PR
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
.../docling/DoclingTempFileCleanupTest.java | 31 +++++++++++++---------
.../openai/integration/OpenAIEmbeddingsIT.java | 11 ++++++++
.../integration/CouchbaseIntegrationTestBase.java | 4 ++-
3 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingTempFileCleanupTest.java b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingTempFileCleanupTest.java
index 69c0178e19ff..bf116ce7d74a 100644
--- a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingTempFileCleanupTest.java
+++ b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/DoclingTempFileCleanupTest.java
@@ -35,15 +35,15 @@ import static org.junit.jupiter.api.Assertions.*;
* processing completes.
*
* <p>
- * Before the fix, temp files created for String content and byte[] bodies accumulated on disk indefinitely. After the
- * fix, an {@code addOnCompletion} callback deletes them when the exchange finishes.
+ * Temp files are created inside per-exchange subdirectories under the system temp dir. The entire subdirectory is
+ * removed when the exchange finishes.
*/
class DoclingTempFileCleanupTest extends CamelTestSupport {
@Test
void tempFileFromStringContentIsCleanedUp() throws Exception {
- // Snapshot temp files before
- List<Path> before = listDoclingTempFiles();
+ // Snapshot docling temp directories before
+ List<Path> before = listDoclingTempDirs();
// Send string content (not a path, not a URL) — this triggers temp file creation.
// The docling CLI will fail (not installed), but the temp file cleanup
@@ -54,18 +54,18 @@ class DoclingTempFileCleanupTest extends CamelTestSupport {
// Expected — docling binary not available in test env
}
- // After exchange completes, temp files should have been cleaned up
- List<Path> after = listDoclingTempFiles();
+ // After exchange completes, temp directories should have been cleaned up
+ List<Path> after = listDoclingTempDirs();
List<Path> leaked = new ArrayList<>(after);
leaked.removeAll(before);
assertTrue(leaked.isEmpty(),
- "Temp files leaked after exchange completion: " + leaked);
+ "Temp directories leaked after exchange completion: " + leaked);
}
@Test
void tempFileFromByteArrayIsCleanedUp() throws Exception {
- List<Path> before = listDoclingTempFiles();
+ List<Path> before = listDoclingTempDirs();
try {
template.requestBody("direct:convert", "Binary content for conversion".getBytes());
@@ -73,20 +73,25 @@ class DoclingTempFileCleanupTest extends CamelTestSupport {
// Expected — docling binary not available in test env
}
- List<Path> after = listDoclingTempFiles();
+ List<Path> after = listDoclingTempDirs();
List<Path> leaked = new ArrayList<>(after);
leaked.removeAll(before);
assertTrue(leaked.isEmpty(),
- "Temp files leaked after exchange completion: " + leaked);
+ "Temp directories leaked after exchange completion: " + leaked);
}
- private List<Path> listDoclingTempFiles() throws IOException {
+ /**
+ * Lists docling temp directories (docling-UUID-*) in the system temp dir.
+ */
+ private List<Path> listDoclingTempDirs() throws IOException {
List<Path> result = new ArrayList<>();
Path tmpDir = Path.of(System.getProperty("java.io.tmpdir"));
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(tmpDir, "docling-*.tmp")) {
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(tmpDir, "docling-*")) {
for (Path entry : stream) {
- result.add(entry);
+ if (Files.isDirectory(entry)) {
+ result.add(entry);
+ }
}
}
return result;
diff --git a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIEmbeddingsIT.java b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIEmbeddingsIT.java
index 45cf8ec8a28b..f67e04874639 100644
--- a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIEmbeddingsIT.java
+++ b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIEmbeddingsIT.java
@@ -55,6 +55,10 @@ public class OpenAIEmbeddingsIT extends CamelTestSupport {
if (apiKey == null || apiKey.isEmpty()) {
apiKey = "dummy";
}
+ if (ObjectHelper.isEmpty(embeddingModel)) {
+ throw new IllegalStateException(
+ "Embedding model not available. Set the ollama.embedding.model system property or use a container with embedding support.");
+ }
}
@Override
@@ -101,6 +105,7 @@ public class OpenAIEmbeddingsIT extends CamelTestSupport {
Exchange result = template.request("direct:embedding",
e -> e.getIn().setBody("Apache Camel is an integration framework"));
+ assertThat(result.getException()).as("Exchange should not have an exception").isNull();
mockResponse.assertIsSatisfied();
assertThat(result).isNotNull();
@@ -128,6 +133,7 @@ public class OpenAIEmbeddingsIT extends CamelTestSupport {
Exchange result = template.request("direct:embeddingWithEncodingFormatFloat",
e -> e.getIn().setBody("Apache Camel is an integration framework"));
+ assertThat(result.getException()).as("Exchange should not have an exception").isNull();
mockResponse.assertIsSatisfied();
assertThat(result).isNotNull();
@@ -157,6 +163,7 @@ public class OpenAIEmbeddingsIT extends CamelTestSupport {
Exchange result = template.request("direct:embedding",
e -> e.getIn().setBody(inputs));
+ assertThat(result.getException()).as("Exchange should not have an exception").isNull();
mockResponse.assertIsSatisfied();
assertThat(result).isNotNull();
@@ -182,6 +189,8 @@ public class OpenAIEmbeddingsIT extends CamelTestSupport {
Exchange result1 = template.request("direct:embedding",
e -> e.getIn().setBody("Apache Camel is an integration framework"));
+ assertThat(result1.getException()).as("Exchange should not have an exception").isNull();
+
@SuppressWarnings("unchecked")
List<Float> embedding1 = (List<Float>) result1.getMessage().getBody();
assertThat(embedding1).isNotEmpty();
@@ -192,6 +201,8 @@ public class OpenAIEmbeddingsIT extends CamelTestSupport {
e.getIn().setHeader(OpenAIConstants.REFERENCE_EMBEDDING, embedding1);
});
+ assertThat(result2.getException()).as("Exchange should not have an exception").isNull();
+
@SuppressWarnings("unchecked")
List<Float> embedding2 = (List<Float>) result2.getMessage().getBody();
assertThat(embedding2).isNotEmpty();
diff --git a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/integration/CouchbaseIntegrationTestBase.java b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/integration/CouchbaseIntegrationTestBase.java
index ac1240e5df6e..d95cea520078 100644
--- a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/integration/CouchbaseIntegrationTestBase.java
+++ b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/integration/CouchbaseIntegrationTestBase.java
@@ -23,6 +23,7 @@ import java.util.Collections;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.manager.bucket.BucketSettings;
import com.couchbase.client.java.manager.bucket.BucketType;
+import com.couchbase.client.java.manager.bucket.StorageBackend;
import com.couchbase.client.java.manager.view.DesignDocument;
import com.couchbase.client.java.manager.view.View;
import com.couchbase.client.java.view.DesignDocumentNamespace;
@@ -48,7 +49,8 @@ public class CouchbaseIntegrationTestBase extends CamelTestSupport {
cluster = Cluster.connect(service.getConnectionString(), service.getUsername(), service.getPassword());
cluster.buckets().createBucket(
- BucketSettings.create(bucketName).bucketType(BucketType.COUCHBASE).flushEnabled(true));
+ BucketSettings.create(bucketName).bucketType(BucketType.COUCHBASE)
+ .storageBackend(StorageBackend.COUCHSTORE).flushEnabled(true));
cluster.bucket(bucketName);
DesignDocument designDoc = new DesignDocument(