Skip to content

Commit

Permalink
DevMojoIT test for quarkusio#10484
Browse files Browse the repository at this point in the history
  • Loading branch information
famod authored and aloubyansky committed Jul 8, 2020
1 parent 91b6981 commit c81c4da
Show file tree
Hide file tree
Showing 16 changed files with 435 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>quarkus-quickstart-multimodule-level0</artifactId>

</project>
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>quarkus-quickstart-multimodule-level1</artifactId>

<dependencies>
<dependency>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-level0</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>quarkus-quickstart-multimodule-level2</artifactId>
<packaging>pom</packaging>
<modules>
<module>submodule</module>
</modules>

<dependencies>
<dependency>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-level1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-level2</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>quarkus-quickstart-multimodule-level2-submodule</artifactId>
</project>
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>

<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>@project.version@</quarkus.platform.version>
<quarkus-plugin.version>@project.version@</quarkus-plugin.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<modules>
<module>level0</module>
<module>level1</module>
<module>level2</module>
<module>runner</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>quarkus-quickstart-multimodule-runner</artifactId>

<dependencies>
<dependency>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-level0</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.acme</groupId>
<artifactId>quarkus-quickstart-multimodule-level2-submodule</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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();
}
}
Loading

0 comments on commit c81c4da

Please sign in to comment.