This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 59094237ca1d445fafe0da99adfba21e9b92129f Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Mon Jan 26 20:34:18 2026 +0000 (chores): ensure usage of text blocks camel-huaweicloud-functiongraph --- .../org/apache/camel/FunctionGraphMockClient.java | 22 +++++++-------- .../apache/camel/InvokeFunctionCombinedTest.java | 31 ++++++++++++---------- .../apache/camel/InvokeFunctionEndpointTest.java | 31 ++++++++++++---------- .../apache/camel/InvokeFunctionExchangeTest.java | 31 ++++++++++++---------- .../apache/camel/InvokeFunctionServiceKeyTest.java | 31 ++++++++++++---------- .../java/org/apache/camel/InvokeFunctionTest.java | 31 ++++++++++++---------- 6 files changed, 96 insertions(+), 81 deletions(-) diff --git a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/FunctionGraphMockClient.java b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/FunctionGraphMockClient.java index c539427098e3..c1eda4489f3c 100644 --- a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/FunctionGraphMockClient.java +++ b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/FunctionGraphMockClient.java @@ -31,20 +31,20 @@ public class FunctionGraphMockClient extends FunctionGraphClient { InvokeFunctionResponse response = new InvokeFunctionResponse() .withRequestId("1939bbbb-4009-4685-bcc0-2ff0381fa911") .withResult( - "{\"headers\":{\"Content-Type\":\"application/json\"},\"statusCode\":200,\"isBase64Encoded\":false,\"body\":{\"orderId\":1621950031517," - + - "\"department\":\"sales\",\"vendor\":\"huawei\",\"product\":\"monitors\",\"price\":20.13,\"quantity\":20,\"status\":\"order submitted successfully\"}}\n") + """ + {"headers":{"Content-Type":"application/json"},"statusCode":200,"isBase64Encoded":false,"body":{"orderId":1621950031517,"department":"sales","vendor":"huawei","product":"monitors","price":20.13,"quantity":20,"status":"order submitted successfully"}} + """) .withStatus(200); if (request.getXCffLogType().equals("tail")) { response.withLog( - "2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest\n" - + - " { product: 'monitors',\n" + - " quantity: 20,\n" + - " vendor: 'huawei',\n" + - " price: 20.13,\n" + - " department: 'sales' }\n" + - " 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB."); + """ + 2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest + { product: 'monitors', + quantity: 20, + vendor: 'huawei', + price: 20.13, + department: 'sales' } + 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB."""); } return response; } diff --git a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionCombinedTest.java b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionCombinedTest.java index 85fa0801399b..724fbe364b18 100644 --- a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionCombinedTest.java +++ b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionCombinedTest.java @@ -67,13 +67,15 @@ public class InvokeFunctionCombinedTest extends CamelTestSupport { public void testInvokeFunction() throws Exception { MockEndpoint mock = getMockEndpoint("mock:invoke_function_result"); mock.expectedMinimumMessageCount(1); - String sampleBody = "{\n" + - " \"department\": \"sales\",\n" + - " \"vendor\": \"huawei\",\n" + - " \"product\": \"monitors\",\n" + - " \"price\": 20.13,\n" + - " \"quantity\": 20\n" + - "}\n"; + String sampleBody = """ + { + "department": "sales", + "vendor": "huawei", + "product": "monitors", + "price": 20.13, + "quantity": 20 + } + """; template.sendBody("direct:invoke_function", sampleBody); Exchange responseExchange = mock.getExchanges().get(0); @@ -86,13 +88,14 @@ public class InvokeFunctionCombinedTest extends CamelTestSupport { "{\"orderId\":1621950031517,\"department\":\"sales\",\"vendor\":\"huawei\",\"product\":\"monitors\",\"price\":20.13,\"quantity\":20,\"status\":\"order submitted successfully\"}", responseExchange.getIn().getBody(String.class)); assertEquals( - "2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest\n" + - " { product: 'monitors',\n" + - " quantity: 20,\n" + - " vendor: 'huawei',\n" + - " price: 20.13,\n" + - " department: 'sales' }\n" + - " 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.", + """ + 2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest + { product: 'monitors', + quantity: 20, + vendor: 'huawei', + price: 20.13, + department: 'sales' } + 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.""", responseExchange.getProperty(FunctionGraphProperties.XCFFLOGS)); } } diff --git a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionEndpointTest.java b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionEndpointTest.java index 6652ed9e6c97..8bbc0aa0b9f3 100644 --- a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionEndpointTest.java +++ b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionEndpointTest.java @@ -61,13 +61,15 @@ public class InvokeFunctionEndpointTest extends CamelTestSupport { public void testInvokeFunction() throws Exception { MockEndpoint mock = getMockEndpoint("mock:invoke_function_result"); mock.expectedMinimumMessageCount(1); - String sampleBody = "{\n" + - " \"department\": \"sales\",\n" + - " \"vendor\": \"huawei\",\n" + - " \"product\": \"monitors\",\n" + - " \"price\": 20.13,\n" + - " \"quantity\": 20\n" + - "}\n"; + String sampleBody = """ + { + "department": "sales", + "vendor": "huawei", + "product": "monitors", + "price": 20.13, + "quantity": 20 + } + """; template.sendBody("direct:invoke_function", sampleBody); Exchange responseExchange = mock.getExchanges().get(0); @@ -80,13 +82,14 @@ public class InvokeFunctionEndpointTest extends CamelTestSupport { "{\"orderId\":1621950031517,\"department\":\"sales\",\"vendor\":\"huawei\",\"product\":\"monitors\",\"price\":20.13,\"quantity\":20,\"status\":\"order submitted successfully\"}", responseExchange.getIn().getBody(String.class)); assertEquals( - "2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest\n" + - " { product: 'monitors',\n" + - " quantity: 20,\n" + - " vendor: 'huawei',\n" + - " price: 20.13,\n" + - " department: 'sales' }\n" + - " 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.", + """ + 2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest + { product: 'monitors', + quantity: 20, + vendor: 'huawei', + price: 20.13, + department: 'sales' } + 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.""", responseExchange.getProperty(FunctionGraphProperties.XCFFLOGS)); } } diff --git a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionExchangeTest.java b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionExchangeTest.java index f90d32ae51fe..dcefd2c14626 100644 --- a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionExchangeTest.java +++ b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionExchangeTest.java @@ -64,13 +64,15 @@ public class InvokeFunctionExchangeTest extends CamelTestSupport { public void testInvokeFunction() throws Exception { MockEndpoint mock = getMockEndpoint("mock:invoke_function_result"); mock.expectedMinimumMessageCount(1); - String sampleBody = "{\n" + - " \"department\": \"sales\",\n" + - " \"vendor\": \"huawei\",\n" + - " \"product\": \"monitors\",\n" + - " \"price\": 20.13,\n" + - " \"quantity\": 20\n" + - "}\n"; + String sampleBody = """ + { + "department": "sales", + "vendor": "huawei", + "product": "monitors", + "price": 20.13, + "quantity": 20 + } + """; template.sendBody("direct:invoke_function", sampleBody); Exchange responseExchange = mock.getExchanges().get(0); @@ -83,13 +85,14 @@ public class InvokeFunctionExchangeTest extends CamelTestSupport { "{\"orderId\":1621950031517,\"department\":\"sales\",\"vendor\":\"huawei\",\"product\":\"monitors\",\"price\":20.13,\"quantity\":20,\"status\":\"order submitted successfully\"}", responseExchange.getIn().getBody(String.class)); assertEquals( - "2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest\n" + - " { product: 'monitors',\n" + - " quantity: 20,\n" + - " vendor: 'huawei',\n" + - " price: 20.13,\n" + - " department: 'sales' }\n" + - " 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.", + """ + 2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest + { product: 'monitors', + quantity: 20, + vendor: 'huawei', + price: 20.13, + department: 'sales' } + 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.""", responseExchange.getProperty(FunctionGraphProperties.XCFFLOGS)); } } diff --git a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionServiceKeyTest.java b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionServiceKeyTest.java index c3b8c8145a6a..2bf7cbe6648a 100644 --- a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionServiceKeyTest.java +++ b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionServiceKeyTest.java @@ -65,13 +65,15 @@ public class InvokeFunctionServiceKeyTest extends CamelTestSupport { public void testInvokeFunction() throws Exception { MockEndpoint mock = getMockEndpoint("mock:invoke_function_result"); mock.expectedMinimumMessageCount(1); - String sampleBody = "{\n" + - " \"department\": \"sales\",\n" + - " \"vendor\": \"huawei\",\n" + - " \"product\": \"monitors\",\n" + - " \"price\": 20.13,\n" + - " \"quantity\": 20\n" + - "}\n"; + String sampleBody = """ + { + "department": "sales", + "vendor": "huawei", + "product": "monitors", + "price": 20.13, + "quantity": 20 + } + """; template.sendBody("direct:invoke_function", sampleBody); Exchange responseExchange = mock.getExchanges().get(0); @@ -84,13 +86,14 @@ public class InvokeFunctionServiceKeyTest extends CamelTestSupport { "{\"orderId\":1621950031517,\"department\":\"sales\",\"vendor\":\"huawei\",\"product\":\"monitors\",\"price\":20.13,\"quantity\":20,\"status\":\"order submitted successfully\"}", responseExchange.getIn().getBody(String.class)); assertEquals( - "2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest\n" + - " { product: 'monitors',\n" + - " quantity: 20,\n" + - " vendor: 'huawei',\n" + - " price: 20.13,\n" + - " department: 'sales' }\n" + - " 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.", + """ + 2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest + { product: 'monitors', + quantity: 20, + vendor: 'huawei', + price: 20.13, + department: 'sales' } + 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.""", responseExchange.getProperty(FunctionGraphProperties.XCFFLOGS)); } } diff --git a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionTest.java b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionTest.java index c9d6240bb931..350ac70d0457 100644 --- a/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionTest.java +++ b/components/camel-huawei/camel-huaweicloud-functiongraph/src/test/java/org/apache/camel/InvokeFunctionTest.java @@ -61,13 +61,15 @@ public class InvokeFunctionTest extends CamelTestSupport { public void testInvokeFunction() throws Exception { MockEndpoint mock = getMockEndpoint("mock:invoke_function_result"); mock.expectedMinimumMessageCount(1); - String sampleBody = "{\n" + - " \"department\": \"sales\",\n" + - " \"vendor\": \"huawei\",\n" + - " \"product\": \"monitors\",\n" + - " \"price\": 20.13,\n" + - " \"quantity\": 20\n" + - "}\n"; + String sampleBody = """ + { + "department": "sales", + "vendor": "huawei", + "product": "monitors", + "price": 20.13, + "quantity": 20 + } + """; template.sendBody("direct:invoke_function", sampleBody); Exchange responseExchange = mock.getExchanges().get(0); @@ -80,13 +82,14 @@ public class InvokeFunctionTest extends CamelTestSupport { "{\"orderId\":1621950031517,\"department\":\"sales\",\"vendor\":\"huawei\",\"product\":\"monitors\",\"price\":20.13,\"quantity\":20,\"status\":\"order submitted successfully\"}", responseExchange.getIn().getBody(String.class)); assertEquals( - "2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest\n" + - " { product: 'monitors',\n" + - " quantity: 20,\n" + - " vendor: 'huawei',\n" + - " price: 20.13,\n" + - " department: 'sales' }\n" + - " 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.", + """ + 2021-05-25 21:40:31.472+08:00 Start invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', version: latest + { product: 'monitors', + quantity: 20, + vendor: 'huawei', + price: 20.13, + department: 'sales' } + 2021-05-25 21:40:31.518+08:00 Finish invoke request '1939bbbb-4009-4685-bcc0-2ff0381fa911', duration: 45.204ms, billing duration: 100ms, memory used: 64.383MB.""", responseExchange.getProperty(FunctionGraphProperties.XCFFLOGS)); } }
