Can you do full-stack development with Java? You can! And what about full-stack platform engineering? You can do it too! In this demo, we build a full-Java implementation for all key aspects of an application:
- The application itself - Spring Boot
- Build automation - Gradle Build Tool, aka Gradle
- Test automation - with Testcontainers, WireMock, LocalStack and other Java tools
- Configuration Management - with Pulumi for Java
- All the build logic - with Gradle Build Tool, a.k.a Gradle. We will also use Gradle Build Scan for troubleshooting the Pulumi SDK issues.
This demo is created for the Mocks as Code workshop by Oleg Nenashev. The same demo setup can be implemented purely in Kotlin, Golang, Python or any other language supported by Pulumi and Testcontainers.
The presentation for this workshop can be found here
- Java 17
- IDE of your choice, tested on Intellij IDEA and VS Code
- Installed Pulumi CLI application and a created account (Installation Guide)
- Testcontainers-compatible Docker Engine, preferably Docker Desktop (see the requirements here)
- Free-tire account on Gradle Build Scan / Develocity
For Java tools, consider using sdkman for the demo to make it easier:
sdk env install
sdk env
- Setting up the environment
- Testing AWS Service Integrations using LocalStack and Testcontainers, similar to this guide
- Mocking service APIs with WireMock
- Infrastructure-as-Code with Pulumi and Pulumi SDK for Java, and using the same stack for Pulumi deployment integration testing
- Advanced troubleshooting and observability of the configurations with Gradle Build Scan
The code implementation is based on the aws-java-webserver example from pulumi/examples.
Some bits of the demo are inspired by Pulumi CLI fo LocalStack wrapper, which is adapted inside the integration test. The bits of the demo will be converted to a Java implementation for it, contributions are welcome!
- Infrastructure as Code with Java and Pulumi by Mikhail Shilkov
- Unit testing Pulumi programs
- Integration testing for Pulumi programs
- Local Testing With Pulumi
- Using Pulumi with LocalStack
- Pulumi and LocalStack — beyond the basics by Josh Graham
- Testing AWS service integrations using LocalStack
To force kill the Pulumi stack:
pulumi stack rm --force oleg-nenashev/mocks-as-code/mocks-as-code-demo
Most of the code is licensed under the Apache License v2, unless specified differently.
The application code is based on the Testing AWS Service Integrations using LocalStack demo, and, hence, it uses the MIT License.