Skip to content

Commit

Permalink
Add Wiremock mappings endpoint to dev ui card (#180)
Browse files Browse the repository at this point in the history
Adds a first entry to the Wiremock dev ui card by pointing to the Admin API, see https://wiremock.org/docs/standalone/administration/

This is first addition to the dev ui for Wiremock, we could potentially think about adding some more useful things here.

# Conflicts:
#	deployment/src/main/java/io/quarkiverse/wiremock/devservice/WireMockServerProcessor.java
  • Loading branch information
wjglerum authored Oct 28, 2024
1 parent 703f7d5 commit 5cfe325
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import io.quarkus.deployment.builditem.DevServicesResultBuildItem.RunningDevService;
import io.quarkus.deployment.dev.devservices.DevServiceDescriptionBuildItem;
import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.Page;
import io.quarkus.logging.Log;
import io.quarkus.runtime.configuration.ConfigurationException;

Expand Down Expand Up @@ -95,6 +97,22 @@ void watchWireMockConfigFiles(WireMockServerBuildTimeConfig config,
}
}

@BuildStep(onlyIf = { WireMockServerEnabled.class, GlobalDevServicesConfig.Enabled.class, IsDevelopment.class })
@Consume(DevServicesResultBuildItem.class)
public CardPageBuildItem pages() {

CardPageBuildItem cardPageBuildItem = new CardPageBuildItem();
String wiremockUrl = "http://localhost:" + devService.getConfig().get(PORT);
String mappingsUrl = wiremockUrl + "/__admin/mappings";

cardPageBuildItem.addPage(Page.externalPageBuilder("Mappings")
.url(mappingsUrl, mappingsUrl)
.doNotEmbed()
.icon("font-awesome-solid:file-code"));

return cardPageBuildItem;
}

private static RunningDevService startWireMockDevService(WireMockServerBuildTimeConfig config) {

final WireMockConfiguration configuration = options().globalTemplating(config.globalResponseTemplating())
Expand Down

0 comments on commit 5cfe325

Please sign in to comment.