Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumps to quarkus 2.14.0 #200

Merged
merged 9 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions quarkus-workshop-super-heroes/docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<github.raw>https://raw.githubusercontent.com/quarkusio/quarkus-workshops/main/quarkus-workshop-super-heroes</github.raw>
<github.url>https://github.com/quarkusio/quarkus-workshops/tree/main/quarkus-workshop-super-heroes</github.url>
<github.issue>https://github.com/quarkusio/quarkus-workshops/issues</github.issue>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -87,7 +87,7 @@
<jdk-version>${maven.compiler.source}</jdk-version>
<graalvm-version>22.0</graalvm-version>
<maven-version>3.8.x</maven-version>
<quarkus-version>2.9.2.Final</quarkus-version>
<quarkus-version>2.14.0.Final</quarkus-version>
</attributes>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ You can use Homebrew to install OpenJDK {jdk-version} using the following comman

[source,shell]
----
brew install java11
brew install java17
----

For Linux distributions, there are also packaged java installations.
[source,shell]
----
# dnf (rpm-based)
dnf install java-11-openjdk
dnf install java-17-openjdk
# Debian-based distributions:
$ apt-get install openjdk-11-jdk
$ apt-get install openjdk-17-jdk
----

== Checking for Java Installation
Expand All @@ -35,10 +35,10 @@ Check that your system recognizes Java by entering `java -version` and the Java
[source,shell]
----
$ java -version
openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10)
OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10, mixed mode)
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)

$ javac -version
javac 11.0.15
javac 17.0.5
----
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

= Rancher Desktop

.NOTE
----
[NOTE]
====
You only need Rancher Desktop if you didn't install Docker or if you want to deploy the applications to a local
Kubernetes instance. You can also use https://minikube.sigs.k8s.io/docs/start/[minikube] for the latter.
----
====

Rancher Desktop runs Kubernetes and container management on your desktop.
You can choose the version of Kubernetes you want to run.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ To build the completed workshop, you need to run the following commands from the

[source, shell]
----
> mvn clean install -f super-heroes/extension-version
> mvn clean install -Pcomplete
$ mvn clean install -f super-heroes/extension-version
$ mvn clean install -Pcomplete
----

== Ready?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ super-heroes
+++++++ workshop
++++++++ superheroes
+++++++++ villain
++++++++++ VillainResourceIT.java
++++++++++ VillainResourceTest.java
++++++++++ NativeVillainResourceIT.java
++ .dockerignore
++ .gitignore
++ mvnw
Expand Down Expand Up @@ -110,15 +110,14 @@ In addition, you can see the `quarkus-maven-plugin` responsible for the packagin
<!-- ... -->
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>{quarkus-version}</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<quarkus.platform.version>2.14.0.Final</quarkus.platform.version>
<skipITs>true</skipITs>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
</properties>
<!-- ... -->
<dependencyManagement>
Expand Down Expand Up @@ -205,12 +204,12 @@ public class VillainResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello RESTEasy Reactive";
return "Hello from RESTEasy Reactive";
}
}
----

It's a very simple REST endpoint returning "Hello RESTEasy Reactive" to requests on `/api/villains`.
It's a very simple REST endpoint returning a "Hello World" to requests on `/api/villains`.
It uses JAX-RS annotations:

