Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request entity tests for the Apache client shim. #232

Merged
merged 1 commit into from
Jul 4, 2013

Conversation

JakeWharton
Copy link
Member

Refs #221.

@JakeWharton
Copy link
Member Author

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] OkHttp (Parent) ................................... SUCCESS [2.202s]
[INFO] OkHttp ............................................ SUCCESS [19.120s]
[INFO] OkHttp Apache HttpClient .......................... SUCCESS [1.570s]
[INFO] Samples (Parent) .................................. SUCCESS [0.270s]
[INFO] Sample: Guide ..................................... SUCCESS [0.900s]
[INFO] Sample: Simple Client ............................. SUCCESS [0.923s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.281s
[INFO] Finished at: Wed Jul 03 18:23:36 PDT 2013
[INFO] Final Memory: 30M/381M
[INFO] ------------------------------------------------------------------------

private final Deque<RecordedRequest> requests = new ArrayDeque<RecordedRequest>();

@Override public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
requests.add(request);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary; the mockwebserver itself records requests. Call server.takeRequest()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the behavior is a bit different because requests without corresponding queued responses are not themselves queued for the take request method. That means that I'd have to call take request (which would block) and then spawn a new thread in the test to make the request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. In that case just enqueue a response?

@JakeWharton
Copy link
Member Author

Updated and still passing.

@swankjesse
Copy link
Member

LGTM

JakeWharton added a commit that referenced this pull request Jul 4, 2013
Request entity tests for the Apache client shim.
@JakeWharton JakeWharton merged commit 1d33ae5 into master Jul 4, 2013
@JakeWharton JakeWharton deleted the jw/apache-thangs branch July 4, 2013 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants