From bf98bee344a6665460d1686324dfe8696a4050b8 Mon Sep 17 00:00:00 2001 From: Daniel Oh Date: Wed, 23 Oct 2024 12:44:32 -0400 Subject: [PATCH] Update reactive tracks --- .../01-01-define-entity/assignment.md | 28 ++++++++----------- .../03-02-remote-dev/assignment.md | 2 -- .../04-03-add-query-endpoints/assignment.md | 4 --- .../05-04-add-paging-filtering/assignment.md | 8 +----- .../06-05-add-lifecycle-task/assignment.md | 2 -- .../track.yml | 14 ++++++---- .../03-02-remote-dev/assignment.md | 5 ---- .../04-03-add-resource/assignment.md | 8 ------ .../05-04-add-model/assignment.md | 1 - .../track.yml | 14 ++++++---- 10 files changed, 29 insertions(+), 57 deletions(-) diff --git a/instruqt-tracks/developing-with-quarkus-panache-reactive/01-01-define-entity/assignment.md b/instruqt-tracks/developing-with-quarkus-panache-reactive/01-01-define-entity/assignment.md index c0b238ea..55f504d4 100755 --- a/instruqt-tracks/developing-with-quarkus-panache-reactive/01-01-define-entity/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-panache-reactive/01-01-define-entity/assignment.md @@ -173,10 +173,10 @@ package org.acme.person.model; import java.time.LocalDate; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; import io.quarkus.hibernate.reactive.panache.PanacheEntity; import io.smallrye.mutiny.Multi; @@ -212,10 +212,6 @@ public class Person extends PanacheEntity { |----| |In the source code file, `src/main/java/org/acme/person/model/Person.java` you will see a `// TODO` comment at `Line XX`. **Do Not Delete It!** You will need this comment later on.| -`Step 5d:` Click on the `Disk` icon or press `CTRL+S` to save the contents of the Java file as shown in the figure below. - -![Save Person](../assets/save-person-java.png) - # Defining the eye color enum You previously defined the `Person` entity to have the fields `name`, `birth`, and `eyes`. The `eyes` field is an enumeration type that is defined as follows using the Java Persistence API's `@Enumerated` annotation, like so: @@ -276,13 +272,13 @@ import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.IntStream; -import javax.enterprise.event.Observes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; +import jakarta.enterprise.event.Observes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; import org.acme.person.model.DataTable; import org.acme.person.model.EyeColor; @@ -324,7 +320,7 @@ public class PersonResource { * `@Path("/person")` - Indicates the path to the `Person` resource that is appended to the base URL of the RESTful API * `@GET` - Indicates the the API call will use the [HTTP GET method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET). * `getAll` - Is the Java function that will be executed with the request to the `/person` endpoint is received by the server -* [`@Produces(MediaType.APPLICATION_JSON)`](https://docs.oracle.com/javaee/7/api/javax/ws/rs/core/MediaType.html) - Indicates that the response will be returned as JSON. +* [`@Produces(MediaType.APPLICATION_JSON)`](https://docs.oracle.com/javaee/7/api/jakarta/ws/rs/core/MediaType.html) - Indicates that the response will be returned as JSON. * `Uni` - A data type defined in the [Mutiny library]((https://javadoc.io/doc/io.smallrye.reactive/mutiny/latest/io/smallrye/mutiny/package-summary.html)) that represents a lazy asynchronous action. # Adding the sample data diff --git a/instruqt-tracks/developing-with-quarkus-panache-reactive/03-02-remote-dev/assignment.md b/instruqt-tracks/developing-with-quarkus-panache-reactive/03-02-remote-dev/assignment.md index 1c83d7e4..568f5364 100755 --- a/instruqt-tracks/developing-with-quarkus-panache-reactive/03-02-remote-dev/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-panache-reactive/03-02-remote-dev/assignment.md @@ -200,8 +200,6 @@ quarkus.hibernate-orm.database.generation=drop-and-create quarkus.hibernate-orm.sql-load-script=import.sql ``` -`Step 9c:` Click on the `Disk` icon or press `CTRL+S` to save the contents of `EyeColor.java`. - **KEY CONCEPTS TO UNDERSTAND** The statement `quarkus.package.type=mutable-jar` shown above in the file `application.properties` indicates that Quarkus will package the application as a `mutable` application. A mutable application is one that's capable of being changed and updated in-place, on demand and on a regular basis. diff --git a/instruqt-tracks/developing-with-quarkus-panache-reactive/04-03-add-query-endpoints/assignment.md b/instruqt-tracks/developing-with-quarkus-panache-reactive/04-03-add-query-endpoints/assignment.md index 89dc685a..ce2674d2 100755 --- a/instruqt-tracks/developing-with-quarkus-panache-reactive/04-03-add-query-endpoints/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-panache-reactive/04-03-add-query-endpoints/assignment.md @@ -72,8 +72,6 @@ You are now going to add some reactive queries to the `Person` entity. The reaso } ``` -`Step 2c:` Click on the `Disk` icon or press `CTRL+S` to save the contents of `Person.java`. - **UNDERSTANDING REACTIVE QUERIES** The query `findByColor(EyeColor color)` retrieves a list of people based on eye color from the demonstration application's database. The query `getBeforeYear(int year)` gets a list of people that have birthdays on or before a particular birth year. @@ -108,8 +106,6 @@ Now that the custom entity queries have been implemented in the `Person` entity } ``` -`Step 3c:` Click on the `Disk` icon or press `CTRL+S` to save the contents of `PersonResource.java`. - **IMPORTANT CONCEPTS TO UNDERSTAND** The code shown above in `Step 4b` uses `Uni` and `Multi` types. These types are defined in the [Mutiny library](https://javadoc.io/doc/io.smallrye.reactive/mutiny/latest/index.html). They are intended to support data streams in an asynchronous, reactive manner. Once declared, `Uni` and `Multi` do the work of establishing and managing the internal asynchronous pipelines. All the developer needs to be concerned with is the data that's emitted from the pipeline. diff --git a/instruqt-tracks/developing-with-quarkus-panache-reactive/05-04-add-paging-filtering/assignment.md b/instruqt-tracks/developing-with-quarkus-panache-reactive/05-04-add-paging-filtering/assignment.md index 6afb3d1a..70c9c0cb 100755 --- a/instruqt-tracks/developing-with-quarkus-panache-reactive/05-04-add-paging-filtering/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-panache-reactive/05-04-add-paging-filtering/assignment.md @@ -74,10 +74,7 @@ You are going to work with the following parameters to enable search and paging } ``` -`Step 1d:` Click on the `Disk` icon or press `CTRL+S` to save the contents of `PersonResource.java`. - - -The code in the method `Uni datatable((...)` shown above in `Step 1c` uses [JAX-RS `@QueryParam`](https://docs.oracle.com/javaee/7/api/javax/ws/rs/QueryParam.html) values to specify the incoming parameters to be applied to queries executed within the function. These parameters are passed to the server from the front-end call to the endpoint, `GET /person/datatable`. +The code in the method `Uni datatable((...)` shown above in `Step 1c` uses [JAX-RS `@QueryParam`](https://docs.oracle.com/javaee/7/api/jakarta/ws/rs/QueryParam.html) values to specify the incoming parameters to be applied to queries executed within the function. These parameters are passed to the server from the front-end call to the endpoint, `GET /person/datatable`. The method `Uni datatable((...)` code you just added has a number of `TODO` statements that need to be implemented. You'll fill in the `TODO`s in a moment. But, first you need to review the predefined class `DataTable.java`. @@ -122,7 +119,6 @@ This work is done by adding a query to the `PersonResource.java` class. .orElseGet(() -> Person.findAll()) .page(pageNumber, length); ``` -`Step 3d:` Click on the `Disk` icon or press `CTRL+S` to save the contents of `PersonResource.java`. ---- @@ -147,8 +143,6 @@ This work is done by adding a query to the `PersonResource.java` class. })); ``` -`Step 4b:` Click on the `Disk` icon or press `CTRL+S` to save the contents of `PersonResource.java`. - The logic in the code you inserted into the file `PersonResource.java` at `Step 3b` above assigns the results of the search of the database to the object variable `filteredPeople`. Then, the fields in the object variable `filteredPeople` are applied to a `DataTable` object named `result`. `result` does the work of taking the field values and data in `filteredPeople` and converting it to JSON, which is then passed back from the RESTful endpoint `/person/database`. diff --git a/instruqt-tracks/developing-with-quarkus-panache-reactive/06-05-add-lifecycle-task/assignment.md b/instruqt-tracks/developing-with-quarkus-panache-reactive/06-05-add-lifecycle-task/assignment.md index 286ad282..37c53e4a 100755 --- a/instruqt-tracks/developing-with-quarkus-panache-reactive/06-05-add-lifecycle-task/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-panache-reactive/06-05-add-lifecycle-task/assignment.md @@ -61,8 +61,6 @@ Managed beans (like the `PersonResource`) can listen for lifecycle events by usi } ``` -`Step 1d:` Click on the `Disk` icon or press `CTRL+S` to save the contents of `PersonResource.java`. - |NOTE| |----| |Adding 10k entries will make the demonstration application's startup time artificially high, around 5-10 seconds.| diff --git a/instruqt-tracks/developing-with-quarkus-panache-reactive/track.yml b/instruqt-tracks/developing-with-quarkus-panache-reactive/track.yml index 83e0c502..312bd42a 100755 --- a/instruqt-tracks/developing-with-quarkus-panache-reactive/track.yml +++ b/instruqt-tracks/developing-with-quarkus-panache-reactive/track.yml @@ -49,17 +49,19 @@ tags: - openshift owner: openshift developers: -- doh@redhat.com +- cclyburn@redhat.com +- ryanj@redhat.com - bob@cogarttech.com +- doh@redhat.com - nvinto@redhat.com -- ryanj@redhat.com -- cclyburn@redhat.com sandbox_preset: openshift-411 lab_config: overlay: false - width: 25 - position: right + width: 0 + position: "" feedback_recap_enabled: true loadingMessages: true hideStopButton: false -checksum: "8414663982899266740" + default_layout: AssignmentRight + default_layout_sidebar_size: 25 +checksum: "10431202518735233778" diff --git a/instruqt-tracks/developing-with-quarkus-reactive-sql/03-02-remote-dev/assignment.md b/instruqt-tracks/developing-with-quarkus-reactive-sql/03-02-remote-dev/assignment.md index e5b06390..39afc318 100755 --- a/instruqt-tracks/developing-with-quarkus-reactive-sql/03-02-remote-dev/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-reactive-sql/03-02-remote-dev/assignment.md @@ -213,11 +213,6 @@ quarkus.datasource.password=password |----| |You can change the remote live-reload username/password pair defined by `quarkus.datasource.username` and `quarkus.datasource.password` in the `application.properties` file to whatever you want. Those credentials are used to secure communication between the remote side and the local side. -`Step 8e:` Click on the `Disk` icon or press `CTRL+S` to save the file as shown in the figure below: - -![Save properties](../assets/save-properties-01.png) - - **KEY POINTS TO UNDERSTAND** * The `quarkus.package.type=mutable-jar` setting in the `application.properties` file instructs Quarkus to package the application as a `mutable application`. diff --git a/instruqt-tracks/developing-with-quarkus-reactive-sql/04-03-add-resource/assignment.md b/instruqt-tracks/developing-with-quarkus-reactive-sql/04-03-add-resource/assignment.md index ed35b9d4..2ea7426e 100755 --- a/instruqt-tracks/developing-with-quarkus-reactive-sql/04-03-add-resource/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-reactive-sql/04-03-add-resource/assignment.md @@ -46,8 +46,6 @@ First you'll add code that will automatically create a table in the PostgresSQL .indefinitely(); ``` -`Step 1d:` Click on the `Disk` icon or press `CTRL+S` to save the file. - Next, you'll add the RESTful API methods. You'll add a `GET` method that sill return all coffee types. Also, you'll add `GET` method that returns a specific coffee type according to `id`. The `getSingle` method that returns a single coffee type uses the `PathParam` to indicate the the `id` passed from the query string value defined by the `@Path` annotation. @@ -72,8 +70,6 @@ The `getSingle` method that returns a single coffee type uses the `PathParam` to ``` -`Step 2b:` Click on the `Disk` icon or press `CTRL+S` to save the file. - Now add the `POST` and `PUT` request methods. ---- @@ -98,8 +94,6 @@ Now add the `POST` and `PUT` request methods. } ``` -`Step 3b:` Click on the `Disk` icon or press `CTRL+S` to save the file. - Finally add the DELETE method, so that there's an endpoint for deleting a coffee type from the Quarkus demonstration application. ---- @@ -116,8 +110,6 @@ Finally add the DELETE method, so that there's an endpoint for deleting a coffee } ``` -`Step 4b:` Click on the `Disk` icon or press `CTRL+S` to save the file. - # Congratulations! You've added the `coffee` type data to the PostgresSQL database. Also, you created `GET`, `POST`, `PUT` and `DELETE` endpoints to the demonstration application diff --git a/instruqt-tracks/developing-with-quarkus-reactive-sql/05-04-add-model/assignment.md b/instruqt-tracks/developing-with-quarkus-reactive-sql/05-04-add-model/assignment.md index 7425094b..28b50b9e 100755 --- a/instruqt-tracks/developing-with-quarkus-reactive-sql/05-04-add-model/assignment.md +++ b/instruqt-tracks/developing-with-quarkus-reactive-sql/05-04-add-model/assignment.md @@ -64,7 +64,6 @@ The outstanding work is to add intelligence to the `Coffee` class that will enab .onItem().transform(iterator -> iterator.hasNext() ? from(iterator.next()) : null); } ``` -`Step 3c:` Click on the `Disk` icon or press `CTRL+S` to save the file. Notice that an `PgPool` object is passed to the `findById()` method as the type of the `client` parameter. diff --git a/instruqt-tracks/developing-with-quarkus-reactive-sql/track.yml b/instruqt-tracks/developing-with-quarkus-reactive-sql/track.yml index 2a8dbd6e..a60f2bcc 100755 --- a/instruqt-tracks/developing-with-quarkus-reactive-sql/track.yml +++ b/instruqt-tracks/developing-with-quarkus-reactive-sql/track.yml @@ -37,18 +37,20 @@ tags: - openshift owner: openshift developers: -- doh@redhat.com +- cclyburn@redhat.com +- ryanj@redhat.com - bob@cogarttech.com +- doh@redhat.com - nvinto@redhat.com - eshortis@redhat.com -- cclyburn@redhat.com -- ryanj@redhat.com sandbox_preset: openshift-411 lab_config: overlay: false - width: 25 - position: right + width: 0 + position: "" feedback_recap_enabled: true loadingMessages: true hideStopButton: false -checksum: "7878072425048305736" + default_layout: AssignmentRight + default_layout_sidebar_size: 25 +checksum: "15109199724749224002"