camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [camel] branch master updated: CAMEL-13474: Move dataformats out of camel-core. And camel3 - modularize a bit
Date Thu, 02 May 2019 11:19:00 GMT
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 0799b2f  CAMEL-13474: Move dataformats out of camel-core. And camel3 - modularize
a bit
0799b2f is described below

commit 0799b2f23c0f85a21bae41947b6edf21e4595e8e
Author: Claus Ibsen <claus.ibsen@gmail.com>
AuthorDate: Thu May 2 13:18:39 2019 +0200

    CAMEL-13474: Move dataformats out of camel-core. And camel3 - modularize a bit
---
 .../camel/dataformat/deflater}/GzipDataFormatTest.java      | 13 ++++++++-----
 .../apache/camel/builder/TokenPairExpressionIterator.java   | 10 +++++-----
 .../apache/camel/builder/TokenXMLExpressionIterator.java    |  2 +-
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatTest.java b/components/camel-zip-deflater/src/test/java/org/apache/camel/dataformat/deflater/GzipDataFormatTest.java
similarity index 89%
rename from core/camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatTest.java
rename to components/camel-zip-deflater/src/test/java/org/apache/camel/dataformat/deflater/GzipDataFormatTest.java
index 8cae4a9..f06dbdb 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatTest.java
+++ b/components/camel-zip-deflater/src/test/java/org/apache/camel/dataformat/deflater/GzipDataFormatTest.java
@@ -14,21 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.impl;
+package org.apache.camel.dataformat.deflater;
 
 import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.zip.GZIPInputStream;
 
-import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.converter.IOConverter;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * Unit test of the gzip data format.
  */
-public class GzipDataFormatTest extends ContextTestSupport {
+public class GzipDataFormatTest extends CamelTestSupport {
     private static final String TEXT = "Hamlet by William Shakespeare\n"
             + "To be, or not to be: that is the question:\n"
             + "Whether 'tis nobler in the mind to suffer\n"
@@ -42,7 +43,7 @@ public class GzipDataFormatTest extends ContextTestSupport {
     }
 
     private byte[] sendText() throws Exception {
-        return (byte[]) template.requestBody("direct:start", TEXT.getBytes("UTF-8"));
+        return (byte[]) template.requestBody("direct:start", TEXT.getBytes(StandardCharsets.UTF_8));
     }
 
     @Test
@@ -71,8 +72,10 @@ public class GzipDataFormatTest extends ContextTestSupport {
         context.start();
 
         MockEndpoint result = context.getEndpoint("mock:result", MockEndpoint.class);
-        result.expectedBodiesReceived(TEXT.getBytes("UTF-8"));
+        result.expectedBodiesReceived(TEXT.getBytes(StandardCharsets.UTF_8));
+
         sendText();
+
         result.assertIsSatisfied();
     }
 }
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/TokenPairExpressionIterator.java
b/core/camel-core/src/main/java/org/apache/camel/builder/TokenPairExpressionIterator.java
index 2f2461b..421c910 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/TokenPairExpressionIterator.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/TokenPairExpressionIterator.java
@@ -23,9 +23,9 @@ import java.util.Iterator;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.InvalidPayloadException;
-import org.apache.camel.language.simple.SimpleLanguage;
 import org.apache.camel.support.ExchangeHelper;
 import org.apache.camel.support.ExpressionAdapter;
+import org.apache.camel.support.LanguageSupport;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.Scanner;
@@ -104,12 +104,12 @@ public class TokenPairExpressionIterator extends ExpressionAdapter {
      */
     protected Iterator<?> createIterator(Exchange exchange, InputStream in, String
charset) {
         String start = startToken;
-        if (start != null && SimpleLanguage.hasSimpleFunction(start)) {
-            start = SimpleLanguage.expression(start).evaluate(exchange, String.class);
+        if (LanguageSupport.hasSimpleFunction(start)) {
+            start = exchange.getContext().resolveLanguage("simple").createExpression(start).evaluate(exchange,
String.class);
         }
         String end = endToken;
-        if (end != null && SimpleLanguage.hasSimpleFunction(end)) {
-            end = SimpleLanguage.expression(end).evaluate(exchange, String.class);
+        if (LanguageSupport.hasSimpleFunction(end)) {
+            end = exchange.getContext().resolveLanguage("simple").createExpression(end).evaluate(exchange,
String.class);
         }
         TokenPairIterator iterator = new TokenPairIterator(start, end, includeTokens, in,
charset);
         iterator.init();
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/TokenXMLExpressionIterator.java
b/core/camel-core/src/main/java/org/apache/camel/builder/TokenXMLExpressionIterator.java
index 60471c7..daff581 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/TokenXMLExpressionIterator.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/TokenXMLExpressionIterator.java
@@ -74,7 +74,7 @@ public class TokenXMLExpressionIterator extends ExpressionAdapter {
             tag = exchange.getContext().resolveLanguage("simple").createExpression(tag).evaluate(exchange,
String.class);
         }
         String inherit = inheritNamespaceToken;
-        if (inherit != null && LanguageSupport.hasSimpleFunction(tag)) {
+        if (LanguageSupport.hasSimpleFunction(inherit)) {
             inherit = exchange.getContext().resolveLanguage("simple").createExpression(inherit).evaluate(exchange,
String.class);
         }
 


Mime
View raw message