diff --git a/applications/mp/pom.xml b/applications/mp/pom.xml index 215327acced..309ce06da94 100644 --- a/applications/mp/pom.xml +++ b/applications/mp/pom.xml @@ -81,7 +81,7 @@ build-native-image - compile + compile-no-fork diff --git a/applications/se/pom.xml b/applications/se/pom.xml index f99de637622..5c550a6a5b0 100644 --- a/applications/se/pom.xml +++ b/applications/se/pom.xml @@ -70,7 +70,7 @@ build-native-image - compile + compile-no-fork diff --git a/integrations/cdi/hibernate-cdi/src/main/resources/META-INF/native-image/io.helidon.integrations.cdi/helidon-integrations-cdi-hibernate/reflect-config.json b/integrations/cdi/hibernate-cdi/src/main/resources/META-INF/native-image/io.helidon.integrations.cdi/helidon-integrations-cdi-hibernate/reflect-config.json index 43d0fdf81ba..826742f0e0e 100644 --- a/integrations/cdi/hibernate-cdi/src/main/resources/META-INF/native-image/io.helidon.integrations.cdi/helidon-integrations-cdi-hibernate/reflect-config.json +++ b/integrations/cdi/hibernate-cdi/src/main/resources/META-INF/native-image/io.helidon.integrations.cdi/helidon-integrations-cdi-hibernate/reflect-config.json @@ -59,6 +59,14 @@ } ] }, + { + "name": "org.hibernate.boot.model.relational.ColumnOrderingStrategyStandard", + "methods": [ + { + "name" : "" + } + ] + }, { "name": "org.hibernate.cache.internal.DisabledCaching", "allPublicMethods": true @@ -351,5 +359,417 @@ ] } ] + }, + { + "name": "org.hibernate.dialect.CockroachDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.DB2400Dialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.DB2Dialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.DB2iDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.DB2zDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.DerbyDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.H2Dialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.HANAColumnStoreDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.HANARowStoreDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.HSQLDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.MariaDBDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.MySQLDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.OracleDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.PostgresPlusDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.PostgreSQLDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.SpannerDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.SQLServerDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.SybaseASEDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.SybaseDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.TiDBDialect", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo" + ] + } + ] + }, + { + "name": "org.hibernate.dialect.CockroachDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.DB2400Dialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.DB2Dialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.DB2iDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.DB2zDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.DerbyDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.H2Dialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.HANAColumnStoreDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.HANARowStoreDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.HSQLDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.MariaDBDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.MySQLDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.OracleDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.PostgresPlusDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.PostgreSQLDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.SpannerDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.SQLServerDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.SybaseASEDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.SybaseDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.TiDBDialect", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.OracleArrayJdbcTypeConstructor", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.OracleNestedTableJdbcTypeConstructor", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "org.hibernate.dialect.OracleStructJdbcType", + "methods": [ + { + "name": "" + } + ] + }, + { + "name": "com.arjuna.ats.internal.arjuna.utils.SocketProcessId", + "methods": [ + { + "name": "" + } + ] } -] \ No newline at end of file +] diff --git a/tests/integration/native-image/mp-2/README.md b/tests/integration/native-image/mp-2/README.md index cae0e88fb07..2ca98b112ad 100644 --- a/tests/integration/native-image/mp-2/README.md +++ b/tests/integration/native-image/mp-2/README.md @@ -1,39 +1,25 @@ -#GraalVM native image integration test MP-2 +# GraalVM native image integration test MP-2 _____ -This is a manual (for the time being) test of integration with native-image. +## Build -To run this test: - -```shell script -export GRAALVM_HOME=${path.to.graal.with.native-image} +```shell mvn clean package -Pnative-image -./target/helidon-tests-native-image-mp-2 ``` -Requires at least GraalVM 23.1.0 - -This test validates that JPA integration (using Hibernate) and JTA -integration work in native image. - -This test requires a running oracle database on `jdbc:oracle:thin:@localhost:1521/XE` - username `system`, password `oracle` (or modify `microprofile-config.properties` to match your DB) -with the following table and data: +## Run -```sql -CREATE TABLE GREETING (FIRSTPART VARCHAR2(100), SECONDPART VARCHAR2(100), PRIMARY KEY (FIRSTPART)) -INSERT INTO GREETING (FIRSTPART, SECONDPART) VALUES ('Jack', 'The Ripper') +Start the database: +```shell +docker run -it --rm \ + -name oracledb \ + -e ORACLE_PWD=oracle \ + -v $PWD/init.sql:/opt/oracle/scripts/startup/init.sql \ + -p 1521:1521 \ + container-registry.oracle.com/database/express:latest ``` -Once the test is done against Oracle DB database, switch to h2: - -Make sure the table exists and contains expected data: -```sql -CREATE TABLE GREETING (FIRSTPART VARCHAR NOT NULL, SECONDPART VARCHAR NOT NULL, PRIMARY KEY (FIRSTPART)) -INSERT INTO GREETING (FIRSTPART, SECONDPART) VALUES ('Jack', 'The Ripper') +Run the application: +```shell +./target/helidon-tests-native-image-mp-2 ``` - - -1. Comment out `ojdbc` and uncomment `h2` in `pom.xml` -2. Comment out `org.hibernate.dialect.Oracle10gDialect"` and uncomment `org.hibernate.dialect.H2Dialect` in `persistence.xml` -3. Comment out all oracle driver properties and uncomment all h2 driver properties in `microprofile-config.properties` diff --git a/tests/integration/native-image/mp-2/init.sql b/tests/integration/native-image/mp-2/init.sql new file mode 100644 index 00000000000..63855a70fad --- /dev/null +++ b/tests/integration/native-image/mp-2/init.sql @@ -0,0 +1,2 @@ +CREATE TABLE SYSTEM.GREETING (FIRSTPART VARCHAR2(100), SECONDPART VARCHAR2(100), PRIMARY KEY (FIRSTPART)); +INSERT INTO SYSTEM.GREETING (FIRSTPART, SECONDPART) VALUES ('Jack', 'The Ripper'); diff --git a/tests/integration/native-image/mp-2/pom.xml b/tests/integration/native-image/mp-2/pom.xml index eccfe5b2689..6ad69a95eab 100644 --- a/tests/integration/native-image/mp-2/pom.xml +++ b/tests/integration/native-image/mp-2/pom.xml @@ -96,16 +96,19 @@ helidon-integrations-cdi-jpa runtime - - - - - io.helidon.integrations.db ojdbc runtime + + io.helidon.logging + helidon-logging-jul + + + org.slf4j + slf4j-jdk14 + org.junit.jupiter diff --git a/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java b/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java index e4f2df6ed91..f7a4f1fab32 100644 --- a/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java +++ b/tests/integration/native-image/mp-2/src/main/java/io/helidon/tests/integration/nativeimage/mp2/Mp2Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package io.helidon.tests.integration.nativeimage.mp2; import io.helidon.common.Errors; -import io.helidon.microprofile.cdi.Main; +import io.helidon.microprofile.server.Server; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientBuilder; @@ -41,27 +41,39 @@ private Mp2Main() { * @param args command line arguments. */ public static void main(final String[] args) { - // start CDI - Main.main(args); + Server server = Server.create().start(); + boolean failed = false; long now = System.currentTimeMillis(); - test(); + try { + test(server.port()); + } catch (Exception e) { + e.printStackTrace(System.out); + failed = true; + } long time = System.currentTimeMillis() - now; System.out.println("Tests finished in " + time + " millis"); - } - private static void test() { - Client client = ClientBuilder.newClient(); - WebTarget target = client.target("http://localhost:8087"); + server.stop(); + + if (failed) { + System.exit(-1); + } + } - Errors.Collector collector = Errors.collector(); + private static void test(int port) { + WebTarget target; + try (Client client = ClientBuilder.newClient()) { + target = client.target("http://localhost:" + port); + Errors.Collector collector = Errors.collector(); - // testing all modules - validateJaxrs(collector, target); - validateDb(collector, target); + // testing all modules + validateJaxrs(collector, target); + validateDb(collector, target); - collector.collect() - .checkValid(); + collector.collect() + .checkValid(); + } } private static void validateJaxrs(Errors.Collector collector, WebTarget target) { diff --git a/tests/integration/native-image/mp-2/src/main/resources/hibernate.properties b/tests/integration/native-image/mp-2/src/main/resources/hibernate.properties deleted file mode 100644 index 5d0d4b0e120..00000000000 --- a/tests/integration/native-image/mp-2/src/main/resources/hibernate.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2020 Oracle and/or its affiliates. -# -# Licensed 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. -# - -# Byte code for JPA must be generated at compile time. -# This is a limitation of native image -hibernate.bytecode.provider=none -