Learning Jmix through real-world app video series: Rent-your-Stuff

Hi everyone,

I decided to start with another Video series as I did it some years ago for CUBA platform. This time I will focus on the rental business and my plan is to create multiple videos covering various aspects of Jmix. But in particular I will focus on creating a real world solution. Therefore it will also cover non-Jmix parts like CI pipelines, testing, Cloud deployments, etc. - since in the real world Jmix does not exist in isolation either.

Here are the important links:

Rent your Stuff - Video Series

A video series about how to build a real world app in the rental business with Jmix.

  _____            _                               _____ _          __  __ 
 |  __ \          | |                             / ____| |        / _|/ _|
 | |__) |___ _ __ | |_   _   _  ___  _   _ _ __  | (___ | |_ _   _| |_| |_ 
 |  _  // _ \ '_ \| __| | | | |/ _ \| | | | '__|  \___ \| __| | | |  _|  _|
 | | \ \  __/ | | | |_  | |_| | (_) | |_| | |     ____) | |_| |_| | | | |  
 |_|  \_\___|_| |_|\__|  \__, |\___/ \__,_|_|    |_____/ \__|\__,_|_| |_|  
                          __/ |                                            
                         |___/                                             

What does it cover?

  • build a real world solution
  • explain (advanced) Jmix concepts along the way
  • cover non-Jmix topics as well

Video Format

  • each video tackles one small feature / improvement
  • Length: 10 - 30 min
  • showing my errors, learnings and suboptimal solutions along the way
  • mostly uncut

How to participate?

  • Feature Requests via GH issues / YouTube comments

Right now there are the first three videos available. When doing new videos I will post them here in the forum.

If you have any feedback or questions, feel free to answer in this thread. I would highly appreciate it :slight_smile:

Cheers
Mario

10 Likes

Issue #0 - About the “Rent your Stuff” Video Series

This video talks about the upcoming video series “Rent your Stuff” and the ideas behind it. Mainly those are:

  • create a real-world rental business application
  • learning about (advanced) Jmix concepts
  • small videos cover one improvement at a time

Issue #0 - Walking Skeleton - Create Project

