Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jt400 com.ibm.as400.access.AS400 should be registered for runtime reinit #5913

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
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;
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;
Expand All @@ -51,12 +54,23 @@ List<RuntimeInitializedClassBuildItem> runtimeInitializedClasses() {
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()
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/jt400/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

}
Loading