Skip to content

Updated lab 'developing-with-quarkus-panache-reactive' & SSO integration #313

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

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ notes:

The figure below illustrates the difference between synchronous and asynchronous information exchange in terms of a query-response interaction with a database.

![sync vs async](../assets/sync-vs-async.png)
![sync vs async](..\assets\sync-vs-async.png)

Under a reactive asynchronous interaction, there is no waiting around for a response to be returned. Rather, the program that executed the request "listens" in the background for the response and processes data when the response is received. Many times the data will be received as a series of continuous messages delivered to the listener function intermittently.

Expand Down Expand Up @@ -56,7 +56,7 @@ timelimit: 500

The objective of this topic is to develop a reactive application starting with predefined source code. The application you will develop is illustrated in the figure below.

![Application Architecture](../assets/app-architecture.png)
![Application Architecture](..\assets\app-architecture.png)

You'll build out the code for a RESTful API. The RESTful API code is stored in a file named `PersonResource.java`. Also, you'll add queries to a data entity that is defined in the file named `Person.java`. `Person.java` extends [`PanacheEntity`](https://javadoc.io/doc/io.quarkus/quarkus-hibernate-orm-panache/latest/io/quarkus/hibernate/orm/panache/PanacheEntity.html). `PanacheEntity` enables asynchronous interaction with the Hibernate ORM which represents the underlying Postgres database in which the application's data is stored.

Expand Down Expand Up @@ -161,7 +161,7 @@ The first piece of work you'll do is to modify the source code by adding content

`Step 5b:` In the **Visual Editor**, navigate to the file `src/main/java/org/acme/person/model/Person.java` as shown in the figure below.

![open file](../assets/open-person-java.png)
![open file](..\assets\open-person-java.png)

`Step 5c:` In the **Visual Editor**, **replace** the contents of the file `src/main/java/org/acme/person/model/Person.java` with the following code that redefines the `Person` data entity:

Expand Down Expand Up @@ -212,7 +212,7 @@ public class Person extends PanacheEntity {

`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)
![Save Person](..\assets\save-person-java.png)

# Defining the eye color enum

Expand All @@ -234,7 +234,7 @@ However, the source code does not yet have the code that defines the enumeration

`Step 6b:` Click the create file icon to create the file named `EyeColor.java` as shown in the figure below.

![create eyecolor](../assets/create-eye-color.png)
![create eyecolor](..\assets\create-eye-color.png)

`Step 6c:` Click the newly created `EyeColor.java` to open the file for editing and add the following code:

Expand All @@ -261,7 +261,7 @@ The following steps create the first endpoint for accessing data in the demonstr

`Step 7b:` Click the create file icon to create the file named `PersonResource.java` as shown in the figure below.

![Create person resource](../assets/create-person-resource.png)
![Create person resource](..\assets\create-person-resource.png)

`Step 7c:` Click the newly created `src/main/java/org/acme/person/PersonResource.java` to open the file for editing and add the following code:

Expand Down Expand Up @@ -335,7 +335,7 @@ The next step in this topic is to add sample data to the demonstration applicati

`Step 8b:` Click the create file icon to create the file named `import.sql` as shown in the figure below.

![create import.sql](../assets/create-sql.png)
![create import.sql](..\assets\create-sql.png)

`Step 8c:` Click the file `src/main/resources/import.sql` to open the file for editing and add the following code:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
slug: join-red-hat-developer-portal
id: wvnxdt5a9nzf
type: challenge
title: Join Red Hat Developer at no cost
teaser: Join Red Hat Developer at no cost
tabs:
- title: Red Hat Login
type: browser
hostname: rhd-login-3882344
difficulty: ""
---
Before you proceed with the next challenge, please take a moment to register for Red Hat Developer. If you already have a Red Hat account, you can use the same login credentials.

This will help us assess user satisfaction and enable us to provide more curated content.

Click on the `Check` button at the bottom once you have registered or logged in.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
set -euxo pipefail
echo 'logincheck'
if [ "${LOGGEDIN-0}" = "1" ]; then
echo 'loggedin'
exit 0
fi

rm -f /home/user/checkResult.json
rm -f /home/user/checkAssets.json
rm -f /home/user/checkError.txt


echo 'dropdown check'
echo '{"location":{"conditions":[{"url":"redhat.com","condition":"contains"}]},"innerText":[{"selector":"html \u003e body","value":"Please click on Check button in the bottom right of your screen to continue with the Lab."}]}' > /home/user/checkAssets.json
until [ -f /home/user/checkResult.json ]; do
sleep 1
done
if grep "SUCCESS" /home/user/checkResult.json; then
echo 'account dropdown'
exit 0
fi


rm -f /home/user/checkResult.json
rm -f /home/user/checkAssets.json
rm -f /home/user/checkError.txt


echo 'email check'
echo '{"location":{"conditions":[]},"innerText":[{"selector":"html \u003e body","value":"Email address verification"}]}' > /home/user/checkAssets.json
until [ -f /home/user/checkResult.json ]; do
sleep 1
done
cat /home/user/checkResult.json
if grep "SUCCESS" /home/user/checkResult.json; then
echo 'email validation'
exit 0
fi
fail-message "Please login and click 'Check' button."
exit 1
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ You'll get output similar to the following:

`Step 4:` Click on `OpenShift Web Console` tab on the horizontal menu bar over the console window to the left to access the OpenShift web console web page. You will be presented with the console login page.

![web log in](../assets/web-console-login.png)
![web log in](..\assets\web-console-login.png)

----

Expand All @@ -123,7 +123,7 @@ You'll get output similar to the following:
|NOTE|
|----|
|You might see the following warning notification due to using an untrusted security certificate.
![Security warning](../assets/security_warning.png)
![Security warning](..\assets\security_warning.png)
If you do get the warning, click the **Advanced** button to complete the process necessary to grant permission to the browser to access the OpenShift web console.|

----
Expand All @@ -136,11 +136,11 @@ If you do get the warning, click the **Advanced** button to complete the process

`Step 7b:` Then click the link `quarkus` in the projects list that appears as shown in the figure below.

![Select Quarkus](../assets/select-quarkus.png)
![Select Quarkus](..\assets\select-quarkus.png)

You'll see a circular graphic that represents the Postgres database as shown in the figure below.

![Postgres](../assets/display-postgres.png)
![Postgres](..\assets\display-postgres.png)

The presence of the circular graphic indicates that the Postgres database has been added to the OpenShift project.

Expand Down Expand Up @@ -179,7 +179,7 @@ You'll see the following output:

`Step 9a:` From the **Visual Editor** tab, navigate to the file `src/main/resources/application.properties` as shown in the figure below.

![Open Application Properties](../assets/open-application-properties.png)
![Open Application Properties](..\assets\open-application-properties.png)


`Step 9b:` Click the file `application.properties` to open it for editing and add the following code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ You are now going to add some reactive queries to the `Person` entity. The reaso

`Step 2a:` In the **Visual Editor** tab, navigate to the folder `src/main/java/org/acme/person/model/` and click on the file `Person.java` to open it for editing as shown in the figure below.

![Open person.java](../assets/open-person-java-02.png)
![Open person.java](..\assets\open-person-java-02.png)

`Step 2b:` Add the following two new queries after the comment `// TODO: Add more queries` beneath `LINE 36` in the `Person.java` file:

Expand Down Expand Up @@ -85,7 +85,7 @@ Now that the custom entity queries have been implemented in the `Person` entity

`Step 3a:` In the **Visual Editor** tab, navigate to the folder `src/main/java/org/acme/person/` and click on the file `PersonResource.java` to open it for editing as shown in the figure below.

![Reopen PersonResource](../assets/reopen-personresource-java.png)
![Reopen PersonResource](..\assets\reopen-personresource-java.png)

`Step 3b:` Add the following code to the file `PersonResource.java` after the comment `// TODO: add basic queries` after `LINE 37`:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ You are going to work with the following parameters to enable search and paging

`Step 1b:` Click on the file `PersonResource.java` to open it for editing as shown in the figure below:

![Edit PersonResource](../assets/reopen-personresource-java.png)
![Edit PersonResource](..\assets\reopen-personresource-java.png)

`Step 1c:` Add this code to the file `PersonResource.java` after the `// TODO: add datatable query` comment:

Expand Down Expand Up @@ -85,7 +85,7 @@ The method `Uni<DataTable> datatable((...)` code you just added has a number of

`Step 2b:` Click on the file `DataTable.java` to open it for viewing as shown in the figure below.

![Open DataTable](../assets/open-datatable-01.png)
![Open DataTable](..\assets\open-datatable-01.png)

Take a look at the code in general. Also, notice the data fields in `DataTable.java`. A description of each field follows:

Expand All @@ -107,7 +107,7 @@ This work is done by adding a query to the `PersonResource.java` class.

`Step 3b:` Click on the file `PersonResource.java` to open it for editing as shown in the figure below.

![Edit PersonResource](../assets/reopen-personresource-java.png)
![Edit PersonResource](..\assets\reopen-personresource-java.png)

`Step 3c:` Add this code to the file `PersonResource.java` after the `// TODO: Construct query` comment:

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Managed beans (like the `PersonResource`) can listen for lifecycle events by usi

`Step 1b:` Click on the file `PersonResource.java` to open it for editing as shown in the figure below.

![Edit PersonResource](../assets/reopen-personresource-java.png)
![Edit PersonResource](..\assets\reopen-personresource-java.png)

`Step 1c: ` Add the following code after the `// TODO: Add lifecycle hook` comment:

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ Now that we have the demonstration application running on OpenShift you'll exerc

`Step 2 :` Click the Topology tab on the horizontal menu bar to the left of the web console as shown in the figure below.

![Access Topology](../assets/open-app-in-topology.png)
![Access Topology](..\assets\open-app-in-topology.png)

----

`Step 3 :` Click on the `Open URL` icon on the `people` circular graphic in the Topology view as shown in the figure above. A browser window with the demonstration application's web page will appear as shown in the figure below.

![New Web Page](../assets/new-app-web-page.png)
![New Web Page](..\assets\new-app-web-page.png)

Notice the total number of records reported at the bottom.

----

`Step 4 :` Type in a single letter, e.g. `G`, in the search box in the demonstration application's web page as shown in the figure below to experience how responsive the application is.

![Application Web Page](../assets/app-web-page.png)
![Application Web Page](..\assets\app-web-page.png)

----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ description: |-

The figure below illustrates the difference between synchronous and asynchronous information exchange in terms of a query-response interaction with a database.

![sync vs async](./assets/sync-vs-async.png)
![sync vs async](.\assets\sync-vs-async.png)

Under a reactive asynchronous interaction, there is no waiting around for a response to be returned. Rather, the program that executed the request "listens" in the background for the response and processes data when the response is received. Many times the data will be received as a series of continuous messages delivered to the listener function intermittently.

Expand Down Expand Up @@ -59,4 +59,6 @@ lab_config:
overlay: false
width: 25
position: right
checksum: "3214010280269239127"
feedback_recap_enabled: true
loadingMessages: true
checksum: "16877277338859105652"