You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/05/19 10:17:26 UTC

[camel-quarkus] branch main updated (00d7344 -> ac74dc1)

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

ppalaga pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


    from 00d7344  Remove superfluous toD in JmsRoutes
     new d2c1ad2  Simplify Simple language tests
     new bc3813a  Test ExchangeProperty and Header languages #2613
     new 8cab814  Rename Simple test module to Core Languages because it now covers multiple Camel Core languages #2613
     new 14f77dc  Test the Ref language without dependency on camel-quarkus-ref #2613
     new 7771be8  Test Tokenize language in isolation #2613
     new 3971f99  Test Constant language in isolation #2613
     new 34329c8  Test bindy() DSL method #2616
     new 894e521  Test cbor() DSL method #2616
     new 6ba0e3e  Test custom() data format DSL method #2616
     new ad41286  Test jaxb() data format DSL method #2616
     new 979f106  Test lzf() data format DSL method #2616
     new 2df64b1  Test mimeMultipart() data format DSL method #2616
     new 210d5e9  Test pgp() data format DSL method #2616
     new 82704be  Test soapjaxb() data format DSL method #2616
     new ac74dc1  Load a classpath resource using current thread's context class loader in Saxon test, because otherwise it cannot be found

The 15 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../component/lzf/deployment/LzfProcessor.java     |   8 ++
 .../foundation/{simple => core-languages}/pom.xml  |  11 ++-
 .../core/languages/it/ConstantLanguageRoutes.java  |  13 +--
 .../core/languages/it/CoreLanguagesResource.java   | 101 +++++++++++++++++++++
 .../core/languages/it/CustomDataFormatRoutes.java  |  83 +++++++++++++++++
 .../it/ExchangePropertyLanguageRoutes.java         |  12 +--
 .../core/languages/it/HeaderLanguageRoutes.java    |  12 ++-
 .../core/languages/it/RefLanguageRoutes.java}      |  38 ++++----
 .../languages/it}/ReflectionConfigurations.java    |   2 +-
 .../quarkus/core/languages/it}/SimpleRoutes.java   |   3 +-
 .../core/languages/it/TokenizeLanguageRoutes.java  |  64 +++++++++++++
 .../src/main/resources/application.properties      |   0
 .../src/main/resources/mysimple.txt                |   0
 .../core/languages/it/ConstantLanguageIT.java}     |   4 +-
 .../core/languages/it/ConstantLanguageTest.java    |  17 ++--
 .../core/languages/it/CustomDataFormatIT.java}     |   4 +-
 .../core/languages/it/CustomDataFormatTest.java}   |  26 +++---
 .../languages/it/ExchangePropertyLanguageIT.java}  |   4 +-
 .../languages/it/ExchangePropertyLanguageTest.java |  15 ++-
 .../core/languages/it/HeaderLanguageIT.java}       |   4 +-
 .../core/languages/it/HeaderLanguageTest.java      |  17 ++--
 .../quarkus/core/languages/it/RefLanguageIT.java}  |   4 +-
 .../quarkus/core/languages/it/RefLanguageTest.java |  29 +++---
 .../camel/quarkus/core/languages/it}/SimpleIT.java |   2 +-
 .../quarkus/core/languages/it}/SimpleTest.java     |  24 +++--
 .../core/languages/it/TokenizeLanguageIT.java}     |   4 +-
 .../core/languages/it/TokenizeLanguageTest.java    |  67 ++++++++++++++
 integration-test-groups/foundation/pom.xml         |   2 +-
 .../quarkus/language/simple/SimpleResource.java    |  83 -----------------
 .../quarkus/component/bindy/it/BindyTestRoute.java |   8 +-
 .../quarkus/component/cbor/it/CborResource.java    |  10 ++
 .../quarkus/component/cbor/it/CborRoutes.java      |   4 +
 .../camel/quarkus/component/cbor/it/CborTest.java  |  12 +++
 .../compression/it/CompressionRouteBuilder.java    |   4 +-
 .../quarkus/component/crypto/it/CryptoRoutes.java  |  14 +--
 .../camel/quarkus/component/jaxb/it/JaxbRoute.java |   3 +-
 .../quarkus/component/mail/CamelResource.java      |  33 ++++++-
 .../camel/quarkus/component/mail/CamelRoute.java   |   7 ++
 .../mail/{MailITCase.java => MailIT.java}          |   2 +-
 .../camel/quarkus/component/mail/MailTest.java     |  57 +++++++++++-
 .../quarkus/component/saxon/it/SaxonTest.java      |   2 +-
 .../quarkus/component/soap/it/SoapRoutes.java      |  12 +--
 42 files changed, 586 insertions(+), 235 deletions(-)
 rename integration-test-groups/foundation/{simple => core-languages}/pom.xml (90%)
 copy integration-tests/mustache/src/main/java/org/apache/camel/quarkus/component/mustache/it/MustacheRoute.java => integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageRoutes.java (78%)
 create mode 100644 integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java
 create mode 100644 integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatRoutes.java
 copy integration-tests/core-discovery-disabled/src/main/java/org/apache/camel/quarkus/core/CoreDiscoveryDisabledRoutes.java => integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageRoutes.java (79%)
 copy integration-tests/main-discovery-disabled/src/main/java/org/apache/camel/quarkus/main/MainDiscoveryDisabledRoutes.java => integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageRoutes.java (82%)
 copy integration-test-groups/foundation/{bean/src/main/java/org/apache/camel/quarkus/component/bean/RouteBuilderWithProducer.java => core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/RefLanguageRoutes.java} (56%)
 rename integration-test-groups/foundation/{simple/src/main/java/org/apache/camel/quarkus/language/simple => core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it}/ReflectionConfigurations.java (96%)
 rename integration-test-groups/foundation/{simple/src/main/java/org/apache/camel/quarkus/language/simple => core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it}/SimpleRoutes.java (96%)
 create mode 100644 integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageRoutes.java
 rename integration-test-groups/foundation/{simple => core-languages}/src/main/resources/application.properties (100%)
 rename integration-test-groups/foundation/{simple => core-languages}/src/main/resources/mysimple.txt (100%)
 copy integration-test-groups/{aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisIT.java => foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageIT.java} (88%)
 copy integration-tests/exec/src/test/java/org/apache/camel/quarkus/component/exec/it/ExecTest.java => integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageTest.java (74%)
 copy integration-test-groups/{aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisIT.java => foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatIT.java} (88%)
 copy integration-test-groups/foundation/{customized-log-component/src/test/java/org/apache/camel/quarkus/component/log/it/CustomizedLogComponentTest.java => core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatTest.java} (66%)
 copy integration-test-groups/{aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisIT.java => foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageIT.java} (86%)
 copy integration-tests/exec/src/test/java/org/apache/camel/quarkus/component/exec/it/ExecTest.java => integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageTest.java (71%)
 copy integration-test-groups/{aws2/aws2-cw/src/test/java/org/apache/camel/quarkus/component/aws2/cw/it/Aws2CwIT.java => foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageIT.java} (88%)
 copy extensions-jvm/apns/integration-test/src/test/java/org/apache/camel/quarkus/component/apns/it/ApnsTest.java => integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageTest.java (72%)
 copy integration-test-groups/{aws2/aws2-cw/src/test/java/org/apache/camel/quarkus/component/aws2/cw/it/Aws2CwIT.java => foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageIT.java} (89%)
 copy extensions-jvm/couchbase/integration-test/src/test/java/org/apache/camel/quarkus/component/couchbase/it/CouchbasePollTest.java => integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageTest.java (61%)
 rename integration-test-groups/foundation/{simple/src/test/java/org/apache/camel/quarkus/core => core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it}/SimpleIT.java (94%)
 rename integration-test-groups/foundation/{simple/src/test/java/org/apache/camel/quarkus/core => core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it}/SimpleTest.java (57%)
 copy integration-test-groups/{aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisIT.java => foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageIT.java} (88%)
 create mode 100644 integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageTest.java
 delete mode 100644 integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
 rename integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/{MailITCase.java => MailIT.java} (95%)