- `@Path` indicates the HTTP path handled by the resource,
Expand All @@ -235,28 +234,31 @@ $ ./mvnw quarkus:dev
[INFO] Building rest-villains 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:{quarkus-version}:dev (default-cli) @ rest-villains ---
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:{quarkus-version}:generate-code @ rest-villains
[INFO] --- quarkus-maven-plugin:2.14.0.Final:dev (default-cli) @ rest-villains ---
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:resources @ rest-villains
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.14.0.Final:generate-code @ rest-villains
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile @ rest-villains
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/clement/Downloads/rest-villains/target/classes
[INFO] Nothing to compile - all classes are up to date
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:testResources @ rest-villains
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/clement/Downloads/rest-villains/src/test/resources
[INFO] skip non existing resourceDirectory /Users/agoncal/Documents/Code/Temp/quarkus-super-heroes/super-heroes/rest-villains/src/test/resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.14.0.Final:generate-code-tests @ rest-villains
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile @ rest-villains
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/clement/Downloads/rest-villains/target/test-classes
[INFO] Nothing to compile - all classes are up to date
Listening for transport dt_socket at address: 5005
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2021-09-21 13:29:16,328 INFO [io.quarkus] (Quarkus Main Thread) rest-villains 1.0.0-SNAPSHOT on JVM (powered by Quarkus {quarkus-version}) started in 1.553s. Listening on: http://localhost:8080
2021-09-21 13:29:16,332 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-09-21 13:29:16,333 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation]
2022-11-15 14:05:29,414 INFO [io.quarkus] (Quarkus Main Thread) rest-villains 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.14.0.Final) started in 1.093s. Listening on: http://localhost:8080

2022-11-15 14:05:29,423 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-11-15 14:05:29,423 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, vertx]

