You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/10/13 14:51:22 UTC

[camel] branch master updated: camel-exec: fixed warnings about deprecations in test code (#4434)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c0c79f  camel-exec: fixed warnings about deprecations in test code (#4434)
5c0c79f is described below

commit 5c0c79feb0d72340e473423b20896a95990a9771
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Tue Oct 13 16:50:59 2020 +0200

    camel-exec: fixed warnings about deprecations in test code (#4434)
---
 .../component/exec/ExecJavaProcessRecipientListTest.java    |  7 +++----
 .../apache/camel/component/exec/ExecJavaProcessTest.java    |  7 +++----
 .../org/apache/camel/component/exec/ExecOutFileTest.java    | 13 ++++++-------
 .../org/apache/camel/component/exec/ExecProducerTest.java   |  3 +--
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessRecipientListTest.java b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessRecipientListTest.java
index 659a705..761ec4f 100644
--- a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessRecipientListTest.java
+++ b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessRecipientListTest.java
@@ -47,7 +47,6 @@ import static org.apache.camel.component.exec.ExecutableJavaProgram.PRINT_IN_STD
 import static org.apache.camel.component.exec.ExecutableJavaProgram.READ_INPUT_LINES_AND_PRINT_THEM;
 import static org.apache.camel.component.exec.ExecutableJavaProgram.SLEEP_WITH_TIMEOUT;
 import static org.apache.camel.component.exec.ExecutableJavaProgram.THREADS;
-import static org.apache.commons.io.IOUtils.LINE_SEPARATOR;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
@@ -204,8 +203,8 @@ public class ExecJavaProcessRecipientListTest extends CamelTestSupport {
 
         String err = IOUtils.toString(exchange.getIn().getHeader(EXEC_STDERR, InputStream.class), Charset.defaultCharset());
         ExecResult result = exchange.getIn().getBody(ExecResult.class);
-        String[] outs = IOUtils.toString(result.getStdout(), Charset.defaultCharset()).split(LINE_SEPARATOR);
-        String[] errs = err.split(LINE_SEPARATOR);
+        String[] outs = IOUtils.toString(result.getStdout(), Charset.defaultCharset()).split(System.lineSeparator());
+        String[] errs = err.split(System.lineSeparator());
 
         output.assertIsSatisfied();
         assertEquals(ExecutableJavaProgram.LINES_TO_PRINT_FROM_EACH_THREAD, outs.length);
@@ -236,7 +235,7 @@ public class ExecJavaProcessRecipientListTest extends CamelTestSupport {
         final StringBuilder builder = new StringBuilder();
         int lines = 10;
         for (int t = 1; t < lines; t++) {
-            builder.append("Line" + t + LINE_SEPARATOR);
+            builder.append("Line" + t + System.lineSeparator());
         }
         String whiteSpaceSeparatedLines = builder.toString();
         String expected = builder.toString();
diff --git a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java
index c55ce59..1c35901 100644
--- a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java
+++ b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java
@@ -54,7 +54,6 @@ import static org.apache.camel.component.exec.ExecutableJavaProgram.PRINT_IN_STD
 import static org.apache.camel.component.exec.ExecutableJavaProgram.READ_INPUT_LINES_AND_PRINT_THEM;
 import static org.apache.camel.component.exec.ExecutableJavaProgram.SLEEP_WITH_TIMEOUT;
 import static org.apache.camel.component.exec.ExecutableJavaProgram.THREADS;
-import static org.apache.commons.io.IOUtils.LINE_SEPARATOR;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
@@ -250,8 +249,8 @@ public class ExecJavaProcessTest extends CamelTestSupport {
 
         String err = IOUtils.toString(exchange.getIn().getHeader(EXEC_STDERR, InputStream.class), Charset.defaultCharset());
         ExecResult result = exchange.getIn().getBody(ExecResult.class);
-        String[] outs = IOUtils.toString(result.getStdout(), Charset.defaultCharset()).split(LINE_SEPARATOR);
-        String[] errs = err.split(LINE_SEPARATOR);
+        String[] outs = IOUtils.toString(result.getStdout(), Charset.defaultCharset()).split(System.lineSeparator());
+        String[] errs = err.split(System.lineSeparator());
 
         output.assertIsSatisfied();
         assertEquals(ExecutableJavaProgram.LINES_TO_PRINT_FROM_EACH_THREAD, outs.length);
@@ -387,7 +386,7 @@ public class ExecJavaProcessTest extends CamelTestSupport {
         final StringBuilder builder = new StringBuilder();
         int lines = 10;
         for (int t = 1; t < lines; t++) {
-            builder.append("Line" + t + LINE_SEPARATOR);
+            builder.append("Line" + t + System.lineSeparator());
         }
         String whiteSpaceSeparatedLines = builder.toString();
         String expected = builder.toString();
diff --git a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecOutFileTest.java b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecOutFileTest.java
index f3bdfd4..cc68470 100644
--- a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecOutFileTest.java
+++ b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecOutFileTest.java
@@ -37,7 +37,6 @@ import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
 
 import static org.apache.camel.component.exec.ExecBinding.EXEC_COMMAND_OUT_FILE;
-import static org.apache.commons.io.IOUtils.LINE_SEPARATOR;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
@@ -118,12 +117,12 @@ public class ExecOutFileTest {
 
     private static String buildFileContent() {
         StringBuilder builder = new StringBuilder();
-        builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append(LINE_SEPARATOR);
-        builder.append("<data>").append(LINE_SEPARATOR);
-        builder.append("<element>data1</element>").append(LINE_SEPARATOR);
-        builder.append("<element>data2</element>").append(LINE_SEPARATOR);
-        builder.append("</data>").append(LINE_SEPARATOR);
-        builder.append(LINE_SEPARATOR);
+        builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append(System.lineSeparator());
+        builder.append("<data>").append(System.lineSeparator());
+        builder.append("<element>data1</element>").append(System.lineSeparator());
+        builder.append("<element>data2</element>").append(System.lineSeparator());
+        builder.append("</data>").append(System.lineSeparator());
+        builder.append(System.lineSeparator());
         return builder.toString();
     }
 }
diff --git a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecProducerTest.java b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecProducerTest.java
index 5fe7ad9..23f3c81 100644
--- a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecProducerTest.java
+++ b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecProducerTest.java
@@ -38,7 +38,6 @@ import static org.apache.camel.component.exec.ExecBinding.EXEC_COMMAND_ARGS;
 import static org.apache.camel.component.exec.ExecBinding.EXEC_COMMAND_EXECUTABLE;
 import static org.apache.camel.component.exec.ExecBinding.EXEC_COMMAND_TIMEOUT;
 import static org.apache.camel.component.exec.ExecBinding.EXEC_COMMAND_WORKING_DIR;
-import static org.apache.commons.io.IOUtils.LINE_SEPARATOR;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
@@ -117,7 +116,7 @@ public class ExecProducerTest {
     @DirtiesContext
     public void testInputLines() throws IOException {
         // String must be convertible to InputStream
-        final String input = "line1" + LINE_SEPARATOR + "line2";
+        final String input = "line1" + System.lineSeparator() + "line2";
         producerTemplate.send(new Processor() {
 
             public void process(Exchange exchange) throws Exception {