This is an automated email from the ASF dual-hosted git repository. zhfeng 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 ba896bc836 jt400 com.ibm.as400.access.AS400 should be registered for runtime reinitialization #589 (#5913) ba896bc836 is described below commit ba896bc836ad173632754a5f0c309cf06bc55fff Author: JiriOndrusek <ondrusek.j...@gmail.com> AuthorDate: Mon Mar 25 05:02:18 2024 +0100 jt400 com.ibm.as400.access.AS400 should be registered for runtime reinitialization #589 (#5913) --- .../component/jt400/deployment/Jt400Processor.java | 14 ++++++++++++ integration-tests/jt400/README.adoc | 2 +- .../src/main/resources/application.properties | 6 ++++- .../camel/quarkus/component/jt400/it/Jt400IT.java | 26 ++++++++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/extensions/jt400/deployment/src/main/java/org/apache/camel/quarkus/component/jt400/deployment/Jt400Processor.java b/extensions/jt400/deployment/src/main/java/org/apache/camel/quarkus/component/jt400/deployment/Jt400Processor.java index 702d7e3983..133fbb3a76 100644 --- a/extensions/jt400/deployment/src/main/java/org/apache/camel/quarkus/component/jt400/deployment/Jt400Processor.java +++ b/extensions/jt400/deployment/src/main/java/org/apache/camel/quarkus/component/jt400/deployment/Jt400Processor.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; +import com.ibm.as400.access.AS400; import com.ibm.as400.access.ConvTable; import com.ibm.as400.access.NLSImplNative; import io.quarkus.deployment.annotations.BuildProducer; @@ -27,8 +28,10 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.IndexDependencyBuildItem; +import io.quarkus.deployment.builditem.NativeImageEnableAllCharsetsBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; import org.jboss.logging.Logger; @@ -51,12 +54,23 @@ class Jt400Processor { return items; } + @BuildStep + NativeImageEnableAllCharsetsBuildItem charset() { + return new NativeImageEnableAllCharsetsBuildItem(); + } + + @BuildStep + RuntimeReinitializedClassBuildItem runtimeReiinitializedClass() { + return new RuntimeReinitializedClassBuildItem(AS400.class.getName()); + } + @BuildStep void reflectiveClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClassesProducer, CombinedIndexBuildItem combinedIndex) { IndexView index = combinedIndex.getIndex(); reflectiveClassesProducer.produce(ReflectiveClassBuildItem.builder(NLSImplNative.class).build()); + reflectiveClassesProducer.produce(ReflectiveClassBuildItem.builder("com.ibm.as400.access.SocketContainerInet").build()); Pattern pattern = Pattern.compile("com.ibm.as400.access.*Remote"); index.getKnownClasses().stream() diff --git a/integration-tests/jt400/README.adoc b/integration-tests/jt400/README.adoc index b515bd9699..ec6ae17525 100644 --- a/integration-tests/jt400/README.adoc +++ b/integration-tests/jt400/README.adoc @@ -25,7 +25,7 @@ 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`. +Execution of mocked tests can be skipped by setting property `skip-mock-tests` to true (by adding parameter `-Dskip-mock-tests=true`). === How to configure an external server diff --git a/integration-tests/jt400/src/main/resources/application.properties b/integration-tests/jt400/src/main/resources/application.properties index b038ba2ea6..bc0097b6f6 100644 --- a/integration-tests/jt400/src/main/resources/application.properties +++ b/integration-tests/jt400/src/main/resources/application.properties @@ -14,7 +14,11 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- -quarkus.test.flat-class-path = ${quarkus.test.flat-class-path} +#quarkus.test.flat-class-path = ${quarkus.test.flat-class-path} + +# workaround for mocked tests, should be solvable by excluding mocked java files from compilation of skip-mock-tests profile +# I can not make it work though, but to not block the native support by this, I'm setting flat path to true for all tests +quarkus.test.flat-class-path = true #jt400 server connection information cq.jt400.url=${JT400_URL:system} diff --git a/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400IT.java b/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400IT.java new file mode 100644 index 0000000000..4e14a5a9f3 --- /dev/null +++ b/integration-tests/jt400/src/test/java/org/apache/camel/quarkus/component/jt400/it/Jt400IT.java @@ -0,0 +1,26 @@ +/* + * 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.QuarkusIntegrationTest; +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; + +@QuarkusIntegrationTest +@EnabledIfEnvironmentVariable(named = "JT400_URL", matches = ".+") +class Jt400IT extends Jt400Test { + +}