This is an automated email from the ASF dual-hosted git repository. apupier pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 8d597871b78b9bcc00e64683d0f682a0dec8b981 Author: Aurélien Pupier <[email protected]> AuthorDate: Wed Jan 28 16:37:05 2026 +0100 Add docling test with cli mode the test is not activated by default to avoid the need to configure the CI with local docling on command-line. Signed-off-by: Aurélien Pupier <[email protected]> --- integration-tests/docling/Readme.md | 19 +++++++++++++++++++ .../quarkus/component/docling/it/DoclingResource.java | 8 ++++++++ .../quarkus/component/docling/it/DoclingRoutes.java | 3 +++ .../quarkus/component/docling/it/DoclingTest.java | 16 ++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/integration-tests/docling/Readme.md b/integration-tests/docling/Readme.md new file mode 100644 index 0000000000..d5984b1a38 --- /dev/null +++ b/integration-tests/docling/Readme.md @@ -0,0 +1,19 @@ +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +One test requires to have docling installed, for instance with `pip install docling`. It is to test the CLI mode of the component. To activate this test, you need to set the property `docling.test.enabled` to `true`. diff --git a/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingResource.java b/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingResource.java index 2b95f86f20..3633edc9ec 100644 --- a/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingResource.java +++ b/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingResource.java @@ -173,6 +173,14 @@ public class DoclingResource { } } + @Path("/convert/json/cli") + @POST + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.APPLICATION_JSON) + public Response convertToJsonWithCLI(String documentContent) throws IOException { + return convert(documentContent, "direct:convertToJsonWithCLI", "Failed to convert to JSON with CLI"); + } + private Response convert(String documentContent, String endpointUri, String logErrorMessage) throws IOException { java.nio.file.Path tempFile = Files.createTempFile("docling-test", ".md"); Files.writeString(tempFile, documentContent); diff --git a/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingRoutes.java b/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingRoutes.java index e267e00c38..b0c76f33f1 100644 --- a/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingRoutes.java +++ b/integration-tests/docling/src/main/java/org/apache/camel/quarkus/component/docling/it/DoclingRoutes.java @@ -63,5 +63,8 @@ public class DoclingRoutes extends RouteBuilder { from("direct:convertToJsonAsync") .to("docling:convert?operation=CONVERT_TO_JSON&contentInBody=true&useAsyncMode=true") .log("Converted to JSON (async): ${body}"); + + from("direct:convertToJsonWithCLI") + .to("docling:convert?operation=CONVERT_TO_JSON&contentInBody=true&useDoclingServe=false"); } } diff --git a/integration-tests/docling/src/test/java/org/apache/camel/quarkus/component/docling/it/DoclingTest.java b/integration-tests/docling/src/test/java/org/apache/camel/quarkus/component/docling/it/DoclingTest.java index 26142543e9..367f3675ae 100644 --- a/integration-tests/docling/src/test/java/org/apache/camel/quarkus/component/docling/it/DoclingTest.java +++ b/integration-tests/docling/src/test/java/org/apache/camel/quarkus/component/docling/it/DoclingTest.java @@ -22,6 +22,7 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.emptyString; @@ -220,4 +221,19 @@ class DoclingTest { .statusCode(200) .body(not(emptyString())); } + + @Test + @EnabledIfSystemProperty(named = "docling.test.enabled", matches = "true") + void convertToJsonWithCLI() { + String testContent = "# Test Document\nThis is a test document for JSON conversion with CLI."; + + RestAssured.given() + .contentType(ContentType.TEXT) + .body(testContent) + .when() + .post("/docling/convert/json/cli") + .then() + .statusCode(200) + .body(not(emptyString())); + } }
