Upgrade from Quarkus 1.2.1 to 1.4.1

Stormy Clouds – Coimbra, PT by myself.

Background

Sometimes it’s not easy to find time to update libraries. Quarkus fast pace, requires frequent attention and upgrades. You should allocate time for that…

This particular upgrade was triggered by a Quartz integration bug, which was quickly fixed, btw. By now, 1.5.1 is already out with less pain than the 1.3.x series, where most of the described issues came from. This post tells you the upgrade adventures and I hope it’s useful to you.

Changes

Tests

On Quarkus 1.3.0 the classloading was totally re-implemented, fixing some test issues. Unfortunately some problems were introduced on test scenarios using Mockito and other JUnit 5 extensions. One easy fix was just not to use the JUnit extension and make de setup using the @BeforeAll and @AfterAll hooks. The Quarkus team, in the meantime, has been creating a few integrations to tackle this problem. One of them is this quarkus mockito extension:

 <dependency>
     <groupId>io.quarkus</groupId>
     <artifactId>quarkus-junit5-mockito</artifactId>
     <scope>test</scope>
 </dependency>

You will be able to use @InjectMock instead of @Mock on integration tests. No need for @InjectMocks. You should remove mockito-core dependency, it comes included. Please take a look at this help page for more.

New way to inject MP REST clients on tests:

@InjectMock 
@RestClient 
WonderfulClient wonderfulClient;

The MicroProfile REST client definition must also be annotated with @ApplicationScoped.

JWT

The smallrye-jwt upgrade broke property compatibility. You cannot define multiple Algorithms anymore and your authentication might start to fail.

Use new for runtime code:

smallrye.jwt.verify.algorithm=RS256 #Instead of:

smallrye.jwt.whitelist.algorithms=RS256,...

Check this page for the current details.

Docker

  • There was this Quarkus bug affecting our docker images. Build worked locally, but failed inside the docker container because the path is simply /app and when trying to search for the parent pom.xml, we get a null pointer exception. Should have been fixed on version 1.5.0 already.
  • You must use Maven 3.6.2+. Please update your docker base images.

Datasources

Use the new properties for datasources that are not backwards compatible:

quarkus.datasource.db-kind=postgresql #Mandatory! 

quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/my_db?current_schema=public

The db-kind property from above will autodetect the driver. It’s not mandatory to use the driver property any longer.

The URL property has changed as well. They’ve done this to support multiple datasources and reactive drivers.

Additional notes

  • Use localhost instead of 0.0.0.0 for local addresses.
  • If you use Quarkus-Camel, please upgrade to 1.0.0-M6

Hope this was useful to you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.