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

Issue #17 - Display Currency for Product Prices - Part 2

After introducing the Money entity, we need to fix the product tests

  • use Money wrapper class instead of BigDecimal directly
  • extend FormInteractions to enter a value to a currency field
  • add @Valid & @NotNull annotation to the price attribute for proper bean validation

Issue #18 - organise Products in Categories - Part 1

Let’s enhance our Product management a little with Categories

  • create ProductCategory entity & association from Product entity
  • create management UI for Product Categories
  • display all categories directly in the product editor by changing the entityPicker to entityComboBox and add an optionsContainer
  • create tests for validation & storage of product & product categories

Issue #19 - Organise products in categories - Part 2

Ensure a category can be selected during product creation:

  • create UI test for selecting category during product creation
  • ensure product category data is correctly loaded during product form

Issue #20 - Register product stock items - Part 1

We will enhance our domain model and allow users to register stock items for products.

  • create stock item entity
  • create a product - stock item association
  • add stock item UI to the product detail screen
  • reorganize product edit screen with the help of Tabs

Issue #21 - Register product stock items - Part 2 - Tests

Ensure Stock Items can be created during Product creation.

  • refactor ProductEditTest to JUnit 5 nested classes
  • create stock item creation test case during product creation
  • encounter problem with failing *BrowseTest

Issue #22 - Remove flakiness from UI integration tests

After finding out about the problem with the UI integration tests in video #21, lets dig deeper into the problem and resolve the root cause of the flaky tests

  • see tests running in isolation, but not in the whole suite
  • debug tests to find problem of incorrect entity comparison
  • find out that multiple screens are still open from other tests
  • reason about shared state of “opened screens”
  • fix by clearing up all screens at the beginning of each test case

Issue #23 - Introduce Multi Tenancy - Part 1

In order to offer the application to multiple clients, let’s enhance the rent-your-stuff application with multi tenancy in order to create a real SaaS solution

  • add multi tenancy add on
  • enhance entities with @TenantId
  • adjust user management UI to support multi tenancy

Issue #24 - Introduce Multi Tenancy - Part 2 - Make Tests run as tenant

Let’s make our tests run as a particular tenant to mirror the actual user scenario.

  • create tenant & user on the fly before each test
  • creating a JUnit 5 extension to automatically setup tenant creating before each test

Issue #25 - Create Rental Order - Part 1 - Domain Model

Let’s enhance our domain model and add a central piece to the table: the rental order

  • create order & order line entity
  • use association, composition for modeling out the connection
  • configure instance names for entities
  • use @SystemLevel to declare the “tenant” attribute as something that should not be used in UI code generation and UI components (like filter)

Issue #26 - Create Rental Order - Part 2 - Domain Model Validation Tests

This video is about adding validation tests for the new domain model of rental orders

  • create validation test for Order and OrderLine
  • check on @PresentOrFuture
  • talk about flakyness with LocalDateTime.now() in test cases
1 Like

Issue #27 - Create rental order - Part 3 - Custom Bean Validation

Let’s create a custom validation for a rental order: a valid rental period

  • create a custom validation annotation & ConstraintValidator class
  • refactor validation tests to create custom assertion methods

Issue #28 - Create rental order - Part 4 - Verify @InstanceName

The @InstanceName annotated method for the Order entity is going to be tested this time

  • create a test case for the Order::getInstanceName method
  • verify the injection mechanism of the @InstanceName methods works as expected

Issue #29 - Create rental order - Part 5 - Test data creation

In order to create a storage test for the order, let’s improve our test data creation approach a little bit. This video will guide you through this process:

  • add two depenencies: Lombok & MapStruct to your Jmix application
  • use Lombok’s @Builder annotation for a data class that only contains the business attributes
  • use MapStruct for mapping the data class to the JPA entity using the Jmix DataManager
  • create pre-build product data with the Products test bean
  • refactor the product storage test to use the new approach

Issue #30 - Create rental order - Part 5 - Order storage test

After the new test data creation approach, let’s use this for creating the order storage test

  • create test case for storing an order with order lines
  • generate custom assertions through assertj code generation

Issue #31 - Create rental order - Part 6 - Create CRUD order UI

After having the domain model in place, let’s start with a very simple UI for the order

  • generate UI for order management
  • talk about limitations of CRUD based UIs
  • explore possible improvements for the UI to make it more usable

order-screen-wireframe

Issue #32 - Search customer in order creation - Part 1 - Entity suggestion field

To improve user experience during order creation, let them search for customers directly in the screen

  • use Jmix’s entity suggestion field for faster search
  • define custom JQPL query for filtering customers
  • use action properties in XML to open the customer detail screen in DIALOG mode