Eric Deandrea
07/19/2023, 6:52 PMprivate final WireMockContainer wireMockContainer =
new WireMockContainer(DockerImageName.parse("wiremock/wiremock:2.35.0-1"))
.withMapping("twitter", "wiremock/mappings/twitter.com-current-stubs.json");
The container never starts up
2023-07-19 14:38:13,104 INFO [org.tes.con.wai.str.HttpWaitStrategy] (pool-2-thread-1) /goofy_ishizaka: Waiting for 60 seconds for URL: <http://localhost:58970/__admin/mappings> (where port 58970 maps to container port 8080)
2023-07-19 14:39:13,126 ERROR [tc.wir.35.0-1] (pool-2-thread-1) Could not start container: java.lang.IllegalStateException: Wait strategy failed. Container exited with code 1
If I remove the .withMapping
then it works fine. Here’s a screenshot of my filesystem layout:private final WireMockContainer wireMockContainer =
new WireMockContainer(DockerImageName.parse("wiremock/wiremock:2.35.0-1"))
.withClasspathResourceMapping("wiremock", "/home/wiremock", BindMode.READ_ONLY);
.withMapping
Lee Turner
07/19/2023, 8:40 PM.withMapping(name, json)
method means you need to pass the contents of the json file as a String
rather than the path to the json file ?Eric Deandrea
07/19/2023, 8:40 PMLee Turner
07/19/2023, 8:43 PM.withMapping
method is different from the one you are using though I think ?Eric Deandrea
07/19/2023, 8:44 PMprivate final WireMockContainer wireMockContainer =
new WireMockContainer(DockerImageName.parse("wiremock/wiremock:2.35.0-1"))
.withMapping("twitter", "wiremock/mappings/twitter.com-current-stubs.json");
private final WireMockContainer wireMockContainer =
new WireMockContainer(DockerImageName.parse("wiremock/wiremock:2.35.0-1"))
.withClasspathResourceMapping("wiremock", "/home/wiremock", BindMode.READ_ONLY);
Lee Turner
07/19/2023, 8:45 PMpublic WireMockContainer withMapping(String name, Class<?> resource, String resourceJson)
.public WireMockContainer withMapping(String name, String json)
Eric Deandrea
07/19/2023, 8:46 PMClass
Lee Turner
07/19/2023, 8:47 PMClass
in the repo here - https://github.com/wiremock/wiremock-testcontainers-java/blob/main/src/test/java/org/wiremock/integrations/testcontainers/WireMockContainerTest.java#L33Eric Deandrea
07/19/2023, 8:48 PMLee Turner
07/19/2023, 8:48 PMEric Deandrea
07/19/2023, 8:50 PMcom/acme/todo/WIremockResourceTestLifecycleManager
.withMapping
that doesn’t take a class. maybe it expects the actual jsonLee Turner
07/19/2023, 8:51 PMwithMapping(String name, String json)
Eric Deandrea
07/19/2023, 8:58 PMFiles
& Paths
classes 🙂 Which doesn’t work if it want to set it up as a class-level attribute 🙂Lee Turner
07/19/2023, 8:58 PMEric Deandrea
07/19/2023, 8:59 PMLee Turner
07/19/2023, 8:59 PMEric Deandrea
07/19/2023, 8:59 PMLee Turner
07/19/2023, 8:59 PMEric Deandrea
07/19/2023, 9:00 PMLee Turner
07/19/2023, 9:00 PMEric Deandrea
07/19/2023, 9:01 PMLee Turner
07/19/2023, 9:01 PMOleg Nenashev
07/20/2023, 7:58 AM