From c81c4da66e3d6227c593b39a671cda4d6f31cb9b Mon Sep 17 00:00:00 2001 From: Falko Modler Date: Sun, 5 Jul 2020 19:35:31 +0200 Subject: [PATCH] DevMojoIT test for #10484 --- .../java/io/quarkus/maven/it/DevMojoIT.java | 6 + .../multimodule-parent-dep/level0/pom.xml | 13 ++ .../java/org/acme/level0/Level0Service.java | 16 ++ .../src/main/resources/META-INF/beans.xml | 0 .../multimodule-parent-dep/level1/pom.xml | 20 +++ .../java/org/acme/level1/Level1Service.java | 17 ++ .../src/main/resources/META-INF/beans.xml | 0 .../multimodule-parent-dep/level2/pom.xml | 24 +++ .../level2/submodule/pom.xml | 12 ++ .../acme/level2/submodule/Level2Service.java | 17 ++ .../src/main/resources/META-INF/beans.xml | 0 .../projects/multimodule-parent-dep/pom.xml | 74 +++++++++ .../multimodule-parent-dep/runner/pom.xml | 44 +++++ .../java/org/acme/rest/HelloResource.java | 36 ++++ .../resources/META-INF/resources/index.html | 155 ++++++++++++++++++ .../src/main/resources/application.properties | 1 + 16 files changed, 435 insertions(+) create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/pom.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/src/main/java/org/acme/level0/Level0Service.java create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/src/main/resources/META-INF/beans.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/pom.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/src/main/java/org/acme/level1/Level1Service.java create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/src/main/resources/META-INF/beans.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/pom.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/pom.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/src/main/java/org/acme/level2/submodule/Level2Service.java create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/src/main/resources/META-INF/beans.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/pom.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/pom.xml create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/java/org/acme/rest/HelloResource.java create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/META-INF/resources/index.html create mode 100644 integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/application.properties diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java index 2e1d572189dbe..592cb4838954c 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java @@ -817,4 +817,10 @@ public void testResourcesFromClasspath() throws MavenInvocationException, IOExce // test that we don't get multiple instances of a resource when loading from the ClassLoader assertThat(DevModeTestUtils.getHttpResponse("/cp/resourcesCount")).isEqualTo("1"); } + + @Test + public void testThatDependencyInParentIsEvaluated() throws IOException, MavenInvocationException { + testDir = initProject("projects/multimodule-parent-dep"); + runAndCheck(); + } } diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/pom.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/pom.xml new file mode 100644 index 0000000000000..087c83f6ab536 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + + + org.acme + quarkus-quickstart-multimodule-parent + 1.0-SNAPSHOT + + + quarkus-quickstart-multimodule-level0 + + diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/src/main/java/org/acme/level0/Level0Service.java b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/src/main/java/org/acme/level0/Level0Service.java new file mode 100644 index 0000000000000..d0d41586a1cb8 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/src/main/java/org/acme/level0/Level0Service.java @@ -0,0 +1,16 @@ +package org.acme.level0; + +import javax.enterprise.context.ApplicationScoped; + +import org.eclipse.microprofile.config.inject.ConfigProperty; + +@ApplicationScoped +public class Level0Service { + + @ConfigProperty(name = "greeting") + String greeting; + + public String getGreeting() { + return greeting; + } +} diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/src/main/resources/META-INF/beans.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level0/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/pom.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/pom.xml new file mode 100644 index 0000000000000..5e6fe8fcaec72 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + + org.acme + quarkus-quickstart-multimodule-parent + 1.0-SNAPSHOT + ../ + + quarkus-quickstart-multimodule-level1 + + + + org.acme + quarkus-quickstart-multimodule-level0 + 1.0-SNAPSHOT + + + diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/src/main/java/org/acme/level1/Level1Service.java b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/src/main/java/org/acme/level1/Level1Service.java new file mode 100644 index 0000000000000..d29dd4fef07b2 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/src/main/java/org/acme/level1/Level1Service.java @@ -0,0 +1,17 @@ +package org.acme.level1; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; + +import org.acme.level0.Level0Service; + +@ApplicationScoped +public class Level1Service { + + @Inject + Level0Service level0Service; + + public String getGreetingFromLevel0() { + return level0Service.getGreeting(); + } +} diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/src/main/resources/META-INF/beans.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level1/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/pom.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/pom.xml new file mode 100644 index 0000000000000..b421c751ac8cf --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + + org.acme + quarkus-quickstart-multimodule-parent + 1.0-SNAPSHOT + ../ + + quarkus-quickstart-multimodule-level2 + pom + + submodule + + + + + org.acme + quarkus-quickstart-multimodule-level1 + 1.0-SNAPSHOT + + + diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/pom.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/pom.xml new file mode 100644 index 0000000000000..200cb27aa81ba --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/pom.xml @@ -0,0 +1,12 @@ + + + 4.0.0 + + + org.acme + quarkus-quickstart-multimodule-level2 + 1.0-SNAPSHOT + ../ + + quarkus-quickstart-multimodule-level2-submodule + diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/src/main/java/org/acme/level2/submodule/Level2Service.java b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/src/main/java/org/acme/level2/submodule/Level2Service.java new file mode 100644 index 0000000000000..8ee37c0979597 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/src/main/java/org/acme/level2/submodule/Level2Service.java @@ -0,0 +1,17 @@ +package org.acme.level2.submodule; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; + +import org.acme.level1.Level1Service; + +@ApplicationScoped +public class Level2Service { + + @Inject + Level1Service level1Service; + + public String getGreetingFromLevel1() { + return level1Service.getGreetingFromLevel0(); + } +} diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/src/main/resources/META-INF/beans.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/level2/submodule/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/pom.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/pom.xml new file mode 100644 index 0000000000000..3e7335c94ef07 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + org.acme + quarkus-quickstart-multimodule-parent + 1.0-SNAPSHOT + pom + + + io.quarkus + quarkus-bom + @project.version@ + @project.version@ + 3.0.0-M5 + UTF-8 + 1.8 + 1.8 + + + level0 + level1 + level2 + runner + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + jakarta.enterprise + jakarta.enterprise.cdi-api + provided + + + org.eclipse.microprofile.config + microprofile-config-api + provided + + + + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus-plugin.version} + + + + + + diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/pom.xml b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/pom.xml new file mode 100644 index 0000000000000..d809377cdd56c --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + org.acme + quarkus-quickstart-multimodule-parent + 1.0-SNAPSHOT + ../ + + quarkus-quickstart-multimodule-runner + + + + org.acme + quarkus-quickstart-multimodule-level0 + 1.0-SNAPSHOT + + + org.acme + quarkus-quickstart-multimodule-level2-submodule + 1.0-SNAPSHOT + + + io.quarkus + quarkus-resteasy + + + + + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + + diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/java/org/acme/rest/HelloResource.java b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/java/org/acme/rest/HelloResource.java new file mode 100644 index 0000000000000..3384e94e8ed13 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/java/org/acme/rest/HelloResource.java @@ -0,0 +1,36 @@ +package org.acme.rest; + +import org.acme.level0.Level0Service; +import org.acme.level2.submodule.Level2Service; +import org.eclipse.microprofile.config.inject.ConfigProperty; + +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/app") +public class HelloResource { + + @Inject + Level0Service level0Service; + + @Inject + Level2Service level2Service; + + // for manual test + @GET + @Path("/hello-0") + @Produces(MediaType.TEXT_PLAIN) + public String getGreetingFromLevel0() { + return level0Service.getGreeting(); + } + + @GET + @Path("/hello") + @Produces(MediaType.TEXT_PLAIN) + public String getGreetingFromLevel2() { + return level2Service.getGreetingFromLevel1(); + } +} diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/META-INF/resources/index.html b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/META-INF/resources/index.html new file mode 100644 index 0000000000000..b5da1d7d71f02 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/META-INF/resources/index.html @@ -0,0 +1,155 @@ + + + + + getting-started - 1.0-SNAPSHOT + + + + + + +
+
+

Congratulations, you have created a new Quarkus application.

+ +

Why do you see this?

+ +

This page is served by Quarkus. The source is in + src/main/resources/META-INF/resources/index.html.

+ +

What can I do from here?

+ +

If not already done, run the application in dev mode using: mvn compile quarkus:dev. +

+
    +
  • Add REST resources, Servlets, functions and other services in src/main/java.
  • +
  • Your static assets are located in src/main/resources/META-INF/resources.
  • +
  • Configure your application in src/main/resources/META-INF/microprofile-config.properties. +
  • +
+ +

Do you like Quarkus?

+

Go give it a star on GitHub.

+ +

How do I get rid of this page?

+

Just delete the src/main/resources/META-INF/resources/index.html file.

+
+
+
+

Application

+
    +
  • GroupId: org.acme
  • +
  • ArtifactId: getting-started
  • +
  • Version: 1.0-SNAPSHOT
  • +
  • Quarkus Version: 0.11.0
  • +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/application.properties b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/application.properties new file mode 100644 index 0000000000000..6926cb19f372a --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/multimodule-parent-dep/runner/src/main/resources/application.properties @@ -0,0 +1 @@ +greeting=bonjour \ No newline at end of file