Comments (7)
Hi,
Would you mind sending me the version of WireMock you're using, whether you're using the standalone JAR and the version of the Apache HTTP client you're using?
Also does your bigLumpOfJson have any unusual characters in it? And is it very large?
Many thanks,
Tom
from wiremock.
No worries
HttpClient is 4.2.3 GA
WireMock is 1.28 - I was not using the standalone JAR, I was driving it around with JUnit
the bigLumpOfJson is only a few hundred bytes in the test case:
{"serviceName":"AttributionEngine","hostName":"localhost","version":"1.0",
"startTime":"20130221T133518Z","status":"ACTIVE","intervals":60,"intervalSize":"minutes",
"serverTime":"20130221T133732Z","javaVersion":"1.7.0_10","counters":[]}
from wiremock.
I've tried to replicate this issue as closely as possible based on the info and code you've given me and everything seems to be working normally. Here's the full test case I used. Perhaps you can spot a crucial difference from what you've done:
package wiremock.test;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.junit.Rule;
import org.junit.Test;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static junit.framework.Assert.assertFalse;
public class AppTest {
@Rule
public WireMockRule wireMockRule = new WireMockRule();
@Test
public void test() throws Exception {
String bigLumpOfJSON = "{\"serviceName\":\"AttributionEngine\",\"hostName\":\"localhost\",\"version\":\"1.0\",\n" +
"\"startTime\":\"20130221T133518Z\",\"status\":\"ACTIVE\",\"intervals\":60,\"intervalSize\":\"minutes\",\n" +
"\"serverTime\":\"20130221T133732Z\",\"javaVersion\":\"1.7.0_10\",\"counters\":[]}";
stubFor(get(urlEqualTo("/some/thing"))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(bigLumpOfJSON)));
final HttpGet request = new HttpGet("http://localhost:8080/some/thing");
final HttpResponse httpResponse = new DefaultHttpClient().execute(request);
final int statusCode = httpResponse.getStatusLine().getStatusCode();
if (HttpStatus.SC_OK == statusCode) {
final HttpEntity entity = httpResponse.getEntity();
if (entity == null) {
throw new RuntimeException("No content in the response");
} else {
final String body = EntityUtils.toString(entity, "UTF-8");
System.out.println(body);
assertFalse(body.isEmpty());
}
} else {
throw new RuntimeException("Server Returned " + statusCode);
}
}
}
from wiremock.
This is profoundly weird. I'm starting to think that the problem is on the HttpClient end, and there is some weird emergent behaviour arising out of the intersection of Ubuntu, 1.7.0_10 and a slightly wonky network configuration. I will keep banging on this to see if I can get any further.
from wiremock.
Right, I'm on a Mac so unfortunately I can't replicate that part. Please
let me know if it does turn out to be a bug or some kind of OS interaction
- trying to make it as robust as possible!
Thanks,
Tom
On 27 February 2013 09:41, Robert Hook [email protected] wrote:
This is profoundly weird. I'm starting to think that the problem is on the
HttpClient end, and there is some weird emergent behaviour arising out of
the intersection of Ubuntu, 1.7.0_10 and a slightly wonky network
configuration. I will keep banging on this to see if I can get any further.—
Reply to this email directly or view it on GitHubhttps://github.com/tomakehurst/wiremock/issues/14#issuecomment-14164874
.
from wiremock.
Will do. I will work with the test case you've built above on several different platforms and see what comes out.
ADDENDUM: the plot thickens - the test case above is now working on the combination of Ubuntu and 1.7.0_10, strongly suggesting some wonkiness in the network configuration has become involved.
ADDENDUM 2: I loathe Heisenbugs (http://www.catb.org/jargon/html/H/heisenbug.html). I cannot reproduce this fault at all now. There are two things that have changed: Commons IO was bumped from 2.3 to 2.4, and our network is not as flaky as it was on Thursday when the problem manifested. I will continue to monitor the behaviour in our environment, but at this stage think that the issue can be closed off as "problem exists between keyboard and chair".
I have moved our testing fully to WireMock, and directed my team to run forward with it - it's exactly right solution for our requirements.
from wiremock.
Thanks for the feedback. Good to hear its proving to be useful!
HTTPS support to be released shortly if that's of any interest.
from wiremock.
Related Issues (20)
- JSON decoding error HOT 2
- Decimals matching issue in wiremock 3.4.0 HOT 1
- Wiremock standalone 3: NoSuchMethodError HOT 1
- Wiremock not detecting POST body request by Spring 6 RestClient HOT 1
- WireMockExtension.stopServerIfRunning() produces NPE when Unit Test aborts unexpectedly
- Add option to preserve User-Agent in the proxied request header
- HTTP/2 not properly supported for PUT requests HOT 10
- Add project icon for IntelliJ
- EqualToXml does not detect difference on certain XML documents if Xalan is on classpath HOT 1
- Enhancement: Add Option to Customize Jackson StreamReadConstraints in Wiremock Standalone
- Provide a summary of logged requests so that a user can assert on them HOT 1
- NoClassDefFoundError LoggerFactory in 3.5.1 HOT 3
- Updating 3.4.2 -> 3.5.1 broken HOT 4
- WireMock.stubFor(..) should have appropriate error description instead of unclear JsonException on 404 error code from non-WireMock server
- Relative date matching uses the system timezone
- Broken link in /Documentation / Using WireMock with Spring Boot HOT 1
- Fix matcher distance short-circuit biases HOT 1
- Allow scenario state to be scoped to arbitrary request attributes
- Version 3.5.3 of org.wiremock:wiremock-standalone references removed wiremock.org.apache.commons.io.IOUtils HOT 8
- Proxy - changing User-Agent with additionalProxyRequestHeaders stopped working after 3.2.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wiremock.