From 01149100e0385dfe515ea323f5ae9ee16bbb7c70 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Wed, 4 May 2022 10:06:41 +0200 Subject: [PATCH] [MNG-7470] Quarkus build A build "borrowed" as is from mvnd build that uses quarkus plugin, a notorius one for using resolver. --- .../apache/maven/it/IntegrationTestSuite.java | 1 + .../maven/it/MavenITmng7470QuarkusTest.java | 43 ++++++ .../test/resources/mng-7470-quarkus/pom.xml | 137 ++++++++++++++++++ .../resources/mng-7470-quarkus/server/pom.xml | 123 ++++++++++++++++ .../test/type/description/server/Main.java | 27 ++++ .../server/domain/AbstractEntity.java | 42 ++++++ .../type/description/server/domain/Image.java | 102 +++++++++++++ .../src/main/resources/application.properties | 24 +++ .../src/main/resources/log4j.properties | 21 +++ 9 files changed, 520 insertions(+) create mode 100644 core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470QuarkusTest.java create mode 100644 core-it-suite/src/test/resources/mng-7470-quarkus/pom.xml create mode 100644 core-it-suite/src/test/resources/mng-7470-quarkus/server/pom.xml create mode 100644 core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/Main.java create mode 100644 core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/AbstractEntity.java create mode 100644 core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/Image.java create mode 100644 core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/application.properties create mode 100644 core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/log4j.properties diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 48b58dec6..0ff8a3fad 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -106,6 +106,7 @@ public static Test suite() // Tests that don't run stable and need to be fixed // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng7470QuarkusTest.class ); suite.addTestSuite( MavenITmng7404IgnorePrefixlessExpressionsTest.class ); suite.addTestSuite( MavenITmng5222MojoDeprecatedTest.class ); suite.addTestSuite( MavenITmng7390SelectModuleOutsideCwdTest.class ); diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470QuarkusTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470QuarkusTest.java new file mode 100644 index 000000000..794365ba4 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7470QuarkusTest.java @@ -0,0 +1,43 @@ +/* + * 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.maven.it; + +import java.io.File; +import java.io.IOException; + +import org.apache.maven.it.util.ResourceExtractor; + +public class MavenITmng7470QuarkusTest extends AbstractMavenIntegrationTestCase +{ + private static final String PROJECT_PATH = "/mng-7470-quarkus"; + + public MavenITmng7470QuarkusTest() + { + super( "[3.8.0,)" ); + } + + public void testBuildUsingQuarkusPlugin() throws IOException, VerificationException + { + final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); + final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + + verifier.executeGoal( "verify" ); + verifier.verifyErrorFreeLog(); + } +} diff --git a/core-it-suite/src/test/resources/mng-7470-quarkus/pom.xml b/core-it-suite/src/test/resources/mng-7470-quarkus/pom.xml new file mode 100644 index 000000000..4db4e744c --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7470-quarkus/pom.xml @@ -0,0 +1,137 @@ + + + + + 4.0.0 + org.mvndaemon.mvnd.test.type-description + type-description + 1.0.0-SNAPSHOT + pom + + + server + + + + UTF-8 + UTF-8 + yyyy-MM-dd HH:mm:ss + ${maven.build.timestamp} + + 1.8 + 1.8 + + latest-release + gnu + + + 2.3.1.Final + + + 1.0.8 + + + 3.8.1 + 2.22.2 + 3.1.2 + 3.3.0 + 3.2.0 + + + + + + + + + io.quarkus + quarkus-bom + ${quarkus.version} + pom + import + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${version.compiler.plugin} + + + org.apache.maven.plugins + maven-surefire-plugin + ${version.surefire.plugin} + + + org.jboss.jandex + jandex-maven-plugin + ${jandex.version} + + + make-index + + jandex + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${maven.compiler.target} + ${maven.compiler.target} + false + false + + + + org.apache.maven.plugins + maven-dependency-plugin + ${version.dependency.plugin} + + + org.apache.maven.plugins + maven-assembly-plugin + ${version.assembly.plugin} + + + org.apache.maven.plugins + maven-resources-plugin + ${version.resources.plugin} + + + + + + diff --git a/core-it-suite/src/test/resources/mng-7470-quarkus/server/pom.xml b/core-it-suite/src/test/resources/mng-7470-quarkus/server/pom.xml new file mode 100644 index 000000000..7fa2ece32 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7470-quarkus/server/pom.xml @@ -0,0 +1,123 @@ + + + + + 4.0.0 + + org.mvndaemon.mvnd.test.type-description + type-description + 1.0.0-SNAPSHOT + ../pom.xml + + + mvnd-server + jar + + + + + io.quarkus + quarkus-undertow + + + io.quarkus + quarkus-jackson + + + io.quarkus + quarkus-resteasy-jackson + + + io.quarkus + quarkus-jdbc-h2 + + + io.quarkus + quarkus-agroal + + + io.quarkus + quarkus-hibernate-orm + + + + + + + src/main/resources + false + + + + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.jboss.logmanager.LogManager + + + + + + + + + native + + + native + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + + native-image + + + false + + + + + + + + + + diff --git a/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/Main.java b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/Main.java new file mode 100644 index 000000000..77cc737eb --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/Main.java @@ -0,0 +1,27 @@ +/* + * Copyright 2021 the original author or authors. + * + * 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. + */ +package org.mvndaemon.mvnd.test.type.description.server; + +import io.quarkus.runtime.Quarkus; + +/** + * @author Ales Justin + */ +public class Main { + public static void main(String[] args) { + Quarkus.run(args); + } +} diff --git a/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/AbstractEntity.java b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/AbstractEntity.java new file mode 100644 index 000000000..e9bacdf4c --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/AbstractEntity.java @@ -0,0 +1,42 @@ +/* + * Copyright 2021 the original author or authors. + * + * 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. + */ +package org.mvndaemon.mvnd.test.type.description.server.domain; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.MappedSuperclass; +import java.io.Serializable; + +/** + * @author Ales Justin + */ +@MappedSuperclass +public abstract class AbstractEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } +} \ No newline at end of file diff --git a/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/Image.java b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/Image.java new file mode 100644 index 000000000..a05464dc3 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/Image.java @@ -0,0 +1,102 @@ +/* + * Copyright 2021 the original author or authors. + * + * 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. + */ +package org.mvndaemon.mvnd.test.type.description.server.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Lob; +import javax.persistence.Table; +import javax.persistence.UniqueConstraint; +import javax.sql.rowset.serial.SerialBlob; +import java.io.IOException; +import java.io.InputStream; +import java.sql.Blob; +import java.sql.SQLException; + +/** + * @author Ales Justin + */ +@Entity +@Table( + name = Image.TABLE_NAME, + uniqueConstraints = @UniqueConstraint(name = Image.PK_CONSTRAINT_NAME, columnNames = {"name"}) +) +public class Image extends AbstractEntity { + public static final String TABLE_NAME = "image"; + public static final String PK_CONSTRAINT_NAME = TABLE_NAME + "_pkey"; + + @Column(nullable = false) + private String name; + @Lob + private Blob blob; + private String mimeType; + private long length; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + public long getLength() { + return length; + } + + public void setLength(long length) { + this.length = length; + } + + public Blob getBlob() { + return blob; + } + + public void setBlob(Blob blob) { + this.blob = blob; + } + + public void write(byte[] bytes) throws Exception { + blob = new SerialBlob(bytes); + } + + public byte[] read() throws IOException { + if (blob == null) + return null; + + try { + return blob.getBytes(1, (int) blob.length() + 1); + } catch (SQLException e) { + throw new IOException(e.getMessage(), e); + } + } + + public InputStream stream() throws IOException { + try { + return (blob != null) ? blob.getBinaryStream() : null; + } catch (SQLException e) { + throw new IOException(e.getMessage(), e); + } + } +} diff --git a/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/application.properties b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/application.properties new file mode 100644 index 000000000..d713804f2 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/application.properties @@ -0,0 +1,24 @@ +# +# Copyright 2021 the original author or authors. +# +# 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. +# + +quarkus.datasource.db-kind=h2 +quarkus.datasource.jdbc.url=jdbc:h2:file:/tmp/h2/database.db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +quarkus.datasource.jdbc.driver=org.h2.Driver +quarkus.datasource.username=sa +quarkus.datasource.password=sa +quarkus.datasource.jdbc.max-size=10 +quarkus.hibernate-orm.database.generation=create-drop +quarkus.hibernate-orm.log.sql=true diff --git a/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/log4j.properties b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/log4j.properties new file mode 100644 index 000000000..65aa140fd --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7470-quarkus/server/src/main/resources/log4j.properties @@ -0,0 +1,21 @@ +# +# Copyright 2021 the original author or authors. +# +# 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. +# + +log4j.rootLogger=INFO, consoleAppender + +log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender +log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout +log4j.appender.consoleAppender.layout.ConversionPattern=[%t] %-5p %c %x - %m%n