From 3132a8ff0c060638bab6683eda88711eab07cbd2 Mon Sep 17 00:00:00 2001 From: nscuro Date: Sat, 15 Jun 2024 00:30:47 +0200 Subject: [PATCH] Add initial DevServices-like implementation Adds a new `dev-services` Maven profile. It is intended to be used in conjunction with the Jetty plugin. A respective IntelliJ run configuration is included. When enabled, PostgreSQL and Redpanda containers will be launched automatically, and disposed when the application stops. Dependency-Track will be auto-configured to use the containers, no manual configuration required. To avoid introducing runtime dependencies on test libraries for production builds, the logic uses reflection to interact with the `testcontainers` library. Topics required by the API server will be created automatically. Database migrations are executed as usual. The containers are not currently discoverable and re-usable by the Quarkus-based services. That capability is planned for a future iteration, see https://github.com/DependencyTrack/hyades/issues/1188 With this functionality, it becomes easier to test features that do not rely on the other Hyades services (e.g. REST API related stuff), or frontend modifications. In those scenarios, using Docker Compose is no longer needed. Signed-off-by: nscuro --- .idea/runConfigurations/Jetty.xml | 2 - .../Jetty_w__Dev_Services.xml | 52 ++++++ pom.xml | 53 ++++++ .../dev/DevServicesInitializer.java | 170 ++++++++++++++++++ .../kafka/processor/api/ProcessorManager.java | 20 ++- src/main/webapp/WEB-INF/web.xml | 4 +- 6 files changed, 290 insertions(+), 11 deletions(-) create mode 100644 .idea/runConfigurations/Jetty_w__Dev_Services.xml create mode 100644 src/main/java/org/dependencytrack/dev/DevServicesInitializer.java diff --git a/.idea/runConfigurations/Jetty.xml b/.idea/runConfigurations/Jetty.xml index a947494be..b98cd238b 100644 --- a/.idea/runConfigurations/Jetty.xml +++ b/.idea/runConfigurations/Jetty.xml @@ -7,8 +7,6 @@