Tests paused
Press [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>
----

Then check that the endpoint returns `hello` as expected:
Expand All @@ -265,7 +267,7 @@ Then check that the endpoint returns `hello` as expected:
----
curl http://localhost:8080/api/villains

Hello RESTEasy Reactive
Hello from RESTEasy Reactive
----

Alternatively, you can open http://localhost:8080/api/villains in your browser.
Expand Down Expand Up @@ -343,7 +345,7 @@ If you look at the `maven-surefire-plugin` configuration in the `pom.xml`, you w

The generated project contains a simple test in `VillainResourceTest.java`.

[source]
[source,java]
----
package io.quarkus.workshop.superheroes.villain;

Expand All @@ -362,7 +364,7 @@ public class VillainResourceTest {
.when().get("/api/villains")
.then()
.statusCode(200)
.body(is("Hello RESTEasy Reactive"));
.body(is("Hello from RESTEasy Reactive"));
}

}
Expand All @@ -387,39 +389,51 @@ In the terminal running the application in _dev mode_, you should see at the bot
----
--
Tests paused
Press [r] to resume testing, [o] Toggle test output, [h] for more options>
Press [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>
----

Hit the `r` key, and watch Quarkus execute your tests automatically and even continuously.
Unfortunately, this first run didn't end well:

[source,text]
----
Running 1/1. Running: io.quarkus.workshop.superheroes.villain.VillainResourceTest#testHelloEndpoint()
Press [o] Toggle test output, [h] for more options>WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v9.Java9 (file:/Users/clement/.m2/repository/org/codehaus/groovy/groovy/3.0.8/groovy-3.0.8.jar) to constructor java.lang.AssertionError(java.lang.String)
2021-09-21 13:39:19,710 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #1 ====================
2021-09-21 13:39:19,711 ERROR [io.qua.test] (Test runner thread) Test VillainResourceTest#testHelloEndpoint() failed
2022-11-15 14:13:17,924 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #1 ====================
2022-11-15 14:13:17,925 ERROR [io.qua.test] (Test runner thread) Test VillainResourceTest#testHelloEndpoint() failed
: java.lang.AssertionError: 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello RESTEasy Reactive"
Expected: is "Hello from RESTEasy Reactive"
Actual: Hello Villain Resource

at io.restassured.internal.ValidatableResponseImpl.body(ValidatableResponseImpl.groovy)
at io.quarkus.workshop.superheroes.villain.VillainResourceTest.testHelloEndpoint(VillainResourceTest.java:18)
at io.restassured.internal.ValidatableResponseImpl.body(ValidatableResponseImpl.groovy)
at io.quarkus.workshop.superheroes.villain.VillainResourceTest.testHelloEndpoint(VillainResourceTest.java:18)


2022-11-15 14:13:17,927 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> Summary: <<<<<<<<<<<<<<<<<<<<
io.quarkus.workshop.superheroes.villain.VillainResourceTest#testHelloEndpoint(VillainResourceTest.java:18) VillainResourceTest#testHelloEndpoint() 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello from RESTEasy Reactive"
Actual: Hello Villain Resource

2021-09-21 13:39:19,714 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<
2021-09-21 13:39:20,030 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #2 ====================
2021-09-21 13:39:20,030 ERROR [io.qua.test] (Test runner thread) Test VillainResourceTest#testHelloEndpoint() failed
2022-11-15 14:13:17,929 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<

2022-11-15 14:13:18,155 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #2 ====================
2022-11-15 14:13:18,155 ERROR [io.qua.test] (Test runner thread) Test VillainResourceTest#testHelloEndpoint() failed
: java.lang.AssertionError: 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello RESTEasy Reactive"
Expected: is "Hello from RESTEasy Reactive"
Actual: Hello Villain Resource

at io.restassured.internal.ValidatableResponseImpl.body(ValidatableResponseImpl.groovy)
at io.quarkus.workshop.superheroes.villain.VillainResourceTest.testHelloEndpoint(VillainResourceTest.java:18)
at io.restassured.internal.ValidatableResponseImpl.body(ValidatableResponseImpl.groovy)
at io.quarkus.workshop.superheroes.villain.VillainResourceTest.testHelloEndpoint(VillainResourceTest.java:18)


2021-09-21 13:39:20,031 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<
2022-11-15 14:13:18,156 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> Summary: <<<<<<<<<<<<<<<<<<<<
io.quarkus.workshop.superheroes.villain.VillainResourceTest#testHelloEndpoint(VillainResourceTest.java:18) VillainResourceTest#testHelloEndpoint() 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello from RESTEasy Reactive"
Actual: Hello Villain Resource

2022-11-15 14:13:18,157 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<
----

It fails! It's expected, you changed the output of `VillainResource.hello()` earlier.
Expand Down Expand Up @@ -454,7 +468,11 @@ Save the file, and watch the dev mode automatically rerunning your test:

[source,text]
----
2021-09-21 13:40:32,361 INFO [io.qua.test] (Test runner thread) All tests are now passing
--
2022-11-15 14:15:22,997 INFO [io.qua.test] (Test runner thread) All tests are now passing
--
All 1 test is passing (0 skipped), 1 test was run in 186ms. Tests completed at 14:15:23.
Press [r] to re-run, [o] Toggle test output, [:] for the terminal, [h] for more options>
----

Continuous testing is a big part of Quarkus development.
Expand All @@ -474,7 +492,7 @@ icon:hand-point-right[role="red", size=2x] [red big]#Call to action#
The application is packaged using the `./mvnw package` command (it also runs the tests).
That command generates:

* `target/rest-villains-1.0-SNAPSHOT.jar`: containing just the classes and resources of the projects, it's the regular artifact produced by the Maven build (it is not an executable jar);
* `target/rest-villains-1.0.0-SNAPSHOT.jar`: containing just the classes and resources of the projects, it's the regular artifact produced by the Maven build (it is not an executable jar);
* `target/quarkus-app/` : this directory uses the _fast jar_ packaging. It contains an executable jar (`quarkus-run.jar`), and all the dependencies (structured into `app`, `lib` and `quarkus`).

This _fast jar_ takes advantage of the build-time principle of Quarkus (we discuss it soon) to improve the application performances and which can be easily transposed to container layers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ If it's not, the transaction will be rolled back.

Our project now requires a connection to a PostgreSQL database.
In dev mode, no need to start a database or configure anything.
Quarkus does that for us.
Quarkus does that for us (just make sure you have Docker up and running).

icon:hand-point-right[role="red", size=2x] [red big]#Call to action#

Expand All @@ -326,7 +326,8 @@ In the log, you will see the following:
2021-09-21 15:58:46,217 INFO [🐳 .2]] (build-38) Starting container with ID: a7fd54795185ab17baf487388c1e3280fdfea3f6ef8670c0336d367dba3e1d9e
2021-09-21 15:58:46,545 INFO [🐳 .2]] (build-38) Container postgres:13.2 is starting: a7fd54795185ab17baf487388c1e3280fdfea3f6ef8670c0336d367dba3e1d9e
2021-09-21 15:58:48,043 INFO [🐳 .2]] (build-38) Container postgres:13.2 started in PT1.959377S
2021-09-21 15:58:48,044 INFO [io.qua.dev.pos.dep.PostgresqlDevServicesProcessor] (build-38) Dev Services for PostgreSQL started.
2021-09-21 15:58:48,044 INFO [io.qua.dev.pos.dep.PostgresqlDevServicesProcessor] (build-38) Dev Services for the default datasource (postgresql) started
----

