Hej, mam taki problem, że chce stworzyć 2 niezależne WireMockStuby i zmienić port drugiego z nich na 8084, ale cały czas próbuje się połączyć z 8080 czyli defaultowy. Czy miał ktoś podobny problem i wie jak to zrobić ?? Z góry dziękuję.
public class CarWireMockStub implements QuarkusTestResourceLifecycleManager {
private static final String CONTENT_TYPE_KEY = "Content-Type";
private static final String CONFIG_API_URL = "quarkus.rest-client.car-manager-api.url";
private static final String CAR_MANAGER_API_URL = "/car";
private static final int PORT = 8084;
private static final ObjectMapper MAPPER = new ObjectMapper();
private WireMockServer wireMockServer = new WireMockServer(PORT);
static {
MAPPER.registerModule(new JavaTimeModule());
}
@Override
public Map<String, String> start() {
wireMockServer = new WireMockServer(options().port(PORT));
wireMockServer.start();
return Map.of(CONFIG_API_URL, wireMockServer.baseUrl());
}
@Override
public void stop() {
if (wireMockServer != null) {
wireMockServer.stop();
}
}
oraz application.yml
quarkus:
rest-client:
car-manager-api:
url: http://localhost:8084/license-manager
leci taki błąd:
org.apache.hc.client5.http.HttpHostConnectException: Connect to http://localhost:8080 [localhost/127.0.0.1, localhost/0000:1] failed: Connection refused: connect
Klient:
@RegisterRestClient(configKey = "car-manager-api")
@RegisterProvider(value = CarResponseExceptionMapper.class)
public interface LicenseRestServiceClient {
@GET
@Path("/license")
@Produces(APPLICATION_JSON)
List<CarResponse> getCar(@QueryParam("carUuid") @NotNull UUID carUuid);