You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2024/03/15 15:12:00 UTC

(camel-quarkus) branch 3.8.x updated: jt400: extend test coverage

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

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


The following commit(s) were added to refs/heads/3.8.x by this push:
     new f63c707b36 jt400: extend test coverage
f63c707b36 is described below

commit f63c707b36c2dfc77e78683da073cfc01c031f24
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Wed Mar 13 13:54:41 2024 +0100

    jt400: extend test coverage
---
 integration-tests/jt400/README.adoc                | 104 +++++++++++
 .../quarkus/component/jt400/it/Jt400Resource.java  | 194 ++++++++++++---------
 .../Jt400MockProducers.java}                       |   4 +-
 .../Jt400MockResource.java}                        |   8 +-
 .../it/{ => mock}/MockAS400ConnectionPool.java     |   2 +-
 .../src/main/resources/application.properties      |  14 +-
 .../quarkus/component/jt400/it/Jt400MockTest.java  |  57 +++---
 .../quarkus/component/jt400/it/Jt400Test.java      | 135 ++++++++++++++
 8 files changed, 400 insertions(+), 118 deletions(-)

diff --git a/integration-tests/jt400/README.adoc b/integration-tests/jt400/README.adoc
new file mode 100644
index 0000000000..b515bd9699
--- /dev/null
+++ b/integration-tests/jt400/README.adoc
@@ -0,0 +1,104 @@
+=== External IBM i
+
+
+To execute the tests against an external IBM i server, provide the connection information by setting environment variables
+
+```
+export JT400_URL=#jdbc_url
+export JT400_USERNAME=#username
+export JT400_PASSWORD=#password
+```
+
+or for Windows:
+
+```
+$Env:JT400_URL = "#jdbc_url"
+$Env:JT400_USERNAME="#username"
+$Env:JT400_PASSWORD="#password"
+```
+
+Tests using an external server are disabled until environmental property `JT400_URL` is present.
+
+=== Mocked test
+
+Mocked tests are enabled by default.
+Unfortunately in case that mocked tests are enabled, the flat class path is forced for the Quarkus, which may influence
+the tests.
+
+Execution of mocked tests can be skipped by activating profile `skip-mock-tests`.
+
+=== How to configure an external server
+
+Several objects (queues, user spaces, ..) have to be created in the external server to make testing successful.
+
+The suggested approach is to create a test library. In the following text, the test library's name is `REDHAT5`
+
+Download i-access client solutions from this https://www.ibm.com/support/pages/ibm-i-access-client-solutions[page].
+Use the 5250 emulator option from the client and run the following command for library creation:
+
+```
+CRTLIB REDHAT5
+```
+
+==== Program call testing
+
+Program call test reads the content of user space.
+
+```
+//interface for multiline commands
+CALL QCMD
+
+//creation of PROGCALL user space
+CALL PGM(QSYS/QUSCRTUS) PARM(('PROGCALL  REDHAT5   ' (*CHAR 20))
+        ('TEST      ' (*CHAR 10)) (16 (*INT 4))
+        (' ' (*CHAR 1)) ('*ALL      ' (*CHAR 10))
+        ('                ' (*CHAR 16)))
+
+//value is set to hello camel
+CALL PGM(QSYS/QUSCHGUS) PARM(('PROGCALL  REDHAT5   ' (*CHAR 20))
+        (1 (*INT 4)) (16 (*INT 4))
+        ('hello camel     ' (*CHAR 16))
+        ('1' (*CHAR 1))  )
+```
+
+==== Message queue testing
+
+Message queue can be created by following the command
+
+```
+CRTMSGQ REDHAT5/TESTMSGQ
+```
+
+==== Data queue testing
+
+Two data-queues are required for the testing. One created as `keyed=true` and one as `LIFO`.
+
+```
+//keyed data queue
+CRTDTAQ DTAQ(REDHAT5/TESTKEYED) SEQ(*KEYED) KEYLEN(20) MAXLEN(100)
+
+//LIFO data queue
+CRTDTAQ DTAQ(REDHAT5/TESTLIFO) SEQ(*LIFO) MAXLEN(100)
+```
+
+==== Using different object names
+
+If your test object names are different from the default ones, you can override default values via environmental variable
+
+```
+export JT400_LIBRARY=#library_if_not_REDHA5
+export JT400_LIFO_QUEUE=#lifoqueue_if_not_TESTLIFO.DTAQ
+export JT400_KEYED_QUEUE=#lkeyedqueue_if_not_TESTKEYED.DTAQ
+export JT400_MESSAGE_QUEUE=#messagequeue_if_not_TESTMSGQ.MSGQ
+export JT400_USER_SPACE=#userspace_if_not_PROGCALL
+```
+
+or for Windows:
+
+```
+$Env:JT400_LIBRARY = "#library_if_not_REDHA5"
+$Env:JT400_LIFO_QUEUE="#lifoqueue_if_not_TESTLIFO.DTAQe"
+$Env:JT400_KEYED_QUEUE="#lkeyedqueue_if_not_TESTKEYED.DTAQ"
+$Env:JT400_MESSAGE_QUEUE="#messagequeue_if_not_TESTMSGQ.MSGQe"
+$Env:JT400_USER_SPACE="#userspace_if_not_PROGCALL"
+```
\ No newline at end of file
diff --git a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Resource.java b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Resource.java
index fd65e7950a..b861f8a78f 100644
--- a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Resource.java
+++ b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Resource.java
@@ -16,48 +16,54 @@
  */
 package org.apache.camel.quarkus.component.jt400.it;
 
