diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/MavenDaemon.java b/common/src/main/java/org/mvndaemon/mvnd/common/MavenDaemon.java index b5e9df2bb..63ca04ea0 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/MavenDaemon.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/MavenDaemon.java @@ -69,6 +69,15 @@ protected Class findClass(String name) throws ClassNotFoundException { return MavenDaemon.class.getClassLoader().loadClass(name); } } + + @Override + public URL getResource(String name) { + URL url = super.getResource(name); + if (url == null) { + url = MavenDaemon.class.getClassLoader().getResource(name); + } + return url; + } }; Thread.currentThread().setContextClassLoader(loader); Class clazz = loader.loadClass("org.mvndaemon.mvnd.daemon.Server"); diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/TypeDescriptionTest.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/TypeDescriptionTest.java new file mode 100644 index 000000000..8d1f0f25b --- /dev/null +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/TypeDescriptionTest.java @@ -0,0 +1,40 @@ +/* + * 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.it; + +import java.io.IOException; +import javax.inject.Inject; +import org.junit.jupiter.api.Test; +import org.mvndaemon.mvnd.assertj.TestClientOutput; +import org.mvndaemon.mvnd.client.Client; +import org.mvndaemon.mvnd.client.DaemonParameters; +import org.mvndaemon.mvnd.junit.MvndTest; + +@MvndTest(projectDir = "src/test/projects/type-description") +public class TypeDescriptionTest { + + @Inject + Client client; + + @Inject + DaemonParameters parameters; + + @Test + void cleanInstall() throws IOException, InterruptedException { + final TestClientOutput output = new TestClientOutput(); + client.execute(output, "clean", "install", "-e").assertSuccess(); + } +} diff --git a/integration-tests/src/test/projects/type-description/.mvn/maven.config b/integration-tests/src/test/projects/type-description/.mvn/maven.config new file mode 100644 index 000000000..4230c2417 --- /dev/null +++ b/integration-tests/src/test/projects/type-description/.mvn/maven.config @@ -0,0 +1,3 @@ +-Dmaven.wagon.httpconnectionManager.ttlSeconds=120 +-Dmaven.wagon.http.retryHandler.requestSentEnabled=true +-Dmaven.wagon.http.retryHandler.count=10 diff --git a/integration-tests/src/test/projects/type-description/pom.xml b/integration-tests/src/test/projects/type-description/pom.xml new file mode 100644 index 000000000..70c1990e4 --- /dev/null +++ b/integration-tests/src/test/projects/type-description/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 + + + 1.10.2.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/integration-tests/src/test/projects/type-description/server/pom.xml b/integration-tests/src/test/projects/type-description/server/pom.xml new file mode 100644 index 000000000..7fa2ece32 --- /dev/null +++ b/integration-tests/src/test/projects/type-description/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/integration-tests/src/test/projects/type-description/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/Main.java b/integration-tests/src/test/projects/type-description/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/Main.java new file mode 100644 index 000000000..77cc737eb --- /dev/null +++ b/integration-tests/src/test/projects/type-description/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/integration-tests/src/test/projects/type-description/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/AbstractEntity.java b/integration-tests/src/test/projects/type-description/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/AbstractEntity.java new file mode 100644 index 000000000..e9bacdf4c --- /dev/null +++ b/integration-tests/src/test/projects/type-description/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/integration-tests/src/test/projects/type-description/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/Image.java b/integration-tests/src/test/projects/type-description/server/src/main/java/org/mvndaemon/mvnd/test/type/description/server/domain/Image.java new file mode 100644 index 000000000..a05464dc3 --- /dev/null +++ b/integration-tests/src/test/projects/type-description/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/integration-tests/src/test/projects/type-description/server/src/main/resources/application.properties b/integration-tests/src/test/projects/type-description/server/src/main/resources/application.properties new file mode 100644 index 000000000..d713804f2 --- /dev/null +++ b/integration-tests/src/test/projects/type-description/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/integration-tests/src/test/projects/type-description/server/src/main/resources/log4j.properties b/integration-tests/src/test/projects/type-description/server/src/main/resources/log4j.properties new file mode 100644 index 000000000..65aa140fd --- /dev/null +++ b/integration-tests/src/test/projects/type-description/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