Running WireMock on a remote Unix Server pro grammatically from JUNIT

134 views
Skip to first unread message

Vivek Malhotra

unread,
Aug 4, 2016, 5:02:08 AM8/4/16
to wiremock-user

Hi,

First of all would like to Thanks WireMock team for amazing mock solution which is simple to use and integrate.

 

I had a specific issue. I am running WireMock Like below in my Junit Tests on my local machine. When WireMock starts it runs on 8089 port as below and I can browse the URL through the below link which is perfect.

 

https://localhost:8099/xx/xx/invoice/201628JP00006097

 

 

@Rule
public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().httpsPort(8089));

 

 

wireMockRule.stubFor(get(urlEqualTo("/xx/larxxs/invoice/201627JP00006087"))
        .willReturn(aResponse().withHeader(
"Content-Type", "text/xml").withBodyFile("K000006087.xml")));

 

 

After hosting this mock on my local machine, I run some batch job on a remote UNIX Server. The batch job then tries to fetch this data from mock via https link and it used to work fine. Now there have been some changes on Remote UNIX Server or I am not sure what has changed overnight as the remote UNIX Machine is throwing error while trying to get data from WireMock. Though the ping is working from my machine to remove UNIX Machine and vice versa and I am able to get data via browser on my localhost.

 

2016-08-03 17:31:50.101 ERROR 19483 --- [main] .w.s.l.s.b.t.OldLarsRestInvoiceGenerator : Exception while getting invoice data from Cybill rest service

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://10.10.34.238:8089/xx/xx/invoice/201627JP00006087": Connection timed out; nested exception is java.net.ConnectException: Connection timed out

 

I wanted to ask, if we can run WireMock programmatically from Junit on Remote UNIX Machine and how we can do that. Like in @Rule I mentioned it to run on port 8089. Can I mention the host also here.

 

I saw that we can install Jar file on remote server and then run it, but is there a way to do it programmatically and start the wireMock on remote server instead.

 

    @Rule

    public WireMockRule wireMockRule = new WireMockRule(wireMockConfig()

                                                                                .httpsPort(8089)

                                                                                .host(myUNIXSERVER));



Thanks for help!!

Vivek Malhotra

unread,
Aug 5, 2016, 4:39:22 AM8/5/16
to wiremock-user
Any Advice by anybody??

Sam Edwards

unread,
Aug 31, 2016, 9:49:59 PM8/31/16
to wiremock-user
It looks like 'localhost' worked. Stick to that. You are probably having an IP address or routing/firewall problem is my guess.

hitesh bhojwani

unread,
Mar 30, 2020, 3:25:45 AM3/30/20
to wiremock-user
Hey Vivek,

Did this work?

I have kind of similar problem

Reply all
Reply to author
Forward
0 new messages