This is an automated email from the ASF dual-hosted git repository. nfilotto 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 3113d031236 CAMEL-18608: camel-core - Fix the FileProducerCharsetUTF tests 3113d031236 is described below commit 3113d03123635c09a8fcd3267c0e8c6ec20ea54c Author: Nicolas Filotto <nfilo...@talend.com> AuthorDate: Wed Nov 9 18:45:40 2022 +0100 CAMEL-18608: camel-core - Fix the FileProducerCharsetUTF tests --- .../file/FileProducerCharsetUTFtoISOConfiguredTest.java | 11 ++++++----- .../file/FileProducerCharsetUTFtoISOConvertBodyToTest.java | 9 +++++---- .../camel/component/file/FileProducerCharsetUTFtoISOTest.java | 11 ++++++----- .../camel/component/file/FileProducerCharsetUTFtoUTFTest.java | 8 ++++---- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConfiguredTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConfiguredTest.java index ed822d54fc4..d2ef4decdf4 100644 --- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConfiguredTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConfiguredTest.java @@ -25,21 +25,22 @@ import org.apache.camel.builder.RouteBuilder; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * */ -public class FileProducerCharsetUTFtoISOConfiguredTest extends ContextTestSupport { +class FileProducerCharsetUTFtoISOConfiguredTest extends ContextTestSupport { private static final String DATA = "ABC\u00e6"; @Test - public void testFileProducerCharsetUTFtoISO() throws Exception { + void testFileProducerCharsetUTFtoISO() throws Exception { try (OutputStream fos = Files.newOutputStream(testFile("input.txt"))) { fos.write(DATA.getBytes(StandardCharsets.UTF_8)); } - oneExchangeDone.matchesWaitTime(); + assertTrue(oneExchangeDone.matchesWaitTime()); assertFileExists(testFile("output.txt")); byte[] data = Files.readAllBytes(testFile("output.txt")); @@ -51,8 +52,8 @@ public class FileProducerCharsetUTFtoISOConfiguredTest extends ContextTestSuppor protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override - public void configure() throws Exception { - from(fileUri("?initialDelay=0&delay=10&charset=utf-8&noop=true")) + public void configure() { + from(fileUri("?initialDelay=0&delay=10&charset=utf-8&fileName=input.txt")) .to(fileUri("?fileName=output.txt&charset=iso-8859-1")); } }; diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConvertBodyToTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConvertBodyToTest.java index 1287479b0c5..dae5ff703b5 100644 --- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConvertBodyToTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConvertBodyToTest.java @@ -26,21 +26,22 @@ import org.apache.camel.builder.RouteBuilder; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * */ -public class FileProducerCharsetUTFtoISOConvertBodyToTest extends ContextTestSupport { +class FileProducerCharsetUTFtoISOConvertBodyToTest extends ContextTestSupport { private static final String DATA = "ABC\u00e6"; @Test - public void testFileProducerCharsetUTFtoISOConvertBodyTo() throws Exception { + void testFileProducerCharsetUTFtoISOConvertBodyTo() throws Exception { try (OutputStream fos = Files.newOutputStream(testFile("input.txt"))) { fos.write(DATA.getBytes(StandardCharsets.UTF_8)); } - oneExchangeDone.matchesWaitTime(); + assertTrue(oneExchangeDone.matchesWaitTime()); assertFileExists(testFile("output.txt")); byte[] data = Files.readAllBytes(testFile("output.txt")); @@ -54,7 +55,7 @@ public class FileProducerCharsetUTFtoISOConvertBodyToTest extends ContextTestSup @Override public void configure() throws Exception { // the input file is in utf-8 - from(fileUri("?initialDelay=0&delay=10&noop=true&charset=utf-8")) + from(fileUri("?initialDelay=0&delay=10&fileName=input.txt&charset=utf-8")) // now convert the input file from utf-8 to iso-8859-1 .convertBodyTo(byte[].class, "iso-8859-1") // and write the file using that encoding diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOTest.java index 6273c68b1ad..70449573161 100644 --- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOTest.java @@ -25,21 +25,22 @@ import org.apache.camel.builder.RouteBuilder; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * */ -public class FileProducerCharsetUTFtoISOTest extends ContextTestSupport { +class FileProducerCharsetUTFtoISOTest extends ContextTestSupport { private static final String DATA = "ABC\u00e6"; @Test - public void testFileProducerCharsetUTFtoISO() throws Exception { + void testFileProducerCharsetUTFtoISO() throws Exception { try (OutputStream fos = Files.newOutputStream(testFile("input.txt"))) { fos.write(DATA.getBytes(StandardCharsets.UTF_8)); } - oneExchangeDone.matchesWaitTime(); + assertTrue(oneExchangeDone.matchesWaitTime()); assertFileExists(testFile("output.txt")); byte[] data = Files.readAllBytes(testFile("output.txt")); @@ -51,8 +52,8 @@ public class FileProducerCharsetUTFtoISOTest extends ContextTestSupport { protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override - public void configure() throws Exception { - from(fileUri("?initialDelay=0&delay=10&noop=true")) + public void configure() { + from(fileUri("?initialDelay=0&delay=10&fileName=input.txt")) .to(fileUri("?fileName=output.txt&charset=iso-8859-1")); } }; diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoUTFTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoUTFTest.java index 5ae128c4c8e..04607f5fbdf 100644 --- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoUTFTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoUTFTest.java @@ -30,18 +30,18 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * */ -public class FileProducerCharsetUTFtoUTFTest extends ContextTestSupport { +class FileProducerCharsetUTFtoUTFTest extends ContextTestSupport { private static final String DATA = "ABC\u00e6"; @Test - public void testFileProducerCharsetUTFtoUTF() throws Exception { + void testFileProducerCharsetUTFtoUTF() throws Exception { byte[] source = DATA.getBytes(StandardCharsets.UTF_8); try (OutputStream fos = Files.newOutputStream(testFile("input.txt"))) { fos.write(source); } - oneExchangeDone.matchesWaitTime(); + assertTrue(oneExchangeDone.matchesWaitTime()); assertFileExists(testFile("output.txt")); byte[] target = Files.readAllBytes(testFile("output.txt")); @@ -54,7 +54,7 @@ public class FileProducerCharsetUTFtoUTFTest extends ContextTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { - from(fileUri("?initialDelay=0&delay=10&noop=true")) + from(fileUri("?initialDelay=0&delay=10&fileName=input.txt")) .to(fileUri("?fileName=output.txt&charset=utf-8")); } };