wiremock

SOAP attachments in WireMock

时间秒杀一切 提交于 2019-12-10 23:01:04
问题 I'm using WireMock to mock a SOAP service. It works great, but one of the services contains an attachment. Is there any way to mock it with WireMock? Thanks 回答1: Yes it's possible. First, you can use SOAP ui to mock the response you are expecting with the attachment. [On the soap resource, right click: generate SOAP mock service] On the mock created, in the response you should see a dummy body corresponding to the wsld. There you can click on attachment and add a file: You run this mock and

Unable to Setup Wiremock on Android Project with Proguard (Duplicate Zip Entry error)

女生的网名这么多〃 提交于 2019-12-10 15:12:37
问题 I've been reading all posts now and at this time I'm really struggling. I was trying to use WireMock in my android project to help on testing. However, Proguard has always something to say. My gradle dependencies file is this: dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') // Fine Tuned Google Play Services compile "com.google.android.gms:play-services-ads:${PLAY_SERVICES_VERSION}" compile "com.google.android.gms:play-services-plus:${PLAY_SERVICES_VERSION}" compile "com

“Selector loop waiting on select” when running multiple test cases which use wiremock stubs

妖精的绣舞 提交于 2019-12-10 13:34:18
问题 I'm using wiremock for mocking a web service. I'm using that to provide a service access to some of units that we are testing. So basically we have multiple junit tests which use stubs from wiremock. But when we run multiple tests at once (let's say run a whole test.java file) it will keep waiting after it completed some of the test cases. And something like following will be displayed at the bottom of the log, [qtp1669854350-14-selector-ServerConnectorManager@62dfb098/0] DEBUG org.eclipse

使用Spring MVC开发RESTful API(续)

陌路散爱 提交于 2019-12-10 04:06:06
使用多线程提高REST服务性能 异步处理REST服务,提高服务器吞吐量 使用Runnable异步处理Rest服务 AsyncController.java @RestController @GetMapping("/async") public class AsyncController { private Logger logger = LoggerFactory.getLogger(getClass()); @RequestMapping("/order") public Callable<String> order() throws Exception { logger.info("主线程开始"); Callable<String> result = new Callable<String>() { @Override public String call() throws Exception { logger.info("副线程开始"); Thread.sleep(2000); // 模拟处理下单消耗的时间 logger.info("副线程结束"); return "success"; } }; logger.info("主线程结束"); return result; } } 使用DeferredResult异步处理Rest服务 应用1/线程1:接收下单请求,放到消息队列

Wiremock Stand alone - How to manipulate response with request data

半城伤御伤魂 提交于 2019-12-08 19:11:43
问题 I was trying to implement mocking of POST REST call using Wiremock Standalone server. I am faced with a challenge like this, suppose the post body contains an "name" field and its value, the same value should be returned in the response of that POST call. My json file looks like this: { "priority": 1, "request": { "method": "POST", "urlPath": "/primeSlots", "bodyPatterns" : [ { "matchesJsonPath" : "{ \"things\": [ { \"name\": \"794363\" }] }" } ] }, "response": { "status": 200, "body": "{{$

Adding headers to Jetty in Wiremock

╄→гoц情女王★ 提交于 2019-12-08 08:02:00
问题 I'm running into CORS issues using the Wiremock standalone jar. I call my mock service using jQuery ajax. Is it possible to add the required "Access-Control-Allow-Origin" header when starting up the server? 回答1: I got it to work by adding an options.json file in my mappings folder for the CORS preflight request { "request" : { "url" : "/myurl", "method" : "OPTIONS" }, "response" : { "status" : 200, "headers" : { "Access-Control-Allow-Origin" : "http://myorigin", "Access-Control-Allow-Headers"

How configure WireMock to use https (and a random port)?

给你一囗甜甜゛ 提交于 2019-12-08 06:44:23
问题 I tried to set wiremock to run https on a random port: @Rule public WireMockRule wireMockServer = new WireMockRule( WireMockConfiguration.wireMockConfig().dynamicPort().dynamicHttpsPort() ); but when I use this and I call wireMockServer.httpsPort() I get the exception: java.lang.IllegalStateException: Not listening on HTTPS port. Either HTTPS is not enabled or the WireMock server is stopped. at com.google.common.base.Preconditions.checkState(Preconditions.java:150) at com.github.tomakehurst

Wiremock : how to upload file to folder __files with API

青春壹個敷衍的年華 提交于 2019-12-07 04:48:08
问题 the documentation of wiremock says that we can mock a a request that retrieve a file thanks to this code : { "request": { "method": "GET", "url": "/body-file" }, "response": { "status": 200, "bodyFileName": "path/to/myfile.xml" } } But now I have to find a way to reaaly upload the file other wise I have 500 error on the request. <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> <title>Error 500 </title> </head> <body> <h2>HTTP ERROR: 500</h2> <p>Problem

How to get HTTPS endpoints to proxy successfully in WireMock?

北慕城南 提交于 2019-12-05 15:23:37
I am writing an HTTP record-playback proxy which internally uses WireMock, and am having a problem with recording HTTPS targets. HTTP sites work fine. Here is how I set up the WireMock proxy for an unencrypted site: java \ -jar /var/proximate/wiremock-standalone-2.4.1.jar \ --port 9000 \ --proxy-all http://ilovephp.jondh.me.uk \ --record-mappings \ --root-dir /remote/experiment/record/http I then can record anything on that site using this command: wget -e use_proxy=yes -e http_proxy=proximate-proxy:9000 \ http://ilovephp.jondh.me.uk/en/tutorial/make-your-own-blog In short order I will get

Wiremock : how to upload file to folder __files with API

限于喜欢 提交于 2019-12-05 10:06:23
the documentation of wiremock says that we can mock a a request that retrieve a file thanks to this code : { "request": { "method": "GET", "url": "/body-file" }, "response": { "status": 200, "bodyFileName": "path/to/myfile.xml" } } But now I have to find a way to reaaly upload the file other wise I have 500 error on the request. <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> <title>Error 500 </title> </head> <body> <h2>HTTP ERROR: 500</h2> <p>Problem accessing /body-file. Reason: <pre> java.lang.RuntimeException: java.io.FileNotFoundException: /wiremock