Quarkus detects the need for a database and starts one using a Docker container.
Expand Down Expand Up @@ -568,7 +569,7 @@ public class VillainResourceTest {
private static final int DEFAULT_LEVEL = 42;
private static final int UPDATED_LEVEL = 43;
private static final int NB_VILLAINS = 581;
private static final int NB_VILLAINS = 570;
private static String villainId;
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ To do so, you will find in the `pom.xml` the following profile:
</property>
</activation>
<properties>
<!-- ... -->
<properties>
<skipITs>false</skipITs>
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public class HeroResourceTest {
private static final int DEFAULT_LEVEL = 42;
private static final int UPDATED_LEVEL = 43;
private static final int NB_HEROES = 951;
private static final int NB_HEROES = 941;
private static String heroId;
@Test
Expand Down Expand Up @@ -661,6 +661,7 @@ Remember that you can also check Swagger UI by going to the dev console: http://

icon:hand-point-right[role="red", size=2x] [red big]#Call to action#

Then, build the application using: `./mvnw package`, and run the application using `java -jar target/quarkus-app/quarkus-run.jar`
Then, build the application using: `./mvnw package`, and run the application using `java -jar target/quarkus-app/quarkus-run.jar`.
Open your browser and go to http://localhost:8083/api/heroes.


Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,13 @@ public class FightResourceTest {
}
----

Quarkus automatically starts the PostGreSQL database as well as a Kafka broker.
Also, delete the generated `FightResourceIT` native test class, as we won't run native tests.

== Running, Testing and Packaging the Application

icon:hand-point-right[role="red", size=2x] [red big]#Call to action#

First, make sure the tests pass by executing the command `./mvnw test` (or from your IDE).
First, delete the generated `FightResourceIT` native test class, as we won't run native tests.
Then, make sure the tests pass by executing the command `./mvnw test` (or from your IDE).
Quarkus automatically starts the PostGreSQL database as well as a Kafka broker.

Now that the tests are green, we are ready to run our application.
Use `./mvnw quarkus:dev` to start it (notice that there is no banner yet, it will come later).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ Being an Angular application, you will find a `package.json` file which defines
All the Angular code (graphical components, model, services) is located under `src/app`.
But what's really important is the packaged application under `src/main/resources/META-INF/resources`.

Notice that there is a `pom.xml` file.
This is just a convenient way to install NodeJS and NPM so we can build the Angular application with Maven (optional).
The `pom.xml` also allows us to package the Angular application into Quarkus.

IMPORTANT: This service is exposed on the port 8080.

== Running the Web Application
Expand All @@ -37,9 +33,12 @@ Oups, not working yet!
Not even the pictures, we must have been forgotten something!
Let's move on to the next section then and make the application work.

== Installing the Web Application on Quarkus (optional)
== (optional) Installing the Web Application on Quarkus

If you want to build the Angular application yourself, you can follow these optional steps (otherwise just jump to the next section).
Notice that there is a `pom.xml` file.
This is just a convenient way to install NodeJS and NPM so we can build the Angular application with Maven (optional).
The `pom.xml` also allows us to package the Angular application into Quarkus.
Thanks to the `frontend-maven-plugin` plugin declared on the `pom.xml`, we can use a good old Maven command to install and build this Angular application.

icon:hand-point-right[role="red", size=2x] [red big]#Call to action#
Expand Down
Loading