+import java.nio.charset.Charset;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 
-import com.ibm.as400.access.DataStream;
-import com.ibm.as400.access.MockAS400ImplRemote;
-import com.ibm.as400.access.MockedResponses;
-import com.ibm.as400.access.ReplyDQCommon;
-import com.ibm.as400.access.ReplyDQReadNormal;
-import com.ibm.as400.access.ReplyDQRequestAttributesNormal;
-import com.ibm.as400.access.ReplyOk;
-import com.ibm.as400.access.ReplyRCCallProgram;
-import com.ibm.as400.access.ReplyRCExchangeAttributes;
+import com.ibm.as400.access.QueuedMessage;
 import jakarta.enterprise.context.ApplicationScoped;
 import jakarta.inject.Inject;
 import jakarta.ws.rs.Consumes;
-import jakarta.ws.rs.GET;
 import jakarta.ws.rs.POST;
 import jakarta.ws.rs.Path;
-import jakarta.ws.rs.PathParam;
 import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
 import jakarta.ws.rs.core.MediaType;
 import jakarta.ws.rs.core.Response;
-import org.apache.camel.CamelContext;
 import org.apache.camel.ConsumerTemplate;
 import org.apache.camel.Exchange;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.jt400.Jt400Endpoint;
-import org.jboss.logging.Logger;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
 
 @Path("/jt400")
 @ApplicationScoped
 public class Jt400Resource {
 
-    public enum ReplyType {
-        DQReadNormal, ok, DQRequestAttributesNormal, DQCommonReply, RCExchangeAttributesReply, RCCallProgramReply
-    }
+    @ConfigProperty(name = "cq.jt400.url")
+    String jt400Url;
 
-    private static final Logger LOG = Logger.getLogger(Jt400Resource.class);
+    @ConfigProperty(name = "cq.jt400.username")
+    String jt400USername;
 
-    private static final String COMPONENT_JT400 = "jt400";
+    @ConfigProperty(name = "cq.jt400.password")
+    String jt400Password;
 
-    @Inject
-    CamelContext context;
+    @ConfigProperty(name = "cq.jt400.keyed-queue")
+    String jt400KeyedQueue;
+
+    @ConfigProperty(name = "cq.jt400.library")
+    String jt400Library;
+
+    @ConfigProperty(name = "cq.jt400.lifo-queue")
+    String jt400LifoQueue;
+
+    @ConfigProperty(name = "cq.jt400.message-queue")
+    String jt400MessageQueue;
+
+    @ConfigProperty(name = "cq.jt400.user-space")
+    String jt400UserSpace;
 
     @Inject
     ProducerTemplate producerTemplate;
@@ -65,60 +71,74 @@ public class Jt400Resource {
     @Inject
     ConsumerTemplate consumerTemplate;
 
-    @Inject
-    MockAS400ImplRemote as400ImplRemote;
+    @Path("/dataQueue/read/")
+    @POST
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response keyedDataQueueRead(String key, @QueryParam("format") String format,
+            @QueryParam("searchType") String searchType) {
+
+        boolean keyed = key != null && !key.isEmpty();
+        String _format = Optional.ofNullable(format).orElse("text");
+        String _searchType = Optional.ofNullable(searchType).orElse("EQ");
+        StringBuilder suffix = new StringBuilder();
+
+        if (keyed) {
+            suffix.append(jt400KeyedQueue)
+                    .append(String.format("?keyed=true&format=%s&searchKey=%s&searchType=%s", _format, key, _searchType));
+        } else {
+            suffix.append(jt400LifoQueue).append(String.format("?readTimeout=100&format=%s", _format));
+        }
 
-    @Path("/keyedDataQueue/read")
-    @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response keyedDataQueueRead() {
+        Exchange ex = consumerTemplate.receive(getUrlForLibrary(suffix.toString()));
 
-        Exchange ex = consumerTemplate.receive(
-                "jt400://username:password@system/qsys.lib/MSGOUTDQ.DTAQ?connectionPool=#mockPool&keyed=true&format=binary&searchKey=MYKEY&searchType=GE");
+        if ("binary".equals(format)) {
+            return generateResponse(new String(ex.getIn().getBody(byte[].class), Charset.forName("Cp037")), ex);
+        }
+        return generateResponse(ex.getIn().getBody(String.class), ex);
 
-        return Response.ok().entity(ex.getIn().getBody(String.class)).build();
     }
 
-    @Path("/keyedDataQueue/write/{key}")
+    @Path("/dataQueue/write/")
     @POST
     @Consumes(MediaType.TEXT_PLAIN)
     @Produces(MediaType.TEXT_PLAIN)
-    public Response keyedDataQueueWrite(@PathParam("key") String key, String data) throws Exception {
+    public Response keyedDataQueueWrite(@QueryParam("key") String key,
+            @QueryParam("searchType") String searchType,
+            String data) {
+        boolean keyed = key != null;
+        StringBuilder suffix = new StringBuilder();
+        Map<String, Object> headers = new HashMap<>();
+
+        if (keyed) {
+            suffix.append(jt400KeyedQueue).append("?keyed=true");
+            headers.put(Jt400Endpoint.KEY, key);
+        } else {
+            suffix.append(jt400LifoQueue);
+        }
 
-        Object ex = producerTemplate.requestBodyAndHeader(
-                "jt400://username:password@system/qsys.lib/MSGINDQ.DTAQ?connectionPool=#mockPool&keyed=true",
-                data,
-                Jt400Endpoint.KEY,
-                key);
+        Object ex = producerTemplate.requestBodyAndHeaders(
+                getUrlForLibrary(suffix.toString()),
+                "Hello " + data,
+                headers);
         return Response.ok().entity(ex).build();
     }
 
-    @Path("/messageQueue/read")
-    @GET
+    @Path("/messageQueue/write/")
+    @POST
     @Produces(MediaType.TEXT_PLAIN)
-    public Response messageQueueRead() throws InterruptedException {
-        Exchange ex = consumerTemplate.receive(
-                "jt400://username:password@system/qsys.lib/MSGOUTQ.MSGQ?connectionPool=#mockPool&readTimeout=100");
-        if (ex.getIn().getBody() != null) {
-            //reurn ok,because something is returned (the message contains 1 char, which is not correctly converted)
-            return Response.ok().build();
-        }
+    public Response messageQueueWrite(String data) {
+        Object ex = producerTemplate.requestBody(getUrlForLibrary(jt400MessageQueue), "Hello " + data);
 
-        return Response.serverError().build();
+        return Response.ok().entity(ex).build();
     }
 
-    @Path("/messageQueue/write/{key}")
+    @Path("/messageQueue/read/")
     @POST
-    @Consumes(MediaType.TEXT_PLAIN)
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response messageQueueWrite(@PathParam("key") String key, String data) throws Exception {
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response messageQueueRead() {
+        Exchange ex = consumerTemplate.receive(getUrlForLibrary(jt400MessageQueue));
 
-        Object ex = producerTemplate.requestBodyAndHeader(
-                "jt400://username:password@system/qsys.lib/MSGINQ.MSGQ?connectionPool=#mockPool",
-                data,
-                Jt400Endpoint.KEY,
-                key);
-        return Response.ok().entity(ex).build();
+        return generateResponse(ex.getIn().getBody(String.class), ex);
     }
 
     @Path("/programCall")
@@ -126,35 +146,45 @@ public class Jt400Resource {
     @Consumes(MediaType.TEXT_PLAIN)
     @Produces(MediaType.APPLICATION_JSON)
     public Response programCall() throws Exception {
+        Exchange ex = producerTemplate.request(getUrl("/qsys.lib/QUSRTVUS.PGM?fieldsLength=20,4,4,16&outputFieldsIdx=3"),
+                exchange -> {
+                    String userSpace = String.format("%-10s", jt400UserSpace);
+                    String userLib = String.format("%-10s", jt400Library);
+
+                    Object[] parms = new Object[] {
+                            userSpace + userLib, // Qualified user space name
+                            1, // starting position
+                            16, // length of data
+                            "" // output
+                    };
+                    exchange.getIn().setBody(parms);
+                });
+
+        return Response.ok().entity(ex.getIn().getBody(Object[].class)[3]).build();
+    }
 
-        Object ex = producerTemplate.requestBody(
-                "jt400://GRUPO:ATWORK@server/QSYS.LIB/assets.LIB/compute.PGM?connectionPool=#mockPool&outputFieldsIdx=1&fieldsLength=10,10,512",
-                new String[] { "par1", "par2" });
-        return Response.ok().entity(ex).build();
+    private String getUrlForLibrary(String suffix) {
+        return String.format("jt400://%s:%s@%s%s", jt400USername, jt400Password, jt400Url,
+                "/QSYS.LIB/" + jt400Library + ".LIB/" + suffix);
     }
 
-    @Path("/put/mockResponse")
-    @POST
-    @Consumes(MediaType.APPLICATION_JSON)
-    public Response putMockResponse(
-            Map params) throws Exception {
-        DataStream dataStream = switch (ReplyType.valueOf((String) params.get("replyType"))) {
-        case DQReadNormal -> new ReplyDQReadNormal((Integer) params.get("hashCode"),
-                (String) params.get("senderInformation"),
-                (String) params.get("entry"),
-                (String) params.get("key"));
-        case ok -> new ReplyOk();
-        case DQCommonReply -> new ReplyDQCommon(
-                (Integer) params.get("hashCode"));
-        case DQRequestAttributesNormal -> new ReplyDQRequestAttributesNormal(
-                (Integer) params.get("keyLength"));
-        case RCExchangeAttributesReply -> new ReplyRCExchangeAttributes();
-        case RCCallProgramReply -> new ReplyRCCallProgram();
-        };
-
-        MockedResponses.add(dataStream);
-
-        return Response.ok().build();
+    private String getUrl(String suffix) {
+        return String.format("jt400://%s:%s@%s%s", jt400USername, jt400Password, jt400Url, suffix);
     }
 
+    Response generateResponse(String result, Exchange ex) {
+        Map<String, Object> retVal = new HashMap<>();
+
+        retVal.put("result", result);
+        ex.getIn().getHeaders().entrySet().stream().forEach(e -> {
+            if (e.getValue() instanceof QueuedMessage) {
+                retVal.put(e.getKey(), "QueuedMessage: " + ((QueuedMessage) e.getValue()).getText());
+            } else {
+                retVal.put(e.getKey(), e.getValue());
+            }
+        });
+
+        return Response.ok().entity(retVal).build();
+
+    }
 }
diff --git a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Producers.java b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/Jt400MockProducers.java
similarity index 95%
rename from integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Producers.java
rename to integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/Jt400MockProducers.java
index 2043d2028f..319e8dc0a4 100644
--- a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Producers.java
+++ b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/Jt400MockProducers.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.jt400.it;
+package org.apache.camel.quarkus.component.jt400.it.mock;
 
 import java.util.HashMap;
 import java.util.List;
@@ -28,7 +28,7 @@ import jakarta.enterprise.context.ApplicationScoped;
 import jakarta.enterprise.inject.Produces;
 import jakarta.inject.Named;
 
-public class Jt400Producers {
+public class Jt400MockProducers {
 
     @Produces
     @ApplicationScoped
diff --git a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Resource.java b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/Jt400MockResource.java
similarity index 96%
copy from integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Resource.java
copy to integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/Jt400MockResource.java
index fd65e7950a..21a561efd8 100644
--- a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Resource.java
+++ b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/Jt400MockResource.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.jt400.it;
+package org.apache.camel.quarkus.component.jt400.it.mock;
 
 import java.util.Map;
 
@@ -44,15 +44,15 @@ import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.jt400.Jt400Endpoint;
 import org.jboss.logging.Logger;
 
-@Path("/jt400")
+@Path("/jt400/mock")
 @ApplicationScoped
-public class Jt400Resource {
+public class Jt400MockResource {
 
     public enum ReplyType {
         DQReadNormal, ok, DQRequestAttributesNormal, DQCommonReply, RCExchangeAttributesReply, RCCallProgramReply
     }
 
-    private static final Logger LOG = Logger.getLogger(Jt400Resource.class);
+    private static final Logger LOG = Logger.getLogger(Jt400MockResource.class);
 
     private static final String COMPONENT_JT400 = "jt400";
 
diff --git a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/MockAS400ConnectionPool.java b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/MockAS400ConnectionPool.java
similarity index 97%
rename from integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/MockAS400ConnectionPool.java
rename to integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/MockAS400ConnectionPool.java
index 00cef3dc94..751e6fa119 100644
--- a/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/MockAS400ConnectionPool.java
+++ b/integration-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/mock/MockAS400ConnectionPool.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.jt400.it;
+package org.apache.camel.quarkus.component.jt400.it.mock;
 
 import java.util.Locale;
 
diff --git a/integration-tests/jt400/src/main/resources/application.properties b/integration-tests/jt400/src/main/resources/application.properties
index b1e3fa4668..b038ba2ea6 100644
--- a/integration-tests/jt400/src/main/resources/application.properties
+++ b/integration-tests/jt400/src/main/resources/application.properties
@@ -14,4 +14,16 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
-quarkus.test.flat-class-path = ${quarkus.test.flat-class-path}
\ No newline at end of file
+quarkus.test.flat-class-path = ${quarkus.test.flat-class-path}
+
+#jt400 server connection information
+cq.jt400.url=${JT400_URL:system}
+cq.jt400.username=${JT400_USERNAME:username}
+cq.jt400.password=${JT400_PASSWORD:password}
+
+#jt400 custom objects for testing
+cq.jt400.library=${JT400_LIBRARY:REDHAT5}
+cq.jt400.user-space=${JT400_USER_SPACE:PROGCALL}
+cq.jt400.message-queue=${JT400_MESSAGE_QUEUE:TESTMSGQ.MSGQ}
+cq.jt400.keyed-queue=${JT400_KEYED_QUEUE:TESTKEYED.DTAQ}
+cq.jt400.lifo-queue=${JT400_LIFO_QUEUE:TESTLIFO.DTAQ}
diff --git a/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400MockTest.java b/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400MockTest.java
index dcb4615b38..5af533476a 100644
--- a/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400MockTest.java
+++ b/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400MockTest.java
@@ -22,6 +22,7 @@ import java.util.Map;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
+import org.apache.camel.quarkus.component.jt400.it.mock.Jt400MockResource;
 import org.apache.camel.util.CollectionHelper;
 import org.hamcrest.Matchers;
 import org.junit.jupiter.api.Test;
@@ -34,12 +35,12 @@ public class Jt400MockTest {
 
     @Test
     public void testReadKeyedDataQueue() {
-        prepareMockReply(Jt400Resource.ReplyType.ok);
-        prepareMockReply(Jt400Resource.ReplyType.DQRequestAttributesNormal, CollectionHelper.mapOf("keyLength", 5));
-        prepareMockReply(Jt400Resource.ReplyType.ok);
-        prepareMockReply(Jt400Resource.ReplyType.DQReadNormal, 0x8003, "mocked jt400", "Hello from mocked jt400!", "MYKEY");
+        prepareMockReply(Jt400MockResource.ReplyType.ok);
+        prepareMockReply(Jt400MockResource.ReplyType.DQRequestAttributesNormal, CollectionHelper.mapOf("keyLength", 5));
+        prepareMockReply(Jt400MockResource.ReplyType.ok);
+        prepareMockReply(Jt400MockResource.ReplyType.DQReadNormal, 0x8003, "mocked jt400", "Hello from mocked jt400!", "MYKEY");
 
-        RestAssured.get("/jt400/keyedDataQueue/read")
+        RestAssured.get("/jt400/mock/keyedDataQueue/read")
                 .then()
                 .statusCode(200)
                 .body(Matchers.equalTo("Hello from mocked jt400!"));
@@ -47,14 +48,14 @@ public class Jt400MockTest {
 
     @Test
     public void testWriteKeyedDataQueue() {
-        prepareMockReply(Jt400Resource.ReplyType.ok);
-        prepareMockReply(Jt400Resource.ReplyType.DQRequestAttributesNormal, CollectionHelper.mapOf("keyLength", 7));
-        prepareMockReply(Jt400Resource.ReplyType.ok);
-        prepareMockReply(Jt400Resource.ReplyType.DQCommonReply, CollectionHelper.mapOf("hashCode", 0x8002));
+        prepareMockReply(Jt400MockResource.ReplyType.ok);
+        prepareMockReply(Jt400MockResource.ReplyType.DQRequestAttributesNormal, CollectionHelper.mapOf("keyLength", 7));
+        prepareMockReply(Jt400MockResource.ReplyType.ok);
+        prepareMockReply(Jt400MockResource.ReplyType.DQCommonReply, CollectionHelper.mapOf("hashCode", 0x8002));
 
         RestAssured.given()
                 .body("Written in mocked jt400!")
-                .post("/jt400/keyedDataQueue/write/testKey")
+                .post("/jt400/mock/keyedDataQueue/write/testKey")
                 .then()
                 .statusCode(200)
                 .body(Matchers.equalTo("Written in mocked jt400!"));
@@ -62,24 +63,24 @@ public class Jt400MockTest {
 
     @Test
     public void testReadMessageQueue() {
-        prepareMockReply(Jt400Resource.ReplyType.RCExchangeAttributesReply);
-        prepareMockReply(Jt400Resource.ReplyType.RCExchangeAttributesReply);
-        prepareMockReply(Jt400Resource.ReplyType.RCCallProgramReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCExchangeAttributesReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCExchangeAttributesReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCCallProgramReply);
 
-        RestAssured.get("/jt400/messageQueue/read")
+        RestAssured.get("/jt400/mock/messageQueue/read")
                 .then()
                 .statusCode(200);
     }
 
     @Test
     public void testWriteMessageQueue() {
-        prepareMockReply(Jt400Resource.ReplyType.RCExchangeAttributesReply);
-        prepareMockReply(Jt400Resource.ReplyType.RCExchangeAttributesReply);
-        prepareMockReply(Jt400Resource.ReplyType.RCCallProgramReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCExchangeAttributesReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCExchangeAttributesReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCCallProgramReply);
 
         RestAssured.given()
                 .body("Written in mocked jt400!")
-                .post("/jt400/messageQueue/write/testKey")
+                .post("/jt400/mock/messageQueue/write/testKey")
                 .then()
                 .statusCode(200)
                 .body(Matchers.equalTo("Written in mocked jt400!"));
@@ -87,20 +88,20 @@ public class Jt400MockTest {
 
     @Test
     public void testProgramCall() {
-        prepareMockReply(Jt400Resource.ReplyType.RCExchangeAttributesReply);
-        prepareMockReply(Jt400Resource.ReplyType.RCExchangeAttributesReply);
-        prepareMockReply(Jt400Resource.ReplyType.RCCallProgramReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCExchangeAttributesReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCExchangeAttributesReply);
+        prepareMockReply(Jt400MockResource.ReplyType.RCCallProgramReply);
 
         RestAssured.given()
                 .body("Written in mocked jt400!")
-                .post("/jt400/programCall")
+                .post("/jt400/mock/programCall")
                 .then()
                 .statusCode(200)
                 .body(Matchers.both(Matchers.not(Matchers.containsString("par1"))).and(
                         Matchers.containsString("par2")));
     }
 
-    private void prepareMockReply(Jt400Resource.ReplyType replyType,
+    private void prepareMockReply(Jt400MockResource.ReplyType replyType,
             Integer hashCode,
             String senderInformation,
             String entry,
@@ -113,29 +114,29 @@ public class Jt400MockTest {
                         "senderInformation", senderInformation,
                         "entry", entry,
                         "key", key))
-                .post("/jt400/put/mockResponse")
+                .post("/jt400/mock/put/mockResponse")
                 .then()
                 .statusCode(200);
     }
 
-    private void prepareMockReply(Jt400Resource.ReplyType replyType) {
+    private void prepareMockReply(Jt400MockResource.ReplyType replyType) {
         //prepare mock data
         RestAssured.given()
                 .body(CollectionHelper.mapOf("replyType", replyType.name()))
                 .contentType(ContentType.JSON)
-                .post("/jt400/put/mockResponse")
+                .post("/jt400/mock/put/mockResponse")
                 .then()
                 .statusCode(200);
     }
 
-    private void prepareMockReply(Jt400Resource.ReplyType replyType, Map<String, Object> data) {
+    private void prepareMockReply(Jt400MockResource.ReplyType replyType, Map<String, Object> data) {
         Map<String, Object> request = new HashMap<>(data);
         request.put("replyType", replyType.name());
         //prepare mock data
         RestAssured.given()
                 .body(request)
                 .contentType(ContentType.JSON)
-                .post("/jt400/put/mockResponse")
+                .post("/jt400/mock/put/mockResponse")
                 .then()
                 .statusCode(200);
     }
diff --git a/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400Test.java b/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400Test.java
new file mode 100644
index 0000000000..d1d73187d0
--- /dev/null
+++ b/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400Test.java
@@ -0,0 +1,135 @@
+/*
+ * 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.component.jt400.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.component.jt400.Jt400Constants;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+@QuarkusTest
+@EnabledIfEnvironmentVariable(named = "JT400_URL", matches = ".+")
+public class Jt400Test {
+
+    @Test
+    public void testDataQueue() {
+        RestAssured.given()
+                .body("Leonard")
+                .post("/jt400/dataQueue/write")
+                .then()
+                .statusCode(200)
+                .body(Matchers.equalTo("Hello Leonard"));
+
+        RestAssured.post("/jt400/dataQueue/read")
+                .then()
+                .statusCode(200)
+                .body("result", Matchers.equalTo("Hello Leonard"));
+    }
+
+    @Test
+    public void testDataQueueBinary() {
+        RestAssured.given()
+                .body("Fred")
+                .post("/jt400/dataQueue/write")
+                .then()
+                .statusCode(200)
+                .body(Matchers.equalTo("Hello Fred"));
+
+        RestAssured.given()
+                .queryParam("format", "binary")
+                .post("/jt400/dataQueue/read")
+                .then()
+                .statusCode(200)
+                .body("result", Matchers.equalTo("Hello Fred"));
+    }
+
+    @Test
+    public void testKeyedDataQueue() {
+        String key = "key1";
+        String key2 = "key2";
+
+        RestAssured.given()
+                .body("Sheldon")
+                .queryParam("key", key)
+                .post("/jt400/dataQueue/write/")
+                .then()
+                .statusCode(200)
+                .body(Matchers.equalTo("Hello Sheldon"));
+
+        RestAssured.given()
+                .body("Sheldon2")
+                .queryParam("key", key2)
+                .post("/jt400/dataQueue/write/")
+                .then()
+                .statusCode(200)
+                .body(Matchers.equalTo("Hello Sheldon2"));
+
+        RestAssured.given()
+                .body(key)
+                .post("/jt400/dataQueue/read/")
+                .then()
+                .statusCode(200)
+                .body("result", Matchers.equalTo("Hello Sheldon"))
+                .body(Jt400Constants.KEY, Matchers.equalTo(key));
+
+        RestAssured.given()
+                .body(key)
+                .queryParam("searchType", "GT")
+                .post("/jt400/dataQueue/read/")
+                .then()
+                .statusCode(200)
+                .body("result", Matchers.equalTo("Hello Sheldon2"))
+                .body(Jt400Constants.KEY, Matchers.equalTo(key2));
+    }
+
+    @Test
+    public void testMessageQueue() {
+        RestAssured.given()
+                .body("Irma")
+                .post("/jt400/messageQueue/write")
+                .then()
+                .statusCode(200)
+                .body(Matchers.equalTo("Hello Irma"));
+
+        RestAssured.post("/jt400/messageQueue/read")
+                .then()
+                .statusCode(200)
+                .body("result", Matchers.is("Hello Irma"))
+                //check of headers
+                .body(Jt400Constants.SENDER_INFORMATION, Matchers.not(Matchers.empty()))
+                .body(Jt400Constants.MESSAGE_FILE, Matchers.is(""))
+                .body(Jt400Constants.MESSAGE_SEVERITY, Matchers.is(0))
+                .body(Jt400Constants.MESSAGE_ID, Matchers.is(""))
+                .body(Jt400Constants.MESSAGE_TYPE, Matchers.is(4))
+                .body(Jt400Constants.MESSAGE, Matchers.is("QueuedMessage: Hello Irma"));
+        //Jt400Constants.MESSAGE_DFT_RPY && Jt400Constants.MESSAGE_REPLYTO_KEY are used only for a special
+        // type of message which can not be created by the camel compinent (*INQUIRY)
+    }
+
+    @Test
+    public void testProgramCall() {
+        RestAssured.given()
+                .body("test")
+                .post("/jt400/programCall")
+                .then()
+                .statusCode(200)
+                .body(Matchers.containsString("hello camel"));
+    }
+
+}