Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Quarkus, Gradle, WireMock. Dev Services for Gradle projects

Oleg Nenashev
March 14, 2024
99

Quarkus, Gradle, WireMock. Dev Services for Gradle projects

Quarkus has many local development capabilities, including the recently released Dev Services that usually run with Testcontainers under the hood. We can leverage Dev Services to provide real-time API provider development experiences for Quarkus-based services and client apps.

In this session, I provide an overview of using Quarkus and its Dev Services in Gradle projects. We take WireMock as an example. I will show how to develop a REST API and gRPC 3-tier client-service-database app with the help of Quarkus, Gradle, and WireMock. DM for the Testcontainers edition!.

Demo: https://github.com/oleg-nenashev/gradle-quarkus-plugin-demo

Oleg Nenashev

March 14, 2024
Tweet

More Decks by Oleg Nenashev

Transcript

  1. > whoami @oleg_nenashev oleg-nenashev Dr. Nenashev / Mr. Jenkins Developer

    tools hacker Community builder FOSS/DevRel consultant #RussiansAgainstPutin #StandWithUkraine
  2. My Open [and not so] Communities Time * Once a

    contributor, [almost] always a contributor Neuchâtel
  3. > whoami --quarkus • Jenkins on Quarkus experiments • Jenkinsfile

    Runner native exec with Quarkus • FaaScinator pet project • WireMock Dev Service • Now: Quarkus and Gradle 5
  4. Docker image for OpenFaaS openfaas/of-watchdog AdoptOpenJDK JDK/JRE Service Wrapper GET

    / run function GET /help GET /usage GET /schema Config and schema (env vars, sys prop) User CLI app Quarkus github.com/oleg-nenashev/faascinator
  5. Quarkus is great for building REST APIs 8 • Built-in

    support • Many extensions • Developer experience code.quarkus.io
  6. Ways to do API integration testing 1. Testing against Production/Staging

    servers 2. Testing against a simplified/containerized instance (e.g. Testcontainers) 3. Modeling (aka Mocking) at the API provider level (e.g. WireMock or Microcks) 4. Mocking at the code level 14 Slow Fast Nope Accu- rate * For Testcontainers, see the slides
  7. 15 wiremock.org/docs/stubbing IF (request_url) THEN (response) * * it gets

    MUCH more complex WireMock Config JSON: Client library response request Client App Mock API Server HTTP/2 API Mocking 101
  8. API Mocking for Quarkus 16 Main implementation in Java Native

    lib, Docker images and Testcontainers modules Support for GraalVM Unofficial Quarkus Dev Service Sandbox CNCF Project Golang / Microservice arch Docker image, Testcontainers module Unofficial Quarkus Dev Service
  9. 17 Staging & QA Tests Build Integration tests Build Tests

    Gaining confidence in you software “Shift Left”
  10. Quarkus Plugin for Gradle 26 • Under active development •

    Collaboration between Red Hat and Gradle teams • Basic Quarkus features are supported • Dev mode: ./gradlew quarkusDev • Or just “quarkus dev”! quarkus.io/guides/gradle-tooling
  11. + 34 • WiP: Develocity evaluation by the Quarkus team

    • For many open source projects: Gradle sponsors Develocity licenses/hosting, helps with build optimization and developer productivity • Maven, Bazel and sbt projects welcome gradle/develocity-oss-projects
  12. What I’m looking for today? • Feedback on Gradle Plugin

    for Quarkus • Promoting WireMock and Microcks Dev Services as official ones • Quarkus and Develocity experiences • Any other feedback on Gradle :) 35
  13. References My demo: • Gradle: https://github.com/oleg-nenashev/gradle-quarkus-plugin-demo • Similar one in

    Maven: WireMock extension for Quarkus: • https://docs.quarkiverse.io/quarkus-wiremock • https://github.com/gscaramuzzino/quarkus-wiremock-testing • https://quarkus.io/guides/getting-started-testing#quarkus-test-resource 36