In this issue we will create the very first part of a walking skeleton (https://wiki.c2.com/?WalkingSkeleton) which is to:

  • create Jmix project
  • create git repository locally
  • introduce shorcut-viewer so that you can see what I press
  • create GitHub project via “gh” CLI (https://cli.github.com/)
  • push the initial commit to GitHub via CLI
1 Like

Issue #1 - Walking Skeleton - CI pipeline

In this issue we will create the first part of a walking skeleton (https://wiki.c2.com/?WalkingSkeleton) which is to:

  • have GitHub Issue template in place
  • CI pipeline using GitHub Actions
  • automated tests succeed in the pipeline
  • introduce to the workflow of small issues and GitHub pull requests
2 Likes

Hi Mario,
A very good and useful initiative.
You’ll have a one more follower :wink:
Thanks Mario

2 Likes

Issue #2 - Walking Skeleton - Infrastructure Provisioning

In this issue we will create the second part of a walking skeleton (https://wiki.c2.com/?WalkingSkeleton) which is to:

  • provision infrastructure via Terraform
  • explain the Terraform workflow with Terraform Cloud
  • provision Heroku application via Terraform
  • provision Heroku database via Terraform

Issue #3 - Walking Skeleton - Use PostgreSQL as database

In this issue we will continue to configure our walking skeleton. The video includes:

  • spin up PostgreSQL as our local database via docker compose
  • connect to PostgreSQL through IntelliJ IDEA
  • configure the Jmix version to use the local database for local development
  • explain a little bit the workflow of Liquibase changelogs applied to local PostgreSQL
  • configure the GitHub Action CI pipeline to spin up PostgreSQL as a service
  • configure Jmix to retrieve DB connection information via environment variables

Issue #4 - Walking Skeleton - Test Environment on Heroku

In this issue we will finish the walking skeleton topic:

  • create Procfile for Heroku to tell how to run the Jmix application
  • use a Spring profile “heroku” to configure the Jmix app in case of Heroku deployment
  • use the Heroku Spring boot environment variables for fetching the database connection for Jmix
  • let the Jmix app run on Java 17
  • see Heroku logs of the Jmix application
  • see the running application

Issue #5 - Register Customers

This video now finally starts with implementing some Jmix functionality: creating / registering customers. In particular it covers:

  • create the first entity: Customer with the help of Jmix Studio
  • explaining the database delta detection via Liquibase changelogs
  • create a mapped superclass for the standard attributes
  • explain the concept of “instance name” in Jmix
  • generate first CRUD screens for the Customer entity
  • use an embedded Address entity in the customer for storing the address information
  • explain how to add new attributes to already generated screen

Issue #6 - Ensure only valid Customers can be stored

In this issue we will implement the very first test case to back up our implementation of storing customers.

  • create Junit 5 Test
  • interact with the DataManager in a Spring Integration Test
  • use assertJ to assert the customer was correctly saved
  • Use SystemAuthenticator to authenticate in an integration test
  • Use Bean validation explicitly in the integration test to check for proper bean validation annotations are present

Issue #7 - Ensure only valid Addresses can be stored

In this issue we will implement the second test case, which is dealing with the Address entity.

  • test validation of Address entity
  • create ValidationVerification Test API abstraction, to more easily test for validation violations
  • split test cases to check one aspect on every test
  • refactor CustomerIntegrationTest to use the new ValidationVerification Test API
  • make ValidationVerification more generic through Java generics

Issue #8 - Ensure customers are loaded in UI

Let’s implement our first web integration test to verify the UI layer also works as expected

  • add a dependency to “io.jmix.ui:jmix-ui-test-assist”
  • use @UiTest annotation to start a web integration test
  • Interact with the regular Jmix UI APIs, like screens to run the system under test
  • interact with Screen components, like the Table to check if a particular Customer is displayed
  • spin up an ad-hoc test database for UI tests, by using Spring Boots @AutoConfigureTestDatabase
  • setup & cleanup test data programmatically through dataManager
1 Like

Issue #9 - Ensure Customer Form is shown on Edit

This time, we will implement the second test case for the UI layer of the customers:

  • Interact with the Table component to select a particular customer & click edit
  • find an open screen via the Screens API
  • move screen interaction logic into helper methods

Issue #10 - Ensure Customers can be saved through the form - Part 1

Following up on issue #9, in this video, we will check the customer edit form works correctly

  • Interact with the form input components to set values to the UI
  • assert on the results through the database
  • create a Test API abstraction: FormInteractions to get rid of all the helper methods on the form interaction
  • use the “move” & “change signature” refactoring from IntelliJ IDEA
  • encounter flaky tests through test data interactions

Issue #11 - Ensure Customers can be saved through form - Part 2

Following up from issue #10, in this video we will try to fix our flaky tests

  • identify the test data that causes the problem
  • cleanup test data by removing all data from the db via the DataManger
  • create Test API: DatabaseCleanup for encapsulating this logic as a Spring Bean

Issue #12 - Create Products - Product Information - Part 1

Let’s create the second domain entity that will be of importance for our application: Products

  • create Product entity & standard Product CRUD screens
  • validation & storage tests for the Product entity

Issue #13 - Create Products - Product Prices - Part 2

Here it is about continue product management by adding prices to the mix.

  • introduce ProductPrice entity
  • modelling the domain with Enums (PriceUnit)
  • create Test case for storing products with prices
  • create validation test cases for ProductPrice

Issue #14 - Refactoring: Cleanup UI test interactions

In this issue we will refactor the UI test interactions a little more, to make it easier to create the next UI test cases. It covers:

  • describing the new TableInteractions and ScreenInteractions class
  • show how to use them in test cases
  • create a new ProductBrowse test case with new APIs

Issue #15 - Ensure products can be saved with Prices via the Form

In this video, we will create a web integration test for the product form. In particular, it contains:

  • create a UI integration test for ProductEdit
  • interact with two screens (ProductEdit and ProductPriceEdit) to store prices as well during the form interaction

Issue #16 - Display Currency for Product Prices - Part 1

In this issue, we will add currency to the Product Price entity

  • use CurrencyField component
  • create Money embeddable entity for storing amount & currency
  • use Spring Boots Configuration Properties binding to configure default currency via application.properties
  • use Messages API for translations of the currency value