Using Woremock outside test environment

254 views
Skip to first unread message

Augustine Kwanashie

unread,
Apr 28, 2016, 12:26:45 PM4/28/16
to wiremock-user
I am setting up an acceptance test environment - this requires me to stand up my api before running my tests. On startup my api looks to hit an external service which I need to mock using wiremock.

I am using scalatra + sbt, so in my build.sbt config I write the code to create a new wiremock server and pock an endpoint.

             val credentialsApiMockServer = new WireMockServer(4000)

This gives an error - java.lang.IllegalArgumentException: resource keystore not found.

When I run the same code in a real test, it works fine. Seems it's caused by this: Resources.getResource("keystore").toString(); in the wiremock config file.

Any ideas?

Thanks

Tom Akehurst

unread,
Apr 28, 2016, 12:31:08 PM4/28/16
to wiremock-user
That's strange because the file "keystore" is inside the wiremock JAR. The only thing I can think of is that there's another dependency on the classpath with a file called keystore in the root and it can't decide which one to return.

Tom Akehurst

unread,
Apr 28, 2016, 12:31:47 PM4/28/16
to wiremock-user
You could try generating your own keystore (or just copying the one out of WireMock) and explicitly configuring WireMock to use it.


On Thursday, 28 April 2016 17:26:45 UTC+1, Augustine Kwanashie wrote:
Reply all
Reply to author
Forward
0 new messages