[camel-quarkus] 14/15: Test soapjaxb() data format DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 82704be2c63e9b437f63ee9074afd03ffa16ba78
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 21:53:36 2021 +0200

    Test soapjaxb() data format DSL method #2616
---
 .../apache/camel/quarkus/component/soap/it/SoapRoutes.java   | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/integration-tests/soap/src/main/java/org/apache/camel/quarkus/component/soap/it/SoapRoutes.java b/integration-tests/soap/src/main/java/org/apache/camel/quarkus/component/soap/it/SoapRoutes.java
index fb8221d..d413e3d 100644
--- a/integration-tests/soap/src/main/java/org/apache/camel/quarkus/component/soap/it/SoapRoutes.java
+++ b/integration-tests/soap/src/main/java/org/apache/camel/quarkus/component/soap/it/SoapRoutes.java
@@ -62,10 +62,12 @@ public class SoapRoutes extends RouteBuilder {
                 .marshal("soapDataFormatWithServiceInterfaceStrategy");
 
         from("direct:marshalQnameStrategy")
-                .marshal("soapDataFormatWithQNameStrategy");
+                .marshal().soapjaxb(SERVICE_CUSTOMERS_BY_NAME_PACKAGE, new QNameStrategy(
+                        new QName("http://service.it.soap.component.quarkus.camel.apache.org/", "getCustomersByName")));
 
         from("direct:unmarshalQnameStrategy")
-                .unmarshal("soapDataFormatWithQNameStrategy");
+                .unmarshal().soapjaxb(SERVICE_CUSTOMERS_BY_NAME_PACKAGE, new QNameStrategy(
+                        new QName("http://service.it.soap.component.quarkus.camel.apache.org/", "getCustomersByName")));
 
         from("direct:marshal-soap1.2")
                 .marshal().soapjaxb12(SERVICE_CUSTOMERS_BY_NAME_PACKAGE);
@@ -98,12 +100,6 @@ public class SoapRoutes extends RouteBuilder {
         return soapJaxbDataFormat;
     }
 
-    @Named("soapDataFormatWithQNameStrategy")
-    public SoapJaxbDataFormat soapJaxbDataFormatQnameStrategy() {
-        QName qName = new QName("http://service.it.soap.component.quarkus.camel.apache.org/", "getCustomersByName");
-        return new SoapJaxbDataFormat(SERVICE_CUSTOMERS_BY_NAME_PACKAGE, new QNameStrategy(qName));
-    }
-
     @Named("soapDataFormatWithServiceInterfaceStrategy")
     public SoapJaxbDataFormat soapJaxbDataFormatServiceInterfaceStrategy() {
         return new SoapJaxbDataFormat(SERVICE_CUSTOMERS_BY_NAME_PACKAGE,

[camel-quarkus] 01/15: Simplify Simple language tests

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit d2c1ad225d44100e20d9ab775ca6e56707f15e37
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 12:50:32 2021 +0200

    Simplify Simple language tests
---
 .../quarkus/language/simple/SimpleResource.java    | 56 ++++++++--------------
 .../quarkus/language/simple/SimpleRoutes.java      |  4 ++
 .../org/apache/camel/quarkus/core/SimpleTest.java  | 20 ++++----
 3 files changed, 36 insertions(+), 44 deletions(-)

diff --git a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
index face86e..d9d2528 100644
--- a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
+++ b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
@@ -22,8 +22,9 @@ import java.nio.charset.StandardCharsets;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
@@ -36,48 +37,31 @@ public class SimpleResource {
     @Inject
     ProducerTemplate template;
 
-    @Path("/filter")
-    @GET
+    @Path("/header/{route}/{key}/{value}")
+    @POST
     @Consumes(MediaType.TEXT_PLAIN)
     @Produces(MediaType.TEXT_PLAIN)
-    public String filter(boolean premium) {
-        return template.requestBodyAndHeader("direct:filter-simple", "NOT-PREMIUM", "premium", premium, String.class);
+    public String header(String body, @PathParam("route") String route, @PathParam("key") String key,
+            @PathParam("value") String value) {
+        return template.requestBodyAndHeader("direct:" + route, body, key, value, String.class);
     }
 
-    @Path("/transform")
-    @GET
+    @Path("/route/{route}/{bodyType}")
+    @POST
     @Consumes(MediaType.TEXT_PLAIN)
     @Produces(MediaType.TEXT_PLAIN)
-    public String transform(String user) {
-        return template.requestBodyAndHeader("direct:transform-simple", null, "user", user, String.class);
-    }
-
-    @Path("/resource")
-    @GET
-    @Consumes(MediaType.TEXT_PLAIN)
-    @Produces(MediaType.TEXT_PLAIN)
-    public String resource(String body) {
-        return template.requestBody("direct:resource-simple", body, String.class);
-    }
-
-    @Path("/mandatoryBodyAs")
-    @GET
-    @Consumes(MediaType.TEXT_PLAIN)
-    @Produces(MediaType.TEXT_PLAIN)
-    public String mandatoryBodyAs(byte[] body) {
-        return template.requestBody("direct:mandatoryBodyAs-simple", body, String.class);
-    }
-
-    @Path("/bodyIs")
-    @GET
-    @Consumes(MediaType.TEXT_PLAIN)
-    @Produces(MediaType.TEXT_PLAIN)
-    public String mandatoryBodyAs(String body) {
-        if ("A body of type String".equals(body)) {
-            return template.requestBody("direct:bodyIs-simple", "STRING", String.class);
-        } else {
-            return template.requestBody("direct:bodyIs-simple", ByteBuffer.wrap(body.getBytes(StandardCharsets.UTF_8)),
+    public String resource(String body, @PathParam("route") String route, @PathParam("bodyType") String bodyType) {
+        switch (bodyType) {
+        case "String":
+            return template.requestBody("direct:" + route, body, String.class);
+        case "byte[]":
+            return template.requestBody("direct:" + route, body.getBytes(StandardCharsets.UTF_8), String.class);
+        case "ByteBuffer":
+            return template.requestBody("direct:" + route, ByteBuffer.wrap(body.getBytes(StandardCharsets.UTF_8)),
                     String.class);
+        default:
+            throw new IllegalStateException("Unexpected body type " + bodyType);
         }
     }
+
 }
diff --git a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
index a211d37..69cad6c 100644
--- a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
+++ b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
@@ -32,6 +32,10 @@ public class SimpleRoutes extends RouteBuilder {
                 .setBody(constant("PREMIUM"));
 
         from("direct:bodyIs-simple").filter().simple("${body} is 'java.nio.ByteBuffer'").setBody(constant("BYTE_BUFFER"));
+
+        from("direct:exchangeProperty")
+                .setBody().exchangeProperty("myExchangeProperty");
+
     }
 
 }
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java b/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
index 520a53f..2ad9447 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
+++ b/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
@@ -27,37 +27,41 @@ public class SimpleTest {
 
     @Test
     public void premiumHeaderShouldPassThroughFilter() {
-        given().body(true).when().get("/simple/filter").then().statusCode(200).body(is("PREMIUM"));
+        given().body("foo").when().post("/simple/header/filter-simple/premium/true").then().statusCode(200).body(is("PREMIUM"));
     }
 
     @Test
     public void notPremiumHeaderShouldNotPassThroughFilter() {
-        given().body(false).when().get("/simple/filter").then().statusCode(200).body(is("NOT-PREMIUM"));
+        given().body("foo").when().post("/simple/header/filter-simple/premium/false").then().statusCode(200)
+                .body(is("foo"));
     }
 
     @Test
     public void aliceUserHeaderShouldBeTransformedToHelloAlice() {
-        given().body("Alice").when().get("/simple/transform").then().statusCode(200).body(is("Hello Alice !"));
+        given().body("Alice").when().post("/simple/header/transform-simple/user/Alice").then().statusCode(200)
+                .body(is("Hello Alice !"));
     }
 
     @Test
     public void aliceBodyShouldBeTransformedToTheNameIsAlice() {
-        given().body("Alice").when().get("/simple/resource").then().statusCode(200).body(is("The name is Alice"));
+        given().body("Alice").when().post("/simple/route/resource-simple/String").then().statusCode(200)
+                .body(is("The name is Alice"));
     }
 
     @Test
     public void goldBodyShouldPassThroughFilter() {
-        given().body("gold").when().get("/simple/mandatoryBodyAs").then().statusCode(200).body(is("PREMIUM"));
+        given().body("gold").when().post("/simple/route/mandatoryBodyAs-simple/byte[]").then().statusCode(200)
+                .body(is("PREMIUM"));
     }
 
     @Test
     public void stringBodyShouldNotPassThroughBodyIsFilter() {
-        given().body("A body of type String").when().get("/simple/bodyIs").then().statusCode(200).body(is("STRING"));
+        given().body("STRING").when().post("/simple/route/bodyIs-simple/String").then().statusCode(200).body(is("STRING"));
     }
 
     @Test
     public void byteBufferBodyShouldPassThroughBodyIsFilter() {
-        given().body("A body of type ByteBuffer").when().get("/simple/bodyIs").then().statusCode(200).body(is("BYTE_BUFFER"));
+        given().body("A body of type ByteBuffer").when().post("/simple/route/bodyIs-simple/ByteBuffer").then().statusCode(200)
+                .body(is("BYTE_BUFFER"));
     }
-
 }

[camel-quarkus] 13/15: Test pgp() data format DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 210d5e9a5fc962ae3a134f603a5d3b09a64e30c4
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 21:46:59 2021 +0200

    Test pgp() data format DSL method #2616
---
 .../camel/quarkus/component/crypto/it/CryptoRoutes.java    | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/integration-tests/crypto/src/main/java/org/apache/camel/quarkus/component/crypto/it/CryptoRoutes.java b/integration-tests/crypto/src/main/java/org/apache/camel/quarkus/component/crypto/it/CryptoRoutes.java
index 6ba8bee..da7cef1 100644
--- a/integration-tests/crypto/src/main/java/org/apache/camel/quarkus/component/crypto/it/CryptoRoutes.java
+++ b/integration-tests/crypto/src/main/java/org/apache/camel/quarkus/component/crypto/it/CryptoRoutes.java
@@ -22,7 +22,6 @@ import javax.crypto.KeyGenerator;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.converter.crypto.CryptoDataFormat;
-import org.apache.camel.converter.crypto.PGPDataFormat;
 
 public class CryptoRoutes extends RouteBuilder {
 
@@ -45,13 +44,11 @@ public class CryptoRoutes extends RouteBuilder {
                 .unmarshal(cryptoDataFormat);
 
         // PGP data format
-        PGPDataFormat encrypt = getPgpDataFormat("pubring.pgp");
-        PGPDataFormat decrypt = getPgpDataFormat("secring.pgp");
         from("direct:marshalPgp")
-                .marshal(encrypt);
+                .marshal().pgp("pubring.pgp", "sdude@nowhere.net", "sdude");
 
         from("direct:unmarshalPgp")
-                .unmarshal(decrypt);
+                .unmarshal().pgp("secring.pgp", "sdude@nowhere.net", "sdude");
     }
 
     private CryptoDataFormat getCryptoDataFormat() throws NoSuchAlgorithmException {
@@ -59,11 +56,4 @@ public class CryptoRoutes extends RouteBuilder {
         return new CryptoDataFormat("DES", generator.generateKey());
     }
 
-    private PGPDataFormat getPgpDataFormat(String keyFile) {
-        PGPDataFormat encrypt = new PGPDataFormat();
-        encrypt.setKeyFileName(keyFile);
-        encrypt.setKeyUserid("sdude@nowhere.net");
-        encrypt.setPassword("sdude");
-        return encrypt;
-    }
 }

[camel-quarkus] 05/15: Test Tokenize language in isolation #2613

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 7771be8bfc998c995092787bde7d4db5b80ae8cb
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 14:52:26 2021 +0200

    Test Tokenize language in isolation #2613
---
 .../foundation/core-languages/pom.xml              |  5 ++
 .../core/languages/it/CoreLanguagesResource.java   | 25 ++++++++
 .../core/languages/it/TokenizeLanguageRoutes.java  | 64 +++++++++++++++++++++
 .../core/languages/it/TokenizeLanguageIT.java      | 24 ++++++++
 .../core/languages/it/TokenizeLanguageTest.java    | 67 ++++++++++++++++++++++
 5 files changed, 185 insertions(+)

diff --git a/integration-test-groups/foundation/core-languages/pom.xml b/integration-test-groups/foundation/core-languages/pom.xml
index a362ba7..186b6db 100644
--- a/integration-test-groups/foundation/core-languages/pom.xml
+++ b/integration-test-groups/foundation/core-languages/pom.xml
@@ -55,6 +55,11 @@
             <artifactId>rest-assured</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
 
         <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
         <dependency>
diff --git a/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java
index a8541de..d777bd7 100644
--- a/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java
@@ -18,10 +18,13 @@ package org.apache.camel.quarkus.core.languages.it;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
+import javax.inject.Named;
 import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -37,6 +40,14 @@ public class CoreLanguagesResource {
     @Inject
     ProducerTemplate template;
 
+    @Inject
+    @Named("tokenCounter")
+    AtomicInteger tokenCounter;
+
+    @Inject
+    @Named("xmlTokenCounter")
+    AtomicInteger xmlTokenCounter;
+
     @Path("/header/{route}/{key}/{value}")
     @POST
     @Consumes(MediaType.TEXT_PLAIN)
@@ -73,4 +84,18 @@ public class CoreLanguagesResource {
         return template.request("direct:" + route, e -> e.getProperties().put(key, value)).getMessage().getBody(String.class);
     }
 
+    @Path("/counter/{name}")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public int tokenCounter(@PathParam("name") String name) {
+        switch (name) {
+        case "tokenCounter":
+            return tokenCounter.get();
+        case "xmlTokenCounter":
+            return xmlTokenCounter.get();
+        default:
+            throw new IllegalStateException("Unexpected counter name: " + name);
+        }
+    }
+
 }
diff --git a/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageRoutes.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageRoutes.java
new file mode 100644
index 0000000..546ef36
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageRoutes.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.camel.builder.RouteBuilder;
+
+@Singleton
+public class TokenizeLanguageRoutes extends RouteBuilder {
+
+    @Inject
+    @Named("tokenCounter")
+    AtomicInteger tokenCounter;
+
+    @Inject
+    @Named("xmlTokenCounter")
+    AtomicInteger xmlTokenCounter;
+
+    @Override
+    public void configure() {
+        from("direct:tokenizeLanguage")
+                .split().tokenize(",")
+                .process(e -> tokenCounter.incrementAndGet());
+        from("direct:tokenizeLanguageXml")
+                .split().tokenizeXML("bar")
+                .process(e -> xmlTokenCounter.incrementAndGet());
+    }
+
+    static class Producers {
+        @Produces
+        @Singleton
+        @Named("tokenCounter")
+        AtomicInteger tokenCounter() {
+            return new AtomicInteger();
+        }
+
+        @Produces
+        @Singleton
+        @Named("xmlTokenCounter")
+        AtomicInteger xmlTokenCounter() {
+            return new AtomicInteger();
+        }
+    }
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageIT.java
new file mode 100644
index 0000000..1659fd8
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class TokenizeLanguageIT extends TokenizeLanguageTest {
+
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageTest.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageTest.java
new file mode 100644
index 0000000..c15e8da
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/TokenizeLanguageTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.awaitility.Awaitility;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+public class TokenizeLanguageTest {
+    @Test
+    public void tokenize() {
+        RestAssured.given()
+                .body("a,b,c,d,e")
+                .post("/core-languages/route/tokenizeLanguage/String")
+                .then()
+                .statusCode(200);
+        Awaitility.await().atMost(10, TimeUnit.SECONDS)
+                .until(
+                        () -> RestAssured.given()
+                                .get("/core-languages/counter/tokenCounter")
+                                .then()
+                                .statusCode(200)
+                                .extract()
+                                .body().asString(),
+                        Matchers.is("5"));
+        ;
+    }
+
+    @Test
+    public void tokenizeXml() {
+        RestAssured.given()
+                .body("<foo><bar>A</bar><bar>B</bar></foo>")
+                .post("/core-languages/route/tokenizeLanguageXml/String")
+                .then()
+                .statusCode(200);
+        Awaitility.await().atMost(10, TimeUnit.SECONDS)
+                .until(
+                        () -> RestAssured.given()
+                                .get("/core-languages/counter/xmlTokenCounter")
+                                .then()
+                                .statusCode(200)
+                                .extract()
+                                .body().asString(),
+                        Matchers.is("2"));
+        ;
+    }
+
+}

[camel-quarkus] 07/15: Test bindy() DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 34329c8db4e76828b0942fe221f492add716b584
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 17:20:00 2021 +0200

    Test bindy() DSL method #2616
---
 .../apache/camel/quarkus/component/bindy/it/BindyTestRoute.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyTestRoute.java b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyTestRoute.java
index 428e419..7c1840f 100644
--- a/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyTestRoute.java
+++ b/integration-tests/bindy/src/main/java/org/apache/camel/quarkus/component/bindy/it/BindyTestRoute.java
@@ -29,11 +29,9 @@ public class BindyTestRoute extends RouteBuilder {
 
     @Override
     public void configure() {
-        BindyDataFormat bindyCsvDataFormat = new BindyDataFormat();
-        bindyCsvDataFormat.setClassType(CsvOrder.class);
-        bindyCsvDataFormat.setType(BindyType.Csv.name());
-        from("direct:marshal-csv-record").marshal(bindyCsvDataFormat);
-        from("direct:unmarshal-csv-record").unmarshal(bindyCsvDataFormat);
+
+        from("direct:marshal-csv-record").marshal().bindy(BindyType.Csv, CsvOrder.class);
+        from("direct:unmarshal-csv-record").unmarshal().bindy(BindyType.Csv, CsvOrder.class);
 
         BindyDataFormat bindyFixedLengthDataFormat = new BindyDataFormat();
         bindyFixedLengthDataFormat.setClassType(FixedLengthOrder.class);

[camel-quarkus] 02/15: Test ExchangeProperty and Header languages #2613

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit bc3813a00515788b788f33e3f9192d9c6fe485b6
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 14:02:56 2021 +0200

    Test ExchangeProperty and Header languages #2613
---
 .../camel/quarkus/language/simple/SimpleResource.java      |  9 +++++++++
 .../apache/camel/quarkus/language/simple/SimpleRoutes.java |  5 ++++-
 .../java/org/apache/camel/quarkus/core/SimpleTest.java     | 14 ++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
index d9d2528..a61c3f9 100644
--- a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
+++ b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
@@ -64,4 +64,13 @@ public class SimpleResource {
         }
     }
 
+    @Path("/exchangeProperty/{route}/{key}/{value}")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String exchangeProperty(String body, @PathParam("route") String route, @PathParam("key") String key,
+            @PathParam("value") String value) {
+        return template.request("direct:" + route, e -> e.getProperties().put(key, value)).getMessage().getBody(String.class);
+    }
+
 }
diff --git a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
index 69cad6c..692645b 100644
--- a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
+++ b/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
@@ -33,9 +33,12 @@ public class SimpleRoutes extends RouteBuilder {
 
         from("direct:bodyIs-simple").filter().simple("${body} is 'java.nio.ByteBuffer'").setBody(constant("BYTE_BUFFER"));
 
-        from("direct:exchangeProperty")
+        from("direct:myExchangePropertyRoute")
                 .setBody().exchangeProperty("myExchangeProperty");
 
+        from("direct:myHeaderRoute")
+                .setBody().header("myHeader");
+
     }
 
 }
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java b/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
index 2ad9447..4242685 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
+++ b/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
@@ -64,4 +64,18 @@ public class SimpleTest {
         given().body("A body of type ByteBuffer").when().post("/simple/route/bodyIs-simple/ByteBuffer").then().statusCode(200)
                 .body(is("BYTE_BUFFER"));
     }
+
+    @Test
+    public void exchangeProperty() {
+        given().body("foo").post("/simple/exchangeProperty/myExchangePropertyRoute/myExchangeProperty/1234").then()
+                .statusCode(200)
+                .body(is("1234"));
+    }
+
+    @Test
+    public void header() {
+        given().body("foo").post("/simple/header/myHeaderRoute/myHeader/barbaz").then().statusCode(200)
+                .body(is("barbaz"));
+    }
+
 }

[camel-quarkus] 06/15: Test Constant language in isolation #2613

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 3971f990852c60f40d63923cb01c846134b1a73c
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 15:03:22 2021 +0200

    Test Constant language in isolation #2613
---
 .../core/languages/it/ConstantLanguageRoutes.java  | 31 +++++++++++++++++++
 .../core/languages/it/ConstantLanguageIT.java      | 24 +++++++++++++++
 .../core/languages/it/ConstantLanguageTest.java    | 35 ++++++++++++++++++++++
 3 files changed, 90 insertions(+)

diff --git a/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageRoutes.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageRoutes.java
new file mode 100644
index 0000000..463b35e
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageRoutes.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import javax.inject.Singleton;
+
+import org.apache.camel.builder.RouteBuilder;
+
+@Singleton
+public class ConstantLanguageRoutes extends RouteBuilder {
+
+    @Override
+    public void configure() {
+        from("direct:constantLanguage")
+                .setBody().constant("as constant as 42");
+    }
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageIT.java
new file mode 100644
index 0000000..b167fd3
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class ConstantLanguageIT extends ConstantLanguageTest {
+
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageTest.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageTest.java
new file mode 100644
index 0000000..aefbcc9
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ConstantLanguageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+public class ConstantLanguageTest {
+    @Test
+    public void constant() {
+        RestAssured.given()
+                .body("foo bar baz")
+                .post("/core-languages/route/constantLanguage/String")
+                .then()
+                .statusCode(200)
+                .body(Matchers.is("as constant as 42"));
+    }
+}

[camel-quarkus] 08/15: Test cbor() DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 894e521e01a2c29b2c61f1b04bb79d77e549f588
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 17:29:52 2021 +0200

    Test cbor() DSL method #2616
---
 .../apache/camel/quarkus/component/cbor/it/CborResource.java | 10 ++++++++++
 .../apache/camel/quarkus/component/cbor/it/CborRoutes.java   |  4 ++++
 .../org/apache/camel/quarkus/component/cbor/it/CborTest.java | 12 ++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborResource.java b/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborResource.java
index e5002fc..e655dbe 100644
--- a/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborResource.java
+++ b/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborResource.java
@@ -68,6 +68,16 @@ public class CborResource {
         return producerTemplate.requestBody("direct:unmarshal-author", marshalled, Author.class);
     }
 
+    @Path("/marshalUnmarshalCborMethod")
+    @GET
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Author marshalUnmarshalCborMethod(Author author) {
+        LOG.debug("Calling marshalUnmarshalAuthor(...)");
+        Object marshalled = producerTemplate.requestBody("direct:marshalCborMethod", author);
+        return producerTemplate.requestBody("direct:unmarshalCborMethod", marshalled, Author.class);
+    }
+
     @Path("/unmarshalAuthorViaJmsTypeHeader")
     @GET
     @Consumes(MediaType.APPLICATION_OCTET_STREAM)
diff --git a/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborRoutes.java b/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborRoutes.java
index 4b2c76b..69cd718 100644
--- a/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborRoutes.java
+++ b/integration-tests/cbor/src/main/java/org/apache/camel/quarkus/component/cbor/it/CborRoutes.java
@@ -25,6 +25,10 @@ public class CborRoutes extends RouteBuilder {
 
     @Override
     public void configure() {
+
+        from("direct:marshalCborMethod").marshal().cbor();
+        from("direct:unmarshalCborMethod").unmarshal().cbor(Author.class);
+
         CBORDataFormat useMapDf = new CBORDataFormat();
         useMapDf.useMap();
         from("direct:marshal-map").marshal(useMapDf);
diff --git a/integration-tests/cbor/src/test/java/org/apache/camel/quarkus/component/cbor/it/CborTest.java b/integration-tests/cbor/src/test/java/org/apache/camel/quarkus/component/cbor/it/CborTest.java
index 96f6b43..39e500b 100644
--- a/integration-tests/cbor/src/test/java/org/apache/camel/quarkus/component/cbor/it/CborTest.java
+++ b/integration-tests/cbor/src/test/java/org/apache/camel/quarkus/component/cbor/it/CborTest.java
@@ -60,6 +60,18 @@ class CborTest {
     }
 
     @Test
+    void marshalUnmarshalCborMethod() {
+        Author in = new Author();
+        in.setName("Joe");
+        in.setSurname("Doe");
+
+        String uri = "/cbor/marshalUnmarshalCborMethod";
+        Author out = given().contentType(ContentType.JSON).body(in).get(uri).then().statusCode(200).extract().as(Author.class);
+        assertEquals("Joe", out.getName());
+        assertEquals("Doe", out.getSurname());
+    }
+
+    @Test
     void unmarshalAuthorViaJmsTypeHeaderShouldSucceed() throws JsonProcessingException {
         Author author = new Author();
         author.setName("David");

[camel-quarkus] 10/15: Test jaxb() data format DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit ad4128672a8da230b316896af082f513a13676b8
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 18:37:52 2021 +0200

    Test jaxb() data format DSL method #2616
---
 .../java/org/apache/camel/quarkus/component/jaxb/it/JaxbRoute.java     | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/integration-tests/jaxb/src/main/java/org/apache/camel/quarkus/component/jaxb/it/JaxbRoute.java b/integration-tests/jaxb/src/main/java/org/apache/camel/quarkus/component/jaxb/it/JaxbRoute.java
index 1ed2874..a55b261 100644
--- a/integration-tests/jaxb/src/main/java/org/apache/camel/quarkus/component/jaxb/it/JaxbRoute.java
+++ b/integration-tests/jaxb/src/main/java/org/apache/camel/quarkus/component/jaxb/it/JaxbRoute.java
@@ -26,7 +26,6 @@ public class JaxbRoute extends RouteBuilder {
 
     @Override
     public void configure() throws Exception {
-        JaxbDataFormat jaxb = new JaxbDataFormat("org.apache.camel.quarkus.component.jaxb.it.model");
 
         JaxbDataFormat xml = new JaxbDataFormat();
         JAXBContext context = JAXBContext.newInstance(Person.class);
@@ -36,7 +35,7 @@ public class JaxbRoute extends RouteBuilder {
         jaxbFromScheme.setSchema("classpath:person.xsd");
 
         from("direct:unmarshal")
-                .unmarshal(jaxb);
+                .unmarshal().jaxb("org.apache.camel.quarkus.component.jaxb.it.model");
 
         from("direct:unmarshal-2")
                 .unmarshal(xml);

[camel-quarkus] 04/15: Test the Ref language without dependency on camel-quarkus-ref #2613

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 14f77dc6c222a80870510b2098d56b1cc3b8deea
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 14:30:47 2021 +0200

    Test the Ref language without dependency on camel-quarkus-ref #2613
---
 .../core/languages/it/RefLanguageRoutes.java       | 50 ++++++++++++++++++++++
 .../quarkus/core/languages/it/RefLanguageIT.java   | 24 +++++++++++
 .../quarkus/core/languages/it/RefLanguageTest.java | 42 ++++++++++++++++++
 3 files changed, 116 insertions(+)

diff --git a/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/RefLanguageRoutes.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/RefLanguageRoutes.java
new file mode 100644
index 0000000..440cdbd
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/RefLanguageRoutes.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import io.quarkus.arc.Unremovable;
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.support.ExpressionAdapter;
+
+public class RefLanguageRoutes extends RouteBuilder {
+
+    @Override
+    public void configure() {
+        from("direct:refLanguage")
+                .transform().ref("refLanguageExpression");
+    }
+
+    @Unremovable
+    @Singleton
+    @Named("refLanguageExpression")
+    @Produces
+    public Expression myExpression() {
+        return new ExpressionAdapter() {
+            @Override
+            public Object evaluate(Exchange exchange) {
+                return exchange.getMessage().getBody(String.class).toUpperCase();
+            }
+        };
+    }
+
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageIT.java
new file mode 100644
index 0000000..1c96098
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class RefLanguageIT extends RefLanguageTest {
+
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageTest.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageTest.java
new file mode 100644
index 0000000..f797860
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/RefLanguageTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+
+/**
+ * Note that a similar test is performed in {@code camel-quarkus-integration-test-ref}. The difference is that here we
+ * test without the {@code camel-quarkus-ref} dependency because the Ref language is brought through
+ * {@code camel-quarkus-core}.
+ */
+@QuarkusTest
+public class RefLanguageTest {
+    @Test
+    public void ref() {
+        given()
+                .body("My very foo")
+                .post("/core-languages/route/refLanguage/String")
+                .then()
+                .statusCode(200)
+                .body(is("MY VERY FOO"));
+    }
+
+}

[camel-quarkus] 03/15: Rename Simple test module to Core Languages because it now covers multiple Camel Core languages #2613

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 8cab8146584cd863fbb9d34927ee5c3de83b10b5
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 14:07:49 2021 +0200

    Rename Simple test module to Core Languages because it now covers
    multiple Camel Core languages #2613
---
 .../foundation/{simple => core-languages}/pom.xml  |  6 ++--
 .../core/languages/it/CoreLanguagesResource.java}  |  6 ++--
 .../it/ExchangePropertyLanguageRoutes.java}        | 13 ++++++---
 .../core/languages/it/HeaderLanguageRoutes.java}   | 15 +++++++---
 .../languages/it}/ReflectionConfigurations.java    |  2 +-
 .../quarkus/core/languages/it}/SimpleRoutes.java   |  8 +-----
 .../src/main/resources/application.properties      |  0
 .../src/main/resources/mysimple.txt                |  0
 .../languages/it/ExchangePropertyLanguageIT.java}  |  4 +--
 .../it/ExchangePropertyLanguageTest.java}          | 19 ++++++++++---
 .../core/languages/it/HeaderLanguageIT.java}       |  4 +--
 .../core/languages/it/HeaderLanguageTest.java}     | 17 +++++++++---
 .../camel/quarkus/core/languages/it}/SimpleIT.java |  2 +-
 .../quarkus/core/languages/it}/SimpleTest.java     | 32 ++++++++--------------
 integration-test-groups/foundation/pom.xml         |  2 +-
 15 files changed, 73 insertions(+), 57 deletions(-)

diff --git a/integration-test-groups/foundation/simple/pom.xml b/integration-test-groups/foundation/core-languages/pom.xml
similarity index 93%
rename from integration-test-groups/foundation/simple/pom.xml
rename to integration-test-groups/foundation/core-languages/pom.xml
index 288d876..a362ba7 100644
--- a/integration-test-groups/foundation/simple/pom.xml
+++ b/integration-test-groups/foundation/core-languages/pom.xml
@@ -26,9 +26,9 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>camel-quarkus-integration-test-simple</artifactId>
-    <name>Camel Quarkus :: Integration Tests :: Simple :: Tests</name>
-    <description>The camel quarkus integration tests for the simple language</description>
+    <artifactId>camel-quarkus-integration-test-core-languages</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Core Languages :: Tests</name>
+    <description>The camel quarkus integration tests for Camel Core languages: Constant, ExchangeProperty, Header, Ref, Simple</description>
 
     <dependencies>
         <dependency>
diff --git a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java
similarity index 96%
rename from integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
rename to integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java
index a61c3f9..a8541de 100644
--- a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleResource.java
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CoreLanguagesResource.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.language.simple;
+package org.apache.camel.quarkus.core.languages.it;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
@@ -30,9 +30,9 @@ import javax.ws.rs.core.MediaType;
 
 import org.apache.camel.ProducerTemplate;
 
-@Path("/simple")
+@Path("/core-languages")
 @ApplicationScoped
-public class SimpleResource {
+public class CoreLanguagesResource {
 
     @Inject
     ProducerTemplate template;
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageRoutes.java
similarity index 71%
copy from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
copy to integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageRoutes.java
index 04ec3a7..238e8c6 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageRoutes.java
@@ -14,11 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
-import io.quarkus.test.junit.NativeImageTest;
+import org.apache.camel.builder.RouteBuilder;
 
-@NativeImageTest
-public class SimpleIT extends SimpleTest {
+public class ExchangePropertyLanguageRoutes extends RouteBuilder {
+
+    @Override
+    public void configure() {
+        from("direct:myExchangePropertyRoute")
+                .setBody().exchangeProperty("myExchangeProperty");
+    }
 
 }
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageRoutes.java
similarity index 73%
copy from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
copy to integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageRoutes.java
index 04ec3a7..fb38a67 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageRoutes.java
@@ -14,11 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
-import io.quarkus.test.junit.NativeImageTest;
+import org.apache.camel.builder.RouteBuilder;
 
-@NativeImageTest
-public class SimpleIT extends SimpleTest {
+public class HeaderLanguageRoutes extends RouteBuilder {
+
+    @Override
+    public void configure() {
+
+        from("direct:myHeaderRoute")
+                .setBody().header("myHeader");
+
+    }
 
 }
diff --git a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/ReflectionConfigurations.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ReflectionConfigurations.java
similarity index 96%
rename from integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/ReflectionConfigurations.java
rename to integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ReflectionConfigurations.java
index 503c1c2..748a38b 100644
--- a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/ReflectionConfigurations.java
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/ReflectionConfigurations.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.language.simple;
+package org.apache.camel.quarkus.core.languages.it;
 
 import java.nio.ByteBuffer;
 
diff --git a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/SimpleRoutes.java
similarity index 86%
rename from integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
rename to integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/SimpleRoutes.java
index 692645b..ede1f2e 100644
--- a/integration-test-groups/foundation/simple/src/main/java/org/apache/camel/quarkus/language/simple/SimpleRoutes.java
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/SimpleRoutes.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.language.simple;
+package org.apache.camel.quarkus.core.languages.it;
 
 import org.apache.camel.builder.RouteBuilder;
 
@@ -33,12 +33,6 @@ public class SimpleRoutes extends RouteBuilder {
 
         from("direct:bodyIs-simple").filter().simple("${body} is 'java.nio.ByteBuffer'").setBody(constant("BYTE_BUFFER"));
 
-        from("direct:myExchangePropertyRoute")
-                .setBody().exchangeProperty("myExchangeProperty");
-
-        from("direct:myHeaderRoute")
-                .setBody().header("myHeader");
-
     }
 
 }
diff --git a/integration-test-groups/foundation/simple/src/main/resources/application.properties b/integration-test-groups/foundation/core-languages/src/main/resources/application.properties
similarity index 100%
rename from integration-test-groups/foundation/simple/src/main/resources/application.properties
rename to integration-test-groups/foundation/core-languages/src/main/resources/application.properties
diff --git a/integration-test-groups/foundation/simple/src/main/resources/mysimple.txt b/integration-test-groups/foundation/core-languages/src/main/resources/mysimple.txt
similarity index 100%
rename from integration-test-groups/foundation/simple/src/main/resources/mysimple.txt
rename to integration-test-groups/foundation/core-languages/src/main/resources/mysimple.txt
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageIT.java
similarity index 86%
copy from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
copy to integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageIT.java
index 04ec3a7..778cb3c 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageIT.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
 import io.quarkus.test.junit.NativeImageTest;
 
 @NativeImageTest
-public class SimpleIT extends SimpleTest {
+public class ExchangePropertyLanguageIT extends ExchangePropertyLanguageTest {
 
 }
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageTest.java
similarity index 60%
copy from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
copy to integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageTest.java
index 04ec3a7..484df7e 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/ExchangePropertyLanguageTest.java
@@ -14,11 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
-import io.quarkus.test.junit.NativeImageTest;
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Test;
 
-@NativeImageTest
-public class SimpleIT extends SimpleTest {
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+
+@QuarkusTest
+public class ExchangePropertyLanguageTest {
+
+    @Test
+    public void exchangeProperty() {
+        given().body("foo").post("/core-languages/exchangeProperty/myExchangePropertyRoute/myExchangeProperty/1234").then()
+                .statusCode(200)
+                .body(is("1234"));
+    }
 
 }
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageIT.java
similarity index 88%
copy from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
copy to integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageIT.java
index 04ec3a7..f200faa 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageIT.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
 import io.quarkus.test.junit.NativeImageTest;
 
 @NativeImageTest
-public class SimpleIT extends SimpleTest {
+public class HeaderLanguageIT extends HeaderLanguageTest {
 
 }
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageTest.java
similarity index 63%
copy from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
copy to integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageTest.java
index 04ec3a7..12cb48f 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/HeaderLanguageTest.java
@@ -14,11 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
-import io.quarkus.test.junit.NativeImageTest;
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Test;
 
-@NativeImageTest
-public class SimpleIT extends SimpleTest {
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.is;
+
+@QuarkusTest
+public class HeaderLanguageTest {
+    @Test
+    public void header() {
+        given().body("foo").post("/core-languages/header/myHeaderRoute/myHeader/barbaz").then().statusCode(200)
+                .body(is("barbaz"));
+    }
 
 }
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/SimpleIT.java
similarity index 94%
rename from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
rename to integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/SimpleIT.java
index 04ec3a7..2a97c36 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleIT.java
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/SimpleIT.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
 import io.quarkus.test.junit.NativeImageTest;
 
diff --git a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/SimpleTest.java
similarity index 61%
rename from integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
rename to integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/SimpleTest.java
index 4242685..66f8dc1 100644
--- a/integration-test-groups/foundation/simple/src/test/java/org/apache/camel/quarkus/core/SimpleTest.java
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/SimpleTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core;
+package org.apache.camel.quarkus.core.languages.it;
 
 import io.quarkus.test.junit.QuarkusTest;
 import org.junit.jupiter.api.Test;
@@ -27,55 +27,45 @@ public class SimpleTest {
 
     @Test
     public void premiumHeaderShouldPassThroughFilter() {
-        given().body("foo").when().post("/simple/header/filter-simple/premium/true").then().statusCode(200).body(is("PREMIUM"));
+        given().body("foo").when().post("/core-languages/header/filter-simple/premium/true").then().statusCode(200)
+                .body(is("PREMIUM"));
     }
 
     @Test
     public void notPremiumHeaderShouldNotPassThroughFilter() {
-        given().body("foo").when().post("/simple/header/filter-simple/premium/false").then().statusCode(200)
+        given().body("foo").when().post("/core-languages/header/filter-simple/premium/false").then().statusCode(200)
                 .body(is("foo"));
     }
 
     @Test
     public void aliceUserHeaderShouldBeTransformedToHelloAlice() {
-        given().body("Alice").when().post("/simple/header/transform-simple/user/Alice").then().statusCode(200)
+        given().body("Alice").when().post("/core-languages/header/transform-simple/user/Alice").then().statusCode(200)
                 .body(is("Hello Alice !"));
     }
 
     @Test
     public void aliceBodyShouldBeTransformedToTheNameIsAlice() {
-        given().body("Alice").when().post("/simple/route/resource-simple/String").then().statusCode(200)
+        given().body("Alice").when().post("/core-languages/route/resource-simple/String").then().statusCode(200)
                 .body(is("The name is Alice"));
     }
 
     @Test
     public void goldBodyShouldPassThroughFilter() {
-        given().body("gold").when().post("/simple/route/mandatoryBodyAs-simple/byte[]").then().statusCode(200)
+        given().body("gold").when().post("/core-languages/route/mandatoryBodyAs-simple/byte[]").then().statusCode(200)
                 .body(is("PREMIUM"));
     }
 
     @Test
     public void stringBodyShouldNotPassThroughBodyIsFilter() {
-        given().body("STRING").when().post("/simple/route/bodyIs-simple/String").then().statusCode(200).body(is("STRING"));
+        given().body("STRING").when().post("/core-languages/route/bodyIs-simple/String").then().statusCode(200)
+                .body(is("STRING"));
     }
 
     @Test
     public void byteBufferBodyShouldPassThroughBodyIsFilter() {
-        given().body("A body of type ByteBuffer").when().post("/simple/route/bodyIs-simple/ByteBuffer").then().statusCode(200)
-                .body(is("BYTE_BUFFER"));
-    }
-
-    @Test
-    public void exchangeProperty() {
-        given().body("foo").post("/simple/exchangeProperty/myExchangePropertyRoute/myExchangeProperty/1234").then()
+        given().body("A body of type ByteBuffer").when().post("/core-languages/route/bodyIs-simple/ByteBuffer").then()
                 .statusCode(200)
-                .body(is("1234"));
-    }
-
-    @Test
-    public void header() {
-        given().body("foo").post("/simple/header/myHeaderRoute/myHeader/barbaz").then().statusCode(200)
-                .body(is("barbaz"));
+                .body(is("BYTE_BUFFER"));
     }
 
 }
diff --git a/integration-test-groups/foundation/pom.xml b/integration-test-groups/foundation/pom.xml
index 0f8adfb..3bd6f79 100644
--- a/integration-test-groups/foundation/pom.xml
+++ b/integration-test-groups/foundation/pom.xml
@@ -38,6 +38,7 @@
         <module>controlbus</module>
         <module>core</module>
         <module>core-annotations</module>
+        <module>core-languages</module>
         <module>customized-log-component</module>
         <module>direct</module>
         <module>log</module>
@@ -45,7 +46,6 @@
         <module>ref</module>
         <module>scheduler</module>
         <module>seda</module>
-        <module>simple</module>
         <module>stream</module>
         <module>timer</module>
         <module>type-converter</module>

[camel-quarkus] 09/15: Test custom() data format DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 6ba0e3e564231104dd56fc1629b496a60fba6a13
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 17:59:08 2021 +0200

    Test custom() data format DSL method #2616
---
 .../core/languages/it/CustomDataFormatRoutes.java  | 83 ++++++++++++++++++++++
 .../core/languages/it/CustomDataFormatIT.java      | 24 +++++++
 .../core/languages/it/CustomDataFormatTest.java    | 44 ++++++++++++
 3 files changed, 151 insertions(+)

diff --git a/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatRoutes.java b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatRoutes.java
new file mode 100644
index 0000000..a6d03ab
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/main/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatRoutes.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import io.quarkus.arc.Unremovable;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.support.ExchangeHelper;
+
+public class CustomDataFormatRoutes extends RouteBuilder {
+
+    @Override
+    public void configure() {
+        from("direct:customDataFormatMarshal")
+                .marshal().custom("customDataFormat");
+        from("direct:customDataFormatUnmarshal")
+                .unmarshal().custom("customDataFormat");
+    }
+
+    @Unremovable
+    @Singleton
+    @Named("customDataFormat")
+    @Produces
+    public DataFormat myExpression() {
+        return new DataFormat() {
+
+            @Override
+            public void start() {
+            }
+
+            @Override
+            public void stop() {
+            }
+
+            @Override
+            public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
+                String payload = ExchangeHelper.convertToMandatoryType(exchange, String.class, graph);
+                stream.write(("(" + payload + ")").getBytes(StandardCharsets.UTF_8));
+                stream.flush();
+            }
+
+            @Override
+            public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+                StringBuilder sb = new StringBuilder();
+                try (InputStreamReader in = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
+                    int c;
+                    while ((c = in.read()) >= 0) {
+                        sb.append((char) c);
+                    }
+                }
+                if (sb.charAt(0) != '(' || sb.charAt(sb.length() - 1) != ')') {
+                    throw new IllegalArgumentException("customDataFormat input must start with ( and end with )");
+                }
+                return sb.substring(1, sb.length() - 1);
+            }
+        };
+    }
+
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatIT.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatIT.java
new file mode 100644
index 0000000..402d9bd
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class CustomDataFormatIT extends CustomDataFormatTest {
+
+}
diff --git a/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatTest.java b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatTest.java
new file mode 100644
index 0000000..0bb78d0
--- /dev/null
+++ b/integration-test-groups/foundation/core-languages/src/test/java/org/apache/camel/quarkus/core/languages/it/CustomDataFormatTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core.languages.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+
+@QuarkusTest
+public class CustomDataFormatTest {
+    @Test
+    public void customDataFormat() {
+        given()
+                .body("foo bar")
+                .post("/core-languages/route/customDataFormatMarshal/String")
+                .then()
+                .statusCode(200)
+                .body(Matchers.is("(foo bar)"));
+
+        given()
+                .body("(bar baz)")
+                .post("/core-languages/route/customDataFormatUnmarshal/byte[]")
+                .then()
+                .statusCode(200)
+                .body(Matchers.is("bar baz"));
+    }
+
+}

[camel-quarkus] 15/15: Load a classpath resource using current thread's context class loader in Saxon test, because otherwise it cannot be found

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit ac74dc142607139225e5c88a3e0a7912c4e9ba1d
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Mon May 17 15:21:40 2021 +0200

    Load a classpath resource using current thread's context class loader in Saxon test, because otherwise it cannot be found
---
 .../java/org/apache/camel/quarkus/component/saxon/it/SaxonTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/integration-tests/saxon/src/test/java/org/apache/camel/quarkus/component/saxon/it/SaxonTest.java b/integration-tests/saxon/src/test/java/org/apache/camel/quarkus/component/saxon/it/SaxonTest.java
index 3800743..2744123 100644
--- a/integration-tests/saxon/src/test/java/org/apache/camel/quarkus/component/saxon/it/SaxonTest.java
+++ b/integration-tests/saxon/src/test/java/org/apache/camel/quarkus/component/saxon/it/SaxonTest.java
@@ -37,7 +37,7 @@ class SaxonTest {
 
     @Test
     public void xqueryTransformShouldConcatEmployeeIdAndSuffix() throws IOException {
-        String xml = resourceToString("/myinput.xml", StandardCharsets.UTF_8);
+        String xml = resourceToString("myinput.xml", StandardCharsets.UTF_8, Thread.currentThread().getContextClassLoader());
         given().body(xml).get("/xquery/transform").then().statusCode(200).body(is("123Suffix"));
     }
 

[camel-quarkus] 12/15: Test mimeMultipart() data format DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 2df64b162a09fb2330284d6a6c26b24d60d65ce7
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 21:41:34 2021 +0200

    Test mimeMultipart() data format DSL method #2616
---
 .../quarkus/component/mail/CamelResource.java      | 33 +++++++++++--
 .../camel/quarkus/component/mail/CamelRoute.java   |  7 +++
 .../mail/{MailITCase.java => MailIT.java}          |  2 +-
 .../camel/quarkus/component/mail/MailTest.java     | 57 +++++++++++++++++++++-
 4 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java
index 19240ef..0bc7b44 100644
--- a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java
+++ b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java
@@ -18,13 +18,18 @@ package org.apache.camel.quarkus.component.mail;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
+import javax.mail.util.ByteArrayDataSource;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.attachment.AttachmentMessage;
+import org.apache.camel.attachment.DefaultAttachment;
 
 @Path("/mail")
 @ApplicationScoped
@@ -33,11 +38,33 @@ public class CamelResource {
     @Inject
     ProducerTemplate template;
 
-    @Path("/mailtext")
+    @Path("/route/{route}")
     @POST
     @Consumes(MediaType.TEXT_PLAIN)
     @Produces(MediaType.TEXT_PLAIN)
-    public String processOrder(String statement) throws Exception {
-        return template.requestBody("direct:mailtext", statement, String.class);
+    public String route(String statement, @PathParam("route") String route) throws Exception {
+        return template.requestBody("direct:" + route, statement, String.class);
     }
+
+    @Path("/mimeMultipartMarshal/{fileName}/{fileContent}")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String mimeMultipart(String body, @PathParam("fileName") String fileName,
+            @PathParam("fileContent") String fileContent) throws Exception {
+
+        return template.request("direct:mimeMultipartMarshal", e -> {
+            AttachmentMessage in = e.getMessage(AttachmentMessage.class);
+            in.setBody(body);
+            in.setHeader(Exchange.CONTENT_TYPE, "text/plain;charset=iso8859-1;other-parameter=true");
+            in.setHeader(Exchange.CONTENT_ENCODING, "UTF8");
+
+            DefaultAttachment attachment = new DefaultAttachment(new ByteArrayDataSource(fileContent, "text/plain"));
+            attachment.addHeader("Content-Description", "Sample Attachment Data");
+            attachment.addHeader("X-AdditionalData", "additional data");
+            in.addAttachmentObject(fileName, attachment);
+
+        }).getMessage().getBody(String.class);
+    }
+
 }
diff --git a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelRoute.java b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelRoute.java
index a21f0fa..6efc00e 100644
--- a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelRoute.java
+++ b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelRoute.java
@@ -34,6 +34,13 @@ public class CamelRoute extends RouteBuilder {
                 .setHeader("To", constant("james@localhost"))
                 .setHeader("From", constant("claus@localhost"))
                 .to("smtp://localhost?initialDelay=100&delay=100");
+
+        from("direct:mimeMultipartMarshal")
+                .marshal().mimeMultipart();
+        from("direct:mimeMultipartUnmarshalMarshal")
+                .unmarshal().mimeMultipart()
+                .marshal().mimeMultipart();
+
     }
 
     @Produces
diff --git a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailITCase.java b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailIT.java
similarity index 95%
rename from integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailITCase.java
rename to integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailIT.java
index ee9f334..d5eb1bb 100644
--- a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailITCase.java
+++ b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailIT.java
@@ -19,5 +19,5 @@ package org.apache.camel.quarkus.component.mail;
 import io.quarkus.test.junit.NativeImageTest;
 
 @NativeImageTest
-public class MailITCase extends MailTest {
+public class MailIT extends MailTest {
 }
diff --git a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java
index bdb9d23..c7c0118 100644
--- a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java
+++ b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTest.java
@@ -16,21 +16,41 @@
  */
 package org.apache.camel.quarkus.component.mail;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.core.Is.is;
 
 @QuarkusTest
 public class MailTest {
+    private static final Pattern DELIMITER_PATTERN = Pattern.compile("\r\n[^\r\n]+");
+    private static final String EXPECTED_TEMPLATE = "${delimiter}\r\n"
+            + "Content-Type: text/plain; charset=UTF8; other-parameter=true\r\n"
+            + "Content-Transfer-Encoding: 8bit\r\n"
+            + "\r\n"
+            + "Hello multipart!"
+            + "${delimiter}\r\n"
+            + "Content-Type: text/plain\r\n"
+            + "Content-Transfer-Encoding: 7bit\r\n"
+            + "Content-Disposition: attachment; filename=file.txt\r\n"
+            + "Content-Description: Sample Attachment Data\r\n"
+            + "X-AdditionalData: additional data\r\n"
+            + "\r\n"
+            + "Hello attachment!"
+            + "${delimiter}--\r\n";
+
     @Test
-    public void testSendAsMail() throws Exception {
+    public void testSendAsMail() {
         RestAssured.given()
                 .contentType(ContentType.TEXT)
                 .body("Hi how are you")
-                .post("/mail/mailtext")
+                .post("/mail/route/mailtext")
                 .then()
                 .statusCode(200);
 
@@ -48,4 +68,37 @@ public class MailTest {
                 .body(is("Hello World"));
     }
 
+    @Test
+    public void mimeMultipartDataFormat() {
+        final String actual = RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body("Hello multipart!")
+                .post("/mail/mimeMultipartMarshal/file.txt/Hello attachment!")
+                .then()
+                .statusCode(200)
+                .extract().body().asString();
+        assertMultipart(EXPECTED_TEMPLATE, actual);
+
+        final String unmarshalMarshal = RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body(actual)
+                .post("/mail/route/mimeMultipartUnmarshalMarshal")
+                .then()
+                .statusCode(200)
+                .extract().body().asString();
+
+        assertMultipart(EXPECTED_TEMPLATE, unmarshalMarshal);
+
+    }
+
+    private void assertMultipart(final String expectedPattern, final String actual) {
+        final Matcher m = DELIMITER_PATTERN.matcher(actual);
+        if (!m.find()) {
+            Assertions.fail("Mime delimiter not found in body: " + actual);
+        }
+        final String delim = m.group();
+        final String expected = expectedPattern.replace("${delimiter}", delim);
+        Assertions.assertEquals(expected, actual);
+    }
+
 }

[camel-quarkus] 11/15: Test lzf() data format DSL method #2616

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 979f106d07956179d3b745ecc0410becb4b2cdee
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue May 18 18:42:42 2021 +0200

    Test lzf() data format DSL method #2616
---
 .../camel/quarkus/component/lzf/deployment/LzfProcessor.java      | 8 ++++++++
 .../quarkus/component/compression/it/CompressionRouteBuilder.java | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/extensions/lzf/deployment/src/main/java/org/apache/camel/quarkus/component/lzf/deployment/LzfProcessor.java b/extensions/lzf/deployment/src/main/java/org/apache/camel/quarkus/component/lzf/deployment/LzfProcessor.java
index 9125dfc..5dea44e 100644
--- a/extensions/lzf/deployment/src/main/java/org/apache/camel/quarkus/component/lzf/deployment/LzfProcessor.java
+++ b/extensions/lzf/deployment/src/main/java/org/apache/camel/quarkus/component/lzf/deployment/LzfProcessor.java
@@ -16,8 +16,11 @@
  */
 package org.apache.camel.quarkus.component.lzf.deployment;
 
+import com.ning.compress.lzf.impl.UnsafeChunkDecoder;
+import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
 
 class LzfProcessor {
 
@@ -28,4 +31,9 @@ class LzfProcessor {
         return new FeatureBuildItem(FEATURE);
     }
 
+    @BuildStep
+    void reflectiveClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+        reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, UnsafeChunkDecoder.class));
+    }
+
 }
diff --git a/integration-tests/compression/src/main/java/org/apache/camel/quarkus/component/compression/it/CompressionRouteBuilder.java b/integration-tests/compression/src/main/java/org/apache/camel/quarkus/component/compression/it/CompressionRouteBuilder.java
index ff78504..7a81e5a 100644
--- a/integration-tests/compression/src/main/java/org/apache/camel/quarkus/component/compression/it/CompressionRouteBuilder.java
+++ b/integration-tests/compression/src/main/java/org/apache/camel/quarkus/component/compression/it/CompressionRouteBuilder.java
@@ -37,8 +37,8 @@ public class CompressionRouteBuilder extends RouteBuilder {
                 .unmarshal().gzipDeflater();
 
         from("direct:lzf-compress")
-                .marshal().gzipDeflater();
+                .marshal().lzf();
         from("direct:lzf-uncompress")
-                .unmarshal().gzipDeflater();
+                .unmarshal().lzf();
     }
 }