You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/08/21 10:24:47 UTC

[camel] branch master updated: Camel-Any23: polished code a bit

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

acosentino 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 3355234  Camel-Any23: polished code a bit
3355234 is described below

commit 335523455bea677207508c302200e427915e5cff
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Aug 21 12:24:20 2019 +0200

    Camel-Any23: polished code a bit
---
 components/camel-any23/src/main/docs/any23-dataformat.adoc        | 4 ++--
 .../java/org/apache/camel/dataformat/any23/Any23DataFormat.java   | 8 +-------
 .../camel/dataformat/any23/Any23DataFormatConfigurationsTest.java | 3 ++-
 .../camel/dataformat/any23/Any23DataFormatExtractorsTest.java     | 3 ++-
 .../camel/dataformat/any23/Any23DataFormatOutputFormatTest.java   | 3 ++-
 .../apache/camel/dataformat/any23/Any23DataFormatSpringTest.java  | 3 ++-
 .../dataformat/any23/springboot/Any23DataFormatConfiguration.java | 5 +++--
 7 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/components/camel-any23/src/main/docs/any23-dataformat.adoc b/components/camel-any23/src/main/docs/any23-dataformat.adoc
index 36d2a84..74b917a 100644
--- a/components/camel-any23/src/main/docs/any23-dataformat.adoc
+++ b/components/camel-any23/src/main/docs/any23-dataformat.adoc
@@ -21,7 +21,7 @@ The Any23 dataformat supports 5 options, which are listed below.
 |===
 | Name | Default | Java Type | Description
 | outputFormat | RDF4JMODEL | Any23Type | What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL.
-| configurations |  | Map | Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used.
+| configurations |  | Map | Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found a href= \https://github.com/apache/any23/blob/master/api/src/main/resources/default-configuration.propertieshere. If not provided, a default configuration is used.
 | extractors |  | List | List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used.
 | baseURI |  | String | The URI to use as base for building RDF entities if only relative paths are provided.
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
@@ -116,4 +116,4 @@ the download page for the latest versions).
   <artifactId>camel-any23</artifactId>
   <version>x.x.x</version>
 </dependency>
-----------------------------------------
\ No newline at end of file
+----------------------------------------
diff --git a/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java b/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java
index 71590e9..5b18542 100644
--- a/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java
+++ b/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java
@@ -36,7 +36,6 @@ import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.DataFormatName;
 import org.apache.camel.spi.annotations.Dataformat;
 import org.apache.camel.support.service.ServiceSupport;
-import org.apache.commons.io.IOUtils;
 import org.eclipse.rdf4j.model.Model;
 import org.eclipse.rdf4j.rio.RDFFormat;
 import org.eclipse.rdf4j.rio.Rio;
@@ -50,11 +49,6 @@ import org.slf4j.LoggerFactory;
 @Dataformat("any23")
 public class Any23DataFormat extends ServiceSupport implements DataFormat, DataFormatName {
 
-    /*
-     * Our Logger
-     */
-    private static final Logger LOG = LoggerFactory.getLogger(Any23DataFormat.class);
-
     private Any23 any23;
 
     private Map<String, String> configurations;
@@ -120,7 +114,7 @@ public class Any23DataFormat extends ServiceSupport implements DataFormat, DataF
         if (outputFormat == Any23OutputFormat.RDF4JMODEL) {
             respon = ((RDF4JModelWriter)handler).getModel();
         } else {
-            respon = IOUtils.toString(out.toByteArray());
+            respon = new String(out.toByteArray());
         }
         return respon;
 
diff --git a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatConfigurationsTest.java b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatConfigurationsTest.java
index c884579..89659c9 100644
--- a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatConfigurationsTest.java
+++ b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatConfigurationsTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.dataformat.any23;
 
 import java.io.File;
 import java.io.InputStream;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -46,7 +47,7 @@ public class Any23DataFormatConfigurationsTest extends CamelTestSupport {
         for (Exchange exchange : list) {
             Message in = exchange.getIn();
             String resultingRDF = in.getBody(String.class);
-            InputStream toInputStream = IOUtils.toInputStream(resultingRDF);
+            InputStream toInputStream = IOUtils.toInputStream(resultingRDF, Charset.defaultCharset());
             Model parse = Rio.parse(toInputStream, baseURI, RDFFormat.TURTLE);
             assertEquals(parse.size(), 25);
         }
diff --git a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatExtractorsTest.java b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatExtractorsTest.java
index 757e94c..136cc8c 100644
--- a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatExtractorsTest.java
+++ b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatExtractorsTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.dataformat.any23;
 
 import java.io.File;
 import java.io.InputStream;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -47,7 +48,7 @@ public class Any23DataFormatExtractorsTest extends CamelTestSupport {
         for (Exchange exchange : list) {
             Message in = exchange.getIn();
             String resultingRDF = in.getBody(String.class);
-            InputStream toInputStream = IOUtils.toInputStream(resultingRDF);
+            InputStream toInputStream = IOUtils.toInputStream(resultingRDF, Charset.defaultCharset());
             Model parse = Rio.parse(toInputStream, baseURI, RDFFormat.TURTLE);
             assertEquals(parse.size(), 1);
         }
diff --git a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatOutputFormatTest.java b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatOutputFormatTest.java
index a0404e6..f53c71c 100644
--- a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatOutputFormatTest.java
+++ b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatOutputFormatTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.dataformat.any23;
 
 import java.io.File;
 import java.io.InputStream;
+import java.nio.charset.Charset;
 import java.util.List;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -44,7 +45,7 @@ public class Any23DataFormatOutputFormatTest extends CamelTestSupport {
         for (Exchange exchange : list) {
             Message in = exchange.getIn();
             String resultingRDF = in.getBody(String.class);
-            InputStream toInputStream = IOUtils.toInputStream(resultingRDF);
+            InputStream toInputStream = IOUtils.toInputStream(resultingRDF, Charset.defaultCharset());
             Model parse = Rio.parse(toInputStream, baseURI, RDFFormat.TURTLE);
             assertEquals(parse.size(), 28);
         }
diff --git a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatSpringTest.java b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatSpringTest.java
index dcd864b..e19ac47 100644
--- a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatSpringTest.java
+++ b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatSpringTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.dataformat.any23;
 
 import java.io.InputStream;
+import java.nio.charset.Charset;
 import java.util.List;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -42,7 +43,7 @@ public class Any23DataFormatSpringTest extends CamelSpringTestSupport {
         for (Exchange exchange : list) {
             Message in = exchange.getIn();
             String resultingRDF = in.getBody(String.class);
-            InputStream toInputStream = IOUtils.toInputStream(resultingRDF);
+            InputStream toInputStream = IOUtils.toInputStream(resultingRDF, Charset.defaultCharset());
             Model parse = Rio.parse(toInputStream, baseURI, RDFFormat.TURTLE);
             assertEquals(parse.size(), 1);
         }
diff --git a/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java
index 80a2e8d..9188822 100644
--- a/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java
@@ -40,8 +40,9 @@ public class Any23DataFormatConfiguration
     private Boolean enabled;
     /**
      * Configurations for Apache Any23 as key-value pairs in order to customize
-     * the extraction process. The list of supported parameters can be found
-     * here. If not provided, a default configuration is used.
+     * the extraction process. The list of supported parameters can be found a
+     * href=
+     * https://github.com/apache/any23/blob/master/api/src/main/resources/default-configuration.propertieshere. If not provided, a default configuration is used.
      */
     private Map<String, String> configurations;
     /**